BossPanel_ItemBonuses = BossPanelPlugin:new({ name = BossPanel_ItemBonusesLocals.Title, description = BossPanel_ItemBonusesLocals.Desc, version = "0.1.3", releaseDate = "03-20-2006", author = "Prandur", website = "http://prandur.wowinterface.com", aceCompatible = "103", bpCompatible = "0.4.23", category = "inventory", db = AceDatabase:new("BossPanel_ItemBonusesDB"), defaults = DEFAULT_OPTIONS, cmd = AceChatCmd:new(BossPanel_ItemBonusesLocals.Cmd, BossPanel_ItemBonusesLocals.Cmd_Opt), loc = BossPanel_ItemBonusesLocals, hasIcon = "Interface\\Icons\\Spell_Nature_EnchantArmor.blp", canHideText = TRUE, ItemBonuses_colors = { X = 'FFD200', -- attributes Y = '20FF20', -- skills M = 'FFFFFF', -- melee R = '00C0C0', -- ranged C = 'FFFF00', -- spells A = 'FF60FF', -- arcane I = 'FF3600', -- fire F = '00C0FF', -- frost H = 'FFA400', -- holy N = '00FF60', -- nature S = 'AA12AC', -- shadow L = '20FF20', -- life P = '6060FF', -- mana }, ITEMBONUSES_EFFECTS = { { effect = "STR", format = "+%d", short = "STR", color = "X", cat = "ATT" }, { effect = "AGI", format = "+%d", short = "AGI", color = "X", cat = "ATT" }, { effect = "STA", format = "+%d", short = "STA", color = "X", cat = "ATT" }, { effect = "INT", format = "+%d", short = "INT", color = "X", cat = "ATT" }, { effect = "SPI", format = "+%d", short = "SPI", color = "X", cat = "ATT" }, { effect = "ARMOR", format = "+%d", short = "ARM", color = "X", cat = "ATT" }, { effect = "ARCANERES", format = "+%d", short = "R", color = "A", cat = "RES" }, { effect = "FIRERES", format = "+%d", short = "R", color = "I", cat = "RES" }, { effect = "NATURERES", format = "+%d", short = "R", color = "N", cat = "RES" }, { effect = "FROSTRES", format = "+%d", short = "R", color = "F", cat = "RES" }, { effect = "SHADOWRES", format = "+%d", short = "R", color = "S", cat = "RES" }, { effect = "DEFENSE", format = "+%d", short = "DEF", color = "Y", cat = "SKILL" }, { effect = "MINING", format = "+%d", short = "MIN", color = "Y", cat = "SKILL" }, { effect = "HERBALISM", format = "+%d", short = "HER", color = "Y", cat = "SKILL" }, { effect = "SKINNING", format = "+%d", short = "SKI", color = "Y", cat = "SKILL" }, { effect = "FISHING", format = "+%d", short = "FIS", color = "Y", cat = "SKILL" }, { effect = "ATTACKPOWER", format = "+%d", short = "A", color = "M", cat = "BON" }, { effect = "CRIT", format = "+%d%%", short = "C", color = "M", cat = "BON" }, { effect = "BLOCK", format = "+%d%%", short = "B", color = "M", cat = "BON" }, { effect = "DODGE", format = "+%d%%", short = "D", color = "M", cat = "BON" }, { effect = "PARRY", format = "+%d%%", short = "P", color = "M", cat = "BON" }, { effect = "TOHIT", format = "+%d%%", short = "H", color = "M", cat = "BON" }, { effect = "RANGEDATTACKPOWER", format = "+%d", short = "A", color = "R", cat = "BON" }, { effect = "RANGEDCRIT", format = "+%d%%", short = "C", color = "R", cat = "BON" }, { effect = "DMG", format = "+%d", short = "D", color = "C", cat = "SBON" }, { effect = "HEAL", format = "+%d", short = "H", color = "C", cat = "SBON"}, { effect = "HOLYCRIT", format = "+%d%%", short = "HC", color = "C", cat = "SBON" }, { effect = "SPELLCRIT", format = "+%d%%", short = "SC", color = "C", cat = "SBON" }, { effect = "SPELLTOHIT", format = "+%d%%", short = "SH", color = "C", cat = "SBON" }, { effect = "ARCANEDMG", format = "+%d", short = "D", color = "A", cat = "SBON" }, { effect = "FIREDMG", format = "+%d", short = "D", color = "I", cat = "SBON" }, { effect = "FROSTDMG", format = "+%d", short = "D", color = "F", cat = "SBON" }, { effect = "HOLYDMG", format = "+%d", short = "D", color = "H", cat = "SBON" }, { effect = "NATUREDMG", format = "+%d", short = "D", color = "N", cat = "SBON" }, { effect = "SHADOWDMG", format = "+%d", short = "D", color = "S", cat = "SBON" }, { effect = "HEALTH", format = "+%d", short = "P", color = "L", cat = "OBON" }, { effect = "HEALTHREG", format = "%d HP/5s", short = "R", color = "L", cat = "OBON" }, { effect = "MANA", format = "+%d", short = "P", color = "P", cat = "OBON" }, { effect = "MANAREG", format = "%d MP/5s", short = "R", color = "P", cat = "OBON" }, }, ITEMBONUSES_CATEGORIES = {'ATT', 'BON', 'SBON', 'RES', 'SKILL', 'OBON'}, }) function BossPanel_ItemBonuses:Enable() self:Hook("BonusScanner_Update", "Update") end function BossPanel_ItemBonuses:Disable() end function BossPanel_ItemBonuses:Report() end function BossPanel_ItemBonuses:UpdateData() local check for i,e in self.ITEMBONUSES_EFFECTS do if self.data[e.effect] then check = TRUE end end if not check then self.data.display_none = TRUE end end function BossPanel_ItemBonuses:UpdateText() if self.data.display_none then if self.data.short_display then self:SetText(self.loc.SHORT_TEXT) else self:SetText(self.loc.TEXT) end else if(not BonusScanner or not BonusScanner.active) then self:SetText(BossPanelUtils.Red(self.loc.BONUSSCANNER_MISSING)) else local text = "" for i,e in self.ITEMBONUSES_EFFECTS do if self.data[e.effect] then text = text .. self:GetBonusText(e, FALSE) end end self:SetText(text) end end end function BossPanel_ItemBonuses:UpdateTooltip() if (not BonusScanner or not BonusScanner.active) then BossPanelTooltip:AddLine(nil, BossPanelUtils.Red(self.loc.BONUSSCANNER_MISSING)) else local cat,val = "","" for i,e in self.ITEMBONUSES_EFFECTS do if(BonusScanner.bonuses[e.effect]) then if(e.format) then val = format(e.format,BonusScanner.bonuses[e.effect]) else val = BonusScanner.bonuses[e.effect] end if(e.cat ~= cat) then cat = e.cat BossPanelTooltip:AddCategory(cat, BossPanelUtils.Green(self.loc.CAT[cat] .. ":")) end BossPanelTooltip:AddDoubleLine(cat, BONUSSCANNER_NAMES[e.effect], BossPanelUtils.White(val)) end end end end function BossPanel_ItemBonuses:MenuSettings(level, value) if level == 1 then UIDropDownMenu_AddButton({ text = self.loc.DISPLAY_NONE, func = function() self:ToggleOption("display_none", TRUE) end, checked = self.data.display_none, keepShownOnClick = true, }) for i,e in self.ITEMBONUSES_CATEGORIES do local my_e = e UIDropDownMenu_AddButton({ text = self.loc.CAT[my_e], hasArrow = TRUE, value = my_e, }) end BossPanelUtils.AddSpacerDropDownMenu() UIDropDownMenu_AddButton({ text = self.loc.SHORTDISPLAY, func = function() self:ToggleOption("short_display", TRUE) end, checked = self.data.short_display, keepShownOnClick = true, }) UIDropDownMenu_AddButton({ text = self.loc.COLORED, func = function() self:ToggleOption("colored", TRUE) end, checked = self.data.colored, keepShownOnClick = true, }) elseif level == 2 then for i,e in self.ITEMBONUSES_EFFECTS do if(e.cat == value) then local my_e = e UIDropDownMenu_AddButton({ text = self:GetBonusText(my_e, TRUE), func = function() self:ToggleOption(my_e.effect, TRUE) end, checked = self.data[my_e.effect], keepShownOnClick = true, }, level) end end end end function BossPanel_ItemBonuses:ToggleOption(var, doUpdate) if self.data[var] then self.data[var] = nil else self.data[var] = true end if doUpdate then self:Update() end end function BossPanel_ItemBonuses:GetBonusText(EffectTable, forMenu) local text = "" local val = "" if(BonusScanner.bonuses[EffectTable.effect]) then val = format(EffectTable.format, BonusScanner.bonuses[EffectTable.effect]) end if forMenu then text = text .. "[" .. BossPanelUtils.Colorize(self.ItemBonuses_colors[EffectTable.color], EffectTable.short) .. "] " .. BONUSSCANNER_NAMES[EffectTable.effect] else if self.data.short_display then text = text .. BossPanelUtils.Colorize(self.ItemBonuses_colors[EffectTable.color], EffectTable.short) else text = text .. BossPanelUtils.Colorize(self.ItemBonuses_colors[EffectTable.color], BONUSSCANNER_NAMES[EffectTable.effect]) end end if val == "" then if not forMenu then val = format(EffectTable.format, 0) else return text end end if self.data.colored then val = BossPanelUtils.Colorize(self.ItemBonuses_colors[EffectTable.color], val) else val = BossPanelUtils.White(val) end if forMenu then text = text .. " (" .. val .. ")" else text = " " .. text .. val end return text end BossPanel_ItemBonuses:RegisterForLoad()