- Even more configuration options

- SpellStatus lib for spell casting (shows rank now too)
This commit is contained in:
iceroth
2006-08-13 15:39:30 +00:00
parent f92e1fffd6
commit 212aa3c9f8
14 changed files with 580 additions and 249 deletions

View File

@ -7,8 +7,10 @@ IceBarElement.TexturePath = IceHUD.Location .. "\\textures\\"
IceBarElement.BarTextureWidth = 128 IceBarElement.BarTextureWidth = 128
IceBarElement.prototype.barFrame = nil IceBarElement.prototype.barFrame = nil
IceBarElement.prototype.backroundAlpha = nil
IceBarElement.prototype.combat = nil IceBarElement.prototype.combat = nil
IceBarElement.prototype.target = nil
@ -30,6 +32,22 @@ function IceBarElement.prototype:Enable()
self:RegisterEvent("PLAYER_REGEN_DISABLED", "InCombat") self:RegisterEvent("PLAYER_REGEN_DISABLED", "InCombat")
self:RegisterEvent("PLAYER_REGEN_ENABLED", "OutCombat") self:RegisterEvent("PLAYER_REGEN_ENABLED", "OutCombat")
self:RegisterEvent("PLAYER_ENTERING_WORLD", "CheckCombat") self:RegisterEvent("PLAYER_ENTERING_WORLD", "CheckCombat")
self:RegisterEvent("PLAYER_TARGET_CHANGED", "TargetChanged")
end
-- OVERRIDE
function IceBarElement.prototype:GetDefaultSettings()
local settings = IceBarElement.super.prototype.GetDefaultSettings(self)
settings["side"] = IceCore.Side.Left
settings["offset"] = 1
settings["barFontSize"] = 13
settings["barFontBold"] = true
settings["lockTextAlpha"] = true
settings["textVisible"] = {upper = true, lower = true}
return settings
end end
@ -40,7 +58,7 @@ function IceBarElement.prototype:GetOptions()
opts["side"] = opts["side"] =
{ {
type = 'text', type = 'text',
name = 'Side', name = '|c' .. self.configColor .. 'Side|r',
desc = 'Side of the HUD where the bar appears', desc = 'Side of the HUD where the bar appears',
get = function() get = function()
if (self.moduleSettings.side == IceCore.Side.Right) then if (self.moduleSettings.side == IceCore.Side.Right) then
@ -64,7 +82,7 @@ function IceBarElement.prototype:GetOptions()
opts["offset"] = opts["offset"] =
{ {
type = 'range', type = 'range',
name = 'Offset', name = '|c' .. self.configColor .. 'Offset|r',
desc = 'Offset of the bar', desc = 'Offset of the bar',
min = -1, min = -1,
max = 10, max = 10,
@ -79,6 +97,88 @@ function IceBarElement.prototype:GetOptions()
order = 31 order = 31
} }
opts["textSettings"] =
{
type = 'group',
name = '|c' .. self.configColor .. 'Text Settings|r',
desc = 'Settings related to texts',
order = 32,
args = {
fontsize = {
type = 'range',
name = 'Bar Font Size',
desc = 'Bar Font Size',
get = function()
return self.moduleSettings.barFontSize
end,
set = function(v)
self.moduleSettings.barFontSize = v
self:Redraw()
end,
min = 8,
max = 20,
step = 1,
order = 11
},
fontBold = {
type = 'toggle',
name = 'Bar Font Bold',
desc = 'If you have game default font selected, this option has no effect',
get = function()
return self.moduleSettings.barFontBold
end,
set = function(v)
self.moduleSettings.barFontBold = v
self:Redraw()
end,
order = 12
},
lockFontAlpha = {
type = "toggle",
name = "Lock Bar Text Alpha",
desc = "Locks upper text alpha to 100%",
get = function()
return self.moduleSettings.lockTextAlpha
end,
set = function(v)
self.moduleSettings.lockTextAlpha = v
self:Redraw()
end,
order = 13
},
upperTextVisible = {
type = 'toggle',
name = 'Upper text visible',
desc = 'Toggle upper text visibility',
get = function()
return self.moduleSettings.textVisible['upper']
end,
set = function(v)
self.moduleSettings.textVisible['upper'] = v
self:Redraw()
end,
order = 14
},
lowerTextVisible = {
type = 'toggle',
name = 'Lower text visible',
desc = 'Toggle lower text visibility',
get = function()
return self.moduleSettings.textVisible['lower']
end,
set = function(v)
self.moduleSettings.textVisible['lower'] = v
self:Redraw()
end,
order = 15
},
}
}
return opts return opts
end end
@ -193,8 +293,8 @@ end
function IceBarElement.prototype:CreateTexts() function IceBarElement.prototype:CreateTexts()
self.frame.bottomUpperText = self:FontFactory(self.settings.barFontBold, self.settings.barFontSize, nil, self.frame.bottomUpperText) self.frame.bottomUpperText = self:FontFactory(self.moduleSettings.barFontBold, self.moduleSettings.barFontSize, nil, self.frame.bottomUpperText)
self.frame.bottomLowerText = self:FontFactory(self.settings.barFontBold, self.settings.barFontSize, nil, self.frame.bottomLowerText) self.frame.bottomLowerText = self:FontFactory(self.moduleSettings.barFontBold, self.moduleSettings.barFontSize, nil, self.frame.bottomLowerText)
self.frame.bottomUpperText:SetWidth(80) self.frame.bottomUpperText:SetWidth(80)
self.frame.bottomLowerText:SetWidth(120) self.frame.bottomLowerText:SetWidth(120)
@ -239,13 +339,13 @@ function IceBarElement.prototype:CreateTexts()
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)
if (self.settings.textVisible["upper"]) then if (self.moduleSettings.textVisible["upper"]) then
self.frame.bottomUpperText:Show() self.frame.bottomUpperText:Show()
else else
self.frame.bottomUpperText:Hide() self.frame.bottomUpperText:Hide()
end end
if (self.settings.textVisible["lower"]) then if (self.moduleSettings.textVisible["lower"]) then
self.frame.bottomLowerText:Show() self.frame.bottomLowerText:Show()
else else
self.frame.bottomLowerText:Hide() self.frame.bottomLowerText:Hide()
@ -275,8 +375,12 @@ function IceBarElement.prototype:UpdateBar(scale, color, alpha)
alpha = alpha or 1 alpha = alpha or 1
self.frame:SetAlpha(alpha) self.frame:SetAlpha(alpha)
local c = self.settings.backgroundColor local r, g, b = self.settings.backgroundColor.r, self.settings.backgroundColor.g, self.settings.backgroundColor.b
self.frame:SetStatusBarColor(c.r, c.g, c.b, self.settings.alphabg) if (self.settings.backgroundToggle) then
r, g, b = self:GetColor(color)
end
self.frame:SetStatusBarColor(r, g, b, self.backgroundAlpha)
self.barFrame:SetStatusBarColor(self:GetColor(color)) self.barFrame:SetStatusBarColor(self:GetColor(color))
@ -287,7 +391,7 @@ end
-- Bottom line 1 -- Bottom line 1
function IceBarElement.prototype:SetBottomText1(text, color) function IceBarElement.prototype:SetBottomText1(text, color)
if not (self.settings.textVisible["upper"]) and not (self.moduleSettings.alwaysShowText) then if not (self.moduleSettings.textVisible["upper"]) then
return return
end end
@ -296,7 +400,7 @@ function IceBarElement.prototype:SetBottomText1(text, color)
end end
local alpha = 1 local alpha = 1
if not (self.settings.lockTextAlpha) then if not (self.moduleSettings.lockTextAlpha) then
-- boost text alpha a bit to make it easier to see -- boost text alpha a bit to make it easier to see
if (self.alpha > 0) then if (self.alpha > 0) then
alpha = self.alpha + 0.1 alpha = self.alpha + 0.1
@ -316,7 +420,7 @@ end
-- Bottom line 2 -- Bottom line 2
function IceBarElement.prototype:SetBottomText2(text, color, alpha) function IceBarElement.prototype:SetBottomText2(text, color, alpha)
if not (self.settings.textVisible["lower"]) and not (self.moduleSettings.alwaysShowText) then if not (self.moduleSettings.textVisible["lower"]) then
return return
end end
@ -352,8 +456,13 @@ end
function IceBarElement.prototype:Update() function IceBarElement.prototype:Update()
if (self.combat) then if (self.combat) then
self.alpha = self.settings.alphaic self.alpha = self.settings.alphaic
self.backgroundAlpha = self.settings.alphaicbg
elseif (self.target) then
self.alpha = self.settings.alphaTarget
self.backgroundAlpha = self.settings.alphaTargetbg
else else
self.alpha = self.settings.alphaooc self.alpha = self.settings.alphaooc
self.backgroundAlpha = self.settings.alphaoocbg
end end
end end
@ -376,5 +485,12 @@ end
function IceBarElement.prototype:CheckCombat() function IceBarElement.prototype:CheckCombat()
self.combat = UnitAffectingCombat("player") self.combat = UnitAffectingCombat("player")
self.target = UnitExists("target")
self:Update(self.unit)
end
function IceBarElement.prototype:TargetChanged()
self.target = UnitExists("target")
self:Update(self.unit) self:Update(self.unit)
end end

View File

@ -37,15 +37,20 @@ function IceCore.prototype:init()
gap = 150, gap = 150,
verticalPos = -150, verticalPos = -150,
scale = 1, scale = 1,
alphaooc = 0.3, alphaooc = 0.3,
alphaic = 0.6, alphaic = 0.6,
alphabg = 0.2, alphaTarget = 0.3,
alphaoocbg = 0.2,
alphaicbg = 0.2,
alphaTargetbg = 0.2,
backgroundToggle = false,
backgroundColor = {r = 0.2, g = 0.2, b = 0.2}, backgroundColor = {r = 0.2, g = 0.2, b = 0.2},
lockTextAlpha = true,
barTexture = "Bar", barTexture = "Bar",
barFontSize = 13,
textVisible = {upper = true, lower = true},
barPreset = defaultPreset, barPreset = defaultPreset,
fontFamily = "IceHUD",
debug = false debug = false
} }
@ -183,29 +188,53 @@ function IceCore.prototype:SetScale(value)
end end
function IceCore.prototype:GetAlphaOOC() function IceCore.prototype:GetAlpha(mode)
return self.settings.alphaooc if (mode == "IC") then
return self.settings.alphaic
elseif (mode == "Target") then
return self.settings.alphaTarget
else
return self.settings.alphaooc
end
end end
function IceCore.prototype:SetAlphaOOC(value) function IceCore.prototype:SetAlpha(mode, value)
self.settings.alphaooc = value if (mode == "IC") then
self.settings.alphaic = value
elseif (mode == "Target") then
self.settings.alphaTarget = value
else
self.settings.alphaooc = value
end
self:Redraw() self:Redraw()
end end
function IceCore.prototype:GetAlphaIC() function IceCore.prototype:GetAlphaBG(mode)
return self.settings.alphaic if (mode == "IC") then
return self.settings.alphaicbg
elseif (mode == "Target") then
return self.settings.alphaTargetbg
else
return self.settings.alphaoocbg
end
end end
function IceCore.prototype:SetAlphaIC(value) function IceCore.prototype:SetAlphaBG(mode, value)
self.settings.alphaic = value if (mode == "IC") then
self.settings.alphaicbg = value
elseif (mode == "Target") then
self.settings.alphaTargetbg = value
else
self.settings.alphaoocbg = value
end
self:Redraw() self:Redraw()
end end
function IceCore.prototype:GetAlphaBG() function IceCore.prototype:GetBackgroundToggle()
return self.settings.alphabg return self.settings.backgroundToggle
end end
function IceCore.prototype:SetAlphaBG(value) function IceCore.prototype:SetBackgroundToggle(value)
self.settings.alphabg = value self.settings.backgroundToggle = value
self:Redraw() self:Redraw()
end end
@ -222,42 +251,6 @@ function IceCore.prototype:SetBackgroundColor(r, g, b)
end end
function IceCore.prototype:GetLockTextAlpha()
return self.settings.lockTextAlpha
end
function IceCore.prototype:SetLockTextAlpha(value)
self.settings.lockTextAlpha = value
self:Redraw()
end
function IceCore.prototype:GetBarFontSize()
return self.settings.barFontSize
end
function IceCore.prototype:SetBarFontSize(value)
self.settings.barFontSize = value
self:Redraw()
end
function IceCore.prototype:GetBarFontBold()
return self.settings.barFontBold
end
function IceCore.prototype:SetBarFontBold(value)
self.settings.barFontBold = value
self:Redraw()
end
function IceCore.prototype:GetTextVisibility(text)
return self.settings.textVisible[text]
end
function IceCore.prototype:SetTextVisibility(text, value)
self.settings.textVisible[text] = value
self:Redraw()
end
function IceCore.prototype:GetBarTexture() function IceCore.prototype:GetBarTexture()
return self.settings.barTexture return self.settings.barTexture
end end
@ -320,6 +313,15 @@ function IceCore.prototype:ChangePreset(value)
end end
function IceCore.prototype:GetFontFamily()
return self.settings.fontFamily
end
function IceCore.prototype:SetFontFamily(value)
self.settings.fontFamily = value
self:Redraw()
end
function IceCore.prototype:GetDebug() function IceCore.prototype:GetDebug()
return self.settings.debug return self.settings.debug
end end

View File

@ -14,6 +14,7 @@ IceElement.prototype.alpha = nil
IceElement.settings = nil IceElement.settings = nil
IceElement.moduleSettings = nil IceElement.moduleSettings = nil
IceElement.prototype.configColor = "ff8888ff"
-- Constructor -- -- Constructor --
-- IceElements are to be instantiated before IceCore is loaded. -- IceElements are to be instantiated before IceCore is loaded.
@ -90,7 +91,7 @@ function IceElement.prototype:GetOptions()
local opts = {} local opts = {}
opts["enabled"] = { opts["enabled"] = {
type = "toggle", type = "toggle",
name = "|cff8888ffEnabled|r", name = "|c" .. self.configColor .. "Enabled|r",
desc = "Enable/disable module", desc = "Enable/disable module",
get = function() get = function()
return self.moduleSettings.enabled return self.moduleSettings.enabled
@ -178,7 +179,11 @@ function IceElement.prototype:FontFactory(weight, size, frame, font)
if (weight) then if (weight) then
weightString = "Bold" weightString = "Bold"
end end
local fontFile = IceHUD.Location .. "\\fonts\\Calibri" .. weightString ..".ttf" local fontFile = IceHUD.Location .. "\\fonts\\Calibri" .. weightString ..".ttf"
if (self.settings.fontFamily == "Default") then
fontFile = STANDARD_TEXT_FONT
end
if not (frame) then if not (frame) then
frame = self.frame frame = self.frame

View File

@ -78,55 +78,142 @@ IceHUD.options =
desc = 'Settings for bar transparencies', desc = 'Settings for bar transparencies',
order = 12, order = 12,
args = { args = {
headerAlpha = {
type = 'header',
name = "Bar Alpha",
order = 10
},
alphaic = { alphaic = {
type = 'range', type = 'range',
name = 'Alpha IC', name = 'Alpha IC',
desc = 'Bar alpha In Combat', desc = 'Bar alpha In Combat',
get = function() get = function()
return IceHUD.IceCore:GetAlphaIC() return IceHUD.IceCore:GetAlpha("IC")
end, end,
set = function(v) set = function(v)
IceHUD.IceCore:SetAlphaIC(v) IceHUD.IceCore:SetAlpha("IC", v)
end, end,
min = 0, min = 0,
max = 1, max = 1,
step = 0.05, step = 0.05,
isPercent = true, isPercent = true,
order = 14, order = 11,
}, },
alphaooc = { alphaooc = {
type = 'range', type = 'range',
name = 'Alpha OOC', name = 'Alpha OOC',
desc = 'Bar alpha Out Of Combat', desc = 'Bar alpha Out Of Combat without target',
get = function() get = function()
return IceHUD.IceCore:GetAlphaOOC() return IceHUD.IceCore:GetAlpha("OOC")
end, end,
set = function(v) set = function(v)
IceHUD.IceCore:SetAlphaOOC(v) IceHUD.IceCore:SetAlpha("OOC", v)
end, end,
min = 0, min = 0,
max = 1, max = 1,
step = 0.05, step = 0.05,
isPercent = true, isPercent = true,
order = 15, order = 12,
}, },
alphabg = { alphaTarget = {
type = 'range', type = 'range',
name = 'Background Alpha', name = 'Alpha OOC and Target',
desc = 'Background alpha for bars', desc = 'Bar alpha Out Of Combat with target accuired',
get = function() get = function()
return IceHUD.IceCore:GetAlphaBG() return IceHUD.IceCore:GetAlpha("Target")
end, end,
set = function(v) set = function(v)
IceHUD.IceCore:SetAlphaBG(v) IceHUD.IceCore:SetAlpha("Target", v)
end, end,
min = 0, min = 0,
max = 1, max = 1,
step = 0.05, step = 0.05,
isPercent = true, isPercent = true,
order = 16, order = 13,
},
headerAlphaBackgroundBlank = { type = 'header', name = " ", order = 20 },
headerAlphaBackground = {
type = 'header',
name = "Background Alpha",
order = 20
},
alphaicbg = {
type = 'range',
name = 'BG Alpha IC',
desc = 'Background alpha for bars IC',
get = function()
return IceHUD.IceCore:GetAlphaBG("IC")
end,
set = function(v)
IceHUD.IceCore:SetAlphaBG("IC", v)
end,
min = 0,
max = 1,
step = 0.05,
isPercent = true,
order = 21,
},
alphaoocbg = {
type = 'range',
name = 'BG Alpha OOC',
desc = 'Background alpha for bars OOC without target',
get = function()
return IceHUD.IceCore:GetAlphaBG("OOC")
end,
set = function(v)
IceHUD.IceCore:SetAlphaBG("OOC", v)
end,
min = 0,
max = 1,
step = 0.05,
isPercent = true,
order = 22,
},
alphaTargetbg = {
type = 'range',
name = 'BG Alpha OOC and Target',
desc = 'Background alpha for bars OOC and target accuired',
get = function()
return IceHUD.IceCore:GetAlphaBG("Target")
end,
set = function(v)
IceHUD.IceCore:SetAlphaBG("Target", v)
end,
min = 0,
max = 1,
step = 0.05,
isPercent = true,
order = 23,
},
headerBarAdvancedBlank = { type = 'header', name = " ", order = 30 },
headerBarAdvanced = {
type = 'header',
name = "Other",
order = 30
},
backgroundToggle = {
type = "toggle",
name = "Contextual Background",
desc = "Toggles contextual background coloring",
get = function()
return IceHUD.IceCore:GetBackgroundToggle()
end,
set = function(value)
IceHUD.IceCore:SetBackgroundToggle(value)
end,
order = 31
}, },
backgroundColor = { backgroundColor = {
@ -139,85 +226,25 @@ IceHUD.options =
set = function(r, g, b) set = function(r, g, b)
IceHUD.IceCore:SetBackgroundColor(r, g, b) IceHUD.IceCore:SetBackgroundColor(r, g, b)
end, end,
order = 32,
}, },
} }
}, },
textSettings = { textSettings = {
type = 'group', type = 'text',
name = 'Text Settings', name = 'Font',
desc = 'Settings related to texts', desc = 'IceHUD Font',
order = 15, order = 19,
args = { get = function()
fontsize = { return IceHUD.IceCore:GetFontFamily()
type = 'range', end,
name = 'Bar Font Size', set = function(value)
desc = 'Bar Font Size', IceHUD.IceCore:SetFontFamily(value)
get = function() IceHUD.IceCore:Redraw()
return IceHUD.IceCore:GetBarFontSize() end,
end, validate = { "IceHUD", "Default" },
set = function(v)
IceHUD.IceCore:SetBarFontSize(v)
end,
min = 8,
max = 20,
step = 1,
order = 11
},
fontBold = {
type = 'toggle',
name = 'Bar Font Bold',
desc = 'Bar Font Bold',
get = function()
return IceHUD.IceCore:GetBarFontBold()
end,
set = function(v)
IceHUD.IceCore:SetBarFontBold(v)
end,
order = 12
},
lockFontAlpha = {
type = "toggle",
name = "Lock Bar Text Alpha",
desc = "Lock Bar Text Alpha",
get = function()
return IceHUD.IceCore:GetLockTextAlpha()
end,
set = function(value)
IceHUD.IceCore:SetLockTextAlpha(value)
end,
order = 13
},
upperTextVisible = {
type = 'toggle',
name = 'Upper text visible',
desc = 'Toggle upper text visibility',
get = function()
return IceHUD.IceCore:GetTextVisibility("upper")
end,
set = function(v)
IceHUD.IceCore:SetTextVisibility("upper", v)
end,
order = 14
},
lowerTextVisible = {
type = 'toggle',
name = 'Lower text visible',
desc = 'Toggle lower text visibility',
get = function()
return IceHUD.IceCore:GetTextVisibility("lower")
end,
set = function(v)
IceHUD.IceCore:SetTextVisibility("lower", v)
end,
order = 15
},
}
}, },
barSettings = { barSettings = {
@ -356,7 +383,7 @@ IceHUD.options =
enabled = { enabled = {
type = "toggle", type = "toggle",
name = "|cff8888ffEnabled|r", name = "|cff11aa11Enabled|r",
desc = "Enable/disable IceHUD", desc = "Enable/disable IceHUD",
get = function() get = function()
return IceHUD.IceCore:IsEnabled() return IceHUD.IceCore:IsEnabled()

View File

@ -3,7 +3,7 @@
## Name: IceHUD ## Name: IceHUD
## Title: IceHUD |cff7fff7f -Ace2-|r ## Title: IceHUD |cff7fff7f -Ace2-|r
## Notes: Another HUD mod ## Notes: Another HUD mod
## Version: 0.4.1 ($Revision$) ## Version: 0.4.2 ($Revision$)
## SavedVariables: IceCoreDB ## SavedVariables: IceCoreDB
## OptionalDeps: FuBar_ToFu, DruidBar, SoleManax, MobHealth ## OptionalDeps: FuBar_ToFu, DruidBar, SoleManax, MobHealth
## X-Category: UnitFrame ## X-Category: UnitFrame
@ -21,8 +21,14 @@ 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\AceConsole-2.0\AceConsole-2.0.lua
libs\AceAddon-2.0\AceAddon-2.0.lua libs\AceAddon-2.0\AceAddon-2.0.lua
libs\Compost-2.0\Compost-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 libs\Dewdrop-2.0\Dewdrop-2.0.lua
libs\Deformat-2.0\Deformat-2.0.lua
libs\Gratuity-2.0\Gratuity-2.0.lua
libs\SpellCache-1.0\SpellCache-1.0.lua
libs\SpellStatus-1.0\SpellStatus-1.0.lua
# IceHUD core functionality # IceHUD core functionality
IceCore.lua IceCore.lua

View File

@ -1,4 +1,5 @@
local AceOO = AceLibrary("AceOO-2.0") local AceOO = AceLibrary("AceOO-2.0")
local SpellCache = AceLibrary("SpellCache-1.0")
local CastBar = AceOO.Class(IceBarElement) local CastBar = AceOO.Class(IceBarElement)
@ -6,8 +7,10 @@ CastBar.prototype.casting = nil
CastBar.prototype.channeling = nil CastBar.prototype.channeling = nil
CastBar.prototype.failing = nil CastBar.prototype.failing = nil
CastBar.prototype.succeeding = nil CastBar.prototype.succeeding = nil
CastBar.prototype.instanting = nil
CastBar.prototype.spellName = nil CastBar.prototype.spellName = nil
CastBar.prototype.spellRank = nil
CastBar.prototype.startTime = nil CastBar.prototype.startTime = nil
CastBar.prototype.castTime = nil CastBar.prototype.castTime = nil
@ -35,7 +38,7 @@ function CastBar.prototype:GetDefaultSettings()
local settings = CastBar.super.prototype.GetDefaultSettings(self) local settings = CastBar.super.prototype.GetDefaultSettings(self)
settings["side"] = IceCore.Side.Left settings["side"] = IceCore.Side.Left
settings["offset"] = 0 settings["offset"] = 0
settings["alwaysShowText"] = true settings["showInstants"] = true
return settings return settings
end end
@ -43,20 +46,21 @@ end
-- OVERRIDE -- OVERRIDE
function CastBar.prototype:GetOptions() function CastBar.prototype:GetOptions()
local opts = CastBar.super.prototype.GetOptions(self) local opts = CastBar.super.prototype.GetOptions(self)
opts["alwaysShowText"] =
opts["showInstants"] =
{ {
type = 'toggle', type = 'toggle',
name = 'Always Show Text', name = 'Show Instant Casts',
desc = 'Overrides possible text hiding option', desc = 'Toggles showing instant spell names',
get = function() get = function()
return self.moduleSettings.alwaysShowText return self.moduleSettings.showInstants
end, end,
set = function(value) set = function(value)
self.moduleSettings.alwaysShowText = value self.moduleSettings.showInstants = value
self:Redraw()
end, end,
order = 50 order = 50
} }
return opts return opts
end end
@ -64,17 +68,17 @@ end
function CastBar.prototype:Enable() function CastBar.prototype:Enable()
CastBar.super.prototype.Enable(self) CastBar.super.prototype.Enable(self)
self:RegisterEvent("SPELLCAST_START", "CastStart") self:RegisterEvent("SpellStatus_SpellCastInstant")
self:RegisterEvent("SPELLCAST_STOP", "CastStop") self:RegisterEvent("SpellStatus_SpellCastCastingStart")
self:RegisterEvent("SPELLCAST_FAILED", "CastFailed") self:RegisterEvent("SpellStatus_SpellCastCastingChange")
self:RegisterEvent("SPELLCAST_INTERRUPTED", "CastInterrupted") self:RegisterEvent("SpellStatus_SpellCastCastingFinish")
self:RegisterEvent("SpellStatus_SpellCastFailure")
self:RegisterEvent("SPELLCAST_DELAYED", "CastDelayed")
self:RegisterEvent("SPELLCAST_CHANNEL_START", "ChannelingStart")
self:RegisterEvent("SPELLCAST_CHANNEL_STOP", "ChannelingStop")
self:RegisterEvent("SPELLCAST_CHANNEL_UPDATE", "ChannelingUpdate")
self:RegisterEvent("SpellStatus_SpellCastChannelingStart")
self:RegisterEvent("SpellStatus_SpellCastChannelingChange")
self:RegisterEvent("SpellStatus_SpellCastChannelingFinish")
self.frame:Hide() self.frame:Hide()
-- remove blizz cast bar -- remove blizz cast bar
@ -99,17 +103,13 @@ end
-- OVERRIDE -- OVERRIDE
function CastBar.prototype:Redraw() function CastBar.prototype:Redraw()
CastBar.super.prototype.Redraw(self) CastBar.super.prototype.Redraw(self)
if (self.moduleSettings.alwaysShowText) then
self.frame.bottomUpperText:Show()
end
end end
-- 'Protected' methods -------------------------------------------------------- -- 'Protected' methods --------------------------------------------------------
-- OVERRIDE -- OVERRIDE
function CastBar.prototype:CreateFrame() function CastBar.prototype:CreateFrame()
CastBar.super.prototype.CreateFrame(self) CastBar.super.prototype.CreateFrame(self)
@ -140,7 +140,9 @@ function CastBar.prototype:OnUpdate()
end end
self:UpdateBar(scale, "castCasting") self:UpdateBar(scale, "castCasting")
self:SetBottomText1(remaining .. "s " .. self.spellName)
self.spellName = self.spellName or ''
self:SetBottomText1(remaining .. "s " .. self.spellName .. self:FormatRank(self.spellRank))
elseif (self.failing) then elseif (self.failing) then
self.alpha = 0.7 self.alpha = 0.7
@ -165,6 +167,22 @@ function CastBar.prototype:OnUpdate()
self.frame:Hide() self.frame:Hide()
self.frame:SetScript("OnUpdate", nil) self.frame:SetScript("OnUpdate", nil)
end end
elseif (self.instanting) then
self:UpdateBar(1, "castSuccess", 1-scale)
self.frame.bg:Hide()
self.barFrame:Hide()
self.spellName = self.spellName or ''
self:SetBottomText1(self.spellName .. self:FormatRank(self.spellRank))
if (scale >= 1) then
self.frame.bg:Show()
self.barFrame:Show()
self:CleanUp()
self.frame:SetScript("OnUpdate", nil)
end
else -- shouldn't be needed else -- shouldn't be needed
self:CleanUp() self:CleanUp()
@ -175,26 +193,83 @@ end
function CastBar.prototype:CastStart(name, castTime) function CastBar.prototype:CleanUp()
self.spellName = name self.spellName = nil
self.castTime = castTime / 1000 self.spellRank = nil
self.startTime = GetTime() self.castTime = nil
self.startTime = nil
self.delay = 0 self.delay = 0
self.casting = true self.casting = false
self.channeling = false
self.failing = false
self.succeeding = false
self.instanting = false
self:SetBottomText1()
self.alpha = self.settings.alphaooc
end
function CastBar.prototype:FormatRank(rank)
if (rank) then
return " (" .. rank .. ")"
else
return ""
end
end
-------------------------------------------------------------------------------
-- INSTANT SPELLS --
-------------------------------------------------------------------------------
function CastBar.prototype:SpellStatus_SpellCastInstant(sId, sName, sRank, sFullName, sCastTime)
IceHUD:Debug("SpellStatus_SpellCastInstant", sId, sName, sRank, sFullName, sCastTime)
if not (self.moduleSettings.showInstants) then
return
end
self:CleanUp()
self.spellName = sName
self.spellRank = SpellCache:GetRankNumber(sRank or '')
self.castTime = 1
self.startTime = GetTime()
self.instanting = true
self.frame:Show() self.frame:Show()
self.frame:SetScript("OnUpdate", function() self:OnUpdate() end) self.frame:SetScript("OnUpdate", function() self:OnUpdate() end)
end end
function CastBar.prototype:CastStop()
if not (self.casting) then
return -------------------------------------------------------------------------------
end -- NORMAL SPELLS --
-------------------------------------------------------------------------------
function CastBar.prototype:SpellStatus_SpellCastCastingStart(sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration)
IceHUD:Debug("SpellStatus_SpellCastCastingStart", sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration)
self.spellName = sName
self.spellRank = SpellCache:GetRankNumber(sRank or '')
self.castTime = sCastDuration / 1000
self.startTime = sCastStartTime
self.delay = 0
self.casting = true
self.frame:Show()
self.frame:SetScript("OnUpdate", function() self:OnUpdate() end)
end
function CastBar.prototype:SpellStatus_SpellCastCastingFinish (sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration, sCastDelayTotal)
IceHUD:Debug("SpellStatus_SpellCastCastingFinish ", sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration, sCastDelayTotal)
self:CleanUp() self:CleanUp()
self.spellName = nil
self.castTime = 1 self.castTime = 1
self.startTime = GetTime() self.startTime = GetTime()
self.succeeding = true self.succeeding = true
@ -203,23 +278,22 @@ function CastBar.prototype:CastStop()
end end
function CastBar.prototype:CastFailed() function CastBar.prototype:SpellStatus_SpellCastCastingChange(sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration, sCastDelay, sCastDelayTotal)
self:CastTerminated("Failed") IceHUD:Debug("SpellStatus_SpellCastCastingChange", sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration, sCastDelay, sCastDelayTotal)
self.delay = sCastDelayTotal
end end
function CastBar.prototype:CastInterrupted() function CastBar.prototype:SpellStatus_SpellCastFailure(sId, sName, sRank, sFullName, isActiveSpell, UIEM_Message, CMSFLP_SpellName, CMSFLP_Message)
self:CastTerminated("Interrupted") IceHUD:Debug("SpellStatus_SpellCastFailure", sId, sName, sRank, sFullName, isActiveSpell, UIEM_Message, CMSFLP_SpellName, CMSFLP_Message)
end
if (not (isActiveSpell) or not (self.casting or self.channeling)) then
function CastBar.prototype:CastTerminated(reason)
if not (self.casting or self.channeling or self.succeeding) then
return return
end end
self:CleanUp() self:CleanUp()
self.spellName = reason self.spellName = UIEM_Message
self.castTime = 1 self.castTime = 1
self.startTime = GetTime() self.startTime = GetTime()
self.failing = true self.failing = true
@ -228,17 +302,22 @@ function CastBar.prototype:CastTerminated(reason)
end end
function CastBar.prototype:CastDelayed(delay)
self.delay = self.delay + (delay / 1000)
end
function CastBar.prototype:ChannelingStart(duration, spell)
self.spellName = spell -------------------------------------------------------------------------------
self.castTime = duration / 1000 -- CHANNELING SPELLS --
self.startTime = GetTime() -------------------------------------------------------------------------------
function CastBar.prototype:SpellStatus_SpellCastChannelingStart(sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration, sAction)
IceHUD:Debug("SpellStatus_SpellCastChannelingStart", sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration, sAction)
self.spellName = sName
self.spellRank = SpellCache:GetRankNumber(sRank or '')
self.castTime = sCastDuration
self.startTime = sCastStartTime
self.delay = 0 self.delay = 0
self.channeling = true self.channeling = true
@ -248,30 +327,27 @@ function CastBar.prototype:ChannelingStart(duration, spell)
end end
function CastBar.prototype:ChannelingStop() function CastBar.prototype:SpellStatus_SpellCastChannelingFinish(sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration, sAction, sCastDisruptionTotal)
IceHUD:Debug("SpellStatus_SpellCastChannelingFinish", sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration, sAction, sCastDisruptionTotal)
self:CleanUp() self:CleanUp()
self.frame:Hide() self.frame:Hide()
end end
function CastBar.prototype:ChannelingUpdate(duration) function CastBar.prototype:SpellStatus_SpellCastChannelingChange(sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration, sAction, sCastDisruption, sCastDisruptionTotal)
self.castTime = duration / 1000 IceHUD:Debug("SpellStatus_SpellCastChannelingChange", sId, sName, sRank, sFullName, sCastStartTime, sCastStopTime, sCastDuration, sAction, sCastDisruption, sCastDisruptionTotal)
self.castTime = sCastDuration / 1000
end end
function CastBar.prototype:CleanUp()
self.spellName = nil
self.castTime = nil
self.startTime = nil
self.delay = 0
self.casting = false
self.channeling = false
self.failing = false
self.succeeding = false
self:SetBottomText1()
self.alpha = self.settings.alphaooc
end
-- Load us up -- Load us up

View File

@ -5,8 +5,8 @@ local DruidMana = AceOO.Class(IceUnitBar)
DruidMana.prototype.inForms = nil DruidMana.prototype.inForms = nil
DruidMana.prototype.mode = nil DruidMana.prototype.mode = nil
DruidMana.prototype.mana = nil DruidMana.prototype.druidMana = nil
DruidMana.prototype.maxMana = nil DruidMana.prototype.druidMaxMana = nil
-- Constructor -- -- Constructor --
@ -71,20 +71,21 @@ end
function DruidMana.prototype:UpdateSoleManax(mana, maxMana) function DruidMana.prototype:UpdateSoleManax(mana, maxMana)
self.mana = mana
self.maxMana = maxMana
self:Update() self:Update()
self.druidMana = mana
self.druidMaxMana = maxMana
end end
function DruidMana.prototype:UpdateDruidBarMana() function DruidMana.prototype:UpdateDruidBarMana()
self.mana = DruidBarKey.keepthemana
self.maxMana = DruidBarKey.maxmana
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)
if ((not self.alive) or (not self.inForms)) then if ((not self.alive) or (not self.inForms)) then
self.frame:Hide() self.frame:Hide()
return return
@ -94,9 +95,9 @@ function DruidMana.prototype:Update()
local color = "druidMana" local color = "druidMana"
self:UpdateBar(self.mana / self.maxMana, color) self:UpdateBar(self.druidMana / self.druidMaxMana, color)
local percentage = (self.mana / self.maxMana) * 100 local percentage = (self.druidMana / self.druidMaxMana) * 100
self:SetBottomText1(math.floor(percentage)) self:SetBottomText1(math.floor(percentage))
end end

View File

@ -48,6 +48,16 @@ function MirrorBar.prototype:Enable()
end end
-- OVERRIDE
function MirrorBar.prototype:Create(parent)
MirrorBar.super.prototype.Create(self, parent)
if (self.timer) then
self.frame:Show()
end
end
function MirrorBar.prototype:OnUpdate(elapsed) function MirrorBar.prototype:OnUpdate(elapsed)
if (self.paused) then if (self.paused) then
return return
@ -96,6 +106,7 @@ function MirrorBar.prototype:MirrorStart(timer, value, maxValue, scale, paused,
self.startTime = GetTime() self.startTime = GetTime()
self:Update()
self.frame:Show() self.frame:Show()
self.frame:SetScript("OnUpdate", function() self:OnUpdate(arg1) end) self.frame:SetScript("OnUpdate", function() self:OnUpdate(arg1) end)
end end
@ -160,6 +171,10 @@ function MirrorBarHandler.prototype:GetDefaultSettings()
local settings = MirrorBarHandler.super.prototype.GetDefaultSettings(self) local settings = MirrorBarHandler.super.prototype.GetDefaultSettings(self)
settings["side"] = IceCore.Side.Left settings["side"] = IceCore.Side.Left
settings["offset"] = 3 settings["offset"] = 3
settings["barFontSize"] = 13
settings["barFontBold"] = true
settings["lockTextAlpha"] = true
settings["textVisible"] = {upper = true, lower = true}
return settings return settings
end end
@ -171,7 +186,7 @@ function MirrorBarHandler.prototype:GetOptions()
opts["side"] = opts["side"] =
{ {
type = 'text', type = 'text',
name = 'Side', name = '|c' .. self.configColor .. 'Side|r',
desc = 'Side of the HUD where the bar appears', desc = 'Side of the HUD where the bar appears',
get = function() get = function()
if (self.moduleSettings.side == IceCore.Side.Right) then if (self.moduleSettings.side == IceCore.Side.Right) then
@ -195,7 +210,7 @@ function MirrorBarHandler.prototype:GetOptions()
opts["offset"] = opts["offset"] =
{ {
type = 'range', type = 'range',
name = 'Offset', name = '|c' .. self.configColor .. 'Offset|r',
desc = 'Offset of the bar', desc = 'Offset of the bar',
min = -1, min = -1,
max = 10, max = 10,
@ -209,7 +224,89 @@ function MirrorBarHandler.prototype:GetOptions()
end, end,
order = 31 order = 31
} }
opts["textSettings"] =
{
type = 'group',
name = '|c' .. self.configColor .. 'Text Settings|r',
desc = 'Settings related to texts',
order = 32,
args = {
fontsize = {
type = 'range',
name = 'Bar Font Size',
desc = 'Bar Font Size',
get = function()
return self.moduleSettings.barFontSize
end,
set = function(v)
self.moduleSettings.barFontSize = v
self:Redraw()
end,
min = 8,
max = 20,
step = 1,
order = 11
},
fontBold = {
type = 'toggle',
name = 'Bar Font Bold',
desc = 'If you have game default font selected, this option has no effect',
get = function()
return self.moduleSettings.barFontBold
end,
set = function(v)
self.moduleSettings.barFontBold = v
self:Redraw()
end,
order = 12
},
lockFontAlpha = {
type = "toggle",
name = "Lock Bar Text Alpha",
desc = "Locks upper text alpha to 100%",
get = function()
return self.moduleSettings.lockTextAlpha
end,
set = function(v)
self.moduleSettings.lockTextAlpha = v
self:Redraw()
end,
order = 13
},
upperTextVisible = {
type = 'toggle',
name = 'Upper text visible',
desc = 'Toggle upper text visibility',
get = function()
return self.moduleSettings.textVisible['upper']
end,
set = function(v)
self.moduleSettings.textVisible['upper'] = v
self:Redraw()
end,
order = 14
},
lowerTextVisible = {
type = 'toggle',
name = 'Lower text visible',
desc = 'Toggle lower text visibility',
get = function()
return self.moduleSettings.textVisible['lower']
end,
set = function(v)
self.moduleSettings.textVisible['lower'] = v
self:Redraw()
end,
order = 15
},
}
}
return opts return opts
end end
@ -236,6 +333,7 @@ function MirrorBarHandler.prototype:Redraw()
MirrorBarHandler.super.prototype.Redraw(self) MirrorBarHandler.super.prototype.Redraw(self)
for i = 1, table.getn(self.bars) do for i = 1, table.getn(self.bars) do
self:SetSettings(self.bars[i])
self.bars[i]:UpdatePosition(self.moduleSettings.side, self.moduleSettings.offset + (i-1)) self.bars[i]:UpdatePosition(self.moduleSettings.side, self.moduleSettings.offset + (i-1))
self.bars[i]:Create(self.parent) self.bars[i]:Create(self.parent)
end end
@ -267,6 +365,7 @@ function MirrorBarHandler.prototype:MirrorStart(timer, value, maxValue, scale, p
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.moduleSettings.side, self.moduleSettings.offset + count, "MirrorBar" .. tostring(count+1), self.settings) self.bars[count + 1] = MirrorBar:new(self.moduleSettings.side, self.moduleSettings.offset + count, "MirrorBar" .. tostring(count+1), self.settings)
self:SetSettings(self.bars[count+1])
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)
@ -293,6 +392,16 @@ end
function MirrorBarHandler.prototype:SetSettings(bar)
bar.moduleSettings.barFontSize = self.moduleSettings.barFontSize
bar.moduleSettings.barFontBold = self.moduleSettings.barFontBold
bar.moduleSettings.lockTextAlpha = self.moduleSettings.lockTextAlpha
bar.moduleSettings.textVisible = self.moduleSettings.textVisible
end
-- Load us up -- Load us up
MirrorBarHandler:new() MirrorBarHandler:new()

View File

@ -38,7 +38,7 @@ function PetHealth.prototype:GetOptions()
self.moduleSettings.scale = value self.moduleSettings.scale = value
self:Redraw() self:Redraw()
end, end,
order = 31 order = 51
} }
return opts return opts
end end

View File

@ -32,7 +32,7 @@ function PetMana.prototype:GetOptions()
self.moduleSettings.scale = value self.moduleSettings.scale = value
self:Redraw() self:Redraw()
end, end,
order = 31 order = 51
} }
return opts return opts
end end

View File

@ -22,7 +22,7 @@ function PlayerMana.prototype:GetDefaultSettings()
settings["side"] = IceCore.Side.Right settings["side"] = IceCore.Side.Right
settings["offset"] = 1 settings["offset"] = 1
settings["tickerEnabled"] = true settings["tickerEnabled"] = true
settings["tickerAlpha"] = 0.8 settings["tickerAlpha"] = 0.5
return settings return settings
end end
@ -42,7 +42,7 @@ function PlayerMana.prototype:GetOptions()
self.moduleSettings.tickerEnabled = value self.moduleSettings.tickerEnabled = value
self:ManaType(self.unit) self:ManaType(self.unit)
end, end,
order = 31 order = 51
} }
opts["tickerAlpha"] = opts["tickerAlpha"] =
@ -60,7 +60,7 @@ function PlayerMana.prototype:GetOptions()
self.moduleSettings.tickerAlpha = value self.moduleSettings.tickerAlpha = value
self.tickerFrame:SetStatusBarColor(self:GetColor("playerEnergy", self.moduleSettings.tickerAlpha)) self.tickerFrame:SetStatusBarColor(self:GetColor("playerEnergy", self.moduleSettings.tickerAlpha))
end, end,
order = 32 order = 52
} }
return opts return opts

View File

@ -54,8 +54,7 @@ function TargetHealth.prototype:Enable()
self:RegisterEvent("UNIT_HEALTH", "Update") self:RegisterEvent("UNIT_HEALTH", "Update")
self:RegisterEvent("UNIT_MAXHEALTH", "Update") self:RegisterEvent("UNIT_MAXHEALTH", "Update")
self:RegisterEvent("PLAYER_TARGET_CHANGED", "TargetChanged")
self:Update(self.unit) self:Update(self.unit)
end end
@ -65,10 +64,6 @@ function TargetHealth.prototype:Disable()
end end
function TargetHealth.prototype:TargetChanged()
self:Update(self.unit)
end
function TargetHealth.prototype:Update(unit) function TargetHealth.prototype:Update(unit)
TargetHealth.super.prototype.Update(self) TargetHealth.super.prototype.Update(self)

View File

@ -33,16 +33,10 @@ function TargetMana.prototype:Enable()
self:RegisterEvent("UNIT_MAXENERGY", "Update") self:RegisterEvent("UNIT_MAXENERGY", "Update")
self:RegisterEvent("UNIT_AURA", "Update") self:RegisterEvent("UNIT_AURA", "Update")
self:RegisterEvent("PLAYER_TARGET_CHANGED", "TargetChanged")
self:Update("target") self:Update("target")
end end
function TargetMana.prototype:TargetChanged()
self:Update("target")
end
function TargetMana.prototype:Update(unit) function TargetMana.prototype:Update(unit)
TargetMana.super.prototype.Update(self) TargetMana.super.prototype.Update(self)

View File

@ -15,8 +15,8 @@ end
function TimerBar.prototype:GetDefaultSettings() function TimerBar.prototype:GetDefaultSettings()
local settings = TimerBar.super.prototype.GetDefaultSettings(self) local settings = TimerBar.super.prototype.GetDefaultSettings(self)
settings["side"] = IceCore.Side.Left settings["side"] = IceCore.Side.Right
settings["offset"] = 0 settings["offset"] = 3
return settings return settings
end end