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.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
},
@ -404,16 +396,6 @@ IceHUD.options =
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
},
@ -437,30 +429,16 @@ IceHUD.options =
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

View File

@ -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

View File

@ -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()

View File

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

View File

@ -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
@ -64,49 +51,123 @@ function DruidMana.prototype:FormsChanged(unit)
return
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()
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.druidManaMax, "DruidMana")
self:UpdateBar(self.druidMana / self.druidMaxMana, "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

View File

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

View File

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

View File

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

View File

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

View File

@ -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()

View File

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

View File

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

View File

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

View File

@ -78,4 +78,4 @@ end
-- 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")
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()

Binary file not shown.

Binary file not shown.