From 0b25b48304c28fe32e2430152033cdf17c525e10 Mon Sep 17 00:00:00 2001 From: Parnic Date: Sun, 3 Aug 2008 05:30:32 +0000 Subject: [PATCH] - added a workaround for DK runic power (and probably all power types) not updating after the new "predicted power" stuff that was added in the beta. specifically, UNIT_RUNIC_POWER doesn't fire any more with the predicted power system since it's supposed to build up slowly. this caused the runic power bar to never get updated as it degenerated. copied the "working" version from blizzard's UnitFrame.lua code (see UnitFrameManaBar_Initialize) - fixed a lua error that was popping up every time the player mounted as a DK (why the crap do rune events fire for the non-existent rune 7 and 8 when you mount?!) --- modules/PlayerMana.lua | 15 ++++++++++----- modules/Runes.lua | 8 ++++++-- modules/TargetMana.lua | 7 ++++++- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/modules/PlayerMana.lua b/modules/PlayerMana.lua index 00cc42b..b3821a1 100644 --- a/modules/PlayerMana.lua +++ b/modules/PlayerMana.lua @@ -96,7 +96,7 @@ end function PlayerMana.prototype:Enable(core) PlayerMana.super.prototype.Enable(self, core) - + self:CreateTickerFrame() self:RegisterEvent("UNIT_MANA", "Update") @@ -107,9 +107,14 @@ function PlayerMana.prototype:Enable(core) self:RegisterEvent("UNIT_MAXENERGY", "Update") -- DK rune stuff if IceHUD.WowVer >= 30000 then - self:RegisterEvent("UNIT_RUNIC_POWER", "Update") + if GetCVarBool("predictedPower") and self.frame then + self.frame:SetScript("OnUpdate", function() self:Update(self.unit) end) + else + self:RegisterEvent("UNIT_RUNIC_POWER", "Update") + end + self:RegisterEvent("UNIT_MAXRUNIC_POWER", "Update") end - + self:RegisterEvent("UNIT_DISPLAYPOWER", "ManaType") self:ManaType(self.unit) @@ -140,9 +145,9 @@ function PlayerMana.prototype:ManaType(unit) if (unit ~= self.unit) then return end - + self.manaType = UnitPowerType(self.unit) - + -- register ticker for rogue energy if (self.moduleSettings.tickerEnabled and (self.manaType == 3) and self.alive) then self.tickerFrame:Show() diff --git a/modules/Runes.lua b/modules/Runes.lua index 8d7c9d5..b5fd77c 100644 --- a/modules/Runes.lua +++ b/modules/Runes.lua @@ -154,8 +154,6 @@ function Runes.prototype:Enable(core) self:RegisterEvent("RUNE_POWER_UPDATE", "UpdateRunePower"); self:RegisterEvent("RUNE_TYPE_UPDATE", "UpdateRuneType"); --- not sure what rune_regen_update is for just yet...UpdateRuneRegen doesn't exist as of yet --- self:RegisterEvent("RUNE_REGEN_UPDATE", "UpdateRuneRegen"); if (self.moduleSettings.hideBlizz) then self:HideBlizz() @@ -164,7 +162,13 @@ end -- simply shows/hides the foreground rune when it becomes usable/unusable. this allows the background transparent rune to show only function Runes.prototype:UpdateRunePower(rune, usable) + DEFAULT_CHAT_FRAME:AddMessage("Runes.prototype:UpdateRunePower: rune="..rune.." usable="..(usable and "yes" or "no")); + if not rune or not self.frame.graphical or #self.frame.graphical <= rune then + return + end + -- DEFAULT_CHAT_FRAME:AddMessage("Runes.prototype:UpdateRunePower: rune="..rune.." usable="..(usable and "yes" or "no").." GetRuneType(rune)="..GetRuneType(rune)); + if usable then self.frame.graphical[rune]:Show() else diff --git a/modules/TargetMana.lua b/modules/TargetMana.lua index 3b81fc3..1de549e 100644 --- a/modules/TargetMana.lua +++ b/modules/TargetMana.lua @@ -41,7 +41,12 @@ function TargetMana.prototype:Enable(core) self:RegisterEvent("UNIT_FLAGS", "Update") -- DK rune stuff if IceHUD.WowVer >= 30000 then - self:RegisterEvent("UNIT_RUNIC_POWER", "Update") + if GetCVarBool("predictedPower") and self.frame then + self.frame:SetScript("OnUpdate", function() self:Update(self.unit) end) + else + self:RegisterEvent("UNIT_RUNIC_POWER", "Update") + end + self:RegisterEvent("UNIT_MAXRUNIC_POWER", "Update") end self:Update("target")