Mercurial > wow > emfor1
comparison CensusPlusProfiler.lua @ 0:edfa01041183
Census+ Mod :
- TLJ guild search
- searchstart at Level 1 for community events
| author | EmFor <EmFor.hg@mroe.de> |
|---|---|
| date | Tue, 30 Mar 2010 13:42:05 +0200 |
| parents | |
| children | 10c85be19b56 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:edfa01041183 |
|---|---|
| 1 --[[ | |
| 2 CensusPlus for World of Warcraft(tm). | |
| 3 | |
| 4 Copyright 2005 - 2006 Cooper Sellers and WarcraftRealms.com | |
| 5 | |
| 6 License: | |
| 7 This program is free software; you can redistribute it and/or | |
| 8 modify it under the terms of the GNU General Public License | |
| 9 as published by the Free Software Foundation; either version 2 | |
| 10 of the License, or (at your option) any later version. | |
| 11 | |
| 12 This program is distributed in the hope that it will be useful, | |
| 13 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 GNU General Public License for more details. | |
| 16 | |
| 17 You should have received a copy of the GNU General Public License | |
| 18 along with this program(see GLP.txt); if not, write to the Free Software | |
| 19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
| 20 ]] | |
| 21 | |
| 22 | |
| 23 CensusPlus_DoThisCharacter = false; | |
| 24 CensusPlus_Profile = {}; | |
| 25 CensusPlus_Profile[GetCVar("realmName")] = {} ; | |
| 26 local myCPProfile_LOADED = nil; -- Successful load of the script | |
| 27 | |
| 28 -- ////////////////////////////////////////////// | |
| 29 -- Configuration Variables | |
| 30 -- ////////////////////////////////////////////// | |
| 31 -- set to nil to disable any of the following | |
| 32 | |
| 33 myCPProfile_ENABLED = 0; -- Enable the profiler? | |
| 34 | |
| 35 local myCPProfile_DoScanInventory = 0; -- get inventory? | |
| 36 local myCPProfile_DoScanBank = 0; -- get bank? | |
| 37 local myCPProfile_DoScanEquipment = 0; -- get equipment? | |
| 38 local myCPProfile_DoScanSkills = 0; -- get skills? | |
| 39 local myCPProfile_DoScanTalents = 0; -- get talents? | |
| 40 local myCPProfile_DoScanProfessions = 0; -- output known tradeskill recipies | |
| 41 local myCPProfile_DoScanReputation = 0; -- get reputation? | |
| 42 local myCPProfile_DoScanQuestLog = 0; -- get quests? | |
| 43 local myCPProfile_DoScanHonor = 0; -- get honor? | |
| 44 | |
| 45 local myCPProfile_HTML_Tooltips = 1; -- make html tooltips (non-array format) - separate lines with <br> | |
| 46 local myCPProfile_TALENTS_Full = 1; -- output all talents and tooltips | |
| 47 | |
| 48 | |
| 49 local myCPProfile_DEBUG = 1; -- enable debugging? unused at this time | |
| 50 local myCPProfile_ALLEVENTS = nil; -- enable all event catching? for debugging only | |
| 51 | |
| 52 -- ////////////////////////////////////////////// | |
| 53 | |
| 54 local TradeSkillDifficultyCode = {}; | |
| 55 TradeSkillDifficultyCode['optimal'] = 4; | |
| 56 TradeSkillDifficultyCode['medium'] = 3; | |
| 57 TradeSkillDifficultyCode['easy'] = 2; | |
| 58 TradeSkillDifficultyCode['trivial'] = 1; | |
| 59 TradeSkillDifficultyCode['header'] = 0; | |
| 60 | |
| 61 local myCPProfile_VERSION = "1.0.0"; -- this only changes when a new variable is added to the output | |
| 62 | |
| 63 local timePlayed = -1; | |
| 64 local timeLevelPlayed = -1; | |
| 65 | |
| 66 -- array of inventory slot names | |
| 67 local Profile_slots = { | |
| 68 "Head", -- 1 | |
| 69 "Neck", -- 2 | |
| 70 "Shoulder", -- 3 | |
| 71 "Shirt", -- 4 | |
| 72 "Chest", -- 5 | |
| 73 "Waist", -- 6 | |
| 74 "Legs", -- 7 | |
| 75 "Feet", -- 8 | |
| 76 "Wrist", -- 9 | |
| 77 "Hands", -- 10 | |
| 78 "Finger0", -- 11 | |
| 79 "Finger1", -- 12 | |
| 80 "Trinket0", -- 13 | |
| 81 "Trinket1", -- 14 | |
| 82 "Back", -- 15 | |
| 83 "MainHand", -- 16 | |
| 84 "SecondaryHand", -- 17 | |
| 85 "Ranged", -- 18 | |
| 86 "Tabard", -- 19 | |
| 87 }; | |
| 88 | |
| 89 function CP_ProfileFrame_OnLoad() | |
| 90 | |
| 91 -- Shut it down for now | |
| 92 if( true ) then | |
| 93 return; | |
| 94 end | |
| 95 this:RegisterEvent("VARIABLES_LOADED"); | |
| 96 if ( myCPProfile_ALLEVENTS ) then -- unused, but keep for testing | |
| 97 this:RegisterEvent("PLAYER_GUILD_UPDATE"); | |
| 98 this:RegisterEvent("UNIT_INVENTORY_CHANGED"); | |
| 99 this:RegisterEvent("VARIABLES_LOADED"); | |
| 100 this:RegisterEvent("TRAINER_CLOSED"); | |
| 101 this:RegisterEvent("PLAYER_LEVEL_UP"); | |
| 102 end | |
| 103 this:RegisterEvent("TIME_PLAYED_MSG"); | |
| 104 this:RegisterEvent("BANKFRAME_CLOSED"); -- 12/17, was OPENED, will it work with closed only? | |
| 105 | |
| 106 this:RegisterEvent("TRADE_SKILL_SHOW"); | |
| 107 this:RegisterEvent("CRAFT_SHOW"); | |
| 108 end | |
| 109 | |
| 110 -- since PLAYER_QUITTING and PLAYER_CAMPING events don't work, hook the functions | |
| 111 -- NOTE: Due to server lag, this could be a cause of the client not actually logging the character out until the server catches up | |
| 112 --[[ | |
| 113 oldLogout = Logout; | |
| 114 oldQuit = Quit; | |
| 115 function Quit() | |
| 116 RequestTimePlayed(); | |
| 117 oldQuit(); | |
| 118 end | |
| 119 function Logout() | |
| 120 RequestTimePlayed(); | |
| 121 oldLogout(); | |
| 122 end | |
| 123 ]]-- | |
| 124 | |
| 125 function CP_ProfileFrame_OnEvent(event, arg1, arg2) | |
| 126 | |
| 127 -- crapout if we're not ready to process, or if not enabled | |
| 128 if ( ( event == "UNIT_INVENTORY_CHANGED" and arg1 ~= "player" ) or not myCPProfile_ENABLED or not UnitName("player") or UnitName("player") == UNKNOWNOBJECT or not GetCVar("realmName") or not CensusPlus_DoThisCharacter ) then | |
| 129 return; | |
| 130 end | |
| 131 | |
| 132 -- CensusPlus_Msg( "PROF TEST : " .. event ); | |
| 133 | |
| 134 -- Got a unit name, now we're loaded | |
| 135 if (event == "VARIABLES_LOADED" and not myCPProfile_LOADED) then | |
| 136 myCPProfile_LOADED = 1; | |
| 137 PaperDollFrame_SetDamage(); | |
| 138 PaperDollFrame_SetRangedDamage(); | |
| 139 elseif (event == "VARIABLES_LOADED" and myCPProfile_LOADED) then | |
| 140 return; | |
| 141 end | |
| 142 | |
| 143 if (event == "TIME_PLAYED_MSG") then | |
| 144 timePlayed = arg1; | |
| 145 timeLevelPlayed = arg2; | |
| 146 end | |
| 147 | |
| 148 -- Event hit, process profile | |
| 149 if (myCPProfile_LOADED) then | |
| 150 Profile_InitProfile(); -- Always do this first, creates a profile is it doesn't exist | |
| 151 | |
| 152 if( ( event == "BANKFRAME_CLOSED" or event == "BANKFRAME_OPENED" or event == "PLAYERBANKSLOTS_CHANGED" ) and myCPProfile_DoScanBank ) then | |
| 153 Profile_ScanBank(); | |
| 154 CP_ProfHidden:ClearLines(); | |
| 155 CP_ProfHidden:Hide(); | |
| 156 return; | |
| 157 end | |
| 158 if ( not myCPProfile_DoScanBank and CensusPlus_Profile[GetCVar("realmName")][UnitName("player")] ) then | |
| 159 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"] = nil; | |
| 160 end | |
| 161 if ( myCPProfile_DoScanProfessions ) then | |
| 162 if ( event == "TRADE_SKILL_SHOW" ) then | |
| 163 Profile_ScanTradeSkill(); | |
| 164 CP_ProfHidden:ClearLines(); | |
| 165 CP_ProfHidden:Hide(); | |
| 166 return; | |
| 167 end | |
| 168 | |
| 169 if ( event == "CRAFT_SHOW" ) then | |
| 170 Profile_ScanCraft(); | |
| 171 CP_ProfHidden:ClearLines(); | |
| 172 CP_ProfHidden:Hide(); | |
| 173 return; | |
| 174 end | |
| 175 elseif ( CensusPlus_Profile[GetCVar("realmName")][UnitName("player")] ) then | |
| 176 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"] = nil; | |
| 177 end | |
| 178 | |
| 179 CP_ProfHidden:ClearLines(); | |
| 180 CP_ProfHidden:Hide(); | |
| 181 end | |
| 182 end | |
| 183 | |
| 184 function Profile_InitProfile() | |
| 185 if ( not CensusPlus_Profile ) then | |
| 186 CensusPlus_Profile = {}; | |
| 187 end | |
| 188 | |
| 189 if ( not CensusPlus_Profile[GetCVar("realmName")] ) then | |
| 190 CensusPlus_Profile[GetCVar("realmName")] = {}; | |
| 191 end | |
| 192 | |
| 193 if ( not CensusPlus_Profile[GetCVar("realmName")][UnitName("player")] ) then | |
| 194 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")] = {}; | |
| 195 else | |
| 196 local tmpBank = CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]; | |
| 197 local tmpProfessions = CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"]; | |
| 198 | |
| 199 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")] = { }; | |
| 200 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"] = tmpBank; | |
| 201 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"] = tmpProfessions; | |
| 202 end | |
| 203 | |
| 204 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["ProfilerVersion"] = myCPProfile_VERSION; -- keep track of version and don't work with old data | |
| 205 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Name"] = playerName; | |
| 206 | |
| 207 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["DateUpdated"] = date(); | |
| 208 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["TimePlayed"] = timePlayed; | |
| 209 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["TimeLevelPlayed"] = timeLevelPlayed; | |
| 210 | |
| 211 local sex = ""; | |
| 212 if (UnitSex("player") == 0) then | |
| 213 sex = "Male"; | |
| 214 else | |
| 215 sex = "Female"; | |
| 216 end | |
| 217 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Sex"] = sex; | |
| 218 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Race"] = UnitRace("player"); | |
| 219 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Class"] = UnitClass("player"); | |
| 220 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Level"] = UnitLevel("player"); | |
| 221 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Guild"] = {} ; | |
| 222 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Guild"]["GuildName"], CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Guild"]["Title"], CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Guild"]["Rank"] = GetGuildInfo("player"); | |
| 223 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Server"] = GetCVar("realmName"); | |
| 224 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["TalentPoints"] = UnitCharacterPoints("player"); | |
| 225 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Zone"] = GetZoneText(); | |
| 226 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["SubZone"] = GetSubZoneText(); | |
| 227 | |
| 228 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Experience"] = UnitXP("player") .. ":" .. UnitXPMax("player"); | |
| 229 | |
| 230 local money = GetMoney(); | |
| 231 local gold = floor(money / (COPPER_PER_SILVER * SILVER_PER_GOLD)); | |
| 232 local silver = floor((money - (gold * COPPER_PER_SILVER * SILVER_PER_GOLD)) / COPPER_PER_SILVER); | |
| 233 local copper = mod(money, COPPER_PER_SILVER); | |
| 234 | |
| 235 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Money"] = {}; | |
| 236 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Money"]["Gold"] = gold; | |
| 237 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Money"]["Silver"] = silver; | |
| 238 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Money"]["Copper"] = copper; | |
| 239 | |
| 240 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Stats"] = {}; | |
| 241 | |
| 242 -- "stat" is the same as effectiveStat... | |
| 243 -- problem here is if they have a debuff spell on, the values saved will be wrong | |
| 244 local stat, effectiveStat, posBuff, negBuff = UnitStat("player", 1); | |
| 245 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Stats"]["Strength"] = (stat - posBuff - negBuff) .. ":" .. effectiveStat .. ":" .. posBuff .. ":" .. negBuff; | |
| 246 stat, effectiveStat, posBuff, negBuff = UnitStat("player", 2); | |
| 247 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Stats"]["Agility"] = (stat - posBuff - negBuff) .. ":" .. effectiveStat .. ":" .. posBuff .. ":" .. negBuff; | |
| 248 stat, effectiveStat, posBuff, negBuff = UnitStat("player", 3); | |
| 249 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Stats"]["Stamina"] = (stat - posBuff - negBuff) .. ":" .. effectiveStat .. ":" .. posBuff .. ":" .. negBuff; | |
| 250 stat, effectiveStat, posBuff, negBuff = UnitStat("player", 4); | |
| 251 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Stats"]["Intellect"] = (stat - posBuff - negBuff) .. ":" .. effectiveStat .. ":" .. posBuff .. ":" .. negBuff; | |
| 252 stat, effectiveStat, posBuff, negBuff = UnitStat("player", 5); | |
| 253 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Stats"]["Spirit"] = (stat - posBuff - negBuff) .. ":" .. effectiveStat .. ":" .. posBuff .. ":" .. negBuff; | |
| 254 | |
| 255 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Resists"] = {}; | |
| 256 local base, resistance, positive, negative = UnitResistance("player", 6); | |
| 257 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Resists"]["Arcane"] = base .. ":" .. resistance .. ":" .. positive .. ":" .. negative; | |
| 258 base, resistance, positive, negative = UnitResistance("player", 2); | |
| 259 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Resists"]["Fire"] = base .. ":" .. resistance .. ":" .. positive .. ":" .. negative; | |
| 260 base, resistance, positive, negative = UnitResistance("player", 3); | |
| 261 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Resists"]["Nature"] = base .. ":" .. resistance .. ":" .. positive .. ":" .. negative; | |
| 262 base, resistance, positive, negative = UnitResistance("player", 4); | |
| 263 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Resists"]["Frost"] = base .. ":" .. resistance .. ":" .. positive .. ":" .. negative; | |
| 264 base, resistance, positive, negative = UnitResistance("player", 5); | |
| 265 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Resists"]["Shadow"] = base .. ":" .. resistance .. ":" .. positive .. ":" .. negative; | |
| 266 | |
| 267 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Mana"] = UnitManaMax("player"); | |
| 268 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Health"] = UnitHealthMax("player"); | |
| 269 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Defense"] = UnitDefense("player"); | |
| 270 | |
| 271 local baseArm, effectiveArmor, armor, positiveArm, negativeArm = UnitArmor("player"); | |
| 272 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Armor"] = baseArm .. ":" .. (baseArm + positiveArm) .. ":" .. positiveArm .. ":" .. negativeArm; -- if they have a debuf on, don't save it | |
| 273 | |
| 274 local minDamage, maxDamage, physicalBonusPos, physicalBonusNeg, percent = UnitDamage("player"); | |
| 275 -- local baseDamage = (minDamage + maxDamage) * 0.5; | |
| 276 -- local fullDamage = (baseDamage + physicalBonusPos + physicalBonusNeg) * percent; | |
| 277 -- local totalBonus = (fullDamage - baseDamage); | |
| 278 -- local displayMin = floor(minDamage + totalBonus); | |
| 279 -- local displayMax = ceil(maxDamage + totalBonus); | |
| 280 | |
| 281 CP_ProfHidden:SetOwner(CensusPlus_ProfileFrame, "ANCHOR_CURSOR"); | |
| 282 | |
| 283 CP_ProfHidden:SetText(INVTYPE_WEAPONMAINHAND, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b); | |
| 284 CP_ProfHidden:AddDoubleLine(ATTACK_SPEED_COLON, string.format("%.2f", CharacterDamageFrame.attackSpeed), NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b); | |
| 285 CP_ProfHidden:AddDoubleLine(DAMAGE_COLON, CharacterDamageFrame.damage, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b); | |
| 286 CP_ProfHidden:AddDoubleLine(DAMAGE_PER_SECOND, string.format("%.1f", CharacterDamageFrame.dps), NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b); | |
| 287 -- Check for offhand weapon | |
| 288 if ( CharacterDamageFrame.offhandAttackSpeed ) then | |
| 289 CP_ProfHidden:AddLine("<br>"); | |
| 290 CP_ProfHidden:AddLine(INVTYPE_WEAPONOFFHAND, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b); | |
| 291 CP_ProfHidden:AddDoubleLine(ATTACK_SPEED_COLON, string.format("%.2f", CharacterDamageFrame.offhandAttackSpeed), NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b); | |
| 292 CP_ProfHidden:AddDoubleLine(DAMAGE_COLON, CharacterDamageFrame.offhandDamage, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b); | |
| 293 CP_ProfHidden:AddDoubleLine(DAMAGE_PER_SECOND, string.format("%.1f", CharacterDamageFrame.offhandDps), NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b); | |
| 294 end | |
| 295 | |
| 296 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Melee Attack"] = {}; | |
| 297 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Melee Attack"]["AttackRating"] = UnitAttackBothHands("player"); | |
| 298 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Melee Attack"]["DamageRange"] = floor(minDamage) .. ":" .. ceil(maxDamage); | |
| 299 local base, posBuff, negBuff = UnitAttackPower("player"); | |
| 300 local effective = base + posBuff + negBuff; | |
| 301 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Melee Attack"]["AttackPower"] = base .. ":" .. effective .. ":" .. posBuff .. ":" .. negBuff; | |
| 302 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Melee Attack"]["DamageRangeTooltip"] = CP_Tooltipscan(); | |
| 303 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Melee Attack"]["AttackPowerTooltip"] = CharacterAttackPowerFrame.tooltipSubtext; | |
| 304 | |
| 305 -- Ranged not saved if there is no ranged weapon equipped | |
| 306 if ( PaperDollFrame.noRanged ) then | |
| 307 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Ranged Attack"] = nil; | |
| 308 else | |
| 309 CP_ProfHidden:SetText(INVTYPE_RANGED, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b); | |
| 310 CP_ProfHidden:AddDoubleLine(ATTACK_SPEED_COLON, string.format("%.2f", CharacterRangedDamageFrame.attackSpeed), NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b); | |
| 311 CP_ProfHidden:AddDoubleLine(DAMAGE_COLON, CharacterRangedDamageFrame.damage, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b); | |
| 312 CP_ProfHidden:AddDoubleLine(DAMAGE_PER_SECOND, string.format("%.1f", CharacterRangedDamageFrame.dps), NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b); | |
| 313 | |
| 314 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Ranged Attack"] = {}; | |
| 315 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Ranged Attack"]["AttackPowerTooltip"] = CharacterRangedAttackPowerFrame.tooltipSubtext; | |
| 316 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Ranged Attack"]["DamageRangeTooltip"] = CP_Tooltipscan(); | |
| 317 | |
| 318 local RangeSpeeed, RangeMinDMG,RangeMaxDMG = UnitRangedDamage("player"); | |
| 319 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Ranged Attack"]["DamageRange"] = max(floor(RangeMinDMG),1) .. ":" .. max(ceil(RangeMaxDMG),1); | |
| 320 local base, pos, neg = UnitRangedAttackPower("player"); | |
| 321 local effective = base + pos + neg; | |
| 322 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Ranged Attack"]["AttackPower"] = base .. ":" .. effective .. ":" .. pos .. ":" .. neg; | |
| 323 local base, pos, neg = UnitRangedAttack("player"); | |
| 324 if (not neg) then neg = 0; end; | |
| 325 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Ranged Attack"]["AttackRating"] = base; | |
| 326 end | |
| 327 | |
| 328 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["DodgePercent"] = strsub(GetDodgeChance(), 0, 5); | |
| 329 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["ParryPercent"] = strsub(GetParryChance(), 0, 5); | |
| 330 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["BlockPercent"] = strsub(GetBlockChance(), 0, 5); | |
| 331 | |
| 332 local MainAC, EffAC, AC, PosAC, NegAC = UnitArmor("player"); | |
| 333 local Level = UnitLevel("player"); | |
| 334 local Mitigation = (EffAC)/((85 * Level)+400); | |
| 335 Mitigation = 100 * (Mitigation/(Mitigation + 1)); | |
| 336 Mitigation = strsub(Mitigation, 0, 5); | |
| 337 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["MitigationPercent"] = Mitigation; | |
| 338 | |
| 339 local spellIndex = 1; | |
| 340 local spellName, subSpellName = GetSpellName(spellIndex,BOOKTYPE_SPELL); | |
| 341 local tmpStr = nil; | |
| 342 while spellName do | |
| 343 if (spellName == "Attack") then | |
| 344 CP_ProfHidden:SetSpell(spellIndex, BOOKTYPE_SPELL); | |
| 345 if( CP_Tooltipscan() ~= nil ) then | |
| 346 tmpStr = string.gsub(CP_Tooltipscan(), ".*<br/?>(%d?%d?%d%.%d%d?)%%.*", "%1"); | |
| 347 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["CritPercent"] = tmpStr; | |
| 348 end | |
| 349 end | |
| 350 spellIndex = spellIndex + 1; | |
| 351 spellName,subSpellName = nil; | |
| 352 spellName,subSpellName = GetSpellName(spellIndex,BOOKTYPE_SPELL); | |
| 353 end | |
| 354 --[[ | |
| 355 local speed, offhandSpeed = UnitAttackSpeed("player"); | |
| 356 local minDamage, maxDamage, minOffHandDamage, maxOffHandDamage, physicalBonusPos, physicalBonusNeg, percent = UnitDamage("player"); | |
| 357 local baseDamage = (minDamage + maxDamage) * 0.5; | |
| 358 local fullDamage = (baseDamage + physicalBonusPos + physicalBonusNeg) * percent; | |
| 359 local damagePerSecond = max( fullDamage, 1 ) / speed; | |
| 360 minDamage = max( floor( minDamage ), 1 ); | |
| 361 maxDamage = max( ceil( maxDamage ),1 ); | |
| 362 speed = string.format( "%.2f", speed ); | |
| 363 damagePerSecond = string.format( "%.1f", damagePerSecond ); | |
| 364 local damagerange = minDamage.." - "..maxDamage; | |
| 365 local output = INVTYPE_WEAPONMAINHAND .. "<br>" | |
| 366 .. ATTACK_SPEED_COLON .. speed .. "<br>" | |
| 367 .. DAMAGE_COLON .. damagerange .. "<br>" | |
| 368 .. DAMAGE_PER_SECOND .. damagePerSecond | |
| 369 if ( offhandSpeed ) then | |
| 370 local offhandBaseDamage = (minOffHandDamage + maxOffHandDamage) * 0.5; | |
| 371 local offhandFullDamage = (offhandBaseDamage + physicalBonusPos + physicalBonusNeg) * percent; | |
| 372 local offhandDamagePerSecond = (max(offhandFullDamage,1) / offhandSpeed); | |
| 373 minOffHandDamage=max(floor(minOffHandDamage),1); | |
| 374 maxOffHandDamage=max(ceil(maxOffHandDamage),1); | |
| 375 local damagerange = minOffHandDamage.." - "..maxOffHandDamage; | |
| 376 offhandDamagePerSecond = string.format( "%.1f", offhandDamagePerSecond ); | |
| 377 offhandSpeed=string.format("%.2f", offhandSpeed); | |
| 378 output = output .. INVTYPE_WEAPONOFFHAND .. "<br>" | |
| 379 .. ATTACK_SPEED_COLON .. offhandSpeed .. "<br>" | |
| 380 .. DAMAGE_COLON .. damagerange .. "<br>" | |
| 381 .. DAMAGE_PER_SECOND .. offhandDamagePerSecond; | |
| 382 end | |
| 383 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Melee Attack"]["DamageRangeTooltip"] = output; | |
| 384 | |
| 385 local speed, minDamage, maxDamage = UnitRangedDamage("player"); | |
| 386 minDamage = (minDamage / percent) - physicalBonusPos - physicalBonusNeg; | |
| 387 maxDamage = (maxDamage / percent) - physicalBonusPos - physicalBonusNeg; | |
| 388 local baseDamage = (minDamage + maxDamage) * 0.5; | |
| 389 local fullDamage = (baseDamage + physicalBonusPos + physicalBonusNeg) * percent; | |
| 390 local damagePerSecond = (max(fullDamage,1) / speed); | |
| 391 minDamage = max(floor(minDamage),1); | |
| 392 maxDamage = max(ceil(maxDamage),1); | |
| 393 speed=string.format("%.2f", speed); | |
| 394 damagePerSecond=string.format("%.1f", damagePerSecond); | |
| 395 local damagerange = max(floor(minDamage),1).." - "..max(ceil(maxDamage),1); | |
| 396 output = INVTYPE_RANGED .. "<br>" | |
| 397 .. ATTACK_SPEED_COLON .. speed .. "<br>" | |
| 398 .. DAMAGE_COLON .. damagerange .. "<br>" | |
| 399 .. DAMAGE_PER_SECOND .. damagePerSecond; | |
| 400 local base,pos,neg=UnitRangedAttack( "player" ); | |
| 401 if(base==0) then | |
| 402 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Ranged Attack"]["DamageRangeTooltip"] = ""; | |
| 403 else | |
| 404 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Ranged Attack"]["DamageRangeTooltip"] = output; | |
| 405 end | |
| 406 ]]-- | |
| 407 -- put in dps? | |
| 408 | |
| 409 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Locale"] = GetLocale(); | |
| 410 Profile_DoBuffs(); | |
| 411 | |
| 412 if ( myCPProfile_DoScanSkills ) then | |
| 413 Profile_GetSkills(); | |
| 414 end | |
| 415 if ( myCPProfile_DoScanEquipment) then | |
| 416 Profile_UpdateInventory(); | |
| 417 end | |
| 418 if ( myCPProfile_DoScanInventory ) then | |
| 419 Profile_ScanInventory(); | |
| 420 end | |
| 421 if ( myCPProfile_DoScanTalents and UnitLevel("player") > 9 ) then | |
| 422 Profile_GetTalents(); | |
| 423 end | |
| 424 if ( myCPProfile_DoScanReputation ) then | |
| 425 Profile_ScanReputation(); | |
| 426 end | |
| 427 if ( myCPProfile_DoScanQuestLog ) then | |
| 428 Profile_ScanQuests(); | |
| 429 end | |
| 430 if ( myCPProfile_DoScanHonor ) then | |
| 431 Profile_ScanHonor(); | |
| 432 end | |
| 433 end | |
| 434 | |
| 435 function Profile_ScanQuests() | |
| 436 local header = "Unknown"; | |
| 437 | |
| 438 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Quests"] = {}; | |
| 439 local slot = 1; | |
| 440 for i=1, GetNumQuestLogEntries(), 1 do | |
| 441 local text, level, questtag, isHeader, isCollapsed = GetQuestLogTitle(i); | |
| 442 if ( isHeader ) then | |
| 443 header = text; | |
| 444 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Quests"][header] = {} | |
| 445 else | |
| 446 if ( text ) then | |
| 447 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Quests"][header][slot] = {} | |
| 448 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Quests"][header][slot]["Title"] = text; | |
| 449 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Quests"][header][slot]["Level"] = level; | |
| 450 if ( questtag ) then | |
| 451 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Quests"][header][slot]["Tag"] = questtag; | |
| 452 end | |
| 453 end | |
| 454 slot = slot + 1; | |
| 455 end | |
| 456 end | |
| 457 end | |
| 458 | |
| 459 function Profile_ScanHonor() | |
| 460 -- save the honor data | |
| 461 local lastweekHK, lastweekDK, lastweekContribution, lastweekRank = GetPVPLastWeekStats(); | |
| 462 local lifetimeHK, lifetimeDK, lifetimeHighestRank = GetPVPLifetimeStats(); | |
| 463 local sessionHK, sessionDK = GetPVPSessionStats(); | |
| 464 local yesterdayHK, yesterdayDK, yesterdayContribution = GetPVPYesterdayStats(); | |
| 465 local lifetimeRankName, lifetimeRankNumber = GetPVPRankInfo(lifetimeHighestRank); | |
| 466 if ( not lifetimeRankName ) then | |
| 467 lifetimeRankName = NONE; | |
| 468 end | |
| 469 | |
| 470 local rankName, rankNumber = GetPVPRankInfo(UnitPVPRank("player")); | |
| 471 if ( not rankName ) then | |
| 472 rankName = NONE; | |
| 473 end | |
| 474 local rankInfo = "("..RANK.." "..rankNumber..")"; | |
| 475 | |
| 476 -- set icon | |
| 477 local rankIcon = ""; | |
| 478 if ( rankNumber > 0 ) then | |
| 479 rankIcon = string.format("%s%02d","Interface\\PvPRankBadges\\PvPRank", rankNumber); | |
| 480 end | |
| 481 | |
| 482 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"] = {} ; | |
| 483 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["LifetimeHighestRank"] = lifetimeHighestRank; | |
| 484 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["LifetimeRankName"] = lifetimeRankName; | |
| 485 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["LifetimeHK"] = lifetimeHK; | |
| 486 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["LifetimeDK"] = lifetimeDK; | |
| 487 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["SessionHK"] = sessionHK; | |
| 488 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["SessionDK"] = sessionDK; | |
| 489 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["YesterdayHK"] = yesterdayHK; | |
| 490 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["YesterdayDK"] = yesterdayDK; | |
| 491 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["YesterdayContribution"] = yesterdayContribution; | |
| 492 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["LastWeekHK"] = lastweekHK; | |
| 493 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["LastWeekDK"] = lastweekDK; | |
| 494 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["LastWeekContribution"] = lastweekContribution; | |
| 495 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["LastWeekRank"] = lastweekRank; | |
| 496 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["RankName"] = rankName; | |
| 497 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["RankInfo"] = rankInfo; | |
| 498 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["RankIcon"] = rankIcon; | |
| 499 end | |
| 500 | |
| 501 | |
| 502 function Profile_ScanReputation() -- Originally by Leronflon, modified to fit my style =) | |
| 503 local count; | |
| 504 local name, standing, rep, atWar, canToggle, foo2, foo3, thisHeader, isHeader; | |
| 505 | |
| 506 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Reputation"] = {}; | |
| 507 | |
| 508 count = GetNumFactions(); | |
| 509 | |
| 510 if( count == nil ) then | |
| 511 return; | |
| 512 end | |
| 513 | |
| 514 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Reputation"]["Count"] = count; | |
| 515 | |
| 516 local Units = { }; | |
| 517 Units[1] = 36000; -- Hated | |
| 518 Units[2] = 3000; -- Hostile | |
| 519 Units[3] = 3000; -- Unfriendly | |
| 520 Units[4] = 3000; -- Neutral | |
| 521 Units[5] = 6000; -- Friendly | |
| 522 Units[6] = 12000; -- Honored | |
| 523 Units[7] = 21000; -- Revered | |
| 524 Units[8] = 1000; -- Exaulted | |
| 525 | |
| 526 local ReputationKey = { [0] = "Unknown", [1] = "Hated", [2] = "Hostile", [3] = "Unfriendly", [4] = "Neutral", [5] = "Friendly", [6] = "Honored", [7] = "Revered", [8] = "Exaulted" }; | |
| 527 | |
| 528 | |
| 529 thisHeader = "none"; | |
| 530 for i = 1, count do | |
| 531 name, description, standing, barValue, atWar, canToggle, isHeader, isCollapsed = GetFactionInfo(i); | |
| 532 | |
| 533 if( name ~= nil ) then | |
| 534 if (atWar == nil) then | |
| 535 atWar = 0; | |
| 536 end | |
| 537 if (rep == nil) then | |
| 538 rep = 0; | |
| 539 end | |
| 540 if (standing == nil) then | |
| 541 standing = 0; | |
| 542 end | |
| 543 if (isHeader == nil ) then | |
| 544 thisHeader = name; | |
| 545 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Reputation"][thisHeader] = {}; | |
| 546 else | |
| 547 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Reputation"][thisHeader][name] = {}; | |
| 548 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Reputation"][thisHeader][name]["Standing"] = ReputationKey[standing]; | |
| 549 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Reputation"][thisHeader][name]["AtWar"] = atWar; | |
| 550 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Reputation"][thisHeader][name]["Value"] = round(barValue*Units[standing]).."/"..Units[standing]; | |
| 551 -- CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Reputation"][thisHeader][name]["canToggle"] = canToggle; | |
| 552 -- CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Reputation"][thisHeader][name]["Order"] = i; | |
| 553 end | |
| 554 end | |
| 555 end | |
| 556 end | |
| 557 | |
| 558 function Profile_GetTalents() | |
| 559 local numTabs = GetNumTalentTabs(); | |
| 560 local name, iconTexture, tier, column, rank, maxRank; | |
| 561 local numTalents; | |
| 562 local tabname, texture, points, fileName; | |
| 563 | |
| 564 -- Make sure the right frame is loaded | |
| 565 if( not CensusPlus_IsTalentLoaded() ) then | |
| 566 return; | |
| 567 end | |
| 568 | |
| 569 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Talents"] = {}; | |
| 570 | |
| 571 for x=1, numTabs do | |
| 572 PanelTemplates_SetTab(TalentFrame, x); | |
| 573 numTalents = GetNumTalents(PanelTemplates_GetSelectedTab(TalentFrame)); | |
| 574 tabname, texture, points, fileName = GetTalentTabInfo(PanelTemplates_GetSelectedTab(TalentFrame)); | |
| 575 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Talents"][tabname] = {}; | |
| 576 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Talents"][tabname]["PointsSpent"] = points; | |
| 577 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Talents"][tabname]["Background"] = "Interface\\TalentFrame\\" .. fileName; | |
| 578 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Talents"][tabname]["Order"] = x; | |
| 579 for i=1, numTalents do | |
| 580 name, iconTexture, tier, column, rank, maxRank = GetTalentInfo(PanelTemplates_GetSelectedTab(TalentFrame), i); | |
| 581 if (rank > 0 or myCPProfile_TALENTS_Full) then | |
| 582 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Talents"][tabname][name] = { }; | |
| 583 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Talents"][tabname][name]["Rank"] = rank .. ":" .. maxRank; | |
| 584 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Talents"][tabname][name]["Location"] = tier .. ":" .. column; | |
| 585 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Talents"][tabname][name]["Texture"] = iconTexture; | |
| 586 end | |
| 587 | |
| 588 if ( myCPProfile_TALENTS_Full ) then | |
| 589 -- double check | |
| 590 if ( not CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Talents"][tabname][name] ) then | |
| 591 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Talents"][tabname][name] = {}; | |
| 592 end | |
| 593 CP_ProfHidden:SetTalent(PanelTemplates_GetSelectedTab(TalentFrame), i) | |
| 594 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Talents"][tabname][name]["Tooltip"] = CP_Tooltipscan(); | |
| 595 end | |
| 596 end | |
| 597 end | |
| 598 end | |
| 599 | |
| 600 function Profile_DoBuffs() | |
| 601 local iIterator = 0; | |
| 602 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Buffs"] = {}; | |
| 603 while( GetPlayerBuffTexture( iIterator ) ) do | |
| 604 buffText = GetPlayerBuffTexture( iIterator); | |
| 605 iIterator = iIterator + 1 | |
| 606 CP_ProfHidden:SetUnitBuff( "player", iIterator ); | |
| 607 | |
| 608 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Buffs"][iIterator] = {}; | |
| 609 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Buffs"][iIterator]["Tooltip"] = CP_Tooltipscan(); | |
| 610 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Buffs"][iIterator]["Texture"] = buffText; | |
| 611 end | |
| 612 --[[ | |
| 613 iIterator = 1; | |
| 614 while( UnitDebuff( "player", iIterator ) ) do | |
| 615 debuffTexture, debuffApplications = UnitDebuff(unitName, debuffIndex); | |
| 616 CP_ProfHidden:SetUnitDebuff( "player", iIterator-1 ); | |
| 617 | |
| 618 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Debuffs"][iIterator] = {}; | |
| 619 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Debuffs"][iIterator]["Tooltip"] = CP_Tooltipscan(); | |
| 620 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Debuffs"][iIterator]["Texture"] = debuffTexture; | |
| 621 iIterator = iIterator + 1 | |
| 622 end | |
| 623 ]]-- | |
| 624 end | |
| 625 | |
| 626 function Profile_GetSkills() | |
| 627 -- Reset/Initialize | |
| 628 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Skills"] = {}; | |
| 629 local skillheader = ''; | |
| 630 local skillinfo = nil; | |
| 631 local rank, maxRank = 0; | |
| 632 local order = 1; -- order in which the headers appear | |
| 633 for i=1, GetNumSkillLines(), 1 do | |
| 634 skillinfo = fixnilempty(GetSkillLineInfo(i)); | |
| 635 rank = skillinfo[4]; | |
| 636 maxRank = skillinfo[7]; | |
| 637 if(skillinfo[2] == 1) then -- if it is a header | |
| 638 skillheader = skillinfo[1]; | |
| 639 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Skills"][skillheader] = { }; | |
| 640 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Skills"][skillheader]["Order"] = order; | |
| 641 order = order + 1; | |
| 642 else | |
| 643 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Skills"][skillheader][skillinfo[1]] = rank .. ":" .. maxRank; | |
| 644 end | |
| 645 end | |
| 646 end | |
| 647 | |
| 648 | |
| 649 --------------------------------------------- | |
| 650 -- Process Inventory | |
| 651 --------------------------------------------- | |
| 652 | |
| 653 function Profile_UpdateInventory() | |
| 654 local link; | |
| 655 local texture; | |
| 656 | |
| 657 -- Reset/Initialize | |
| 658 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Equipment"] = {}; | |
| 659 | |
| 660 for index,slot in Profile_slots do | |
| 661 link = GetInventoryItemLink("player", index); | |
| 662 texture = GetInventoryItemTexture("player", index); | |
| 663 if( link ) then | |
| 664 for color, item, name in string.gfind(link, "|c(%x+)|Hitem:(%d+:%d+:%d+:%d+)|h%[(.-)%]|h|r") do | |
| 665 if( color ~= nil and item ~= nil and name ~= nil ) then | |
| 666 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Equipment"][slot] = { }; | |
| 667 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Equipment"][slot]["Texture"] = texture; | |
| 668 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Equipment"][slot]["Color"] = color; | |
| 669 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Equipment"][slot]["Item"] = item; | |
| 670 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Equipment"][slot]["Name"] = name; | |
| 671 -- Build Tooltip | |
| 672 --CP_ProfHidden:SetHyperlink("item:" .. item); | |
| 673 CP_ProfHidden:SetInventoryItem("player", index); | |
| 674 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Equipment"][slot]["Tooltip"] = CP_Tooltipscan(); | |
| 675 | |
| 676 end | |
| 677 end | |
| 678 end | |
| 679 end | |
| 680 end | |
| 681 | |
| 682 function Profile_ScanInventory() | |
| 683 local bag, bagname, link, texture, color, item, strings, str; | |
| 684 | |
| 685 -- Reset/Initialize | |
| 686 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"] = {} | |
| 687 | |
| 688 for bag = 0,4 do | |
| 689 if (bag == 0) then | |
| 690 bagname = "Backpack"; | |
| 691 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag] = { }; | |
| 692 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Name"] = "Backpack"; | |
| 693 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Item"] = "Backpack"; | |
| 694 if ( myCPProfile_HTML_Tooltips ) then | |
| 695 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Tooltip"] = "Backpack"; | |
| 696 else | |
| 697 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Tooltip"] = {}; | |
| 698 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Tooltip"][1] = "Backpack"; | |
| 699 end | |
| 700 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Color"] = "ffffffff"; | |
| 701 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Slots"] = 16; | |
| 702 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Texture"] = "Interface\\Buttons\\Button-Backpack-Up"; | |
| 703 ProcessBagItems(bag, bagname); | |
| 704 else | |
| 705 link = GetInventoryItemLink("player", (bag+19)); | |
| 706 texture = GetInventoryItemTexture("player", (bag+19)); | |
| 707 if( link ) then | |
| 708 for color, item, bagname in string.gfind(link, "|c(%x+)|Hitem:(%d+:%d+:%d+:%d+)|h%[(.-)%]|h|r") do | |
| 709 if( color ~= nil and item ~= nil and bagname ~= nil ) then | |
| 710 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag] = { }; | |
| 711 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Item"] = item; | |
| 712 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Color"] = color; | |
| 713 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Texture"] = texture; | |
| 714 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Name"] = bagname; | |
| 715 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Slots"] = GetContainerNumSlots(bag); | |
| 716 CP_ProfHidden:SetInventoryItem("player", (bag+19)) | |
| 717 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Tooltip"] = CP_Tooltipscan(); | |
| 718 ProcessBagItems(bag); | |
| 719 end | |
| 720 end | |
| 721 end | |
| 722 end | |
| 723 end | |
| 724 end | |
| 725 | |
| 726 function ProcessBagItems(bag) | |
| 727 local slot, strings, str, texture, itemCount, locked, quality, link, color, item, name; | |
| 728 | |
| 729 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Contents"] = {}; | |
| 730 | |
| 731 for slot = 1,GetContainerNumSlots(bag) do -- loop through all slots in this bag and get items | |
| 732 | |
| 733 CP_ProfHidden:SetBagItem(bag, slot); | |
| 734 | |
| 735 texture, itemCount, locked, quality = GetContainerItemInfo(bag,slot); | |
| 736 link = GetContainerItemLink(bag, slot); | |
| 737 if( link ) then | |
| 738 for color, item, name in string.gfind(link, "|c(%x+)|Hitem:(%d+:%d+:%d+:%d+)|h%[(.-)%]|h|r") do | |
| 739 if( color ~= nil and item ~= nil and name ~= nil ) then | |
| 740 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Contents"][slot] = {}; | |
| 741 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Contents"][slot]["Tooltip"] = CP_Tooltipscan(); | |
| 742 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Contents"][slot]["Texture"] = texture; | |
| 743 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Contents"][slot]["Quantity"] = itemCount; | |
| 744 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Contents"][slot]["Name"] = name; | |
| 745 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Contents"][slot]["Color"] = color; | |
| 746 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Contents"][slot]["Item"] = item; | |
| 747 end | |
| 748 end | |
| 749 end | |
| 750 end | |
| 751 end | |
| 752 | |
| 753 | |
| 754 -- From CosmosCommonFunctions.lua | |
| 755 -- Clears a tooltip for usage. | |
| 756 function ClearTooltip(TooltipNameBase) | |
| 757 for i=1, 15, 1 do | |
| 758 getglobal(TooltipNameBase.."TextLeft"..i):SetText(""); | |
| 759 getglobal(TooltipNameBase.."TextRight"..i):SetText(""); | |
| 760 end | |
| 761 end | |
| 762 | |
| 763 | |
| 764 function Profile_ScanBank() | |
| 765 -- Borrowed from Telo's LootLink and restructured to fit my data | |
| 766 local oldBank = nil; | |
| 767 if (CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]) then | |
| 768 oldBank = CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]; | |
| 769 end | |
| 770 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"] = {} | |
| 771 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Contents"] = {} | |
| 772 | |
| 773 local bag, size, slot, link; | |
| 774 | |
| 775 -- First the bank container itself | |
| 776 size = GetContainerNumSlots(BANK_CONTAINER); | |
| 777 for slot = size, 1, -1 do | |
| 778 link = GetContainerItemLink(BANK_CONTAINER, slot); | |
| 779 local texture, itemCount, locked = GetContainerItemInfo(BANK_CONTAINER, slot); | |
| 780 if( link ) then | |
| 781 for color, item, name in string.gfind(link, "|c(%x+)|Hitem:(%d+:%d+:%d+:%d+)|h%[(.-)%]|h|r") do | |
| 782 if( color ~= nil and item ~= nil and name ~= nil ) then | |
| 783 oldBank = nil; -- When we find items, remove the oldBank variable | |
| 784 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Contents"][slot] = {}; | |
| 785 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Contents"][slot]["Texture"] = texture; | |
| 786 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Contents"][slot]["Quantity"] = itemCount; | |
| 787 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Contents"][slot]["Name"] = name; | |
| 788 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Contents"][slot]["Color"] = color; | |
| 789 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Contents"][slot]["Item"] = item; | |
| 790 CP_ProfHidden:SetHyperlink("item:" .. item); | |
| 791 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Contents"][slot]["Tooltip"] = CP_Tooltipscan(); | |
| 792 end | |
| 793 end | |
| 794 end | |
| 795 end | |
| 796 | |
| 797 -- Now the bank bags | |
| 798 for bag = 5, 10 do | |
| 799 link = GetContainerItemLink(BANK_CONTAINER, (bag+20)); | |
| 800 texture, itemCount, locked, quality = GetContainerItemInfo(BANK_CONTAINER, (bag+20)); | |
| 801 if( link ) then | |
| 802 for color, item, bagname in string.gfind(link, "|c(%x+)|Hitem:(%d+:%d+:%d+:%d+)|h%[(.-)%]|h|r") do | |
| 803 if( color ~= nil and item ~= nil and bagname ~= nil ) then | |
| 804 oldBank = nil; -- When we find items, remove the oldBank variable | |
| 805 bagnum = bag-4; | |
| 806 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum] = {}; | |
| 807 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Name"] = bagname; | |
| 808 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Slots"] = GetContainerNumSlots(bag); | |
| 809 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Texture"] = texture; | |
| 810 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Color"] = color; | |
| 811 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Item"] = item; | |
| 812 CP_ProfHidden:SetHyperlink("item:" .. item); | |
| 813 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Tooltip"] = CP_Tooltipscan(); | |
| 814 | |
| 815 ProcessBankBagItems(bag, bagnum); | |
| 816 end | |
| 817 end | |
| 818 end | |
| 819 end | |
| 820 | |
| 821 if ( oldBank ) then | |
| 822 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"] = oldBank; | |
| 823 end | |
| 824 end | |
| 825 | |
| 826 function ProcessBankBagItems(bag, bagnum) | |
| 827 | |
| 828 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Contents"] = {}; | |
| 829 | |
| 830 for slot = 1,GetContainerNumSlots(bag) do -- loop through all slots in this bag and get items | |
| 831 -- CP_ProfHidden:SetBagItem(bag, slot); | |
| 832 texture, itemCount, locked, quality = GetContainerItemInfo(bag,slot); | |
| 833 link = GetContainerItemLink(bag, slot); | |
| 834 if( link ) then | |
| 835 for color, item, name in string.gfind(link, "|c(%x+)|Hitem:(%d+:%d+:%d+:%d+)|h%[(.-)%]|h|r") do | |
| 836 if( color ~= nil and item ~= nil and name ~= nil ) then | |
| 837 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Contents"][slot] = {}; | |
| 838 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Contents"][slot]["Texture"] = texture; | |
| 839 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Contents"][slot]["Quantity"] = itemCount; | |
| 840 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Contents"][slot]["Name"] = name; | |
| 841 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Contents"][slot]["Color"] = color; | |
| 842 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Contents"][slot]["Item"] = item; | |
| 843 CP_ProfHidden:SetBagItem(bag, slot); | |
| 844 -- CP_ProfHidden:SetHyperlink("item:" .. item); | |
| 845 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Contents"][slot]["Tooltip"] = CP_Tooltipscan(); | |
| 846 end | |
| 847 end | |
| 848 end | |
| 849 end | |
| 850 end | |
| 851 | |
| 852 | |
| 853 function Profile_ScanTradeSkill() | |
| 854 local skillLineName, skillLineRank, skillLineMaxRank = GetTradeSkillLine(); | |
| 855 | |
| 856 if( (not skillLineName) or (skillLineName == "") or (skillLineName == "UNKNOWN")) then | |
| 857 return; | |
| 858 end | |
| 859 -- we don't bother saving the following tradeskills | |
| 860 if( (skillLineName == "Fishing") or (skillLineName == "Mining") or (skillLineName == "Herbalism") or (skillLineName == "Skinning") ) then | |
| 861 return; | |
| 862 end | |
| 863 | |
| 864 if ( not CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"] ) then | |
| 865 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"] = {}; | |
| 866 end | |
| 867 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName] = {}; | |
| 868 | |
| 869 -- expand the tree so we can see all the recipes | |
| 870 ExpandTradeSkillSubClass(0); | |
| 871 | |
| 872 -- get the number of recipes and loop through each one | |
| 873 local numTradeSkills = GetNumTradeSkills(); | |
| 874 local skillHeader = skillLineName; | |
| 875 for itemIndex=1, numTradeSkills, 1 do | |
| 876 if( itemIndex == nil or skillLineName==nil or skillHeader==nil ) then | |
| 877 return; | |
| 878 end | |
| 879 local skillText = ""; | |
| 880 local skillName, skillDifficulty, numAvailable, isExpanded = GetTradeSkillInfo(itemIndex); | |
| 881 if( skillDifficulty ~= "header" and skillLineName ~= nil and skillLineName ~= "" and skillHeader ~= nil and skillHeader ~= "" and skillName ~= nil and skillName ~= "" ) then | |
| 882 if( not CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader] ) then | |
| 883 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader] = {}; | |
| 884 end | |
| 885 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader][skillName] = {}; | |
| 886 local skillIcon = GetTradeSkillIcon(itemIndex); | |
| 887 if( not skillIcon ) then | |
| 888 skillIcon = ""; | |
| 889 end | |
| 890 | |
| 891 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader][skillName]["Texture"] = skillIcon; | |
| 892 | |
| 893 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader][skillName]["Difficulty"] = TradeSkillDifficultyCode[skillDifficulty]; | |
| 894 | |
| 895 CP_ProfHidden:SetTradeSkillItem(itemIndex); | |
| 896 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader][skillName]["Tooltip"] = CP_Tooltipscan(); | |
| 897 | |
| 898 | |
| 899 | |
| 900 local numReagents = GetTradeSkillNumReagents(itemIndex); | |
| 901 local reagents = ''; | |
| 902 for reagentIndex=1, numReagents, 1 do | |
| 903 local reagentName, reagentTexture, reagentCount, playerReagentCount = GetTradeSkillReagentInfo(itemIndex, reagentIndex); | |
| 904 if( not reagentTexture ) then | |
| 905 reagentTexture = ""; | |
| 906 end | |
| 907 if( not reagentName ) then | |
| 908 reagentName = "Unknown"; | |
| 909 end | |
| 910 | |
| 911 if (reagentIndex == numReagents) then | |
| 912 reagents = reagents .. reagentName .. " x" .. reagentCount; | |
| 913 else | |
| 914 reagents = reagents .. reagentName .. " x" .. reagentCount .. "<br>"; | |
| 915 end | |
| 916 end | |
| 917 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader][skillName]["Reagents"] = reagents; | |
| 918 else | |
| 919 skillHeader = skillName; | |
| 920 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader] = {}; | |
| 921 end | |
| 922 end | |
| 923 end | |
| 924 | |
| 925 -- is this ever called?! | |
| 926 function Profile_ScanCraft() | |
| 927 local skillLineName, skillLineRank, skillLineMaxRank = GetCraftDisplaySkillLine(); | |
| 928 | |
| 929 if( (not skillLineName) or (skillLineName == "") or (skillLineName == "UNKNOWN")) then | |
| 930 return; | |
| 931 end | |
| 932 | |
| 933 if ( not CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"] ) then | |
| 934 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"] = {}; | |
| 935 end | |
| 936 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName] = {}; | |
| 937 | |
| 938 -- expand the tree so we can see all the recipes | |
| 939 -- ExpandCraftSubClass(0); | |
| 940 | |
| 941 -- get the number of recipes and loop through each one | |
| 942 local numCrafts = GetNumCrafts(); | |
| 943 local skillHeader = skillLineName; -- default it, enchanting doesn't have categories? | |
| 944 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader] = {}; | |
| 945 for itemIndex=1, numCrafts, 1 do | |
| 946 local skillText = ""; | |
| 947 local skillName, craftSubSpellName, skillDifficulty, numAvailable, isExpanded = GetCraftInfo(itemIndex); | |
| 948 --Debug(skillName .. ":" .. craftSubSpellName); | |
| 949 if( skillDifficulty ~= "header" and skillLineName and skillLineName ~= "" and skillHeader and skillHeader ~= "" and skillName and skillName ~= "" ) then | |
| 950 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader][skillName] = {}; | |
| 951 local skillIcon = GetCraftIcon(itemIndex); | |
| 952 if( not skillIcon ) then | |
| 953 skillIcon = ""; | |
| 954 end | |
| 955 local description = GetCraftDescription(itemIndex); | |
| 956 if (description == nil) then | |
| 957 description = ""; | |
| 958 end | |
| 959 | |
| 960 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader][skillName]["Texture"] = skillIcon; | |
| 961 | |
| 962 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader][skillName]["Difficulty"] = TradeSkillDifficultyCode[skillDifficulty]; | |
| 963 | |
| 964 -- CP_ProfHidden:SetCraftItem(itemIndex); | |
| 965 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader][skillName]["Tooltip"] = description; | |
| 966 --Debug(description); | |
| 967 | |
| 968 local numReagents = GetCraftNumReagents(itemIndex); | |
| 969 local reagents = ''; | |
| 970 for reagentIndex=1, numReagents, 1 do | |
| 971 local reagentName, reagentTexture, reagentCount, playerReagentCount = GetCraftReagentInfo(itemIndex, reagentIndex); | |
| 972 if( not reagentTexture ) then | |
| 973 reagentTexture = ""; | |
| 974 end | |
| 975 if( not reagentName ) then | |
| 976 reagentName = "Unknown"; | |
| 977 end | |
| 978 | |
| 979 if (reagentIndex == numReagents) then | |
| 980 reagents = reagents .. reagentName .. " x" .. reagentCount; | |
| 981 else | |
| 982 reagents = reagents .. reagentName .. " x" .. reagentCount .. "<br>"; | |
| 983 end | |
| 984 end | |
| 985 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader][skillName]["Reagents"] = reagents; | |
| 986 else | |
| 987 local skillHeader = skillName; | |
| 988 CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader] = {}; | |
| 989 end | |
| 990 end | |
| 991 end | |
| 992 | |
| 993 | |
| 994 -- Utilities go below | |
| 995 -- From CosmosCommonFunctions.lua | |
| 996 -- Gets all lines out of a tooltip. | |
| 997 | |
| 998 function CP_Tooltipscan() | |
| 999 --CP_ProfHidden:Show(); | |
| 1000 | |
| 1001 local TooltipNameBase = "CP_ProfHidden"; | |
| 1002 local tooltipFrame = getglobal(TooltipNameBase); | |
| 1003 local strings = {}; | |
| 1004 local htmlstr = nil; | |
| 1005 | |
| 1006 -- CensusPlus_Msg( "NUM LINES: " .. CP_ProfHidden:NumLines() ); | |
| 1007 | |
| 1008 for idx = 1, CP_ProfHidden:NumLines() do | |
| 1009 local textLeft = nil; | |
| 1010 local textRight = nil; | |
| 1011 ttext = getglobal(TooltipNameBase.."TextLeft"..idx); | |
| 1012 | |
| 1013 if(ttext and ttext:IsVisible() and ttext:GetText() ~= nil) then | |
| 1014 textLeft = ttext:GetText(); | |
| 1015 end | |
| 1016 | |
| 1017 --if( textLeft ~= nil ) then | |
| 1018 -- CensusPlus_Msg( "LEFT TEXT: " .. textLeft ); | |
| 1019 --end | |
| 1020 | |
| 1021 ttext = getglobal(TooltipNameBase.."TextRight"..idx); | |
| 1022 if(ttext and ttext:IsVisible() and ttext:GetText() ~= nil) then | |
| 1023 textRight = ttext:GetText(); | |
| 1024 end | |
| 1025 --if( textRight ~= nil ) then | |
| 1026 -- CensusPlus_Msg( "RIGHT TEXT: " .. textRight ); | |
| 1027 --end | |
| 1028 | |
| 1029 if (textLeft or textRight) then | |
| 1030 if ( textRight) then | |
| 1031 textRight = "\t"..textRight; | |
| 1032 else | |
| 1033 textRight = ""; | |
| 1034 end | |
| 1035 | |
| 1036 if ( htmlstr ~= nil ) then | |
| 1037 htmlstr = htmlstr .. "<br>" .. textLeft .. textRight; | |
| 1038 else | |
| 1039 htmlstr = textLeft .. textRight; | |
| 1040 end | |
| 1041 end | |
| 1042 end | |
| 1043 | |
| 1044 -- CP_ProfHidden:ClearLines(); | |
| 1045 -- ClearTooltip( "CP_ProfHidden" ); | |
| 1046 | |
| 1047 return htmlstr; | |
| 1048 end | |
| 1049 | |
| 1050 function round(x) | |
| 1051 if(x - math.floor(x) > 0.5) then | |
| 1052 x = x + 0.5; | |
| 1053 end | |
| 1054 return math.floor(x); | |
| 1055 end | |
| 1056 | |
| 1057 if (not fixnilempty) then | |
| 1058 fixnilempty = function(...) | |
| 1059 for i=1, arg.n, 1 do | |
| 1060 if(not arg[i]) then | |
| 1061 arg[i] = ""; | |
| 1062 end | |
| 1063 end | |
| 1064 return arg; | |
| 1065 end | |
| 1066 end | |
| 1067 | |
| 1068 |
