diff --git a/modules/ClassPowerCounter.lua b/modules/ClassPowerCounter.lua index 25c7ce4..3929e63 100644 --- a/modules/ClassPowerCounter.lua +++ b/modules/ClassPowerCounter.lua @@ -147,7 +147,7 @@ function IceClassPowerCounter.prototype:GetOptions() end, order = 35 } - + opts["inactiveDisplayMode"] = { type = 'select', name = 'Inactive mode', @@ -216,7 +216,7 @@ end -- OVERRIDE function IceClassPowerCounter.prototype:Redraw() IceClassPowerCounter.super.prototype.Redraw(self) - + self:CreateFrame() end @@ -234,6 +234,14 @@ function IceClassPowerCounter.prototype:Enable(core) end end +function IceClassPowerCounter.prototype:Disable(core) + IceClassPowerCounter.super.prototype.Disable(self, core) + + if self.moduleSettings.hideBlizz then + self:ShowBlizz() + end +end + function IceClassPowerCounter.prototype:UpdateRunePower() local numReady = UnitPower("player", self.unitPower) @@ -294,7 +302,7 @@ function IceClassPowerCounter.prototype:CreateFrame() self.frame:SetPoint("TOP", self.parent, "BOTTOM", self.moduleSettings.hpos, self.moduleSettings.vpos) self:CreateRuneFrame() - + self:SetDisplayMode() end diff --git a/modules/FocusHealth.lua b/modules/FocusHealth.lua index 1f1e01f..c3c9a57 100644 --- a/modules/FocusHealth.lua +++ b/modules/FocusHealth.lua @@ -313,6 +313,10 @@ end function FocusHealth.prototype:Disable(core) FocusHealth.super.prototype.Disable(self, core) + + if self.moduleSettings.hideBlizz then + self:ShowBlizz() + end end function FocusHealth.prototype:UpdateEvent(event, unit) @@ -445,16 +449,7 @@ end function FocusHealth.prototype:ShowBlizz() FocusFrame:Show() - FocusFrame:RegisterEvent("PLAYER_ENTERING_WORLD"); - FocusFrame:RegisterEvent("PLAYER_FOCUS_CHANGED"); - FocusFrame:RegisterEvent("UNIT_HEALTH"); - FocusFrame:RegisterEvent("UNIT_LEVEL"); - FocusFrame:RegisterEvent("UNIT_FACTION"); - FocusFrame:RegisterEvent("UNIT_CLASSIFICATION_CHANGED"); - FocusFrame:RegisterEvent("UNIT_AURA"); - FocusFrame:RegisterEvent("PLAYER_FLAGS_CHANGED"); - FocusFrame:RegisterEvent("PARTY_MEMBERS_CHANGED"); - FocusFrame:RegisterEvent("RAID_TARGET_UPDATE"); + FocusFrame:GetScript("OnLoad")(FocusFrame) end diff --git a/modules/HolyPower.lua b/modules/HolyPower.lua index ddfcc0b..aa67570 100644 --- a/modules/HolyPower.lua +++ b/modules/HolyPower.lua @@ -37,10 +37,7 @@ end function HolyPower.prototype:ShowBlizz() PaladinPowerBar:Show() - PaladinPowerBar:RegisterEvent("UNIT_POWER"); - PaladinPowerBar:RegisterEvent("PLAYER_ENTERING_WORLD"); - PaladinPowerBar:RegisterEvent("UNIT_DISPLAYPOWER"); - PaladinPowerBar:RegisterEvent("UNIT_AURA"); + PaladinPowerBar:GetScript("OnLoad")(PaladinPowerBar) end function HolyPower.prototype:HideBlizz() diff --git a/modules/PlayerHealth.lua b/modules/PlayerHealth.lua index f8eaabd..a64e809 100644 --- a/modules/PlayerHealth.lua +++ b/modules/PlayerHealth.lua @@ -113,6 +113,14 @@ function PlayerHealth.prototype:Enable(core) --self:Update(self.unit) end +function PlayerHealth.prototype:Disable(core) + PlayerHealth.super.prototype.Disable(self, core) + + if self.moduleSettings.hideBlizz then + self:ShowBlizz() + end +end + function PlayerHealth.prototype:HealComm_HealEvent(event, casterGUID, spellID, spellType, endTime, ...) local bFoundMe = false for i=1, select("#", ...) do @@ -288,7 +296,7 @@ function PlayerHealth.prototype:GetOptions() self:Update() end, disabled = function() - return not self.moduleSettings.enabled or not HealComm + return not (self.moduleSettings.enabled and (IceHUD.WowVer >= 40000 or HealComm)) end, order = 43.6 } @@ -1303,22 +1311,7 @@ end function PlayerHealth.prototype:ShowBlizz() PlayerFrame:Show() - - PlayerFrame:RegisterEvent("UNIT_LEVEL") - PlayerFrame:RegisterEvent("UNIT_COMBAT") - PlayerFrame:RegisterEvent("UNIT_FACTION") - PlayerFrame:RegisterEvent("UNIT_MAXMANA") - PlayerFrame:RegisterEvent("PLAYER_ENTERING_WORLD") - PlayerFrame:RegisterEvent("PLAYER_ENTER_COMBAT") - PlayerFrame:RegisterEvent("PLAYER_LEAVE_COMBAT") - PlayerFrame:RegisterEvent("PLAYER_REGEN_DISABLED") - PlayerFrame:RegisterEvent("PLAYER_REGEN_ENABLED") - PlayerFrame:RegisterEvent("PLAYER_UPDATE_RESTING") - PlayerFrame:RegisterEvent("PARTY_MEMBERS_CHANGED") - PlayerFrame:RegisterEvent("PARTY_LEADER_CHANGED") - PlayerFrame:RegisterEvent("PARTY_LOOT_METHOD_CHANGED") - PlayerFrame:RegisterEvent("RAID_ROSTER_UPDATE") - PlayerFrame:RegisterEvent("PLAYTIME_CHANGED") + PlayerFrame:GetScript("OnLoad")(PlayerFrame) end @@ -1349,18 +1342,20 @@ end function PlayerHealth.prototype:ShowBlizzardParty() -- Both Pitbull 4 and Xperl use these exact code, so we use it too. - for i = 1, 4 do + for i = 1, MAX_PARTY_MEMBERS do local frame = _G["PartyMemberFrame"..i] - frame.Show = nil - frame:GetScript("OnLoad")(frame) - frame:GetScript("OnEvent")(frame, "PARTY_MEMBERS_CHANGED") + if frame then + frame.Show = nil + frame:GetScript("OnLoad")(frame) + frame:GetScript("OnEvent")(frame, "PARTY_MEMBERS_CHANGED") - PartyMemberFrame_UpdateMember(frame) + PartyMemberFrame_UpdateMember(frame) + end end + UIParent:RegisterEvent("RAID_ROSTER_UPDATE") end -UIParent:RegisterEvent("RAID_ROSTER_UPDATE") --function PlayerHealth.prototype:ShowBlizzParty() -- This loop exists because we need to unregister for events in case the party composition changes. -- for i = 1, MAX_PARTY_MEMBERS do diff --git a/modules/PlayerInfo.lua b/modules/PlayerInfo.lua index 936095c..098ba48 100644 --- a/modules/PlayerInfo.lua +++ b/modules/PlayerInfo.lua @@ -45,7 +45,7 @@ function PlayerInfo.prototype:GetOptions() disabled = function() return not self.moduleSettings.enabled end, - order = 41 + order = 33.1, } return opts @@ -116,7 +116,7 @@ function PlayerInfo.prototype:ShowBlizz() BuffFrame:Show() TemporaryEnchantFrame:Show() - BuffFrame:RegisterEvent("UNIT_AURA"); + BuffFrame:GetScript("OnLoad")(BuffFrame) end diff --git a/modules/Runes.lua b/modules/Runes.lua index 21ec170..d705aa7 100644 --- a/modules/Runes.lua +++ b/modules/Runes.lua @@ -184,7 +184,7 @@ end -- OVERRIDE function Runes.prototype:Redraw() Runes.super.prototype.Redraw(self) - + self:CreateFrame() end @@ -202,6 +202,14 @@ function Runes.prototype:Enable(core) end end +function Runes.prototype:Disable(core) + Runes.super.prototype.Disable(self, core) + + if self.moduleSettings.hideBlizz then + self:ShowBlizz() + end +end + function Runes.prototype:ResetRuneAvailability() for i=1, self.numRunes do self:UpdateRunePower(nil, i, true) @@ -381,10 +389,13 @@ end function Runes.prototype:ShowBlizz() RuneFrame:Show() - RuneFrame:RegisterEvent("RUNE_POWER_UPDATE"); - RuneFrame:RegisterEvent("RUNE_TYPE_UPDATE"); - RuneFrame:RegisterEvent("RUNE_REGEN_UPDATE"); - RuneFrame:RegisterEvent("PLAYER_ENTERING_WORLD"); + RuneFrame:GetScript("OnLoad")(RuneFrame) + for i=1, self.numRunes do + local frame = _G["RuneButtonIndividual"..i] + if frame then + frame:GetScript("OnLoad")(frame) + end + end end diff --git a/modules/Shards.lua b/modules/Shards.lua index ad6184b..f233215 100644 --- a/modules/Shards.lua +++ b/modules/Shards.lua @@ -39,9 +39,7 @@ end function ShardCounter.prototype:ShowBlizz() ShardBarFrame:Show() - ShardBarFrame:RegisterEvent("UNIT_POWER"); - ShardBarFrame:RegisterEvent("PLAYER_ENTERING_WORLD"); - ShardBarFrame:RegisterEvent("UNIT_DISPLAYPOWER"); + ShardBarFrame:GetScript("OnLoad")(ShardBarFrame) end function ShardCounter.prototype:HideBlizz() diff --git a/modules/TargetHealth.lua b/modules/TargetHealth.lua index f0a0208..5e28c5f 100644 --- a/modules/TargetHealth.lua +++ b/modules/TargetHealth.lua @@ -549,6 +549,10 @@ function IceTargetHealth.prototype:Disable(core) IceTargetHealth.super.prototype.Disable(self, core) UnregisterUnitWatch(self.frame) + + if self.moduleSettings.hideBlizz then + self:ShowBlizz() + end end @@ -878,19 +882,10 @@ end function IceTargetHealth.prototype:ShowBlizz() TargetFrame:Show() - TargetFrame:RegisterEvent("PLAYER_TARGET_CHANGED") - TargetFrame:RegisterEvent("UNIT_HEALTH") - TargetFrame:RegisterEvent("UNIT_LEVEL") - TargetFrame:RegisterEvent("UNIT_FACTION") - TargetFrame:RegisterEvent("UNIT_CLASSIFICATION_CHANGED") - TargetFrame:RegisterEvent("UNIT_AURA") - TargetFrame:RegisterEvent("PLAYER_FLAGS_CHANGED") - TargetFrame:RegisterEvent("PARTY_MEMBERS_CHANGED") - TargetFrame:RegisterEvent("RAID_TARGET_UPDATE") + TargetFrame:GetScript("OnLoad")(TargetFrame) ComboFrame:Show() - ComboFrame:RegisterEvent("PLAYER_TARGET_CHANGED"); - ComboFrame:RegisterEvent("PLAYER_COMBO_POINTS"); + ComboFrame:GetScript("OnLoad")(ComboFrame) end diff --git a/modules/Totems.lua b/modules/Totems.lua index e5cefda..6c97fed 100644 --- a/modules/Totems.lua +++ b/modules/Totems.lua @@ -124,7 +124,7 @@ function Totems.prototype:GetOptions() end, order = 35 } - +--[[ opts["cooldownMode"] = { type = 'select', name = 'Totem cooldown mode', @@ -142,7 +142,7 @@ function Totems.prototype:GetOptions() end, order = 36 } - +]]-- opts["totemGap"] = { type = 'range', name = 'Totem gap', @@ -187,7 +187,7 @@ end -- OVERRIDE function Totems.prototype:Redraw() Totems.super.prototype.Redraw(self) - + self:CreateFrame() end @@ -198,11 +198,19 @@ function Totems.prototype:Enable(core) self:RegisterEvent("PLAYER_TOTEM_UPDATE", "UpdateTotem"); self:RegisterEvent("PLAYER_ENTERING_WORLD", "ResetTotemAvailability"); - if (self.moduleSettings.hideBlizz) then + if self.moduleSettings.hideBlizz then self:HideBlizz() end end +function Totems.prototype:Disable(core) + Totems.super.prototype.Disable(self, core) + + if self.moduleSettings.hideBlizz then + self:ShowBlizz() + end +end + function Totems.prototype:ResetTotemAvailability() for i=1, self.numTotems do self:UpdateTotem(nil, totem) @@ -220,7 +228,7 @@ function Totems.prototype:UpdateTotem(event, totem, ...) self.frame.graphical[totem].cd:SetCooldown(startTime, duration) self.frame.graphical[totem].cd:Show() self.frame.graphical[totem]:Show() - else + else self.frame.graphical[totem].cd:Hide() self.frame.graphical[totem]:Hide() end @@ -267,8 +275,7 @@ end function Totems.prototype:ShowBlizz() TotemFrame:Show() - TotemFrame:RegisterEvent("PLAYER_TOTEM_UPDATE"); - TotemFrame:RegisterEvent("PLAYER_ENTERING_WORLD"); + TotemFrame:GetScript("OnLoad")(TotemFrame) end @@ -327,7 +334,7 @@ function Totems.prototype:CreateTotem(i, name) self.frame.graphical[i]:SetPoint("TOPLEFT", 0, -1 * ((i-1) * (self.totemSize-(MAX_TOTEMS - 1)) + (i-1) + ((i-1) * self.moduleSettings.totemGap))) end - + self.frame.graphical[i].cd:SetFrameStrata("BACKGROUND") self.frame.graphical[i].cd:SetFrameLevel(self.frame.graphical[i]:GetFrameLevel()+1) @@ -338,7 +345,7 @@ function Totems.prototype:CreateTotem(i, name) self.frame.graphical[i].cd:Show() self.frame.graphical[i]:Show() end - + self.frame.graphical[i].shine:SetTexture("Interface\\ComboFrame\\ComboPoint") self.frame.graphical[i].shine:SetBlendMode("ADD") self.frame.graphical[i].shine:SetTexCoord(0.5625, 1, 0, 1) @@ -347,7 +354,7 @@ function Totems.prototype:CreateTotem(i, name) self.frame.graphical[i].shine:SetWidth(self.totemSize + 25) self.frame.graphical[i].shine:SetHeight(self.totemSize + 10) self.frame.graphical[i].shine:Hide() - + self.frame.graphical[i]:EnableMouse(true) self.frame.graphical[i].slot = i; self.frame.graphical[i]:SetScript("OnEnter", function(button) GameTooltip:SetOwner(button); GameTooltip:SetTotem(button.slot) end)