From 0734ddd94c331bcf1ecb2b77b75ecc85576be17b Mon Sep 17 00:00:00 2001 From: Parnic Date: Sat, 30 Jun 2012 22:30:54 +0000 Subject: [PATCH] - Created Monk Harmony Power module. - Added localization to HolyPower module description. - Fixed a comment in the Shard module. --- IceHUD.toc | 1 + modules/HarmonyPower.lua | 84 ++++++++++++++++++++++++++++++++++++++++ modules/HolyPower.lua | 2 +- modules/Shards.lua | 2 +- 4 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 modules/HarmonyPower.lua diff --git a/IceHUD.toc b/IceHUD.toc index 4bad8c0..3812cfa 100644 --- a/IceHUD.toc +++ b/IceHUD.toc @@ -79,6 +79,7 @@ modules\Shards.lua modules\EclipseBar.lua modules\Vengeance.lua modules\PlayerAlternatePower.lua +modules\HarmonyPower.lua #@do-not-package@ IceHUD_Options\Options.lua diff --git a/modules/HarmonyPower.lua b/modules/HarmonyPower.lua new file mode 100644 index 0000000..967daf6 --- /dev/null +++ b/modules/HarmonyPower.lua @@ -0,0 +1,84 @@ +local L = LibStub("AceLocale-3.0"):GetLocale("IceHUD", false) +local HarmonyPower = IceCore_CreateClass(IceClassPowerCounter) + +function HarmonyPower.prototype:init() + HarmonyPower.super.prototype.init(self, "HarmonyPower") + + self:SetDefaultColor("HarmonyPowerNumeric", 218, 231, 31) + + -- pulled from MonkHarmonyBar.xml in Blizzard's UI source + self.runeCoords = + { + {0.00390625, 0.08593750, 0.71093750, 0.87500000}, + {0.00390625, 0.08593750, 0.71093750, 0.87500000}, + {0.00390625, 0.08593750, 0.71093750, 0.87500000}, + {0.00390625, 0.08593750, 0.71093750, 0.87500000}, + {0.00390625, 0.08593750, 0.71093750, 0.87500000}, + } + self.numRunes = 4 + self.numericColor = "HarmonyPowerNumeric" + self.unitPower = SPELL_POWER_LIGHT_FORCE + self.minLevel = MONKHARMONYBAR_SHOW_LEVEL + self.bTreatEmptyAsFull = true + self.unit = "player" + self.runeWidth = self.runeHeight +end + +function HarmonyPower.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() + + local width = self.runeHeight + if self.moduleSettings.runeMode == "Graphical" then + width = self.runeWidth + end + self.frame:SetWidth(width*self.numRunes) + end + HarmonyPower.super.prototype.UpdateRunePower(self) +end + +function HarmonyPower.prototype:GetOptions() + local opts = HarmonyPower.super.prototype.GetOptions(self) + + opts.hideBlizz.desc = L["Hides Blizzard Harmony Power frame and disables all events related to it.\n\nNOTE: Blizzard attaches the harmony power UI to the player's unitframe, so if you have that hidden in PlayerHealth, then this won't do anything."] + + return opts +end + +function HarmonyPower.prototype:GetRuneTexture(rune) + if not rune or rune ~= tonumber(rune) then + return + end + return "Interface\\PlayerFrame\\MonkUI" +end + +function HarmonyPower.prototype:ShowBlizz() + MonkHarmonyBar:Show() + + MonkHarmonyBar:GetScript("OnLoad")(MonkHarmonyBar) +end + +function HarmonyPower.prototype:HideBlizz() + MonkHarmonyBar:Hide() + + MonkHarmonyBar:UnregisterAllEvents() +end + +-- Load us up +local _, unitClass = UnitClass("player") +if (unitClass == "MONK" and IceHUD.WowVer >= 50000) then + IceHUD.HarmonyPower = HarmonyPower:new() +end diff --git a/modules/HolyPower.lua b/modules/HolyPower.lua index ccadf6e..0e7e821 100644 --- a/modules/HolyPower.lua +++ b/modules/HolyPower.lua @@ -22,7 +22,7 @@ end function HolyPower.prototype:GetOptions() local opts = HolyPower.super.prototype.GetOptions(self) - opts.hideBlizz.desc = "Hides Blizzard Holy Power frame and disables all events related to it.\n\nNOTE: Blizzard attaches the holy power UI to the player's unitframe, so if you have that hidden in PlayerHealth, then this won't do anything." + opts.hideBlizz.desc = L["Hides Blizzard Holy Power frame and disables all events related to it.\n\nNOTE: Blizzard attaches the holy power UI to the player's unitframe, so if you have that hidden in PlayerHealth, then this won't do anything."] return opts end diff --git a/modules/Shards.lua b/modules/Shards.lua index 9719626..e53073b 100644 --- a/modules/Shards.lua +++ b/modules/Shards.lua @@ -6,7 +6,7 @@ function ShardCounter.prototype:init() self:SetDefaultColor("ShardCounterNumeric", 218, 231, 31) - -- pulled from PaladinPowerBar.xml in Blizzard's UI source + -- pulled from ShardBar.xml in Blizzard's UI source self.runeCoords = { {0.01562500, 0.28125000, 0.00781250, 0.13281250},