Version 0.9

- New round bar texture
- Standalone druid mana bar
- Lots of stuff I can't remember
This commit is contained in:
iceroth
2007-04-16 16:58:00 +00:00
parent f5b0391090
commit f63072e40c
17 changed files with 148 additions and 109 deletions

View File

@ -1,6 +1,6 @@
IceHUD = AceLibrary("AceAddon-2.0"):new("AceConsole-2.0", "AceDebug-2.0") 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.Location = "Interface\\AddOns\\IceHUD"
IceHUD.options = IceHUD.options =
@ -356,18 +356,10 @@ IceHUD.options =
}, },
headerModulesBlank = { type = 'header', name = ' ', order = 40 },
headerModules = {
type = 'header',
name = 'Module Settings',
order = 40
},
modules = { modules = {
type='group', type='group',
desc = 'Module configuration options', desc = 'Module configuration options',
name = 'Modules', name = 'Module settings',
args = {}, args = {},
order = 41 order = 41
}, },
@ -404,16 +396,6 @@ IceHUD.options =
order = 91 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 = { debug = {
type = "toggle", type = "toggle",
name = "Debugging", name = "Debugging",
@ -424,6 +406,16 @@ IceHUD.options =
set = function(value) set = function(value)
IceHUD.IceCore:SetDebug(value) IceHUD.IceCore:SetDebug(value)
end, 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 order = 93
}, },
@ -437,30 +429,16 @@ IceHUD.options =
order = 94 order = 94
}, },
endSpace = {
type = 'header',
name = ' ',
order = 1000
},
} }
} }
IceHUD.slashMenu = IceHUD.slashMenu =
{ {
type = 'execute', type = 'execute',
func = function() 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 if not (UnitAffectingCombat("player")) then
IceHUD.dewdrop:Open(IceHUD.IceCore.IceHUDFrame) waterfall:Open("IceHUD")
else else
DEFAULT_CHAT_FRAME:AddMessage("|cff8888ffIceHUD|r: Combat lockdown restriction." .. DEFAULT_CHAT_FRAME:AddMessage("|cff8888ffIceHUD|r: Combat lockdown restriction." ..
" Leave combat and try again.") " Leave combat and try again.")
@ -468,6 +446,7 @@ IceHUD.slashMenu =
end end
} }
StaticPopupDialogs["ICEHUD_RESET"] = StaticPopupDialogs["ICEHUD_RESET"] =
{ {
text = "Are you sure you want to reset IceHUD settings?", text = "Are you sure you want to reset IceHUD settings?",
@ -482,7 +461,6 @@ StaticPopupDialogs["ICEHUD_RESET"] =
} }
function IceHUD:OnInitialize() function IceHUD:OnInitialize()
self:SetDebugging(false) self:SetDebugging(false)
self:Debug("IceHUD:OnInitialize()") self:Debug("IceHUD:OnInitialize()")
@ -494,7 +472,6 @@ end
function IceHUD:OnEnable() function IceHUD:OnEnable()
self:Debug("IceHUD:OnEnable()") self:Debug("IceHUD:OnEnable()")
self.IceCore:Enable() self.IceCore:Enable()
self:SetDebugging(self.IceCore:GetDebug()) self:SetDebugging(self.IceCore:GetDebug())
self.debugFrame = ChatFrame2 self.debugFrame = ChatFrame2
@ -502,6 +479,8 @@ function IceHUD:OnEnable()
self.options.args.modules.args = self.IceCore:GetModuleOptions() self.options.args.modules.args = self.IceCore:GetModuleOptions()
self.options.args.colors.args = self.IceCore:GetColorOptions() self.options.args.colors.args = self.IceCore:GetColorOptions()
waterfall:Register("IceHUD", 'aceOptions', IceHUD.options)
self:RegisterChatCommand({ "/icehud" }, IceHUD.slashMenu) self:RegisterChatCommand({ "/icehud" }, IceHUD.slashMenu)
end end

View File

@ -1,12 +1,12 @@
## Interface: 20000 ## Interface: 20003
## Author: Iceroth ## Author: Iceroth
## Name: IceHUD ## Name: IceHUD
## Title: IceHUD |cff7fff7f -Ace2-|r ## Title: IceHUD |cff7fff7f -Ace2-|r
## Notes: Another HUD addon ## Notes: Another HUD addon
## Version: 0.8.6 ($Revision$) ## Version: 0.9 ($Revision$)
## SavedVariables: IceCoreDB ## SavedVariables: IceCoreDB
## OptionalDeps: Ace2, DewdropLib, DruidBar, MobHealth ## OptionalDeps: Ace2, GratuityLib, WaterfallLib, MobHealth
## X-Embeds: Ace2, DewdropLib ## X-Embeds: Ace2, GratuityLib, WaterfallLib
## X-Category: UnitFrame ## X-Category: UnitFrame
## X-Date: $Date$ ## X-Date: $Date$
## X-eMail: iceroth@iceroth.net ## 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\AceDebug-2.0\AceDebug-2.0.lua
libs\AceConsole-2.0\AceConsole-2.0.lua libs\AceConsole-2.0\AceConsole-2.0.lua
libs\AceAddon-2.0\AceAddon-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 # IceHUD core functionality
IceCore.lua IceCore.lua

View File

@ -144,12 +144,11 @@ function CastBar.prototype:CreateLagBar()
self.lagBar:SetStatusBarTexture(self.lagBar.bar) self.lagBar:SetStatusBarTexture(self.lagBar.bar)
local r, g, b = self:GetColor("CastFail") local r, g, b = self.settings.backgroundColor.r, self.settings.backgroundColor.g, self.settings.backgroundColor.b
self.lagBar:SetStatusBarColor( if (self.settings.backgroundToggle) then
self.settings.backgroundColor.r, r, g, b = self:GetColor("CastCasting")
self.settings.backgroundColor.g, end
self.settings.backgroundColor.b, self.lagBar:SetStatusBarColor(r, g, b, self.moduleSettings.lagAlpha)
self.moduleSettings.lagAlpha)
if (self.moduleSettings.side == IceCore.Side.Left) then if (self.moduleSettings.side == IceCore.Side.Left) then
@ -196,4 +195,4 @@ end
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- Load us up -- Load us up
PRKL = CastBar:new() CastBar:new()

View File

@ -241,4 +241,4 @@ end
-- Load us up -- Load us up
ComboPoints:new() IceHUD.ComboPoints = ComboPoints:new()

View File

@ -1,11 +1,14 @@
local AceOO = AceLibrary("AceOO-2.0") local AceOO = AceLibrary("AceOO-2.0")
local DruidMana = AceOO.Class(IceUnitBar) 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.druidMana = nil
DruidMana.prototype.druidMaxMana = nil DruidMana.prototype.druidManaMax = nil
DruidMana.prototype.lastCast = nil
DruidMana.prototype.baseMana = nil
local intMod = 14
-- Constructor -- -- Constructor --
@ -30,32 +33,16 @@ end
function DruidMana.prototype:Enable(core) function DruidMana.prototype:Enable(core)
DruidMana.super.prototype.Enable(self, core) DruidMana.super.prototype.Enable(self, core)
if (IsAddOnLoaded("SoleManax")) then self:FormsChanged(self.unit)
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:RegisterEvent("UNIT_DISPLAYPOWER", "FormsChanged") self:RegisterEvent("UNIT_DISPLAYPOWER", "FormsChanged")
self:RegisterEvent("UNIT_MANA", "UpdateMana")
self:FormsChanged(self.unit) self:RegisterEvent("UNIT_MAXMANA", "UpdateManaMax")
end end
function DruidMana.prototype:Disable(core) function DruidMana.prototype:Disable(core)
DruidMana.super.prototype.Disable(self, 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 end
@ -64,49 +51,123 @@ function DruidMana.prototype:FormsChanged(unit)
return return
end end
self.inForms = (UnitPowerType(self.unit) ~= 0) 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:Update() self:Update()
end 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:Update()
self.druidMana = mana
self.druidMaxMana = maxMana
end 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:Update()
self.druidMana = DruidBarKey.keepthemana
self.druidMaxMana = DruidBarKey.maxmana
end end
function DruidMana.prototype:Update() function DruidMana.prototype:Update()
DruidMana.super.prototype.Update(self) 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() self.frame:Hide()
return return
else else
self.frame:Show() self.frame:Show()
end end
if (not self.druidMana or not self.druidMaxMana) then self:UpdateBar(self.druidMana / self.druidManaMax, "DruidMana")
return
end
self:UpdateBar(self.druidMana / self.druidMaxMana, "DruidMana") local percentage = (self.druidMana / self.druidManaMax) * 100
local percentage = (self.druidMana / self.druidMaxMana) * 100
self:SetBottomText1(math.floor(percentage)) 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 end
-- Load us up (if we are a druid) -- Load us up (if we are a druid)
local _, unitClass = UnitClass("player") local _, unitClass = UnitClass("player")
if (unitClass == "DRUID" and (IsAddOnLoaded("SoleManax") or IsAddOnLoaded("DruidBar"))) then if (unitClass == "DRUID") then
DruidMana:new() IceHUD.DruidMana = DruidMana:new()
end end

View File

@ -413,6 +413,4 @@ end
-- Load us up -- Load us up
MirrorBarHandler:new() IceHUD.MirrorBarHandler = MirrorBarHandler:new()

View File

@ -106,4 +106,4 @@ end
-- Load us up -- Load us up
PetHealth:new() IceHUD.PetHealth = PetHealth:new()

View File

@ -118,4 +118,4 @@ end
-- Load us up -- Load us up
PetMana:new() IceHUD.PetMana = PetMana:new()

View File

@ -150,4 +150,4 @@ end
-- Load us up -- Load us up
PlayerHealth:new() IceHUD.PlayerHealth = PlayerHealth:new()

View File

@ -195,7 +195,8 @@ function PlayerMana.prototype:UpdateEnergy(unit)
end end
if (not (self.previousEnergy) or (self.previousEnergy <= UnitMana(self.unit))) then if ((not (self.previousEnergy) or (self.previousEnergy <= UnitMana(self.unit))) and
(self.moduleSettings.tickerEnabled)) then
self.tickStart = GetTime() self.tickStart = GetTime()
self.tickerFrame:Show() self.tickerFrame:Show()
end end
@ -259,4 +260,4 @@ end
-- Load us up -- Load us up
PlayerMana:new() IceHUD.PlayerMana = PlayerMana:new()

View File

@ -56,4 +56,4 @@ end
-- Load us up -- Load us up
TargetCast:new() IceHUD.TargetCast = TargetCast:new()

View File

@ -213,4 +213,4 @@ end
-- Load us up -- Load us up
TargetHealth:new() IceHUD.TargetHealth = TargetHealth:new()

View File

@ -801,4 +801,4 @@ end
-- Load us up -- Load us up
IceHUD_Module_TargetInfo = TargetInfo:new() IceHUD.TargetInfo = TargetInfo:new()

View File

@ -78,4 +78,4 @@ end
-- Load us up -- Load us up
TargetMana:new() IceHUD.TargetMana = TargetMana:new()

View File

@ -14,7 +14,7 @@ function TargetOfTarget.prototype:init()
TargetOfTarget.super.prototype.init(self, "TargetOfTarget") TargetOfTarget.super.prototype.init(self, "TargetOfTarget")
self.buffSize = 12 self.buffSize = 12
self.height = 12 self.height = 15
self.stackedDebuffs = {} self.stackedDebuffs = {}
self.unit = "targettarget" self.unit = "targettarget"
self.hadTarget = false self.hadTarget = false
@ -110,7 +110,7 @@ function TargetOfTarget.prototype:GetDefaultSettings()
local defaults = TargetOfTarget.super.prototype.GetDefaultSettings(self) local defaults = TargetOfTarget.super.prototype.GetDefaultSettings(self)
defaults["vpos"] = -130 defaults["vpos"] = -130
defaults["showDebuffs"] = true defaults["showDebuffs"] = true
defaults["fontSize"] = 12 defaults["fontSize"] = 15
defaults["mouse"] = true defaults["mouse"] = true
return defaults return defaults
end end
@ -243,7 +243,7 @@ function TargetOfTarget.prototype:CreateToTFrame()
self.frame.totName:SetJustifyH("LEFT") self.frame.totName:SetJustifyH("LEFT")
self.frame.totName:SetJustifyV("TOP") 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() self.frame.totName:Show()
end end
@ -413,4 +413,4 @@ end
-- load us up -- load us up
IceHUD_Module_TargetOfTarget = TargetOfTarget:new() IceHUD.TargetOfTarget = TargetOfTarget:new()

Binary file not shown.

Binary file not shown.