From 3e32e4a4814fda752cc7cad5a7f5db19595ae66d Mon Sep 17 00:00:00 2001 From: Parnic Date: Sat, 25 Aug 2012 20:07:32 +0000 Subject: [PATCH] - Added support for ClassPowerCounters to only show up for specific talent specs. - Added Priest Shadow Orbs module. --- IceHUD.toc | 1 + modules/ClassPowerCounter.lua | 24 ++++++++++- modules/ShadowOrbs.lua | 79 +++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 modules/ShadowOrbs.lua diff --git a/IceHUD.toc b/IceHUD.toc index 66ba386..d14dd1e 100644 --- a/IceHUD.toc +++ b/IceHUD.toc @@ -81,6 +81,7 @@ modules\Vengeance.lua modules\PlayerAlternatePower.lua modules\HarmonyPower.lua modules\MonkManaBar.lua +modules\ShadowOrbs.lua #@do-not-package@ IceHUD_Options\Options.lua diff --git a/modules/ClassPowerCounter.lua b/modules/ClassPowerCounter.lua index f06235e..a05a115 100644 --- a/modules/ClassPowerCounter.lua +++ b/modules/ClassPowerCounter.lua @@ -14,6 +14,7 @@ IceClassPowerCounter.prototype.minLevel = 9 IceClassPowerCounter.prototype.DesiredAnimDuration = 0.6 IceClassPowerCounter.prototype.DesiredScaleMod = .4 IceClassPowerCounter.prototype.DesiredAnimPause = 0.5 +IceClassPowerCounter.prototype.requiredSpec = nil -- Constructor -- function IceClassPowerCounter.prototype:init(name) @@ -371,15 +372,36 @@ end function IceClassPowerCounter.prototype:CheckValidLevel(event, level) if not level then - return + if event == "PLAYER_TALENT_UPDATE" then + level = UnitLevel("player") + else + return + end end if level < self.minLevel then self:RegisterEvent("PLAYER_LEVEL_UP", "CheckValidLevel") self:Show(false) else + self:CheckValidSpec() + end +end + +function IceClassPowerCounter.prototype:CheckValidSpec() + if self.requiredSpec == nil then self:DisplayCounter() self:Show(true) + return + end + + self:RegisterEvent("PLAYER_TALENT_UPDATE", "CheckValidLevel") + + local spec = GetSpecialization() + if spec == self.requiredSpec then + self:DisplayCounter() + self:Show(true) + else + self:Show(false) end end diff --git a/modules/ShadowOrbs.lua b/modules/ShadowOrbs.lua new file mode 100644 index 0000000..7c16375 --- /dev/null +++ b/modules/ShadowOrbs.lua @@ -0,0 +1,79 @@ +local L = LibStub("AceLocale-3.0"):GetLocale("IceHUD", false) +local ShadowOrbs = IceCore_CreateClass(IceClassPowerCounter) + +function ShadowOrbs.prototype:init() + ShadowOrbs.super.prototype.init(self, "ShadowOrbs") + + self:SetDefaultColor("ShadowOrbsNumeric", 218, 231, 31) + + -- pulled from PriestBar.xml in Blizzard's UI source + self.runeCoords = + { + {0.45703125, 0.60546875, 0.44531250, 0.73437500}, + {0.45703125, 0.60546875, 0.44531250, 0.73437500}, + {0.45703125, 0.60546875, 0.44531250, 0.73437500}, + } + self.numericColor = "ShadowOrbsNumeric" + self.unitPower = SPELL_POWER_SHADOW_ORBS + self.minLevel = SHADOW_ORBS_SHOW_LEVEL + self.bTreatEmptyAsFull = true + self.unit = "player" + self.numConsideredFull = PRIEST_BAR_NUM_ORBS + self.runeHeight = 36 + self.runeWidth = 36 + self.requiredSpec = SPEC_PRIEST_SHADOW +end + +function ShadowOrbs.prototype:GetOptions() + local opts = ShadowOrbs.super.prototype.GetOptions(self) + + opts.hideBlizz.desc = L["Hides Blizzard Shadow Orb frame and disables all events related to it.\n\nNOTE: Blizzard attaches the shadow orb UI to the player's unitframe, so if you have that hidden in PlayerHealth, then this won't do anything."] + + return opts +end + +function ShadowOrbs.prototype:GetRuneTexture(rune) + if not rune or rune ~= tonumber(rune) then + return + end + return "Interface\\PlayerFrame\\Priest-ShadowUI" +end + +function ShadowOrbs.prototype:ShowBlizz() + PriestBarFrame:Show() + + PriestBarFrame:GetScript("OnLoad")(PriestBarFrame) +end + +function ShadowOrbs.prototype:HideBlizz() + PriestBarFrame:Hide() + + PriestBarFrame:UnregisterAllEvents() +end + +function ShadowOrbs.prototype:UpdateRunePower() + local numRunes = UnitPowerMax(self.unit, self.unitPower) + + if self.fakeNumRunes ~= nil and self.fakeNumRunes > 0 then + numRunes = self.fakeNumRunes + end + + if numRunes ~= self.numRunes then + if numRunes < self.numRunes and #self.frame.graphical >= numRunes then + for i=numRunes + 1, #self.frame.graphical do + self.frame.graphical[i]:Hide() + end + end + self.numRunes = numRunes + + self:CreateRuneFrame() + end + ShadowOrbs.super.prototype.UpdateRunePower(self) +end + +-- Load us up +local _, unitClass = UnitClass("player") +if (unitClass == "PRIEST" and IceHUD.WowVer >= 50000) then + IceHUD.ShadowOrbs = ShadowOrbs:new() +end +