diff --git a/IceHUD.lua b/IceHUD.lua index 5c172b9..8bfe209 100644 --- a/IceHUD.lua +++ b/IceHUD.lua @@ -1,6 +1,6 @@ IceHUD = AceLibrary("AceAddon-2.0"):new("AceConsole-2.0", "AceDebug-2.0") -IceHUD.dewdrop = AceLibrary("Dewdrop-2.0") +local waterfall = AceLibrary("Waterfall-1.0") IceHUD.Location = "Interface\\AddOns\\IceHUD" IceHUD.options = @@ -356,18 +356,10 @@ IceHUD.options = }, - - headerModulesBlank = { type = 'header', name = ' ', order = 40 }, - headerModules = { - type = 'header', - name = 'Module Settings', - order = 40 - }, - modules = { type='group', desc = 'Module configuration options', - name = 'Modules', + name = 'Module settings', args = {}, order = 41 }, @@ -403,17 +395,7 @@ IceHUD.options = end, order = 91 }, - - reset = { - type = 'execute', - name = '|cffff0000Reset|r', - desc = "Resets all IceHUD options - WARNING: Reloads UI", - func = function() - StaticPopup_Show("ICEHUD_RESET") - end, - order = 92 - }, - + debug = { type = "toggle", name = "Debugging", @@ -424,6 +406,16 @@ IceHUD.options = set = function(value) IceHUD.IceCore:SetDebug(value) end, + order = 92 + }, + + reset = { + type = 'execute', + name = '|cffff0000Reset|r', + desc = "Resets all IceHUD options - WARNING: Reloads UI", + func = function() + StaticPopup_Show("ICEHUD_RESET") + end, order = 93 }, @@ -436,31 +428,17 @@ IceHUD.options = end, order = 94 }, - - endSpace = { - type = 'header', - name = ' ', - order = 1000 - }, } } + IceHUD.slashMenu = { type = 'execute', func = function() - if not (IceHUD.dewdrop:IsRegistered(IceHUD.IceCore.IceHUDFrame)) then - IceHUD.dewdrop:Register(IceHUD.IceCore.IceHUDFrame, - 'children', IceHUD.options, - 'point', "BOTTOMLEFT", - 'relativePoint', "TOPLEFT", - 'dontHook', true - ) - end - if not (UnitAffectingCombat("player")) then - IceHUD.dewdrop:Open(IceHUD.IceCore.IceHUDFrame) + waterfall:Open("IceHUD") else DEFAULT_CHAT_FRAME:AddMessage("|cff8888ffIceHUD|r: Combat lockdown restriction." .. " Leave combat and try again.") @@ -468,6 +446,7 @@ IceHUD.slashMenu = end } + StaticPopupDialogs["ICEHUD_RESET"] = { text = "Are you sure you want to reset IceHUD settings?", @@ -482,7 +461,6 @@ StaticPopupDialogs["ICEHUD_RESET"] = } - function IceHUD:OnInitialize() self:SetDebugging(false) self:Debug("IceHUD:OnInitialize()") @@ -494,7 +472,6 @@ end function IceHUD:OnEnable() self:Debug("IceHUD:OnEnable()") - self.IceCore:Enable() self:SetDebugging(self.IceCore:GetDebug()) self.debugFrame = ChatFrame2 @@ -502,6 +479,8 @@ function IceHUD:OnEnable() self.options.args.modules.args = self.IceCore:GetModuleOptions() self.options.args.colors.args = self.IceCore:GetColorOptions() + waterfall:Register("IceHUD", 'aceOptions', IceHUD.options) + self:RegisterChatCommand({ "/icehud" }, IceHUD.slashMenu) end diff --git a/IceHUD.toc b/IceHUD.toc index 67c0373..5a6b796 100644 --- a/IceHUD.toc +++ b/IceHUD.toc @@ -1,12 +1,12 @@ -## Interface: 20000 +## Interface: 20003 ## Author: Iceroth ## Name: IceHUD ## Title: IceHUD |cff7fff7f -Ace2-|r ## Notes: Another HUD addon -## Version: 0.8.6 ($Revision$) +## Version: 0.9 ($Revision$) ## SavedVariables: IceCoreDB -## OptionalDeps: Ace2, DewdropLib, DruidBar, MobHealth -## X-Embeds: Ace2, DewdropLib +## OptionalDeps: Ace2, GratuityLib, WaterfallLib, MobHealth +## X-Embeds: Ace2, GratuityLib, WaterfallLib ## X-Category: UnitFrame ## X-Date: $Date$ ## X-eMail: iceroth@iceroth.net @@ -20,7 +20,8 @@ libs\AceEvent-2.0\AceEvent-2.0.lua libs\AceDebug-2.0\AceDebug-2.0.lua libs\AceConsole-2.0\AceConsole-2.0.lua libs\AceAddon-2.0\AceAddon-2.0.lua -libs\Dewdrop-2.0\Dewdrop-2.0.lua +libs\Gratuity-2.0\Gratuity-2.0.lua +libs\Waterfall-1.0\Waterfall-1.0.lua # IceHUD core functionality IceCore.lua diff --git a/modules/CastBar.lua b/modules/CastBar.lua index d8d2893..4c65ceb 100644 --- a/modules/CastBar.lua +++ b/modules/CastBar.lua @@ -144,12 +144,11 @@ function CastBar.prototype:CreateLagBar() self.lagBar:SetStatusBarTexture(self.lagBar.bar) - local r, g, b = self:GetColor("CastFail") - self.lagBar:SetStatusBarColor( - self.settings.backgroundColor.r, - self.settings.backgroundColor.g, - self.settings.backgroundColor.b, - self.moduleSettings.lagAlpha) + local r, g, b = self.settings.backgroundColor.r, self.settings.backgroundColor.g, self.settings.backgroundColor.b + if (self.settings.backgroundToggle) then + r, g, b = self:GetColor("CastCasting") + end + self.lagBar:SetStatusBarColor(r, g, b, self.moduleSettings.lagAlpha) if (self.moduleSettings.side == IceCore.Side.Left) then @@ -196,4 +195,4 @@ end ------------------------------------------------------------------------------- -- Load us up -PRKL = CastBar:new() +CastBar:new() diff --git a/modules/ComboPoints.lua b/modules/ComboPoints.lua index 2968e2f..bfbfde5 100644 --- a/modules/ComboPoints.lua +++ b/modules/ComboPoints.lua @@ -241,4 +241,4 @@ end -- Load us up -ComboPoints:new() +IceHUD.ComboPoints = ComboPoints:new() diff --git a/modules/DruidMana.lua b/modules/DruidMana.lua index 6a30306..c20baff 100644 --- a/modules/DruidMana.lua +++ b/modules/DruidMana.lua @@ -1,11 +1,14 @@ local AceOO = AceLibrary("AceOO-2.0") local DruidMana = AceOO.Class(IceUnitBar) +local gratuity = AceLibrary("Gratuity-2.0") -DruidMana.prototype.inForms = nil -DruidMana.prototype.mode = nil DruidMana.prototype.druidMana = nil -DruidMana.prototype.druidMaxMana = nil +DruidMana.prototype.druidManaMax = nil +DruidMana.prototype.lastCast = nil +DruidMana.prototype.baseMana = nil + +local intMod = 14 -- Constructor -- @@ -30,32 +33,16 @@ end function DruidMana.prototype:Enable(core) DruidMana.super.prototype.Enable(self, core) - if (IsAddOnLoaded("SoleManax")) then - self.mode = "SoleManax" - SoleManax:AddUser(self.UpdateSoleManax, TRUE, self) - self:UpdateSoleManax(SoleManax:GetPlayerMana()) - - elseif (IsAddOnLoaded("DruidBar")) then - self.mode = "DruidBar" - self:ScheduleRepeatingEvent("DruidBar", self.UpdateDruidBarMana, 0.2, self) - end + self:FormsChanged(self.unit) self:RegisterEvent("UNIT_DISPLAYPOWER", "FormsChanged") - - self:FormsChanged(self.unit) + self:RegisterEvent("UNIT_MANA", "UpdateMana") + self:RegisterEvent("UNIT_MAXMANA", "UpdateManaMax") end function DruidMana.prototype:Disable(core) DruidMana.super.prototype.Disable(self, core) - - if (IsAddOnLoaded("SoleManax")) then - SoleManax.DelUser(self.UpdateSoleManax) - end - - if (IsAddOnLoaded("DruidBar")) then - self:CancelScheduledEvent("DruidBar") - end end @@ -63,50 +50,124 @@ function DruidMana.prototype:FormsChanged(unit) if (unit ~= self.unit) then return end + + local forms = (UnitPowerType(self.unit) ~= 0) + + if (forms) then + self.lastCast = GetTime() + + if (not self.druidMana) then + return + end + + -- deduct the shapeshift cost from last known mana value + -- when we shift to forms + local uberTooltips = GetCVar("UberTooltips") + SetCVar("UberTooltips", 1) + + gratuity:SetShapeshift(1) -- 1 = bear form, rawr + local _, _, manaCost = gratuity:Find("(%d+)", 2, 2) -- 2 = mana cost line + + self.druidMana = self.druidMana - (manaCost or 0) + + SetCVar("UberTooltips", uberTooltips) + else + -- always update with actual mana values when shifting out + self:UpdateMana(self.unit) + self:UpdateManaMax(self.unit) + + local _, intellect, _, _ = UnitStat(self.unit, 4) + self.baseMana = UnitMana(self.unit) - (intellect * intMod) + end - self.inForms = (UnitPowerType(self.unit) ~= 0) self:Update() end -function DruidMana.prototype:UpdateSoleManax(mana, maxMana) +function DruidMana.prototype:UpdateMana(unit) + if (unit ~= self.unit) then + return + end + + local forms = (UnitPowerType(self.unit) ~= 0) + + if (forms) then + if (not self.druidMana or not self.lastCast) then + return + end + + local time = GetTime() + local normal, casting = GetManaRegen() + + if (time - self.lastCast > 5) then + self.druidMana = self.druidMana + (normal * 2) + else + self.druidMana = self.druidMana + (casting * 2) + end + + -- sanity check, the tick can be off a little sometimes + if (self.druidMana > self.druidManaMax) then + self.druidMana = self.druidManaMax + end + else + self.druidMana = UnitMana(self.unit) + end + self:Update() - self.druidMana = mana - self.druidMaxMana = maxMana end -function DruidMana.prototype:UpdateDruidBarMana() +function DruidMana.prototype:UpdateManaMax(unit) + if (unit ~= self.unit) then + return + end + + local forms = (UnitPowerType(self.unit) ~= 0) + + if (forms) then + if not (self.baseMana) then + return + end + + local _, intellect, _, _ = UnitStat(self.unit, 4) + + self.druidManaMax = self.baseMana + (intellect * intMod) + + if (self.druidMana > self.druidManaMax) then + self.druidMana = self.druidManaMax + end + else + self.druidManaMax = UnitManaMax(self.unit) + end + self:Update() - self.druidMana = DruidBarKey.keepthemana - self.druidMaxMana = DruidBarKey.maxmana end function DruidMana.prototype:Update() DruidMana.super.prototype.Update(self) - if ((not self.alive) or (not self.inForms)) then + + local forms = (UnitPowerType(self.unit) ~= 0) + + if (not self.alive or not forms or not self.druidMana or not self.druidManaMax) then self.frame:Hide() return else self.frame:Show() end - if (not self.druidMana or not self.druidMaxMana) then - return - end - - self:UpdateBar(self.druidMana / self.druidMaxMana, "DruidMana") + self:UpdateBar(self.druidMana / self.druidManaMax, "DruidMana") - local percentage = (self.druidMana / self.druidMaxMana) * 100 + local percentage = (self.druidMana / self.druidManaMax) * 100 self:SetBottomText1(math.floor(percentage)) - self:SetBottomText2(self:GetFormattedText(string.format("%.0f", self.druidMana), string.format("%.0f", self.druidMaxMana)), "DruidMana") + self:SetBottomText2(self:GetFormattedText(string.format("%.0f", self.druidMana), + string.format("%.0f", self.druidManaMax)), "DruidMana") end -- Load us up (if we are a druid) local _, unitClass = UnitClass("player") -if (unitClass == "DRUID" and (IsAddOnLoaded("SoleManax") or IsAddOnLoaded("DruidBar"))) then - DruidMana:new() +if (unitClass == "DRUID") then + IceHUD.DruidMana = DruidMana:new() end diff --git a/modules/MirrorBar.lua b/modules/MirrorBar.lua index d0a270c..d5bfe95 100644 --- a/modules/MirrorBar.lua +++ b/modules/MirrorBar.lua @@ -413,6 +413,4 @@ end -- Load us up -MirrorBarHandler:new() - - +IceHUD.MirrorBarHandler = MirrorBarHandler:new() diff --git a/modules/PetHealth.lua b/modules/PetHealth.lua index 47c47ae..4eb3712 100644 --- a/modules/PetHealth.lua +++ b/modules/PetHealth.lua @@ -106,4 +106,4 @@ end -- Load us up -PetHealth:new() +IceHUD.PetHealth = PetHealth:new() diff --git a/modules/PetMana.lua b/modules/PetMana.lua index 029a1aa..7e3b1c0 100644 --- a/modules/PetMana.lua +++ b/modules/PetMana.lua @@ -118,4 +118,4 @@ end -- Load us up -PetMana:new() +IceHUD.PetMana = PetMana:new() diff --git a/modules/PlayerHealth.lua b/modules/PlayerHealth.lua index 1a73063..3db685c 100644 --- a/modules/PlayerHealth.lua +++ b/modules/PlayerHealth.lua @@ -150,4 +150,4 @@ end -- Load us up -PlayerHealth:new() +IceHUD.PlayerHealth = PlayerHealth:new() diff --git a/modules/PlayerMana.lua b/modules/PlayerMana.lua index eba369e..08e3d14 100644 --- a/modules/PlayerMana.lua +++ b/modules/PlayerMana.lua @@ -195,9 +195,10 @@ function PlayerMana.prototype:UpdateEnergy(unit) end - if (not (self.previousEnergy) or (self.previousEnergy <= UnitMana(self.unit))) then - self.tickStart = GetTime() - self.tickerFrame:Show() + if ((not (self.previousEnergy) or (self.previousEnergy <= UnitMana(self.unit))) and + (self.moduleSettings.tickerEnabled)) then + self.tickStart = GetTime() + self.tickerFrame:Show() end self.previousEnergy = UnitMana(self.unit) @@ -259,4 +260,4 @@ end -- Load us up -PlayerMana:new() +IceHUD.PlayerMana = PlayerMana:new() diff --git a/modules/TargetCast.lua b/modules/TargetCast.lua index fc32e96..3d70a30 100644 --- a/modules/TargetCast.lua +++ b/modules/TargetCast.lua @@ -56,4 +56,4 @@ end -- Load us up -TargetCast:new() +IceHUD.TargetCast = TargetCast:new() diff --git a/modules/TargetHealth.lua b/modules/TargetHealth.lua index 379e7da..3594f9d 100644 --- a/modules/TargetHealth.lua +++ b/modules/TargetHealth.lua @@ -213,4 +213,4 @@ end -- Load us up -TargetHealth:new() +IceHUD.TargetHealth = TargetHealth:new() diff --git a/modules/TargetInfo.lua b/modules/TargetInfo.lua index f03d9e5..4b00f7b 100644 --- a/modules/TargetInfo.lua +++ b/modules/TargetInfo.lua @@ -801,4 +801,4 @@ end -- Load us up -IceHUD_Module_TargetInfo = TargetInfo:new() +IceHUD.TargetInfo = TargetInfo:new() diff --git a/modules/TargetMana.lua b/modules/TargetMana.lua index 71b7e29..511a746 100644 --- a/modules/TargetMana.lua +++ b/modules/TargetMana.lua @@ -78,4 +78,4 @@ end -- Load us up -TargetMana:new() +IceHUD.TargetMana = TargetMana:new() diff --git a/modules/TargetOfTarget.lua b/modules/TargetOfTarget.lua index 6df4cb1..39a0f4b 100644 --- a/modules/TargetOfTarget.lua +++ b/modules/TargetOfTarget.lua @@ -14,7 +14,7 @@ function TargetOfTarget.prototype:init() TargetOfTarget.super.prototype.init(self, "TargetOfTarget") self.buffSize = 12 - self.height = 12 + self.height = 15 self.stackedDebuffs = {} self.unit = "targettarget" self.hadTarget = false @@ -110,7 +110,7 @@ function TargetOfTarget.prototype:GetDefaultSettings() local defaults = TargetOfTarget.super.prototype.GetDefaultSettings(self) defaults["vpos"] = -130 defaults["showDebuffs"] = true - defaults["fontSize"] = 12 + defaults["fontSize"] = 15 defaults["mouse"] = true return defaults end @@ -243,7 +243,7 @@ function TargetOfTarget.prototype:CreateToTFrame() self.frame.totName:SetJustifyH("LEFT") self.frame.totName:SetJustifyV("TOP") - self.frame.totName:SetPoint("LEFT", self.frame, "LEFT", 0, 0) + self.frame.totName:SetPoint("LEFT", self.frame, "LEFT", 0, -1) self.frame.totName:Show() end @@ -413,4 +413,4 @@ end -- load us up -IceHUD_Module_TargetOfTarget = TargetOfTarget:new() +IceHUD.TargetOfTarget = TargetOfTarget:new() diff --git a/textures/Bar.blp b/textures/Bar.blp index 67c7ad9..2411e86 100644 Binary files a/textures/Bar.blp and b/textures/Bar.blp differ diff --git a/textures/BarBG.blp b/textures/BarBG.blp index ef0c211..6038ca7 100644 Binary files a/textures/BarBG.blp and b/textures/BarBG.blp differ