Version 0.2

- Added basic pet support
- Added configuration (via both console and Dewdrop)
- Fixed indexing problem with non-English clients
This commit is contained in:
iceroth
2006-07-21 09:11:03 +00:00
parent 772fe5a179
commit 0106530c98
17 changed files with 948 additions and 136 deletions

View File

@ -10,12 +10,13 @@ IceBarElement.BackgroundTexture = IceHUD.Location .. "\\textures\\HiBarBG"
IceBarElement.BarProportion = 0.25 -- 0.18 IceBarElement.BarProportion = 0.25 -- 0.18
IceBarElement.prototype.barFrame = nil IceBarElement.prototype.barFrame = nil
IceBarElement.prototype.side = nil
IceBarElement.prototype.offset = nil --offsets less than 0 should be reserved for pets etc
IceBarElement.prototype.width = nil IceBarElement.prototype.width = nil
IceBarElement.prototype.height = nil IceBarElement.prototype.height = nil
IceBarElement.prototype.backgroundAlpha = nil IceBarElement.prototype.backgroundAlpha = nil
IceBarElement.prototype.combat = nil
-- Constructor -- -- Constructor --
function IceBarElement.prototype:init(name) function IceBarElement.prototype:init(name)
@ -23,6 +24,7 @@ function IceBarElement.prototype:init(name)
self.width = 77 self.width = 77
self.height = 154 self.height = 154
self.backgroundAlpha = IceBarElement.BackgroundAlpha self.backgroundAlpha = IceBarElement.BackgroundAlpha
end end
@ -31,18 +33,94 @@ end
-- 'Public' methods ----------------------------------------------------------- -- 'Public' methods -----------------------------------------------------------
-- OVERRIDE
function IceBarElement.prototype:Enable()
IceBarElement.super.prototype.Enable(self)
self:RegisterEvent("PLAYER_REGEN_DISABLED", "InCombat")
self:RegisterEvent("PLAYER_REGEN_ENABLED", "OutCombat")
self:RegisterEvent("PLAYER_ENTERING_WORLD", "CheckCombat")
end
-- OVERRIDE
function IceBarElement.prototype:GetOptions()
local opts = IceBarElement.super.prototype.GetOptions(self)
opts["side"] =
{
type = 'group',
name = 'side',
desc = 'Side of the HUD where the bar appears',
args = {
left = {
type = 'execute',
name = 'left',
desc = "Left side",
func = function()
self.moduleSettings.side = IceCore.Side.Left
self:Redraw()
end
},
right = {
type = 'execute',
name = 'right',
desc = "Right side",
func = function()
self.moduleSettings.side = IceCore.Side.Right
self:Redraw()
end
}
},
order = 30
}
opts["offset"] =
{
type = 'range',
name = 'offset',
desc = 'Offset of the bar',
min = -1,
max = 10,
step = 1,
get = function()
return self.moduleSettings.offset
end,
set = function(value)
self.moduleSettings.offset = value
self:Redraw()
end,
order = 31
}
return opts
end
-- OVERRIDE
function IceBarElement.prototype:Redraw()
IceBarElement.super.prototype.Redraw(self)
self.alpha = self.settings.alphaooc
self:CreateFrame()
self.frame:SetAlpha(self.alpha)
end
function IceBarElement.prototype:SetPosition(side, offset) function IceBarElement.prototype:SetPosition(side, offset)
IceBarElement.prototype.side = side IceBarElement.prototype.side = side
IceBarElement.prototype.offset = offset IceBarElement.prototype.offset = offset
end end
-- 'Protected' methods -------------------------------------------------------- -- 'Protected' methods --------------------------------------------------------
-- OVERRIDE -- OVERRIDE
function IceBarElement.prototype:CreateFrame() function IceBarElement.prototype:CreateFrame()
-- don't call overridden method -- don't call overridden method
self.alpha = self.settings.alphaooc
self:CreateBackground() self:CreateBackground()
self:CreateBar() self:CreateBar()
self:CreateTexts() self:CreateTexts()
@ -51,77 +129,97 @@ end
-- Creates background for the bar -- Creates background for the bar
function IceBarElement.prototype:CreateBackground() function IceBarElement.prototype:CreateBackground()
self.frame = CreateFrame("StatusBar", nil, self.parent) if not (self.frame) then
self.frame = CreateFrame("StatusBar", nil, self.parent)
end
self.frame:SetFrameStrata("BACKGROUND") self.frame:SetFrameStrata("BACKGROUND")
self.frame:SetWidth(self.width) self.frame:SetWidth(self.width)
self.frame:SetHeight(self.height) self.frame:SetHeight(self.height)
local bg = self.frame:CreateTexture(nil, "BACKGROUND") if not (self.frame.bg) then
self.frame.bg = self.frame:CreateTexture(nil, "BACKGROUND")
bg:SetTexture(IceBarElement.BackgroundTexture)
bg:SetAllPoints(self.frame)
if (self.side == IceCore.Side.Left) then
bg:SetTexCoord(1, 0, 0, 1)
end end
self.frame:SetStatusBarTexture(bg) self.frame.bg:SetTexture(IceBarElement.BackgroundTexture)
self.frame.bg:ClearAllPoints()
self.frame.bg:SetAllPoints(self.frame)
if (self.moduleSettings.side == IceCore.Side.Left) then
self.frame.bg:SetTexCoord(1, 0, 0, 1)
else
self.frame.bg:SetTexCoord(1, 0, 1, 0)
end
self.frame:SetStatusBarTexture(self.frame.bg)
self.frame:SetStatusBarColor(self:GetColor("undef", self.backgroundAlpha)) self.frame:SetStatusBarColor(self:GetColor("undef", self.backgroundAlpha))
local ownPoint = "LEFT" local ownPoint = "LEFT"
if (self.side == ownPoint) then if (self.moduleSettings.side == ownPoint) then
ownPoint = "RIGHT" ownPoint = "RIGHT"
end end
-- ofxx = (bar width) + (extra space in between the bars) -- ofxx = (bar width) + (extra space in between the bars)
local offx = (IceBarElement.BarProportion * self.width * self.offset) + (self.offset * 10) local offx = (IceBarElement.BarProportion * self.width * self.moduleSettings.offset)
if (self.side == IceCore.Side.Left) then + (self.moduleSettings.offset * 10)
if (self.moduleSettings.side == IceCore.Side.Left) then
offx = offx * -1 offx = offx * -1
end end
self.frame:SetPoint("BOTTOM"..ownPoint, self.parent, "BOTTOM"..self.side, offx, 0) self.frame:ClearAllPoints()
self.frame:SetPoint("BOTTOM"..ownPoint, self.parent, "BOTTOM"..self.moduleSettings.side, offx, 0)
end end
-- Creates the actual bar -- Creates the actual bar
function IceBarElement.prototype:CreateBar() function IceBarElement.prototype:CreateBar()
self.barFrame = CreateFrame("StatusBar", nil, self.frame) if not (self.barFrame) then
self.barFrame = CreateFrame("StatusBar", nil, self.frame)
end
self.barFrame:SetFrameStrata("BACKGROUND") self.barFrame:SetFrameStrata("BACKGROUND")
self.barFrame:SetWidth(self.width) self.barFrame:SetWidth(self.width)
self.barFrame:SetHeight(self.height) self.barFrame:SetHeight(self.height)
local bar = self.frame:CreateTexture(nil, "BACKGROUND") if not (self.barFrame.bar) then
self.barFrame.texture = bar self.barFrame.bar = self.frame:CreateTexture(nil, "BACKGROUND")
end
bar:SetTexture(IceBarElement.BarTexture) self.barFrame.bar:SetTexture(IceBarElement.BarTexture)
bar:SetAllPoints(self.frame) self.barFrame.bar:SetAllPoints(self.frame)
self.barFrame:SetStatusBarTexture(bar) self.barFrame:SetStatusBarTexture(self.barFrame.bar)
self:UpdateBar(1, "undef") self:UpdateBar(1, "undef")
local point = "LEFT" local point = "LEFT"
if (self.side == point) then if (self.moduleSettings.side == point) then
point = "RIGHT" point = "RIGHT"
end end
self.barFrame:SetPoint("BOTTOM"..point, self.frame, "BOTTOM"..self.side, 0, 0) self.barFrame:ClearAllPoints()
self.barFrame:SetPoint("BOTTOM"..point, self.frame, "BOTTOM"..self.moduleSettings.side, 0, 0)
end end
function IceBarElement.prototype:CreateTexts() function IceBarElement.prototype:CreateTexts()
self.frame.bottomUpperText = self:FontFactory(nil, 13) if not (self.frame.bottomUpperText) then
self.frame.bottomLowerText = self:FontFactory(nil, 13) self.frame.bottomUpperText = self:FontFactory(nil, 13)
end
if not (self.frame.bottomLowerText) then
self.frame.bottomLowerText = self:FontFactory(nil, 13)
end
self.frame.bottomUpperText:SetWidth(80) self.frame.bottomUpperText:SetWidth(80)
self.frame.bottomLowerText:SetWidth(120) self.frame.bottomLowerText:SetWidth(120)
self.frame.bottomUpperText:SetHeight(14)
self.frame.bottomLowerText:SetHeight(14)
local justify = "RIGHT" local justify = "RIGHT"
if ((self.side == "LEFT" and self.offset <= 1) or if ((self.moduleSettings.side == "LEFT" and self.moduleSettings.offset <= 1) or
(self.side == "RIGHT" and self.offset > 1)) (self.moduleSettings.side == "RIGHT" and self.moduleSettings.offset > 1))
then then
justify = "LEFT" justify = "LEFT"
end end
@ -131,25 +229,28 @@ function IceBarElement.prototype:CreateTexts()
self.frame.bottomLowerText:SetJustifyH(justify) self.frame.bottomLowerText:SetJustifyH(justify)
local ownPoint = self.side local ownPoint = self.moduleSettings.side
if (self.offset > 1) then if (self.moduleSettings.offset > 1) then
ownPoint = self:Flip(ownPoint) ownPoint = self:Flip(ownPoint)
end end
local parentPoint = self:Flip(self.side) local parentPoint = self:Flip(self.moduleSettings.side)
local offx = 2 local offx = 2
-- adjust offset for bars where text is aligned to the outer side -- adjust offset for bars where text is aligned to the outer side
if (self.offset <= 1) then if (self.moduleSettings.offset <= 1) then
offx = IceBarElement.BarProportion * self.width + 6 offx = IceBarElement.BarProportion * self.width + 6
end end
if (self.side == IceCore.Side.Left) then if (self.moduleSettings.side == IceCore.Side.Left) then
offx = offx * -1 offx = offx * -1
end end
self.frame.bottomUpperText:ClearAllPoints()
self.frame.bottomLowerText:ClearAllPoints()
self.frame.bottomUpperText:SetPoint("TOP"..ownPoint , self.frame, "BOTTOM"..parentPoint, offx, -1) self.frame.bottomUpperText:SetPoint("TOP"..ownPoint , self.frame, "BOTTOM"..parentPoint, offx, -1)
self.frame.bottomLowerText:SetPoint("TOP"..ownPoint , self.frame, "BOTTOM"..parentPoint, offx, -15) self.frame.bottomLowerText:SetPoint("TOP"..ownPoint , self.frame, "BOTTOM"..parentPoint, offx, -15)
end end
@ -165,7 +266,7 @@ end
function IceBarElement.prototype:SetScale(texture, scale) function IceBarElement.prototype:SetScale(texture, scale)
if (self.side == IceCore.Side.Left) then if (self.moduleSettings.side == IceCore.Side.Left) then
texture:SetTexCoord(1, 0, 1-scale, 1) texture:SetTexCoord(1, 0, 1-scale, 1)
else else
texture:SetTexCoord(0, 1, 1-scale, 1) texture:SetTexCoord(0, 1, 1-scale, 1)
@ -177,11 +278,11 @@ function IceBarElement.prototype:UpdateBar(scale, color, alpha)
alpha = alpha or 1 alpha = alpha or 1
self.frame:SetAlpha(alpha) self.frame:SetAlpha(alpha)
self.frame:SetStatusBarColor(self:GetColor(color, self.backgroundAlpha)) self.frame:SetStatusBarColor(self:GetColor(color, self.alpha))
self.barFrame:SetStatusBarColor(self:GetColor(color)) self.barFrame:SetStatusBarColor(self:GetColor(color))
self:SetScale(self.barFrame.texture, scale) self:SetScale(self.barFrame.bar, scale)
end end
@ -203,6 +304,9 @@ function IceBarElement.prototype:SetBottomText2(text, color, alpha)
end end
if not (alpha) then if not (alpha) then
alpha = self.alpha + 0.1 alpha = self.alpha + 0.1
if (alpha > 1) then
alpha = 1
end
end end
self.frame.bottomLowerText:SetTextColor(self:GetColor(color, alpha)) self.frame.bottomLowerText:SetTextColor(self:GetColor(color, alpha))
self.frame.bottomLowerText:SetText(text) self.frame.bottomLowerText:SetText(text)
@ -217,3 +321,36 @@ function IceBarElement.prototype:GetFormattedText(value1, value2)
return string.format("|c%s[|r%s|c%s/|r%s|c%s]|r", color, value1, color, value2, color) return string.format("|c%s[|r%s|c%s/|r%s|c%s]|r", color, value1, color, value2, color)
end end
-- To be overridden
function IceBarElement.prototype:Update()
if (self.combat) then
self.alpha = self.settings.alphaic
self.backgroundAlpha = IceBarElement.BackgroundAlpha
else
self.alpha = self.settings.alphaooc
self.backgroundAlpha = IceBarElement.BackgroundAlpha
end
end
-- Combat event handlers ------------------------------------------------------
function IceBarElement.prototype:InCombat()
self.combat = true
self:Update(self.unit)
end
function IceBarElement.prototype:OutCombat()
self.combat = false
self:Update(self.unit)
end
function IceBarElement.prototype:CheckCombat()
self.combat = UnitAffectingCombat("player")
self:Update(self.unit)
end

View File

@ -1,71 +1,108 @@
local AceOO = AceLibrary("AceOO-2.0") local AceOO = AceLibrary("AceOO-2.0")
IceCore = AceOO.Class("AceEvent-2.0") IceCore = AceOO.Class("AceEvent-2.0", "AceDB-2.0")
IceCore.Side = { Left = "LEFT", Right = "RIGHT" } IceCore.Side = { Left = "LEFT", Right = "RIGHT" }
IceCore.Width = 150
-- Events modules should register/trigger during load -- Events modules should register/trigger during load
IceCore.Loaded = "IceCore_Loaded" IceCore.Loaded = "IceCore_Loaded"
IceCore.RegisterModule = "IceCore_RegisterModule" IceCore.RegisterModule = "IceCore_RegisterModule"
-- 'Private' variables -- Private variables --
IceCore.prototype.settings = nil
IceCore.prototype.IceHUDFrame = nil IceCore.prototype.IceHUDFrame = nil
IceCore.prototype.elements = {} IceCore.prototype.elements = {}
-- Constructor --
function IceCore.prototype:init() function IceCore.prototype:init()
IceCore.super.prototype.init(self) IceCore.super.prototype.init(self)
IceHUD:Debug("IceCore.prototype:init()") IceHUD:Debug("IceCore.prototype:init()")
self:DrawFrame() self:RegisterDB("IceCoreDB")
self.IceHUDFrame = CreateFrame("Frame","IceHUDFrame", WorldFrame)
-- We are ready to load modules -- We are ready to load modules
self:RegisterEvent(IceCore.RegisterModule, "Register") self:RegisterEvent(IceCore.RegisterModule, "Register")
self:TriggerEvent(IceCore.Loaded) self:TriggerEvent(IceCore.Loaded)
-- DEFAULT SETTINGS
local defaults = {
gap = 150,
verticalPos = -150,
scale = 1,
alphaooc = 0.3,
alphaic = 0.6
}
-- get default settings from the modules
defaults.modules = {}
for i = 1, table.getn(self.elements) do
local name = self.elements[i]:GetName()
defaults.modules[name] = self.elements[i]:GetDefaultSettings()
end
self:RegisterDefaults('account', defaults)
end end
function IceCore.prototype:Enable() function IceCore.prototype:Enable()
self.settings = self.db.account
IceElement.Alpha = self.settings.bar
self:DrawFrame()
for i = 1, table.getn(self.elements) do for i = 1, table.getn(self.elements) do
self.elements[i]:SetDatabase(self.settings)
self.elements[i]:Create(self.IceHUDFrame) self.elements[i]:Create(self.IceHUDFrame)
self.elements[i]:Enable() if (self.elements[i]:IsEnabled()) then
self.elements[i]:Enable()
end
end end
end end
function IceCore.prototype:DrawFrame() function IceCore.prototype:DrawFrame()
self.IceHUDFrame = CreateFrame("Frame","IceHUDFrame", UIParent)
self.IceHUDFrame:SetFrameStrata("BACKGROUND") self.IceHUDFrame:SetFrameStrata("BACKGROUND")
self.IceHUDFrame:SetWidth(IceCore.Width) self.IceHUDFrame:SetWidth(self.settings.gap)
self.IceHUDFrame:SetHeight(20) self.IceHUDFrame:SetHeight(20)
self:SetScale(self.settings.scale)
-- For debug purposes self.IceHUDFrame:SetPoint("CENTER", 0, self.settings.verticalPos)
--[[
self.IceHUDFrame:SetBackdrop(
{
bgFile = "Interface/Tooltips/UI-Tooltip-Background",
edgeFile = "Interface/Tooltips/UI-ToolTip-Border",
tile = false,
tileSize = 32,
edgeSize = 14,
insets = { left = 4, right = 4, top = 4, bottom = 4 }
} )
self.IceHUDFrame:SetBackdropColor(0.5, 0.5, 0.5, 0.1)
self.IceHUDFrame:SetBackdropBorderColor(0.4, 0.4, 0.4, 0.1)
--]]
self.IceHUDFrame:SetPoint("CENTER", 0, -150)
self.IceHUDFrame:Show() self.IceHUDFrame:Show()
end end
function IceCore.prototype:Redraw()
for i = 1, table.getn(self.elements) do
self.elements[i]:Redraw()
end
end
function IceCore.prototype:GetModuleOptions()
local options = {}
for i = 1, table.getn(self.elements) do
local modName = self.elements[i]:GetName()
local opt = self.elements[i]:GetOptions()
options[modName] = {
type = 'group',
desc = 'Module options',
name = modName,
args = opt
}
end
return options
end
-- Method to handle module registration -- Method to handle module registration
function IceCore.prototype:Register(element) function IceCore.prototype:Register(element)
@ -74,3 +111,61 @@ function IceCore.prototype:Register(element)
table.insert(self.elements, element) table.insert(self.elements, element)
end end
-------------------------------------------------------------------------------
-- Configuration methods --
-------------------------------------------------------------------------------
function IceCore.prototype:ResetSettings()
self:ResetDB()
ReloadUI()
end
function IceCore.prototype:GetVerticalPos()
return self.settings.verticalPos
end
function IceCore.prototype:SetVerticalPos(value)
self.settings.verticalPos = value
self.IceHUDFrame:ClearAllPoints()
self.IceHUDFrame:SetPoint("CENTER", 0, self.settings.verticalPos)
end
function IceCore.prototype:GetGap()
return self.settings.gap
end
function IceCore.prototype:SetGap(value)
self.settings.gap = value
self.IceHUDFrame:SetWidth(self.settings.gap)
end
function IceCore.prototype:GetScale()
return self.settings.scale
end
function IceCore.prototype:SetScale(value)
self.settings.scale = value
local scale = UIParent:GetScale() * value
self.IceHUDFrame:SetScale(scale)
end
function IceCore.prototype:GetAlphaOOC()
return self.settings.alphaooc
end
function IceCore.prototype:SetAlphaOOC(value)
self.settings.alphaooc = value
self:Redraw()
end
function IceCore.prototype:GetAlphaIC()
return self.settings.alphaic
end
function IceCore.prototype:SetAlphaIC(value)
self.settings.alphaic = value
self:Redraw()
end

View File

@ -3,9 +3,7 @@ local AceOO = AceLibrary("AceOO-2.0")
IceElement = AceOO.Class("AceEvent-2.0") IceElement = AceOO.Class("AceEvent-2.0")
IceElement.virtual = true IceElement.virtual = true
IceElement.Alpha = 0.3 -- default alpha for hud elements -- Protected variables --
-- Private variables --
IceElement.prototype.name = nil IceElement.prototype.name = nil
IceElement.prototype.parent = nil IceElement.prototype.parent = nil
IceElement.prototype.frame = nil IceElement.prototype.frame = nil
@ -13,6 +11,9 @@ IceElement.prototype.frame = nil
IceElement.prototype.colors = {} -- Shared table for all child classes to save some memory IceElement.prototype.colors = {} -- Shared table for all child classes to save some memory
IceElement.prototype.alpha = nil IceElement.prototype.alpha = nil
IceElement.settings = nil
IceElement.moduleSettings = nil
-- Constructor -- -- Constructor --
-- IceElements are to be instantiated before IceCore is loaded. -- IceElements are to be instantiated before IceCore is loaded.
@ -20,11 +21,10 @@ IceElement.prototype.alpha = nil
-- module to the core with another event. -- module to the core with another event.
function IceElement.prototype:init(name) function IceElement.prototype:init(name)
IceElement.super.prototype.init(self) IceElement.super.prototype.init(self)
assert(name, "IceElement must have a name") assert(name, "IceElement must have a name")
self.name = name self.name = name
self.alpha = IceElement.Alpha self.alpha = 1
-- Some common colors -- Some common colors
self:SetColor("text", 1, 1, 1) self:SetColor("text", 1, 1, 1)
@ -54,6 +54,17 @@ function IceElement.prototype:Create(parent)
end end
function IceElement.prototype:SetDatabase(db)
self.settings = db
self.moduleSettings = db.modules[self.name]
end
function IceElement.prototype:IsEnabled()
return self.moduleSettings.enabled
end
function IceElement.prototype:Enable() function IceElement.prototype:Enable()
self.frame:Show() self.frame:Show()
end end
@ -65,12 +76,56 @@ function IceElement.prototype:Disable()
end end
-- inherting classes should override this and provide
-- make sure they refresh any changes made to them
function IceElement.prototype:Redraw()
end
-- inheriting classes should override this and provide
-- AceOptions table for configuration
function IceElement.prototype:GetOptions()
local opts = {}
opts["enabled"] = {
type = "toggle",
name = "Enabled",
desc = "Enable/disable module",
get = function()
return self.moduleSettings.enabled
end,
set = function(value)
self.moduleSettings.enabled = value
if (value) then
self:Enable()
else
self:Disable()
end
end,
order = 20
}
return opts
end
-- inheriting classes should override this and provide
-- default settings to populate db
function IceElement.prototype:GetDefaultSettings()
local defaults = {}
defaults["enabled"] = true
return defaults
end
-- 'Protected' methods -------------------------------------------------------- -- 'Protected' methods --------------------------------------------------------
-- This should be overwritten by inheriting classes -- This should be overwritten by inheriting classes
function IceElement.prototype:CreateFrame() function IceElement.prototype:CreateFrame()
self.frame = CreateFrame("Frame", nil, self.parent) if not (self.frame) then
self.frame = CreateFrame("Frame", nil, self.parent)
end
end end
@ -133,6 +188,8 @@ function IceElement.prototype:FontFactory(weight, size, frame)
return font return font
end end
-- Event Handlers ------------------------------------------------------------- -- Event Handlers -------------------------------------------------------------
-- Register ourself to the core -- Register ourself to the core

View File

@ -1,13 +1,162 @@
IceHUD = AceLibrary("AceAddon-2.0"):new("AceDebug-2.0") IceHUD = AceLibrary("AceAddon-2.0"):new("AceConsole-2.0", "AceDebug-2.0")
local AceOO = AceLibrary("AceOO-2.0")
IceHUD.dewdrop = AceLibrary("Dewdrop-2.0")
IceHUD.Location = "Interface\\AddOns\\IceHUD" IceHUD.Location = "Interface\\AddOns\\IceHUD"
IceHUD.temp = nil
IceHUD.options =
{
type = 'group',
args =
{
headerGeneral = {
type = 'header',
name = "General Settings",
order = 10
},
vpos = {
type = 'range',
name = 'Vertical position',
desc = 'Vertical position',
get = function()
return IceHUD.IceCore:GetVerticalPos()
end,
set = function(v)
IceHUD.IceCore:SetVerticalPos(v)
end,
min = -300,
max = 300,
step = 10,
order = 11
},
gap = {
type = 'range',
name = 'Gap',
desc = 'Distance between the left and right bars',
get = function()
return IceHUD.IceCore:GetGap()
end,
set = function(v)
IceHUD.IceCore:SetGap(v)
end,
min = 50,
max = 300,
step = 5,
order = 12,
},
scale = {
type = 'range',
name = 'Scale',
desc = 'HUD scale',
get = function()
return IceHUD.IceCore:GetScale()
end,
set = function(v)
IceHUD.IceCore:SetScale(v)
end,
min = 0.5,
max = 1.5,
step = 0.05,
order = 13,
},
alphaooc = {
type = 'range',
name = 'Alpha OOC',
desc = 'Bar alpha Out Of Combat',
get = function()
return IceHUD.IceCore:GetAlphaOOC()
end,
set = function(v)
IceHUD.IceCore:SetAlphaOOC(v)
end,
min = 0,
max = 1,
step = 0.05,
order = 14,
},
alphaic = {
type = 'range',
name = 'Alpha IC',
desc = 'Bar alpha In Combat',
get = function()
return IceHUD.IceCore:GetAlphaIC()
end,
set = function(v)
IceHUD.IceCore:SetAlphaIC(v)
end,
min = 0,
max = 1,
step = 0.05,
order = 15
},
headerModules = {
type = 'header',
name = 'Module Settings',
order = 40
},
modules = {
type='group',
desc = 'Module configuration options',
name = 'Modules',
args = {},
order = 41
},
headerOther = {
type = 'header',
name = 'Other Settings',
order = 90
},
reset = {
type = 'execute',
name = '|cffff0000Reset|r',
desc = "Resets all IceHUD options - WARNING: Reloads UI",
func = function()
IceHUD.IceCore:ResetSettings()
end,
order = 91
},
dewdrop = {
type = 'execute',
name = 'dewdrop',
desc = 'Open Dewdrop menu for commands',
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
IceHUD.dewdrop:Open(IceHUD.IceCore.IceHUDFrame)
end,
order = 92
}
}
}
function IceHUD:OnInitialize() function IceHUD:OnInitialize()
self:SetDebugging(false) self:SetDebugging(false)
self:Debug("IceHUD:OnInitialize()") self:Debug("IceHUD:OnInitialize()")
self.IceCore = IceCore:new() self.IceCore = IceCore:new()
self.options.args.modules.args = self.IceCore:GetModuleOptions()
self:RegisterChatCommand({ "/icehud" }, IceHUD.options)
end end

View File

@ -1,17 +1,25 @@
## Interface: 11100 ## Interface: 11100
## Author: Iceroth ## Author: Iceroth
## Name: IceHUD
## Title: IceHUD |cff7fff7f -Ace2-|r ## Title: IceHUD |cff7fff7f -Ace2-|r
## Notes: Another HUD mod ## Notes: Another HUD mod
## Version: 0.11 ## Version: 0.2 ($Revision$)
## X-Category: UnitFrames ## SavedVariables: IceCoreDB
## X-Category: UnitFrame
## X-Date: $Date$
## X-Website: http://www.wowace.com/forums/index.php/topic,1705.0.html
libs\AceLibrary\AceLibrary.lua libs\AceLibrary\AceLibrary.lua
libs\AceOO-2.0\AceOO-2.0.lua libs\AceOO-2.0\AceOO-2.0.lua
libs\AceDB-2.0\AceDB-2.0.lua
libs\AceEvent-2.0\AceEvent-2.0.lua 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\AceLocale-2.0\AceLocale-2.0.lua libs\AceLocale-2.0\AceLocale-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\Metrognome-2.0\Metrognome-2.0.lua libs\Metrognome-2.0\Metrognome-2.0.lua
libs\Dewdrop-2.0\Dewdrop-2.0.lua
IceCore.lua IceCore.lua
IceHUD.lua IceHUD.lua
@ -24,6 +32,8 @@ modules\PlayerHealth.lua
modules\PlayerMana.lua modules\PlayerMana.lua
modules\TargetHealth.lua modules\TargetHealth.lua
modules\TargetMana.lua modules\TargetMana.lua
modules\PetHealth.lua
modules\PetMana.lua
modules\DruidMana.lua modules\DruidMana.lua
modules\TargetInfo.lua modules\TargetInfo.lua
modules\TargetOfTarget.lua modules\TargetOfTarget.lua

View File

@ -5,7 +5,7 @@ IceUnitBar.virtual = true
IceUnitBar.prototype.unit = nil IceUnitBar.prototype.unit = nil
IceUnitBar.prototype.alive = nil IceUnitBar.prototype.alive = nil
IceUnitBar.prototype.combat = nil
IceUnitBar.prototype.tapped = nil IceUnitBar.prototype.tapped = nil
IceUnitBar.prototype.health = nil IceUnitBar.prototype.health = nil
@ -18,6 +18,8 @@ IceUnitBar.prototype.manaPercentage = nil
IceUnitBar.prototype.unitClass = nil IceUnitBar.prototype.unitClass = nil
IceUnitBar.prototype.hasPet = nil
-- Constructor -- -- Constructor --
function IceUnitBar.prototype:init(name, unit) function IceUnitBar.prototype:init(name, unit)
@ -41,27 +43,23 @@ function IceUnitBar.prototype:Enable()
self:RegisterEvent("PLAYER_ALIVE", "Alive") self:RegisterEvent("PLAYER_ALIVE", "Alive")
self:RegisterEvent("PLAYER_DEAD", "Dead") self:RegisterEvent("PLAYER_DEAD", "Dead")
self:RegisterEvent("PLAYER_REGEN_DISABLED", "InCombat")
self:RegisterEvent("PLAYER_REGEN_ENABLED", "OutCombat")
self.alive = not UnitIsDeadOrGhost(self.unit) self.alive = not UnitIsDeadOrGhost(self.unit)
self.combat = UnitAffectingCombat(self.unit) self.combat = UnitAffectingCombat(self.unit)
end end
-- OVERRIDE
function IceUnitBar.prototype:Redraw()
IceUnitBar.super.prototype.Redraw(self)
self:Update(self.unit)
end
-- 'Protected' methods -------------------------------------------------------- -- 'Protected' methods --------------------------------------------------------
-- To be overridden
function IceUnitBar.prototype:Update(unit) function IceUnitBar.prototype:Update()
if (self.combat) then IceUnitBar.super.prototype.Update(self)
self.alpha = IceElement.Alpha + 0.2
self.backgroundAlpha = IceBarElement.BackgroundAlpha
else
self.alpha = IceElement.Alpha
self.backgroundAlpha = IceBarElement.BackgroundAlpha
end
self.tapped = UnitIsTapped(self.unit) and (not UnitIsTappedByPlayer(self.unit)) self.tapped = UnitIsTapped(self.unit) and (not UnitIsTappedByPlayer(self.unit))
self.health = UnitHealth(self.unit) self.health = UnitHealth(self.unit)
@ -88,13 +86,3 @@ function IceUnitBar.prototype:Dead()
end end
function IceUnitBar.prototype:InCombat()
self.combat = true
self:Update(self.unit)
end
function IceUnitBar.prototype:OutCombat()
self.combat = false
self:Update(self.unit)
end

View File

@ -19,8 +19,6 @@ CastBar.prototype.debug = 0
-- Constructor -- -- Constructor --
function CastBar.prototype:init() function CastBar.prototype:init()
CastBar.super.prototype.init(self, "CastBar") CastBar.super.prototype.init(self, "CastBar")
self.side = IceCore.Side.Left
self.offset = 0
self:SetColor("castCasting", 242, 242, 10) self:SetColor("castCasting", 242, 242, 10)
self:SetColor("castChanneling", 117, 113, 161) self:SetColor("castChanneling", 117, 113, 161)
@ -32,10 +30,19 @@ end
-- 'Public' methods ----------------------------------------------------------- -- 'Public' methods -----------------------------------------------------------
function CastBar.prototype:GetDefaultSettings()
local settings = CastBar.super.prototype.GetDefaultSettings(self)
settings["side"] = IceCore.Side.Left
settings["offset"] = 0
return settings
end
function CastBar.prototype:Enable() function CastBar.prototype:Enable()
CastBar.super.prototype.Enable(self) CastBar.super.prototype.Enable(self)
self.frame.bottomUpperText:SetWidth(200) self.frame.bottomUpperText:SetWidth(180)
self:RegisterEvent("SPELLCAST_START", "CastStart") self:RegisterEvent("SPELLCAST_START", "CastStart")
self:RegisterEvent("SPELLCAST_STOP", "CastStop") self:RegisterEvent("SPELLCAST_STOP", "CastStop")
@ -76,12 +83,14 @@ function CastBar.prototype:OnUpdate()
local taken = GetTime() - self.startTime local taken = GetTime() - self.startTime
local scale = taken / (self.castTime + self.delay) local scale = taken / (self.castTime + self.delay)
self:Update()
if (self.casting or self.channeling) then if (self.casting or self.channeling) then
if (scale > 1) then -- lag compensation if (scale > 1) then -- lag compensation
scale = 1 scale = 1
end end
local timeRemaining = self.castTime - taken local timeRemaining = self.castTime + self.delay - taken
local remaining = string.format("%.1f", timeRemaining) local remaining = string.format("%.1f", timeRemaining)
if (timeRemaining < 0 and timeRemaining > -1.5) then -- lag compensation if (timeRemaining < 0 and timeRemaining > -1.5) then -- lag compensation
remaining = 0 remaining = 0
@ -92,7 +101,7 @@ function CastBar.prototype:OnUpdate()
end end
self:UpdateBar(scale, "castCasting") self:UpdateBar(scale, "castCasting")
self:SetBottomText1(remaining .. "s " .. self:GetFormattedText(self.spellName)) self:SetBottomText1(remaining .. "s " .. self.spellName)
elseif (self.failing) then elseif (self.failing) then
self.alpha = 0.7 self.alpha = 0.7
@ -180,7 +189,6 @@ function CastBar.prototype:CastTerminated(reason)
end end
function CastBar.prototype:CastDelayed(delay) function CastBar.prototype:CastDelayed(delay)
self.delay = self.delay + (delay / 1000) self.delay = self.delay + (delay / 1000)
end end
@ -188,8 +196,6 @@ end
function CastBar.prototype:ChannelingStart(duration, spell) function CastBar.prototype:ChannelingStart(duration, spell)
self.spellName = spell self.spellName = spell
self.castTime = duration / 1000 self.castTime = duration / 1000
@ -225,7 +231,7 @@ function CastBar.prototype:CleanUp()
self.failing = false self.failing = false
self.succeeding = false self.succeeding = false
self:SetBottomText1() self:SetBottomText1()
self.alpha = IceElement.Alpha self.alpha = self.settings.alphaooc
end end

View File

@ -16,6 +16,14 @@ function DruidMana.prototype:init()
end end
function DruidMana.prototype:GetDefaultSettings()
local settings = DruidMana.super.prototype.GetDefaultSettings(self)
settings["side"] = IceCore.Side.Right
settings["offset"] = 0
return settings
end
function DruidMana.prototype:Enable() function DruidMana.prototype:Enable()
DruidMana.super.prototype.Enable(self) DruidMana.super.prototype.Enable(self)
@ -26,6 +34,7 @@ function DruidMana.prototype:Enable()
self:RegisterEvent("UNIT_DISPLAYPOWER", "FormsChanged") self:RegisterEvent("UNIT_DISPLAYPOWER", "FormsChanged")
self:FormsChanged(self.unit)
self:Update() self:Update()
end end

View File

@ -1,7 +1,7 @@
local AceOO = AceLibrary("AceOO-2.0") local AceOO = AceLibrary("AceOO-2.0")
-- 2 classes in the same file.. ugly but keeps the idea of -- 2 classes in the same file.. ugly but keeps the idea of
-- "1 module, 1 file" intact -- "1 module = 1 file" intact
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -19,10 +19,12 @@ MirrorBar.prototype.label = nil
-- Constructor -- -- Constructor --
function MirrorBar.prototype:init(side, offset, name) function MirrorBar.prototype:init(side, offset, name, db)
MirrorBar.super.prototype.init(self, name) MirrorBar.super.prototype.init(self, name)
self.side = side self.settings = db
self.offset = offset self.moduleSettings = {}
self.moduleSettings.side = side
self.moduleSettings.offset = offset
-- unregister the event superclass registered, we don't want to register -- unregister the event superclass registered, we don't want to register
-- this to the core -- this to the core
@ -30,6 +32,12 @@ function MirrorBar.prototype:init(side, offset, name)
end end
function MirrorBar.prototype:UpdatePosition(side, offset)
self.moduleSettings.side = side
self.moduleSettings.offset = offset
end
function MirrorBar.prototype:Enable() function MirrorBar.prototype:Enable()
MirrorBar.super.prototype.Enable(self) MirrorBar.super.prototype.Enable(self)
@ -68,9 +76,11 @@ function MirrorBar.prototype:OnUpdate(elapsed)
local text = self.label .. " " .. remaining .. "s" local text = self.label .. " " .. remaining .. "s"
if (math.mod(self.offset, 2) == 1) then if (math.mod(self.moduleSettings.offset, 2) == 1) then
self:SetBottomText1(text) self:SetBottomText1(text)
self:SetBottomText2()
else else
self:SetBottomText1()
self:SetBottomText2(text, "text", 1) self:SetBottomText2(text, "text", 1)
end end
end end
@ -136,9 +146,7 @@ MirrorBarHandler.prototype.bars = nil
-- Constructor -- -- Constructor --
function MirrorBarHandler.prototype:init() function MirrorBarHandler.prototype:init()
MirrorBarHandler.super.prototype.init(self, "MirrorBarHandler") MirrorBarHandler.super.prototype.init(self, "MirrorBarHandler")
self.side = IceCore.Side.Left
self.offset = 3
self.bars = {} self.bars = {}
self:SetColor("EXHAUSTION", 1, 0.9, 0) self:SetColor("EXHAUSTION", 1, 0.9, 0)
@ -148,6 +156,65 @@ function MirrorBarHandler.prototype:init()
end end
function MirrorBarHandler.prototype:GetDefaultSettings()
local settings = MirrorBarHandler.super.prototype.GetDefaultSettings(self)
settings["side"] = IceCore.Side.Left
settings["offset"] = 3
return settings
end
-- OVERRIDE
function MirrorBarHandler.prototype:GetOptions()
local opts = MirrorBarHandler.super.prototype.GetOptions(self)
opts["side"] =
{
type = 'group',
name = 'side',
desc = 'Side of the HUD where the bar appears',
args = {
left = {
type = 'execute',
name = 'left',
desc = "Left side",
func = function()
self.moduleSettings.side = IceCore.Side.Left
self:Redraw()
end
},
right = {
type = 'execute',
name = 'right',
desc = "Right side",
func = function()
self.moduleSettings.side = IceCore.Side.Right
self:Redraw()
end
}
}
}
opts["offset"] =
{
type = 'range',
name = 'offset',
desc = 'Offset of the bar',
min = -1,
max = 10,
step = 1,
get = function()
return self.moduleSettings.offset
end,
set = function(value)
self.moduleSettings.offset = value
self:Redraw()
end
}
return opts
end
function MirrorBarHandler.prototype:Enable() function MirrorBarHandler.prototype:Enable()
MirrorBarHandler.super.prototype.Enable(self) MirrorBarHandler.super.prototype.Enable(self)
self:RegisterEvent("MIRROR_TIMER_START", "MirrorStart") self:RegisterEvent("MIRROR_TIMER_START", "MirrorStart")
@ -166,6 +233,16 @@ function MirrorBarHandler.prototype:Disable()
end end
function MirrorBarHandler.prototype:Redraw()
MirrorBarHandler.super.prototype.Redraw(self)
for i = 1, table.getn(self.bars) do
self.bars[i]:UpdatePosition(self.moduleSettings.side, self.moduleSettings.offset + (i-1))
self.bars[i]:Create(self.parent)
end
end
function MirrorBarHandler.prototype:MirrorStart(timer, value, maxValue, scale, paused, label) function MirrorBarHandler.prototype:MirrorStart(timer, value, maxValue, scale, paused, label)
local done = nil local done = nil
@ -190,7 +267,7 @@ function MirrorBarHandler.prototype:MirrorStart(timer, value, maxValue, scale, p
-- finally create a new instance if no available ones were found -- finally create a new instance if no available ones were found
if not (done) then if not (done) then
local count = table.getn(self.bars) local count = table.getn(self.bars)
self.bars[count + 1] = MirrorBar:new(self.side, self.offset + count, "MirrorBar" .. tostring(count+1)) self.bars[count + 1] = MirrorBar:new(self.moduleSettings.side, self.moduleSettings.offset + count, "MirrorBar" .. tostring(count+1), self.settings)
self.bars[count + 1]:Create(self.parent) self.bars[count + 1]:Create(self.parent)
self.bars[count + 1]:Enable() self.bars[count + 1]:Enable()
self.bars[count + 1]:MirrorStart(timer, value, maxValue, scale, paused, label) self.bars[count + 1]:MirrorStart(timer, value, maxValue, scale, paused, label)

106
modules/PetHealth.lua Normal file
View File

@ -0,0 +1,106 @@
local AceOO = AceLibrary("AceOO-2.0")
local PetHealth = AceOO.Class(IceUnitBar)
-- Constructor --
function PetHealth.prototype:init()
PetHealth.super.prototype.init(self, "PetHealth", "pet")
self:SetColor("petHealth", 37, 164, 30)
end
function PetHealth.prototype:GetDefaultSettings()
local settings = PetHealth.super.prototype.GetDefaultSettings(self)
settings["side"] = IceCore.Side.Left
settings["offset"] = -1
settings["scale"] = 0.7
return settings
end
-- OVERRIDE
function PetHealth.prototype:GetOptions()
local opts = PetHealth.super.prototype.GetOptions(self)
opts["scale"] =
{
type = 'range',
name = 'scale',
desc = 'Scale of the bar',
min = 0.2,
max = 1,
step = 0.05,
get = function()
return self.moduleSettings.scale
end,
set = function(value)
self.moduleSettings.scale = value
self:Redraw()
end
}
return opts
end
-- OVERRIDE
function PetHealth.prototype:CreateFrame()
PetHealth.super.prototype.CreateFrame(self)
self.frame:SetScale(self.moduleSettings.scale)
local point, relativeTo, relativePoint, xoff, yoff = self.frame.bottomUpperText:GetPoint()
if (point == "TOPLEFT") then
point = "BOTTOMLEFT"
else
point = "BOTTOMRIGHT"
end
self.frame.bottomUpperText:ClearAllPoints()
self.frame.bottomUpperText:SetPoint(point, relativeTo, relativePoint, 0, 0)
end
function PetHealth.prototype:Enable()
PetHealth.super.prototype.Enable(self)
self:RegisterEvent("PET_UI_UPDATE", "CheckPet");
self:RegisterEvent("PLAYER_PET_CHANGED", "CheckPet");
self:RegisterEvent("PET_BAR_CHANGED", "CheckPet");
self:RegisterEvent("UNIT_PET", "CheckPet");
self:RegisterEvent("UNIT_HEALTH", "Update")
self:RegisterEvent("UNIT_MAXHEALTH", "Update")
self:CheckPet()
end
function PetHealth.prototype:CheckPet()
if (UnitExists(self.unit)) then
self.frame:Show()
self:Update(self.unit)
else
self.frame:Hide()
end
end
function PetHealth.prototype:Update(unit)
PetHealth.super.prototype.Update(self)
if (unit and (unit ~= self.unit)) then
return
end
local color = "petHealth"
if not (self.alive) then
color = "dead"
end
self:UpdateBar(self.health/self.maxHealth, color)
self:SetBottomText1(self.healthPercentage)
end
-- Load us up
PetHealth:new()

141
modules/PetMana.lua Normal file
View File

@ -0,0 +1,141 @@
local AceOO = AceLibrary("AceOO-2.0")
local PetMana = AceOO.Class(IceUnitBar)
-- Constructor --
function PetMana.prototype:init()
PetMana.super.prototype.init(self, "PetMana", "pet")
self:SetColor("petMana", 62, 54, 152)
self:SetColor("petRage", 171, 59, 59)
self:SetColor("petEnergy", 218, 231, 31)
self:SetColor("targetFocus", 242, 149, 98)
end
-- OVERRIDE
function PetMana.prototype:GetOptions()
local opts = PetMana.super.prototype.GetOptions(self)
opts["scale"] =
{
type = 'range',
name = 'scale',
desc = 'Scale of the bar',
min = 0.2,
max = 1,
step = 0.05,
get = function()
return self.moduleSettings.scale
end,
set = function(value)
self.moduleSettings.scale = value
self:Redraw()
end
}
return opts
end
function PetMana.prototype:GetDefaultSettings()
local settings = PetMana.super.prototype.GetDefaultSettings(self)
settings["side"] = IceCore.Side.Right
settings["offset"] = -1
settings["scale"] = 0.7
return settings
end
-- OVERRIDE
function PetMana.prototype:CreateFrame()
PetMana.super.prototype.CreateFrame(self)
self.frame:SetScale(self.moduleSettings.scale)
local point, relativeTo, relativePoint, xoff, yoff = self.frame.bottomUpperText:GetPoint()
if (point == "TOPLEFT") then
point = "BOTTOMLEFT"
else
point = "BOTTOMRIGHT"
end
self.frame.bottomUpperText:ClearAllPoints()
self.frame.bottomUpperText:SetPoint(point, relativeTo, relativePoint, 0, 0)
end
function PetMana.prototype:Enable()
PetMana.super.prototype.Enable(self)
self:RegisterEvent("PET_UI_UPDATE", "CheckPet");
self:RegisterEvent("PLAYER_PET_CHANGED", "CheckPet");
self:RegisterEvent("PET_BAR_CHANGED", "CheckPet");
self:RegisterEvent("UNIT_PET", "CheckPet");
self:RegisterEvent("UNIT_MANA", "Update")
self:RegisterEvent("UNIT_MAXMANA", "Update")
self:RegisterEvent("UNIT_RAGE", "Update")
self:RegisterEvent("UNIT_MAXRAGE", "Update")
self:RegisterEvent("UNIT_ENERGY", "Update")
self:RegisterEvent("UNIT_MAXENERGY", "Update")
self:RegisterEvent("UNIT_DISPLAYPOWER", "ManaType")
self:CheckPet()
self:ManaType(self.unit)
end
function PetMana.prototype:CheckPet()
if (UnitExists(self.unit)) then
self.frame:Show()
self:Update(self.unit)
else
self.frame:Hide()
end
end
function PetMana.prototype:ManaType(unit)
if (unit ~= self.unit) then
return
end
self.manaType = UnitPowerType(self.unit)
self:Update(self.unit)
end
function PetMana.prototype:Update(unit)
PetMana.super.prototype.Update(self)
if (unit and (unit ~= self.unit)) then
return
end
if ((not UnitExists(unit)) or (self.maxMana == 0)) then
self.frame:Hide()
return
else
self.frame:Show()
end
local color = "petMana"
if not (self.alive) then
color = "dead"
else
local color = "petMana"
if (self.manaType == 1) then
color = "petRage"
elseif (self.manaType == 2) then
color = "petFocus"
elseif (self.manaType == 3) then
color = "petEnergy"
end
end
self:UpdateBar(self.mana/self.maxMana, color)
self:SetBottomText1(self.manaPercentage)
end
-- Load us up
PetMana:new()

View File

@ -5,13 +5,19 @@ local PlayerHealth = AceOO.Class(IceUnitBar)
-- Constructor -- -- Constructor --
function PlayerHealth.prototype:init() function PlayerHealth.prototype:init()
PlayerHealth.super.prototype.init(self, "PlayerHealth", "player") PlayerHealth.super.prototype.init(self, "PlayerHealth", "player")
self.side = IceCore.Side.Left
self.offset = 1
self:SetColor("playerHealth", 37, 164, 30) self:SetColor("playerHealth", 37, 164, 30)
end end
function PlayerHealth.prototype:GetDefaultSettings()
local settings = PlayerHealth.super.prototype.GetDefaultSettings(self)
settings["side"] = IceCore.Side.Left
settings["offset"] = 1
return settings
end
function PlayerHealth.prototype:Enable() function PlayerHealth.prototype:Enable()
PlayerHealth.super.prototype.Enable(self) PlayerHealth.super.prototype.Enable(self)

View File

@ -7,14 +7,20 @@ PlayerMana.prototype.manaType = nil
-- Constructor -- -- Constructor --
function PlayerMana.prototype:init() function PlayerMana.prototype:init()
PlayerMana.super.prototype.init(self, "PlayerMana", "player") PlayerMana.super.prototype.init(self, "PlayerMana", "player")
self.side = IceCore.Side.Right
self.offset = 1
self:SetColor("playerMana", 62, 54, 152) self:SetColor("playerMana", 62, 54, 152)
self:SetColor("playerRage", 171, 59, 59) self:SetColor("playerRage", 171, 59, 59)
self:SetColor("playerEnergy", 218, 231, 31) self:SetColor("playerEnergy", 218, 231, 31)
end end
function PlayerMana.prototype:GetDefaultSettings()
local settings = PlayerMana.super.prototype.GetDefaultSettings(self)
settings["side"] = IceCore.Side.Right
settings["offset"] = 1
return settings
end
function PlayerMana.prototype:Enable() function PlayerMana.prototype:Enable()
PlayerMana.super.prototype.Enable(self) PlayerMana.super.prototype.Enable(self)
@ -29,7 +35,6 @@ function PlayerMana.prototype:Enable()
self:RegisterEvent("UNIT_DISPLAYPOWER", "ManaType") self:RegisterEvent("UNIT_DISPLAYPOWER", "ManaType")
self:ManaType(self.unit) self:ManaType(self.unit)
self:Update("player")
end end

View File

@ -5,8 +5,6 @@ local TargetHealth = AceOO.Class(IceUnitBar)
-- Constructor -- -- Constructor --
function TargetHealth.prototype:init() function TargetHealth.prototype:init()
TargetHealth.super.prototype.init(self, "TargetHealth", "target") TargetHealth.super.prototype.init(self, "TargetHealth", "target")
self.side = IceCore.Side.Left
self.offset = 2
self:SetColor("targetHealthHostile", 231, 31, 36) self:SetColor("targetHealthHostile", 231, 31, 36)
self:SetColor("targetHealthFriendly", 46, 223, 37) self:SetColor("targetHealthFriendly", 46, 223, 37)
@ -14,6 +12,15 @@ function TargetHealth.prototype:init()
end end
function TargetHealth.prototype:GetDefaultSettings()
local settings = TargetHealth.super.prototype.GetDefaultSettings(self)
settings["side"] = IceCore.Side.Left
settings["offset"] = 2
return settings
end
function TargetHealth.prototype:Enable() function TargetHealth.prototype:Enable()
TargetHealth.super.prototype.Enable(self) TargetHealth.super.prototype.Enable(self)

View File

@ -25,13 +25,14 @@ function TargetInfo.prototype:Enable()
self:RegisterEvent("UNIT_AURA", "AuraChanged") self:RegisterEvent("UNIT_AURA", "AuraChanged")
self:RegisterEvent("UNIT_FACTION", "InfoTextChanged") self:RegisterEvent("UNIT_FACTION", "InfoTextChanged")
self:RegisterEvent("UNIT_LEVEL", "InfoTextChanged"); self:RegisterEvent("UNIT_LEVEL", "InfoTextChanged")
self:RegisterEvent("UNIT_CLASSIFICATION_CHANGED", "InfoTextChanged"); self:RegisterEvent("UNIT_CLASSIFICATION_CHANGED", "InfoTextChanged")
self:RegisterEvent("PLAYER_FLAGS_CHANGED", "InfoTextChanged"); self:RegisterEvent("PLAYER_FLAGS_CHANGED", "InfoTextChanged")
self:RegisterEvent("UNIT_DYNAMIC_FLAGS", "InfoTextChanged")
self:RegisterEvent("RAID_TARGET_UPDATE", "RaidIconChanged"); self:RegisterEvent("RAID_TARGET_UPDATE", "RaidIconChanged")
self:RegisterEvent("PLAYER_COMBO_POINTS", "ComboPointsChanged"); self:RegisterEvent("PLAYER_COMBO_POINTS", "ComboPointsChanged")
end end
@ -100,7 +101,7 @@ end
function TargetInfo.prototype:CreateComboFrame() function TargetInfo.prototype:CreateComboFrame()
self.frame.comboPoints = self:FontFactory("Bold", 18) self.frame.comboPoints = self:FontFactory("Bold", 20)
self.frame.comboPoints:SetWidth(TargetInfo.Width) self.frame.comboPoints:SetWidth(TargetInfo.Width)
self.frame.comboPoints:SetJustifyH("CENTER") self.frame.comboPoints:SetJustifyH("CENTER")
@ -268,6 +269,12 @@ function TargetInfo.prototype:TargetChanged()
end end
function TargetInfo.prototype:CombatCheck(arg1)
print(arg1)
end
function TargetInfo.prototype:GetInfoString() function TargetInfo.prototype:GetInfoString()
local u = "target" local u = "target"
@ -275,14 +282,14 @@ function TargetInfo.prototype:GetInfoString()
return "" return ""
end end
local class, _ = UnitClass(u) local class, unitClass = UnitClass(u)
local creatureType = UnitCreatureType(u) local creatureType = UnitCreatureType(u)
local classification = UnitClassification(u) local classification = UnitClassification(u)
local level = UnitLevel(u) local level = UnitLevel(u)
local isPlayer = UnitIsPlayer(u) local isPlayer = UnitIsPlayer(u)
local classColor = self:GetHexColor(class) local classColor = self:GetHexColor(unitClass)
local sLevel = "[??] " local sLevel = "[??] "
if (level > 0) then if (level > 0) then
@ -326,14 +333,13 @@ function TargetInfo.prototype:GetInfoString()
sLeader = "[Leader] " sLeader = "[Leader] "
end end
local guildName, guildRankName, guildRankIndex = GetGuildInfo("target") local sCombat = ""
local sGuild = "" --if (UnitAffectingCombat(u)) then
if (guildName) then -- sCombat = " +Combat+"
--sGuild = " <" .. guildName .. ">" --end
end
return string.format("%s%s%s%s%s%s", return string.format("%s%s%s%s%s%s",
sLevel, sClass, sPVP, sClassification, sLeader, sGuild) sLevel, sClass, sPVP, sClassification, sLeader, sCombat)
end end

View File

@ -2,11 +2,10 @@ local AceOO = AceLibrary("AceOO-2.0")
local TargetMana = AceOO.Class(IceUnitBar) local TargetMana = AceOO.Class(IceUnitBar)
-- Constructor -- -- Constructor --
function TargetMana.prototype:init() function TargetMana.prototype:init()
TargetMana.super.prototype.init(self, "TargetMana", "target") TargetMana.super.prototype.init(self, "TargetMana", "target")
self.side = IceCore.Side.Right
self.offset = 2
self:SetColor("targetMana", 52, 64, 221) self:SetColor("targetMana", 52, 64, 221)
self:SetColor("targetRage", 235, 44, 26) self:SetColor("targetRage", 235, 44, 26)
@ -15,6 +14,14 @@ function TargetMana.prototype:init()
end end
function TargetMana.prototype:GetDefaultSettings()
local settings = TargetMana.super.prototype.GetDefaultSettings(self)
settings["side"] = IceCore.Side.Right
settings["offset"] = 2
return settings
end
function TargetMana.prototype:Enable() function TargetMana.prototype:Enable()
TargetMana.super.prototype.Enable(self) TargetMana.super.prototype.Enable(self)

View File

@ -27,6 +27,12 @@ function TargetOfTarget.prototype:Enable()
end end
function TargetOfTarget.prototype:Disable()
TargetOfTarget.super.prototype.Disable(self)
Metrognome:Unregister("TargetOfTarget")
end
-- 'Protected' methods -------------------------------------------------------- -- 'Protected' methods --------------------------------------------------------
-- OVERRIDE -- OVERRIDE