EmFor@0: --[[ EmFor@0: CensusPlus for World of Warcraft(tm). EmFor@0: EmFor@0: Copyright 2005 - 2006 Cooper Sellers and WarcraftRealms.com EmFor@0: EmFor@0: License: EmFor@0: This program is free software; you can redistribute it and/or EmFor@0: modify it under the terms of the GNU General Public License EmFor@0: as published by the Free Software Foundation; either version 2 EmFor@0: of the License, or (at your option) any later version. EmFor@0: EmFor@0: This program is distributed in the hope that it will be useful, EmFor@0: but WITHOUT ANY WARRANTY; without even the implied warranty of EmFor@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the EmFor@0: GNU General Public License for more details. EmFor@0: EmFor@0: You should have received a copy of the GNU General Public License EmFor@0: along with this program(see GLP.txt); if not, write to the Free Software EmFor@0: Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. EmFor@0: ]] EmFor@0: EmFor@0: EmFor@0: CensusPlus_DoThisCharacter = false; EmFor@0: CensusPlus_Profile = {}; EmFor@0: CensusPlus_Profile[GetCVar("realmName")] = {} ; EmFor@0: local myCPProfile_LOADED = nil; -- Successful load of the script EmFor@0: EmFor@0: -- ////////////////////////////////////////////// EmFor@0: -- Configuration Variables EmFor@0: -- ////////////////////////////////////////////// EmFor@0: -- set to nil to disable any of the following EmFor@0: EmFor@0: myCPProfile_ENABLED = 0; -- Enable the profiler? EmFor@0: EmFor@0: local myCPProfile_DoScanInventory = 0; -- get inventory? EmFor@0: local myCPProfile_DoScanBank = 0; -- get bank? EmFor@0: local myCPProfile_DoScanEquipment = 0; -- get equipment? EmFor@0: local myCPProfile_DoScanSkills = 0; -- get skills? EmFor@0: local myCPProfile_DoScanTalents = 0; -- get talents? EmFor@0: local myCPProfile_DoScanProfessions = 0; -- output known tradeskill recipies EmFor@0: local myCPProfile_DoScanReputation = 0; -- get reputation? EmFor@0: local myCPProfile_DoScanQuestLog = 0; -- get quests? EmFor@0: local myCPProfile_DoScanHonor = 0; -- get honor? EmFor@0: EmFor@0: local myCPProfile_HTML_Tooltips = 1; -- make html tooltips (non-array format) - separate lines with
EmFor@0: local myCPProfile_TALENTS_Full = 1; -- output all talents and tooltips EmFor@0: EmFor@0: EmFor@0: local myCPProfile_DEBUG = 1; -- enable debugging? unused at this time EmFor@0: local myCPProfile_ALLEVENTS = nil; -- enable all event catching? for debugging only EmFor@0: EmFor@0: -- ////////////////////////////////////////////// EmFor@0: EmFor@0: local TradeSkillDifficultyCode = {}; EmFor@0: TradeSkillDifficultyCode['optimal'] = 4; EmFor@0: TradeSkillDifficultyCode['medium'] = 3; EmFor@0: TradeSkillDifficultyCode['easy'] = 2; EmFor@0: TradeSkillDifficultyCode['trivial'] = 1; EmFor@0: TradeSkillDifficultyCode['header'] = 0; EmFor@0: EmFor@0: local myCPProfile_VERSION = "1.0.0"; -- this only changes when a new variable is added to the output EmFor@0: EmFor@0: local timePlayed = -1; EmFor@0: local timeLevelPlayed = -1; EmFor@0: EmFor@0: -- array of inventory slot names EmFor@0: local Profile_slots = { EmFor@0: "Head", -- 1 EmFor@0: "Neck", -- 2 EmFor@0: "Shoulder", -- 3 EmFor@0: "Shirt", -- 4 EmFor@0: "Chest", -- 5 EmFor@0: "Waist", -- 6 EmFor@0: "Legs", -- 7 EmFor@0: "Feet", -- 8 EmFor@0: "Wrist", -- 9 EmFor@0: "Hands", -- 10 EmFor@0: "Finger0", -- 11 EmFor@0: "Finger1", -- 12 EmFor@0: "Trinket0", -- 13 EmFor@0: "Trinket1", -- 14 EmFor@0: "Back", -- 15 EmFor@0: "MainHand", -- 16 EmFor@0: "SecondaryHand", -- 17 EmFor@0: "Ranged", -- 18 EmFor@0: "Tabard", -- 19 EmFor@0: }; EmFor@0: EmFor@0: function CP_ProfileFrame_OnLoad() EmFor@0: EmFor@0: -- Shut it down for now EmFor@0: if( true ) then EmFor@0: return; EmFor@0: end EmFor@0: this:RegisterEvent("VARIABLES_LOADED"); EmFor@0: if ( myCPProfile_ALLEVENTS ) then -- unused, but keep for testing EmFor@0: this:RegisterEvent("PLAYER_GUILD_UPDATE"); EmFor@0: this:RegisterEvent("UNIT_INVENTORY_CHANGED"); EmFor@0: this:RegisterEvent("VARIABLES_LOADED"); EmFor@0: this:RegisterEvent("TRAINER_CLOSED"); EmFor@0: this:RegisterEvent("PLAYER_LEVEL_UP"); EmFor@0: end EmFor@0: this:RegisterEvent("TIME_PLAYED_MSG"); EmFor@0: this:RegisterEvent("BANKFRAME_CLOSED"); -- 12/17, was OPENED, will it work with closed only? EmFor@0: EmFor@0: this:RegisterEvent("TRADE_SKILL_SHOW"); EmFor@0: this:RegisterEvent("CRAFT_SHOW"); EmFor@0: end EmFor@0: EmFor@0: -- since PLAYER_QUITTING and PLAYER_CAMPING events don't work, hook the functions EmFor@0: -- NOTE: Due to server lag, this could be a cause of the client not actually logging the character out until the server catches up EmFor@0: --[[ EmFor@0: oldLogout = Logout; EmFor@0: oldQuit = Quit; EmFor@0: function Quit() EmFor@0: RequestTimePlayed(); EmFor@0: oldQuit(); EmFor@0: end EmFor@0: function Logout() EmFor@0: RequestTimePlayed(); EmFor@0: oldLogout(); EmFor@0: end EmFor@0: ]]-- EmFor@0: EmFor@0: function CP_ProfileFrame_OnEvent(event, arg1, arg2) EmFor@0: EmFor@0: -- crapout if we're not ready to process, or if not enabled EmFor@0: 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 EmFor@0: return; EmFor@0: end EmFor@0: EmFor@0: -- CensusPlus_Msg( "PROF TEST : " .. event ); EmFor@0: EmFor@0: -- Got a unit name, now we're loaded EmFor@0: if (event == "VARIABLES_LOADED" and not myCPProfile_LOADED) then EmFor@0: myCPProfile_LOADED = 1; EmFor@0: PaperDollFrame_SetDamage(); EmFor@0: PaperDollFrame_SetRangedDamage(); EmFor@0: elseif (event == "VARIABLES_LOADED" and myCPProfile_LOADED) then EmFor@0: return; EmFor@0: end EmFor@0: EmFor@0: if (event == "TIME_PLAYED_MSG") then EmFor@0: timePlayed = arg1; EmFor@0: timeLevelPlayed = arg2; EmFor@0: end EmFor@0: EmFor@0: -- Event hit, process profile EmFor@0: if (myCPProfile_LOADED) then EmFor@0: Profile_InitProfile(); -- Always do this first, creates a profile is it doesn't exist EmFor@0: EmFor@0: if( ( event == "BANKFRAME_CLOSED" or event == "BANKFRAME_OPENED" or event == "PLAYERBANKSLOTS_CHANGED" ) and myCPProfile_DoScanBank ) then EmFor@0: Profile_ScanBank(); EmFor@0: CP_ProfHidden:ClearLines(); EmFor@0: CP_ProfHidden:Hide(); EmFor@0: return; EmFor@0: end EmFor@0: if ( not myCPProfile_DoScanBank and CensusPlus_Profile[GetCVar("realmName")][UnitName("player")] ) then EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"] = nil; EmFor@0: end EmFor@0: if ( myCPProfile_DoScanProfessions ) then EmFor@0: if ( event == "TRADE_SKILL_SHOW" ) then EmFor@0: Profile_ScanTradeSkill(); EmFor@0: CP_ProfHidden:ClearLines(); EmFor@0: CP_ProfHidden:Hide(); EmFor@0: return; EmFor@0: end EmFor@0: EmFor@0: if ( event == "CRAFT_SHOW" ) then EmFor@0: Profile_ScanCraft(); EmFor@0: CP_ProfHidden:ClearLines(); EmFor@0: CP_ProfHidden:Hide(); EmFor@0: return; EmFor@0: end EmFor@0: elseif ( CensusPlus_Profile[GetCVar("realmName")][UnitName("player")] ) then EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"] = nil; EmFor@0: end EmFor@0: EmFor@0: CP_ProfHidden:ClearLines(); EmFor@0: CP_ProfHidden:Hide(); EmFor@0: end EmFor@0: end EmFor@0: EmFor@0: function Profile_InitProfile() EmFor@0: if ( not CensusPlus_Profile ) then EmFor@0: CensusPlus_Profile = {}; EmFor@0: end EmFor@0: EmFor@0: if ( not CensusPlus_Profile[GetCVar("realmName")] ) then EmFor@0: CensusPlus_Profile[GetCVar("realmName")] = {}; EmFor@0: end EmFor@0: EmFor@0: if ( not CensusPlus_Profile[GetCVar("realmName")][UnitName("player")] ) then EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")] = {}; EmFor@0: else EmFor@0: local tmpBank = CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]; EmFor@0: local tmpProfessions = CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"]; EmFor@0: EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")] = { }; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"] = tmpBank; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"] = tmpProfessions; EmFor@0: end EmFor@0: EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["ProfilerVersion"] = myCPProfile_VERSION; -- keep track of version and don't work with old data EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Name"] = playerName; EmFor@0: EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["DateUpdated"] = date(); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["TimePlayed"] = timePlayed; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["TimeLevelPlayed"] = timeLevelPlayed; EmFor@0: EmFor@0: local sex = ""; EmFor@0: if (UnitSex("player") == 0) then EmFor@0: sex = "Male"; EmFor@0: else EmFor@0: sex = "Female"; EmFor@0: end EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Sex"] = sex; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Race"] = UnitRace("player"); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Class"] = UnitClass("player"); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Level"] = UnitLevel("player"); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Guild"] = {} ; EmFor@0: 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"); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Server"] = GetCVar("realmName"); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["TalentPoints"] = UnitCharacterPoints("player"); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Zone"] = GetZoneText(); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["SubZone"] = GetSubZoneText(); EmFor@0: EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Experience"] = UnitXP("player") .. ":" .. UnitXPMax("player"); EmFor@0: EmFor@0: local money = GetMoney(); EmFor@0: local gold = floor(money / (COPPER_PER_SILVER * SILVER_PER_GOLD)); EmFor@0: local silver = floor((money - (gold * COPPER_PER_SILVER * SILVER_PER_GOLD)) / COPPER_PER_SILVER); EmFor@0: local copper = mod(money, COPPER_PER_SILVER); EmFor@0: EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Money"] = {}; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Money"]["Gold"] = gold; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Money"]["Silver"] = silver; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Money"]["Copper"] = copper; EmFor@0: EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Stats"] = {}; EmFor@0: EmFor@0: -- "stat" is the same as effectiveStat... EmFor@0: -- problem here is if they have a debuff spell on, the values saved will be wrong EmFor@0: local stat, effectiveStat, posBuff, negBuff = UnitStat("player", 1); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Stats"]["Strength"] = (stat - posBuff - negBuff) .. ":" .. effectiveStat .. ":" .. posBuff .. ":" .. negBuff; EmFor@0: stat, effectiveStat, posBuff, negBuff = UnitStat("player", 2); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Stats"]["Agility"] = (stat - posBuff - negBuff) .. ":" .. effectiveStat .. ":" .. posBuff .. ":" .. negBuff; EmFor@0: stat, effectiveStat, posBuff, negBuff = UnitStat("player", 3); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Stats"]["Stamina"] = (stat - posBuff - negBuff) .. ":" .. effectiveStat .. ":" .. posBuff .. ":" .. negBuff; EmFor@0: stat, effectiveStat, posBuff, negBuff = UnitStat("player", 4); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Stats"]["Intellect"] = (stat - posBuff - negBuff) .. ":" .. effectiveStat .. ":" .. posBuff .. ":" .. negBuff; EmFor@0: stat, effectiveStat, posBuff, negBuff = UnitStat("player", 5); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Stats"]["Spirit"] = (stat - posBuff - negBuff) .. ":" .. effectiveStat .. ":" .. posBuff .. ":" .. negBuff; EmFor@0: EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Resists"] = {}; EmFor@0: local base, resistance, positive, negative = UnitResistance("player", 6); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Resists"]["Arcane"] = base .. ":" .. resistance .. ":" .. positive .. ":" .. negative; EmFor@0: base, resistance, positive, negative = UnitResistance("player", 2); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Resists"]["Fire"] = base .. ":" .. resistance .. ":" .. positive .. ":" .. negative; EmFor@0: base, resistance, positive, negative = UnitResistance("player", 3); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Resists"]["Nature"] = base .. ":" .. resistance .. ":" .. positive .. ":" .. negative; EmFor@0: base, resistance, positive, negative = UnitResistance("player", 4); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Resists"]["Frost"] = base .. ":" .. resistance .. ":" .. positive .. ":" .. negative; EmFor@0: base, resistance, positive, negative = UnitResistance("player", 5); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Resists"]["Shadow"] = base .. ":" .. resistance .. ":" .. positive .. ":" .. negative; EmFor@0: EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Mana"] = UnitManaMax("player"); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Health"] = UnitHealthMax("player"); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Defense"] = UnitDefense("player"); EmFor@0: EmFor@0: local baseArm, effectiveArmor, armor, positiveArm, negativeArm = UnitArmor("player"); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Armor"] = baseArm .. ":" .. (baseArm + positiveArm) .. ":" .. positiveArm .. ":" .. negativeArm; -- if they have a debuf on, don't save it EmFor@0: EmFor@0: local minDamage, maxDamage, physicalBonusPos, physicalBonusNeg, percent = UnitDamage("player"); EmFor@0: -- local baseDamage = (minDamage + maxDamage) * 0.5; EmFor@0: -- local fullDamage = (baseDamage + physicalBonusPos + physicalBonusNeg) * percent; EmFor@0: -- local totalBonus = (fullDamage - baseDamage); EmFor@0: -- local displayMin = floor(minDamage + totalBonus); EmFor@0: -- local displayMax = ceil(maxDamage + totalBonus); EmFor@0: EmFor@0: CP_ProfHidden:SetOwner(CensusPlus_ProfileFrame, "ANCHOR_CURSOR"); EmFor@0: EmFor@0: CP_ProfHidden:SetText(INVTYPE_WEAPONMAINHAND, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b); EmFor@0: 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); EmFor@0: 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); EmFor@0: 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); EmFor@0: -- Check for offhand weapon EmFor@0: if ( CharacterDamageFrame.offhandAttackSpeed ) then EmFor@0: CP_ProfHidden:AddLine("
"); EmFor@0: CP_ProfHidden:AddLine(INVTYPE_WEAPONOFFHAND, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b); EmFor@0: 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); EmFor@0: 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); EmFor@0: 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); EmFor@0: end EmFor@0: EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Melee Attack"] = {}; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Melee Attack"]["AttackRating"] = UnitAttackBothHands("player"); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Melee Attack"]["DamageRange"] = floor(minDamage) .. ":" .. ceil(maxDamage); EmFor@0: local base, posBuff, negBuff = UnitAttackPower("player"); EmFor@0: local effective = base + posBuff + negBuff; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Melee Attack"]["AttackPower"] = base .. ":" .. effective .. ":" .. posBuff .. ":" .. negBuff; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Melee Attack"]["DamageRangeTooltip"] = CP_Tooltipscan(); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Melee Attack"]["AttackPowerTooltip"] = CharacterAttackPowerFrame.tooltipSubtext; EmFor@0: EmFor@0: -- Ranged not saved if there is no ranged weapon equipped EmFor@0: if ( PaperDollFrame.noRanged ) then EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Ranged Attack"] = nil; EmFor@0: else EmFor@0: CP_ProfHidden:SetText(INVTYPE_RANGED, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b); EmFor@0: 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); EmFor@0: 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); EmFor@0: 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); EmFor@0: EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Ranged Attack"] = {}; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Ranged Attack"]["AttackPowerTooltip"] = CharacterRangedAttackPowerFrame.tooltipSubtext; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Ranged Attack"]["DamageRangeTooltip"] = CP_Tooltipscan(); EmFor@0: EmFor@0: local RangeSpeeed, RangeMinDMG,RangeMaxDMG = UnitRangedDamage("player"); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Ranged Attack"]["DamageRange"] = max(floor(RangeMinDMG),1) .. ":" .. max(ceil(RangeMaxDMG),1); EmFor@0: local base, pos, neg = UnitRangedAttackPower("player"); EmFor@0: local effective = base + pos + neg; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Ranged Attack"]["AttackPower"] = base .. ":" .. effective .. ":" .. pos .. ":" .. neg; EmFor@0: local base, pos, neg = UnitRangedAttack("player"); EmFor@0: if (not neg) then neg = 0; end; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Ranged Attack"]["AttackRating"] = base; EmFor@0: end EmFor@0: EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["DodgePercent"] = strsub(GetDodgeChance(), 0, 5); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["ParryPercent"] = strsub(GetParryChance(), 0, 5); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["BlockPercent"] = strsub(GetBlockChance(), 0, 5); EmFor@0: EmFor@0: local MainAC, EffAC, AC, PosAC, NegAC = UnitArmor("player"); EmFor@0: local Level = UnitLevel("player"); EmFor@0: local Mitigation = (EffAC)/((85 * Level)+400); EmFor@0: Mitigation = 100 * (Mitigation/(Mitigation + 1)); EmFor@0: Mitigation = strsub(Mitigation, 0, 5); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["MitigationPercent"] = Mitigation; EmFor@0: EmFor@0: local spellIndex = 1; EmFor@0: local spellName, subSpellName = GetSpellName(spellIndex,BOOKTYPE_SPELL); EmFor@0: local tmpStr = nil; EmFor@0: while spellName do EmFor@0: if (spellName == "Attack") then EmFor@0: CP_ProfHidden:SetSpell(spellIndex, BOOKTYPE_SPELL); EmFor@0: if( CP_Tooltipscan() ~= nil ) then EmFor@0: tmpStr = string.gsub(CP_Tooltipscan(), ".*
(%d?%d?%d%.%d%d?)%%.*", "%1"); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["CritPercent"] = tmpStr; EmFor@0: end EmFor@0: end EmFor@0: spellIndex = spellIndex + 1; EmFor@0: spellName,subSpellName = nil; EmFor@0: spellName,subSpellName = GetSpellName(spellIndex,BOOKTYPE_SPELL); EmFor@0: end EmFor@0: --[[ EmFor@0: local speed, offhandSpeed = UnitAttackSpeed("player"); EmFor@0: local minDamage, maxDamage, minOffHandDamage, maxOffHandDamage, physicalBonusPos, physicalBonusNeg, percent = UnitDamage("player"); EmFor@0: local baseDamage = (minDamage + maxDamage) * 0.5; EmFor@0: local fullDamage = (baseDamage + physicalBonusPos + physicalBonusNeg) * percent; EmFor@0: local damagePerSecond = max( fullDamage, 1 ) / speed; EmFor@0: minDamage = max( floor( minDamage ), 1 ); EmFor@0: maxDamage = max( ceil( maxDamage ),1 ); EmFor@0: speed = string.format( "%.2f", speed ); EmFor@0: damagePerSecond = string.format( "%.1f", damagePerSecond ); EmFor@0: local damagerange = minDamage.." - "..maxDamage; EmFor@0: local output = INVTYPE_WEAPONMAINHAND .. "
" EmFor@0: .. ATTACK_SPEED_COLON .. speed .. "
" EmFor@0: .. DAMAGE_COLON .. damagerange .. "
" EmFor@0: .. DAMAGE_PER_SECOND .. damagePerSecond EmFor@0: if ( offhandSpeed ) then EmFor@0: local offhandBaseDamage = (minOffHandDamage + maxOffHandDamage) * 0.5; EmFor@0: local offhandFullDamage = (offhandBaseDamage + physicalBonusPos + physicalBonusNeg) * percent; EmFor@0: local offhandDamagePerSecond = (max(offhandFullDamage,1) / offhandSpeed); EmFor@0: minOffHandDamage=max(floor(minOffHandDamage),1); EmFor@0: maxOffHandDamage=max(ceil(maxOffHandDamage),1); EmFor@0: local damagerange = minOffHandDamage.." - "..maxOffHandDamage; EmFor@0: offhandDamagePerSecond = string.format( "%.1f", offhandDamagePerSecond ); EmFor@0: offhandSpeed=string.format("%.2f", offhandSpeed); EmFor@0: output = output .. INVTYPE_WEAPONOFFHAND .. "
" EmFor@0: .. ATTACK_SPEED_COLON .. offhandSpeed .. "
" EmFor@0: .. DAMAGE_COLON .. damagerange .. "
" EmFor@0: .. DAMAGE_PER_SECOND .. offhandDamagePerSecond; EmFor@0: end EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Melee Attack"]["DamageRangeTooltip"] = output; EmFor@0: EmFor@0: local speed, minDamage, maxDamage = UnitRangedDamage("player"); EmFor@0: minDamage = (minDamage / percent) - physicalBonusPos - physicalBonusNeg; EmFor@0: maxDamage = (maxDamage / percent) - physicalBonusPos - physicalBonusNeg; EmFor@0: local baseDamage = (minDamage + maxDamage) * 0.5; EmFor@0: local fullDamage = (baseDamage + physicalBonusPos + physicalBonusNeg) * percent; EmFor@0: local damagePerSecond = (max(fullDamage,1) / speed); EmFor@0: minDamage = max(floor(minDamage),1); EmFor@0: maxDamage = max(ceil(maxDamage),1); EmFor@0: speed=string.format("%.2f", speed); EmFor@0: damagePerSecond=string.format("%.1f", damagePerSecond); EmFor@0: local damagerange = max(floor(minDamage),1).." - "..max(ceil(maxDamage),1); EmFor@0: output = INVTYPE_RANGED .. "
" EmFor@0: .. ATTACK_SPEED_COLON .. speed .. "
" EmFor@0: .. DAMAGE_COLON .. damagerange .. "
" EmFor@0: .. DAMAGE_PER_SECOND .. damagePerSecond; EmFor@0: local base,pos,neg=UnitRangedAttack( "player" ); EmFor@0: if(base==0) then EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Ranged Attack"]["DamageRangeTooltip"] = ""; EmFor@0: else EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Ranged Attack"]["DamageRangeTooltip"] = output; EmFor@0: end EmFor@0: ]]-- EmFor@0: -- put in dps? EmFor@0: EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Locale"] = GetLocale(); EmFor@0: Profile_DoBuffs(); EmFor@0: EmFor@0: if ( myCPProfile_DoScanSkills ) then EmFor@0: Profile_GetSkills(); EmFor@0: end EmFor@0: if ( myCPProfile_DoScanEquipment) then EmFor@0: Profile_UpdateInventory(); EmFor@0: end EmFor@0: if ( myCPProfile_DoScanInventory ) then EmFor@0: Profile_ScanInventory(); EmFor@0: end EmFor@0: if ( myCPProfile_DoScanTalents and UnitLevel("player") > 9 ) then EmFor@0: Profile_GetTalents(); EmFor@0: end EmFor@0: if ( myCPProfile_DoScanReputation ) then EmFor@0: Profile_ScanReputation(); EmFor@0: end EmFor@0: if ( myCPProfile_DoScanQuestLog ) then EmFor@0: Profile_ScanQuests(); EmFor@0: end EmFor@0: if ( myCPProfile_DoScanHonor ) then EmFor@0: Profile_ScanHonor(); EmFor@0: end EmFor@0: end EmFor@0: EmFor@0: function Profile_ScanQuests() EmFor@0: local header = "Unknown"; EmFor@0: EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Quests"] = {}; EmFor@0: local slot = 1; EmFor@0: for i=1, GetNumQuestLogEntries(), 1 do EmFor@0: local text, level, questtag, isHeader, isCollapsed = GetQuestLogTitle(i); EmFor@0: if ( isHeader ) then EmFor@0: header = text; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Quests"][header] = {} EmFor@0: else EmFor@0: if ( text ) then EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Quests"][header][slot] = {} EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Quests"][header][slot]["Title"] = text; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Quests"][header][slot]["Level"] = level; EmFor@0: if ( questtag ) then EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Quests"][header][slot]["Tag"] = questtag; EmFor@0: end EmFor@0: end EmFor@0: slot = slot + 1; EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: EmFor@0: function Profile_ScanHonor() EmFor@0: -- save the honor data EmFor@0: local lastweekHK, lastweekDK, lastweekContribution, lastweekRank = GetPVPLastWeekStats(); EmFor@0: local lifetimeHK, lifetimeDK, lifetimeHighestRank = GetPVPLifetimeStats(); EmFor@0: local sessionHK, sessionDK = GetPVPSessionStats(); EmFor@0: local yesterdayHK, yesterdayDK, yesterdayContribution = GetPVPYesterdayStats(); EmFor@0: local lifetimeRankName, lifetimeRankNumber = GetPVPRankInfo(lifetimeHighestRank); EmFor@0: if ( not lifetimeRankName ) then EmFor@0: lifetimeRankName = NONE; EmFor@0: end EmFor@0: EmFor@0: local rankName, rankNumber = GetPVPRankInfo(UnitPVPRank("player")); EmFor@0: if ( not rankName ) then EmFor@0: rankName = NONE; EmFor@0: end EmFor@0: local rankInfo = "("..RANK.." "..rankNumber..")"; EmFor@0: EmFor@0: -- set icon EmFor@0: local rankIcon = ""; EmFor@0: if ( rankNumber > 0 ) then EmFor@0: rankIcon = string.format("%s%02d","Interface\\PvPRankBadges\\PvPRank", rankNumber); EmFor@0: end EmFor@0: EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"] = {} ; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["LifetimeHighestRank"] = lifetimeHighestRank; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["LifetimeRankName"] = lifetimeRankName; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["LifetimeHK"] = lifetimeHK; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["LifetimeDK"] = lifetimeDK; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["SessionHK"] = sessionHK; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["SessionDK"] = sessionDK; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["YesterdayHK"] = yesterdayHK; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["YesterdayDK"] = yesterdayDK; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["YesterdayContribution"] = yesterdayContribution; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["LastWeekHK"] = lastweekHK; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["LastWeekDK"] = lastweekDK; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["LastWeekContribution"] = lastweekContribution; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["LastWeekRank"] = lastweekRank; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["RankName"] = rankName; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["RankInfo"] = rankInfo; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Honor"]["RankIcon"] = rankIcon; EmFor@0: end EmFor@0: EmFor@0: EmFor@0: function Profile_ScanReputation() -- Originally by Leronflon, modified to fit my style =) EmFor@0: local count; EmFor@0: local name, standing, rep, atWar, canToggle, foo2, foo3, thisHeader, isHeader; EmFor@0: EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Reputation"] = {}; EmFor@0: EmFor@0: count = GetNumFactions(); EmFor@0: EmFor@0: if( count == nil ) then EmFor@0: return; EmFor@0: end EmFor@0: EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Reputation"]["Count"] = count; EmFor@0: EmFor@0: local Units = { }; EmFor@0: Units[1] = 36000; -- Hated EmFor@0: Units[2] = 3000; -- Hostile EmFor@0: Units[3] = 3000; -- Unfriendly EmFor@0: Units[4] = 3000; -- Neutral EmFor@0: Units[5] = 6000; -- Friendly EmFor@0: Units[6] = 12000; -- Honored EmFor@0: Units[7] = 21000; -- Revered EmFor@0: Units[8] = 1000; -- Exaulted EmFor@0: EmFor@0: local ReputationKey = { [0] = "Unknown", [1] = "Hated", [2] = "Hostile", [3] = "Unfriendly", [4] = "Neutral", [5] = "Friendly", [6] = "Honored", [7] = "Revered", [8] = "Exaulted" }; EmFor@0: EmFor@0: EmFor@0: thisHeader = "none"; EmFor@0: for i = 1, count do EmFor@0: name, description, standing, barValue, atWar, canToggle, isHeader, isCollapsed = GetFactionInfo(i); EmFor@0: EmFor@0: if( name ~= nil ) then EmFor@0: if (atWar == nil) then EmFor@0: atWar = 0; EmFor@0: end EmFor@0: if (rep == nil) then EmFor@0: rep = 0; EmFor@0: end EmFor@0: if (standing == nil) then EmFor@0: standing = 0; EmFor@0: end EmFor@0: if (isHeader == nil ) then EmFor@0: thisHeader = name; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Reputation"][thisHeader] = {}; EmFor@0: else EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Reputation"][thisHeader][name] = {}; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Reputation"][thisHeader][name]["Standing"] = ReputationKey[standing]; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Reputation"][thisHeader][name]["AtWar"] = atWar; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Reputation"][thisHeader][name]["Value"] = round(barValue*Units[standing]).."/"..Units[standing]; EmFor@0: -- CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Reputation"][thisHeader][name]["canToggle"] = canToggle; EmFor@0: -- CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Reputation"][thisHeader][name]["Order"] = i; EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: EmFor@0: function Profile_GetTalents() EmFor@0: local numTabs = GetNumTalentTabs(); EmFor@0: local name, iconTexture, tier, column, rank, maxRank; EmFor@0: local numTalents; EmFor@0: local tabname, texture, points, fileName; EmFor@0: EmFor@0: -- Make sure the right frame is loaded EmFor@0: if( not CensusPlus_IsTalentLoaded() ) then EmFor@0: return; EmFor@0: end EmFor@0: EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Talents"] = {}; EmFor@0: EmFor@0: for x=1, numTabs do EmFor@0: PanelTemplates_SetTab(TalentFrame, x); EmFor@0: numTalents = GetNumTalents(PanelTemplates_GetSelectedTab(TalentFrame)); EmFor@0: tabname, texture, points, fileName = GetTalentTabInfo(PanelTemplates_GetSelectedTab(TalentFrame)); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Talents"][tabname] = {}; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Talents"][tabname]["PointsSpent"] = points; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Talents"][tabname]["Background"] = "Interface\\TalentFrame\\" .. fileName; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Talents"][tabname]["Order"] = x; EmFor@0: for i=1, numTalents do EmFor@0: name, iconTexture, tier, column, rank, maxRank = GetTalentInfo(PanelTemplates_GetSelectedTab(TalentFrame), i); EmFor@0: if (rank > 0 or myCPProfile_TALENTS_Full) then EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Talents"][tabname][name] = { }; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Talents"][tabname][name]["Rank"] = rank .. ":" .. maxRank; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Talents"][tabname][name]["Location"] = tier .. ":" .. column; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Talents"][tabname][name]["Texture"] = iconTexture; EmFor@0: end EmFor@0: EmFor@0: if ( myCPProfile_TALENTS_Full ) then EmFor@0: -- double check EmFor@0: if ( not CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Talents"][tabname][name] ) then EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Talents"][tabname][name] = {}; EmFor@0: end EmFor@0: CP_ProfHidden:SetTalent(PanelTemplates_GetSelectedTab(TalentFrame), i) EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Talents"][tabname][name]["Tooltip"] = CP_Tooltipscan(); EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: EmFor@0: function Profile_DoBuffs() EmFor@0: local iIterator = 0; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Buffs"] = {}; EmFor@0: while( GetPlayerBuffTexture( iIterator ) ) do EmFor@0: buffText = GetPlayerBuffTexture( iIterator); EmFor@0: iIterator = iIterator + 1 EmFor@0: CP_ProfHidden:SetUnitBuff( "player", iIterator ); EmFor@0: EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Buffs"][iIterator] = {}; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Buffs"][iIterator]["Tooltip"] = CP_Tooltipscan(); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Buffs"][iIterator]["Texture"] = buffText; EmFor@0: end EmFor@0: --[[ EmFor@0: iIterator = 1; EmFor@0: while( UnitDebuff( "player", iIterator ) ) do EmFor@0: debuffTexture, debuffApplications = UnitDebuff(unitName, debuffIndex); EmFor@0: CP_ProfHidden:SetUnitDebuff( "player", iIterator-1 ); EmFor@0: EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Debuffs"][iIterator] = {}; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Debuffs"][iIterator]["Tooltip"] = CP_Tooltipscan(); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Debuffs"][iIterator]["Texture"] = debuffTexture; EmFor@0: iIterator = iIterator + 1 EmFor@0: end EmFor@0: ]]-- EmFor@0: end EmFor@0: EmFor@0: function Profile_GetSkills() EmFor@0: -- Reset/Initialize EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Skills"] = {}; EmFor@0: local skillheader = ''; EmFor@0: local skillinfo = nil; EmFor@0: local rank, maxRank = 0; EmFor@0: local order = 1; -- order in which the headers appear EmFor@0: for i=1, GetNumSkillLines(), 1 do EmFor@0: skillinfo = fixnilempty(GetSkillLineInfo(i)); EmFor@0: rank = skillinfo[4]; EmFor@0: maxRank = skillinfo[7]; EmFor@0: if(skillinfo[2] == 1) then -- if it is a header EmFor@0: skillheader = skillinfo[1]; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Skills"][skillheader] = { }; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Skills"][skillheader]["Order"] = order; EmFor@0: order = order + 1; EmFor@0: else EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Skills"][skillheader][skillinfo[1]] = rank .. ":" .. maxRank; EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: EmFor@0: EmFor@0: --------------------------------------------- EmFor@0: -- Process Inventory EmFor@0: --------------------------------------------- EmFor@0: EmFor@0: function Profile_UpdateInventory() EmFor@0: local link; EmFor@0: local texture; EmFor@0: EmFor@0: -- Reset/Initialize EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Equipment"] = {}; EmFor@0: EmFor@0: for index,slot in Profile_slots do EmFor@0: link = GetInventoryItemLink("player", index); EmFor@0: texture = GetInventoryItemTexture("player", index); EmFor@0: if( link ) then EmFor@0: for color, item, name in string.gfind(link, "|c(%x+)|Hitem:(%d+:%d+:%d+:%d+)|h%[(.-)%]|h|r") do EmFor@0: if( color ~= nil and item ~= nil and name ~= nil ) then EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Equipment"][slot] = { }; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Equipment"][slot]["Texture"] = texture; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Equipment"][slot]["Color"] = color; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Equipment"][slot]["Item"] = item; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Equipment"][slot]["Name"] = name; EmFor@0: -- Build Tooltip EmFor@0: --CP_ProfHidden:SetHyperlink("item:" .. item); EmFor@0: CP_ProfHidden:SetInventoryItem("player", index); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Equipment"][slot]["Tooltip"] = CP_Tooltipscan(); EmFor@0: EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: EmFor@0: function Profile_ScanInventory() EmFor@0: local bag, bagname, link, texture, color, item, strings, str; EmFor@0: EmFor@0: -- Reset/Initialize EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"] = {} EmFor@0: EmFor@0: for bag = 0,4 do EmFor@0: if (bag == 0) then EmFor@0: bagname = "Backpack"; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag] = { }; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Name"] = "Backpack"; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Item"] = "Backpack"; EmFor@0: if ( myCPProfile_HTML_Tooltips ) then EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Tooltip"] = "Backpack"; EmFor@0: else EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Tooltip"] = {}; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Tooltip"][1] = "Backpack"; EmFor@0: end EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Color"] = "ffffffff"; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Slots"] = 16; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Texture"] = "Interface\\Buttons\\Button-Backpack-Up"; EmFor@0: ProcessBagItems(bag, bagname); EmFor@0: else EmFor@0: link = GetInventoryItemLink("player", (bag+19)); EmFor@0: texture = GetInventoryItemTexture("player", (bag+19)); EmFor@0: if( link ) then EmFor@0: for color, item, bagname in string.gfind(link, "|c(%x+)|Hitem:(%d+:%d+:%d+:%d+)|h%[(.-)%]|h|r") do EmFor@0: if( color ~= nil and item ~= nil and bagname ~= nil ) then EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag] = { }; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Item"] = item; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Color"] = color; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Texture"] = texture; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Name"] = bagname; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Slots"] = GetContainerNumSlots(bag); EmFor@0: CP_ProfHidden:SetInventoryItem("player", (bag+19)) EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Tooltip"] = CP_Tooltipscan(); EmFor@0: ProcessBagItems(bag); EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: EmFor@0: function ProcessBagItems(bag) EmFor@0: local slot, strings, str, texture, itemCount, locked, quality, link, color, item, name; EmFor@0: EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Contents"] = {}; EmFor@0: EmFor@0: for slot = 1,GetContainerNumSlots(bag) do -- loop through all slots in this bag and get items EmFor@0: EmFor@0: CP_ProfHidden:SetBagItem(bag, slot); EmFor@0: EmFor@0: texture, itemCount, locked, quality = GetContainerItemInfo(bag,slot); EmFor@0: link = GetContainerItemLink(bag, slot); EmFor@0: if( link ) then EmFor@0: for color, item, name in string.gfind(link, "|c(%x+)|Hitem:(%d+:%d+:%d+:%d+)|h%[(.-)%]|h|r") do EmFor@0: if( color ~= nil and item ~= nil and name ~= nil ) then EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Contents"][slot] = {}; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Contents"][slot]["Tooltip"] = CP_Tooltipscan(); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Contents"][slot]["Texture"] = texture; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Contents"][slot]["Quantity"] = itemCount; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Contents"][slot]["Name"] = name; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Contents"][slot]["Color"] = color; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Inventory"]["Bag" .. bag]["Contents"][slot]["Item"] = item; EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: EmFor@0: EmFor@0: -- From CosmosCommonFunctions.lua EmFor@0: -- Clears a tooltip for usage. EmFor@0: function ClearTooltip(TooltipNameBase) EmFor@0: for i=1, 15, 1 do EmFor@0: getglobal(TooltipNameBase.."TextLeft"..i):SetText(""); EmFor@0: getglobal(TooltipNameBase.."TextRight"..i):SetText(""); EmFor@0: end EmFor@0: end EmFor@0: EmFor@0: EmFor@0: function Profile_ScanBank() EmFor@0: -- Borrowed from Telo's LootLink and restructured to fit my data EmFor@0: local oldBank = nil; EmFor@0: if (CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]) then EmFor@0: oldBank = CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]; EmFor@0: end EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"] = {} EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Contents"] = {} EmFor@0: EmFor@0: local bag, size, slot, link; EmFor@0: EmFor@0: -- First the bank container itself EmFor@0: size = GetContainerNumSlots(BANK_CONTAINER); EmFor@0: for slot = size, 1, -1 do EmFor@0: link = GetContainerItemLink(BANK_CONTAINER, slot); EmFor@0: local texture, itemCount, locked = GetContainerItemInfo(BANK_CONTAINER, slot); EmFor@0: if( link ) then EmFor@0: for color, item, name in string.gfind(link, "|c(%x+)|Hitem:(%d+:%d+:%d+:%d+)|h%[(.-)%]|h|r") do EmFor@0: if( color ~= nil and item ~= nil and name ~= nil ) then EmFor@0: oldBank = nil; -- When we find items, remove the oldBank variable EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Contents"][slot] = {}; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Contents"][slot]["Texture"] = texture; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Contents"][slot]["Quantity"] = itemCount; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Contents"][slot]["Name"] = name; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Contents"][slot]["Color"] = color; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Contents"][slot]["Item"] = item; EmFor@0: CP_ProfHidden:SetHyperlink("item:" .. item); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Contents"][slot]["Tooltip"] = CP_Tooltipscan(); EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: EmFor@0: -- Now the bank bags EmFor@0: for bag = 5, 10 do EmFor@0: link = GetContainerItemLink(BANK_CONTAINER, (bag+20)); EmFor@0: texture, itemCount, locked, quality = GetContainerItemInfo(BANK_CONTAINER, (bag+20)); EmFor@0: if( link ) then EmFor@0: for color, item, bagname in string.gfind(link, "|c(%x+)|Hitem:(%d+:%d+:%d+:%d+)|h%[(.-)%]|h|r") do EmFor@0: if( color ~= nil and item ~= nil and bagname ~= nil ) then EmFor@0: oldBank = nil; -- When we find items, remove the oldBank variable EmFor@0: bagnum = bag-4; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum] = {}; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Name"] = bagname; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Slots"] = GetContainerNumSlots(bag); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Texture"] = texture; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Color"] = color; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Item"] = item; EmFor@0: CP_ProfHidden:SetHyperlink("item:" .. item); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Tooltip"] = CP_Tooltipscan(); EmFor@0: EmFor@0: ProcessBankBagItems(bag, bagnum); EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: EmFor@0: if ( oldBank ) then EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"] = oldBank; EmFor@0: end EmFor@0: end EmFor@0: EmFor@0: function ProcessBankBagItems(bag, bagnum) EmFor@0: EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Contents"] = {}; EmFor@0: EmFor@0: for slot = 1,GetContainerNumSlots(bag) do -- loop through all slots in this bag and get items EmFor@0: -- CP_ProfHidden:SetBagItem(bag, slot); EmFor@0: texture, itemCount, locked, quality = GetContainerItemInfo(bag,slot); EmFor@0: link = GetContainerItemLink(bag, slot); EmFor@0: if( link ) then EmFor@0: for color, item, name in string.gfind(link, "|c(%x+)|Hitem:(%d+:%d+:%d+:%d+)|h%[(.-)%]|h|r") do EmFor@0: if( color ~= nil and item ~= nil and name ~= nil ) then EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Contents"][slot] = {}; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Contents"][slot]["Texture"] = texture; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Contents"][slot]["Quantity"] = itemCount; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Contents"][slot]["Name"] = name; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Contents"][slot]["Color"] = color; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Contents"][slot]["Item"] = item; EmFor@0: CP_ProfHidden:SetBagItem(bag, slot); EmFor@0: -- CP_ProfHidden:SetHyperlink("item:" .. item); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Bank"]["Bag" .. bagnum]["Contents"][slot]["Tooltip"] = CP_Tooltipscan(); EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: EmFor@0: EmFor@0: function Profile_ScanTradeSkill() EmFor@0: local skillLineName, skillLineRank, skillLineMaxRank = GetTradeSkillLine(); EmFor@0: EmFor@0: if( (not skillLineName) or (skillLineName == "") or (skillLineName == "UNKNOWN")) then EmFor@0: return; EmFor@0: end EmFor@0: -- we don't bother saving the following tradeskills EmFor@0: if( (skillLineName == "Fishing") or (skillLineName == "Mining") or (skillLineName == "Herbalism") or (skillLineName == "Skinning") ) then EmFor@0: return; EmFor@0: end EmFor@0: EmFor@0: if ( not CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"] ) then EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"] = {}; EmFor@0: end EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName] = {}; EmFor@0: EmFor@0: -- expand the tree so we can see all the recipes EmFor@0: ExpandTradeSkillSubClass(0); EmFor@0: EmFor@0: -- get the number of recipes and loop through each one EmFor@0: local numTradeSkills = GetNumTradeSkills(); EmFor@0: local skillHeader = skillLineName; EmFor@0: for itemIndex=1, numTradeSkills, 1 do EmFor@0: if( itemIndex == nil or skillLineName==nil or skillHeader==nil ) then EmFor@0: return; EmFor@0: end EmFor@0: local skillText = ""; EmFor@0: local skillName, skillDifficulty, numAvailable, isExpanded = GetTradeSkillInfo(itemIndex); EmFor@0: if( skillDifficulty ~= "header" and skillLineName ~= nil and skillLineName ~= "" and skillHeader ~= nil and skillHeader ~= "" and skillName ~= nil and skillName ~= "" ) then EmFor@0: if( not CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader] ) then EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader] = {}; EmFor@0: end EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader][skillName] = {}; EmFor@0: local skillIcon = GetTradeSkillIcon(itemIndex); EmFor@0: if( not skillIcon ) then EmFor@0: skillIcon = ""; EmFor@0: end EmFor@0: EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader][skillName]["Texture"] = skillIcon; EmFor@0: EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader][skillName]["Difficulty"] = TradeSkillDifficultyCode[skillDifficulty]; EmFor@0: EmFor@0: CP_ProfHidden:SetTradeSkillItem(itemIndex); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader][skillName]["Tooltip"] = CP_Tooltipscan(); EmFor@0: EmFor@0: EmFor@0: EmFor@0: local numReagents = GetTradeSkillNumReagents(itemIndex); EmFor@0: local reagents = ''; EmFor@0: for reagentIndex=1, numReagents, 1 do EmFor@0: local reagentName, reagentTexture, reagentCount, playerReagentCount = GetTradeSkillReagentInfo(itemIndex, reagentIndex); EmFor@0: if( not reagentTexture ) then EmFor@0: reagentTexture = ""; EmFor@0: end EmFor@0: if( not reagentName ) then EmFor@0: reagentName = "Unknown"; EmFor@0: end EmFor@0: EmFor@0: if (reagentIndex == numReagents) then EmFor@0: reagents = reagents .. reagentName .. " x" .. reagentCount; EmFor@0: else EmFor@0: reagents = reagents .. reagentName .. " x" .. reagentCount .. "
"; EmFor@0: end EmFor@0: end EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader][skillName]["Reagents"] = reagents; EmFor@0: else EmFor@0: skillHeader = skillName; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader] = {}; EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: EmFor@0: -- is this ever called?! EmFor@0: function Profile_ScanCraft() EmFor@0: local skillLineName, skillLineRank, skillLineMaxRank = GetCraftDisplaySkillLine(); EmFor@0: EmFor@0: if( (not skillLineName) or (skillLineName == "") or (skillLineName == "UNKNOWN")) then EmFor@0: return; EmFor@0: end EmFor@0: EmFor@0: if ( not CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"] ) then EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"] = {}; EmFor@0: end EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName] = {}; EmFor@0: EmFor@0: -- expand the tree so we can see all the recipes EmFor@0: -- ExpandCraftSubClass(0); EmFor@0: EmFor@0: -- get the number of recipes and loop through each one EmFor@0: local numCrafts = GetNumCrafts(); EmFor@0: local skillHeader = skillLineName; -- default it, enchanting doesn't have categories? EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader] = {}; EmFor@0: for itemIndex=1, numCrafts, 1 do EmFor@0: local skillText = ""; EmFor@0: local skillName, craftSubSpellName, skillDifficulty, numAvailable, isExpanded = GetCraftInfo(itemIndex); EmFor@0: --Debug(skillName .. ":" .. craftSubSpellName); EmFor@0: if( skillDifficulty ~= "header" and skillLineName and skillLineName ~= "" and skillHeader and skillHeader ~= "" and skillName and skillName ~= "" ) then EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader][skillName] = {}; EmFor@0: local skillIcon = GetCraftIcon(itemIndex); EmFor@0: if( not skillIcon ) then EmFor@0: skillIcon = ""; EmFor@0: end EmFor@0: local description = GetCraftDescription(itemIndex); EmFor@0: if (description == nil) then EmFor@0: description = ""; EmFor@0: end EmFor@0: EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader][skillName]["Texture"] = skillIcon; EmFor@0: EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader][skillName]["Difficulty"] = TradeSkillDifficultyCode[skillDifficulty]; EmFor@0: EmFor@0: -- CP_ProfHidden:SetCraftItem(itemIndex); EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader][skillName]["Tooltip"] = description; EmFor@0: --Debug(description); EmFor@0: EmFor@0: local numReagents = GetCraftNumReagents(itemIndex); EmFor@0: local reagents = ''; EmFor@0: for reagentIndex=1, numReagents, 1 do EmFor@0: local reagentName, reagentTexture, reagentCount, playerReagentCount = GetCraftReagentInfo(itemIndex, reagentIndex); EmFor@0: if( not reagentTexture ) then EmFor@0: reagentTexture = ""; EmFor@0: end EmFor@0: if( not reagentName ) then EmFor@0: reagentName = "Unknown"; EmFor@0: end EmFor@0: EmFor@0: if (reagentIndex == numReagents) then EmFor@0: reagents = reagents .. reagentName .. " x" .. reagentCount; EmFor@0: else EmFor@0: reagents = reagents .. reagentName .. " x" .. reagentCount .. "
"; EmFor@0: end EmFor@0: end EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader][skillName]["Reagents"] = reagents; EmFor@0: else EmFor@0: local skillHeader = skillName; EmFor@0: CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Professions"][skillLineName][skillHeader] = {}; EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: EmFor@0: EmFor@0: -- Utilities go below EmFor@0: -- From CosmosCommonFunctions.lua EmFor@0: -- Gets all lines out of a tooltip. EmFor@0: EmFor@0: function CP_Tooltipscan() EmFor@0: --CP_ProfHidden:Show(); EmFor@0: EmFor@0: local TooltipNameBase = "CP_ProfHidden"; EmFor@0: local tooltipFrame = getglobal(TooltipNameBase); EmFor@0: local strings = {}; EmFor@0: local htmlstr = nil; EmFor@0: EmFor@0: -- CensusPlus_Msg( "NUM LINES: " .. CP_ProfHidden:NumLines() ); EmFor@0: EmFor@0: for idx = 1, CP_ProfHidden:NumLines() do EmFor@0: local textLeft = nil; EmFor@0: local textRight = nil; EmFor@0: ttext = getglobal(TooltipNameBase.."TextLeft"..idx); EmFor@0: EmFor@0: if(ttext and ttext:IsVisible() and ttext:GetText() ~= nil) then EmFor@0: textLeft = ttext:GetText(); EmFor@0: end EmFor@0: EmFor@0: --if( textLeft ~= nil ) then EmFor@0: -- CensusPlus_Msg( "LEFT TEXT: " .. textLeft ); EmFor@0: --end EmFor@0: EmFor@0: ttext = getglobal(TooltipNameBase.."TextRight"..idx); EmFor@0: if(ttext and ttext:IsVisible() and ttext:GetText() ~= nil) then EmFor@0: textRight = ttext:GetText(); EmFor@0: end EmFor@0: --if( textRight ~= nil ) then EmFor@0: -- CensusPlus_Msg( "RIGHT TEXT: " .. textRight ); EmFor@0: --end EmFor@0: EmFor@0: if (textLeft or textRight) then EmFor@0: if ( textRight) then EmFor@0: textRight = "\t"..textRight; EmFor@0: else EmFor@0: textRight = ""; EmFor@0: end EmFor@0: EmFor@0: if ( htmlstr ~= nil ) then EmFor@0: htmlstr = htmlstr .. "
" .. textLeft .. textRight; EmFor@0: else EmFor@0: htmlstr = textLeft .. textRight; EmFor@0: end EmFor@0: end EmFor@0: end EmFor@0: EmFor@0: -- CP_ProfHidden:ClearLines(); EmFor@0: -- ClearTooltip( "CP_ProfHidden" ); EmFor@0: EmFor@0: return htmlstr; EmFor@0: end EmFor@0: EmFor@0: function round(x) EmFor@0: if(x - math.floor(x) > 0.5) then EmFor@0: x = x + 0.5; EmFor@0: end EmFor@0: return math.floor(x); EmFor@0: end EmFor@0: EmFor@0: if (not fixnilempty) then EmFor@0: fixnilempty = function(...) EmFor@0: for i=1, arg.n, 1 do EmFor@0: if(not arg[i]) then EmFor@0: arg[i] = ""; EmFor@0: end EmFor@0: end EmFor@0: return arg; EmFor@0: end EmFor@0: end EmFor@0: EmFor@0: