Version 0.5

- Graphical combo points
- Various tweaks and bug fixes (ie. mirror timer bar)
This commit is contained in:
iceroth
2006-08-20 16:28:50 +00:00
parent 5035e8428a
commit 7050788344
14 changed files with 372 additions and 155 deletions

View File

@ -3,7 +3,6 @@ local AceOO = AceLibrary("AceOO-2.0")
IceBarElement = AceOO.Class(IceElement) IceBarElement = AceOO.Class(IceElement)
IceBarElement.virtual = true IceBarElement.virtual = true
IceBarElement.TexturePath = IceHUD.Location .. "\\textures\\"
IceBarElement.BarTextureWidth = 128 IceBarElement.BarTextureWidth = 128
IceBarElement.prototype.barFrame = nil IceBarElement.prototype.barFrame = nil
@ -212,6 +211,8 @@ function IceBarElement.prototype:CreateFrame()
self:CreateBackground() self:CreateBackground()
self:CreateBar() self:CreateBar()
self:CreateTexts() self:CreateTexts()
self.frame:SetScale(self.moduleSettings.scale)
end end
@ -229,7 +230,7 @@ function IceBarElement.prototype:CreateBackground()
self.frame.bg = self.frame:CreateTexture(nil, "BACKGROUND") self.frame.bg = self.frame:CreateTexture(nil, "BACKGROUND")
end end
self.frame.bg:SetTexture(IceBarElement.TexturePath .. self.settings.barTexture.."BG") self.frame.bg:SetTexture(IceElement.TexturePath .. self.settings.barTexture.."BG")
self.frame.bg:ClearAllPoints() self.frame.bg:ClearAllPoints()
self.frame.bg:SetAllPoints(self.frame) self.frame.bg:SetAllPoints(self.frame)
@ -274,7 +275,7 @@ function IceBarElement.prototype:CreateBar()
self.barFrame.bar = self.frame:CreateTexture(nil, "BACKGROUND") self.barFrame.bar = self.frame:CreateTexture(nil, "BACKGROUND")
end end
self.barFrame.bar:SetTexture(IceBarElement.TexturePath .. self.settings.barTexture) self.barFrame.bar:SetTexture(IceElement.TexturePath .. self.settings.barTexture)
self.barFrame.bar:SetAllPoints(self.frame) self.barFrame.bar:SetAllPoints(self.frame)
self.barFrame:SetStatusBarTexture(self.barFrame.bar) self.barFrame:SetStatusBarTexture(self.barFrame.bar)
@ -393,7 +394,6 @@ function IceBarElement.prototype:UpdateBar(scale, color, alpha)
end end
self.frame:SetStatusBarColor(r, g, b, self.backgroundAlpha) self.frame:SetStatusBarColor(r, g, b, self.backgroundAlpha)
self.barFrame:SetStatusBarColor(self:GetColor(color)) self.barFrame:SetStatusBarColor(self:GetColor(color))
self:SetScale(self.barFrame.bar, scale) self:SetScale(self.barFrame.bar, scale)
@ -411,7 +411,6 @@ function IceBarElement.prototype:SetBottomText1(text, color)
color = "text" color = "text"
end end
local alpha = self.alpha local alpha = self.alpha
if (self.alpha > 0) then if (self.alpha > 0) then
@ -450,8 +449,8 @@ function IceBarElement.prototype:SetBottomText2(text, color, alpha)
alpha = 1 alpha = 1
end end
end 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)
end end

View File

@ -40,11 +40,11 @@ function IceCore.prototype:init()
alphaooc = 0.3, alphaooc = 0.3,
alphaic = 0.6, alphaic = 0.6,
alphaTarget = 0.3, alphaTarget = 0.4,
alphaoocbg = 0.2, alphaoocbg = 0.2,
alphaicbg = 0.2, alphaicbg = 0.3,
alphaTargetbg = 0.2, alphaTargetbg = 0.25,
backgroundToggle = false, backgroundToggle = false,
backgroundColor = {r = 0.2, g = 0.2, b = 0.2}, backgroundColor = {r = 0.2, g = 0.2, b = 0.2},

View File

@ -3,6 +3,8 @@ 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.TexturePath = IceHUD.Location .. "\\textures\\"
-- Protected variables -- -- Protected variables --
IceElement.prototype.name = nil IceElement.prototype.name = nil
IceElement.prototype.parent = nil IceElement.prototype.parent = nil
@ -15,6 +17,7 @@ IceElement.settings = nil
IceElement.moduleSettings = nil IceElement.moduleSettings = nil
IceElement.prototype.configColor = "ff8888ff" IceElement.prototype.configColor = "ff8888ff"
IceElement.prototype.scalingEnabled = nil
-- Constructor -- -- Constructor --
-- IceElements are to be instantiated before IceCore is loaded. -- IceElements are to be instantiated before IceCore is loaded.
@ -26,6 +29,7 @@ function IceElement.prototype:init(name)
self.name = name self.name = name
self.alpha = 1 self.alpha = 1
self.scalingEnabled = false
-- Some common colors -- Some common colors
self:SetColor("text", 1, 1, 1) self:SetColor("text", 1, 1, 1)
@ -89,6 +93,7 @@ end
-- AceOptions table for configuration -- AceOptions table for configuration
function IceElement.prototype:GetOptions() function IceElement.prototype:GetOptions()
local opts = {} local opts = {}
opts["enabled"] = { opts["enabled"] = {
type = "toggle", type = "toggle",
name = "|c" .. self.configColor .. "Enabled|r", name = "|c" .. self.configColor .. "Enabled|r",
@ -106,6 +111,27 @@ function IceElement.prototype:GetOptions()
end, end,
order = 20 order = 20
} }
opts["scale"] =
{
type = 'range',
name = "|c" .. self.configColor .. "Scale|r",
desc = 'Scale of the element',
min = 0.2,
max = 2,
step = 0.1,
isPercent = true,
hidden = not self.scalingEnabled,
get = function()
return self.moduleSettings.scale
end,
set = function(value)
self.moduleSettings.scale = value
self:Redraw()
end,
order = 21
}
return opts return opts
end end
@ -116,6 +142,7 @@ end
function IceElement.prototype:GetDefaultSettings() function IceElement.prototype:GetDefaultSettings()
local defaults = {} local defaults = {}
defaults["enabled"] = true defaults["enabled"] = true
defaults["scale"] = 1
return defaults return defaults
end end
@ -128,6 +155,8 @@ function IceElement.prototype:CreateFrame()
if not (self.frame) then if not (self.frame) then
self.frame = CreateFrame("Frame", "IceHUD_"..self.name, self.parent) self.frame = CreateFrame("Frame", "IceHUD_"..self.name, self.parent)
end end
self.frame:SetScale(self.moduleSettings.scale)
end end

View File

@ -403,7 +403,7 @@ IceHUD.options =
name = '|cffff0000Reset|r', name = '|cffff0000Reset|r',
desc = "Resets all IceHUD options - WARNING: Reloads UI", desc = "Resets all IceHUD options - WARNING: Reloads UI",
func = function() func = function()
IceHUD.IceCore:ResetSettings() StaticPopup_Show("ICEHUD_RESET")
end, end,
order = 92 order = 92
}, },
@ -456,6 +456,20 @@ IceHUD.slashMenu =
end end
} }
StaticPopupDialogs["ICEHUD_RESET"] =
{
text = "Are you sure you want to reset IceHUD settings?",
button1 = "Okay",
button2 = "Cancel",
timeout = 0,
whileDead = 1,
hideOnEscape = 1,
OnAccept = function()
print("hellooo")
IceHUD.IceCore:ResetSettings()
end
}
function IceHUD:OnInitialize() function IceHUD:OnInitialize()

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.3 ($Revision$) ## Version: 0.5 ($Revision$)
## SavedVariables: IceCoreDB ## SavedVariables: IceCoreDB
## OptionalDeps: FuBar_ToFu, DruidBar, SoleManax, MobHealth ## OptionalDeps: FuBar_ToFu, DruidBar, SoleManax, MobHealth
## X-Category: UnitFrame ## X-Category: UnitFrame
@ -42,6 +42,7 @@ modules\PetMana.lua
modules\DruidMana.lua modules\DruidMana.lua
modules\TargetInfo.lua modules\TargetInfo.lua
modules\TargetOfTarget.lua modules\TargetOfTarget.lua
modules\ComboPoints.lua
modules\CastBar.lua modules\CastBar.lua
modules\MirrorBar.lua modules\MirrorBar.lua
modules\TimerBar.lua modules\TimerBar.lua

210
modules/ComboPoints.lua Normal file
View File

@ -0,0 +1,210 @@
local AceOO = AceLibrary("AceOO-2.0")
local ComboPoints = AceOO.Class(IceElement)
ComboPoints.prototype.comboSize = 20
-- Constructor --
function ComboPoints.prototype:init()
ComboPoints.super.prototype.init(self, "ComboPoints")
self:SetColor("combo", 1, 1, 0)
self.scalingEnabled = true
end
-- 'Public' methods -----------------------------------------------------------
-- OVERRIDE
function ComboPoints.prototype:GetOptions()
local opts = ComboPoints.super.prototype.GetOptions(self)
opts["vpos"] = {
type = "range",
name = "Vertical Position",
desc = "Vertical Position",
get = function()
return self.moduleSettings.vpos
end,
set = function(v)
self.moduleSettings.vpos = v
self:Redraw()
end,
min = -300,
max = 200,
step = 10,
order = 31
}
opts["comboFontSize"] = {
type = "range",
name = "Combo Points Font Size",
desc = "Combo Points Font Size",
get = function()
return self.moduleSettings.comboFontSize
end,
set = function(v)
self.moduleSettings.comboFontSize = v
self:Redraw()
end,
min = 10,
max = 40,
step = 1,
order = 32
}
opts["comboMode"] = {
type = "text",
name = "Display Mode",
desc = "Show graphical or numeric combo points",
get = function()
return self.moduleSettings.comboMode
end,
set = function(v)
self.moduleSettings.comboMode = v
self:Redraw()
end,
validate = { "Numeric", "Graphical" },
order = 33
}
return opts
end
-- OVERRIDE
function ComboPoints.prototype:GetDefaultSettings()
local defaults = ComboPoints.super.prototype.GetDefaultSettings(self)
defaults["vpos"] = -30
defaults["comboFontSize"] = 20
defaults["comboMode"] = "Graphical"
return defaults
end
-- OVERRIDE
function ComboPoints.prototype:Redraw()
ComboPoints.super.prototype.Redraw(self)
self:CreateFrame()
self:UpdateComboPoints()
end
-- OVERRIDE
function ComboPoints.prototype:Enable()
ComboPoints.super.prototype.Enable(self)
self:RegisterEvent("PLAYER_TARGET_CHANGED", "UpdateComboPoints")
self:RegisterEvent("PLAYER_COMBO_POINTS", "UpdateComboPoints")
end
-- 'Protected' methods --------------------------------------------------------
-- OVERRIDE
function ComboPoints.prototype:CreateFrame()
ComboPoints.super.prototype.CreateFrame(self)
self.frame:SetFrameStrata("BACKGROUND")
self.frame:SetWidth(self.comboSize*5)
self.frame:SetHeight(1)
self.frame:ClearAllPoints()
self.frame:SetPoint("TOP", self.parent, "BOTTOM", 0, self.moduleSettings.vpos)
self.frame:Show()
self:CreateComboFrame()
end
function ComboPoints.prototype:CreateComboFrame()
-- create numeric combo points
self.frame.numeric = self:FontFactory("Bold", self.moduleSettings.comboFontSize, nil, self.frame.numeric)
self.frame.numeric:SetWidth(50)
self.frame.numeric:SetJustifyH("CENTER")
self.frame.numeric:SetTextColor(self:GetColor("combo", 0.7))
self.frame.numeric:SetPoint("TOP", self.frame, "TOP", 0, 0)
self.frame.numeric:Show()
if (not self.frame.graphicalBG) then
self.frame.graphicalBG = {}
self.frame.graphical = {}
end
-- create backgrounds
for i = 1, 5 do
if (not self.frame.graphicalBG[i]) then
self.frame.graphicalBG[i] = CreateFrame("StatusBar", nil, self.frame)
self.frame.graphicalBG[i]:SetStatusBarTexture(IceElement.TexturePath .. "ComboBG")
end
self.frame.graphicalBG[i]:SetFrameStrata("BACKGROUND")
self.frame.graphicalBG[i]:SetWidth(self.comboSize)
self.frame.graphicalBG[i]:SetHeight(self.comboSize)
self.frame.graphicalBG[i]:SetPoint("TOPLEFT", (i-1) * (self.comboSize-5) + (i-1), 0)
self.frame.graphicalBG[i]:SetAlpha(0.3)
self.frame.graphicalBG[i]:SetStatusBarColor(self:GetColor("combo"))
self.frame.graphicalBG[i]:Hide()
end
-- create combo points
for i = 1, 5 do
if (not self.frame.graphical[i]) then
self.frame.graphical[i] = CreateFrame("StatusBar", nil, self.frame.graphicalBG[i])
self.frame.graphical[i]:SetStatusBarTexture(IceElement.TexturePath .. "Combo")
end
self.frame.graphical[i]:SetFrameStrata("BACKGROUND")
self.frame.graphical[i]:SetAllPoints(self.frame.graphicalBG[i])
local r, g, b = self:GetColor("combo")
g = g - (0.15*i)
self.frame.graphical[i]:SetStatusBarColor(r, g, b)
self.frame.graphical[i]:Hide()
end
end
function ComboPoints.prototype:UpdateComboPoints()
local points = GetComboPoints("target")
if (points == 0) then
points = nil
end
if (self.moduleSettings.comboMode == "Numeric") then
self.frame.numeric:SetText(points)
else
self.frame.numeric:SetText()
for i = 1, table.getn(self.frame.graphical) do
if (points ~= nil) then
self.frame.graphicalBG[i]:Show()
else
self.frame.graphicalBG[i]:Hide()
end
if (points ~= nil and i <= points) then
self.frame.graphical[i]:Show()
else
self.frame.graphical[i]:Hide()
end
end
end
end
-- Load us up
ComboPoints:new()

View File

@ -13,7 +13,7 @@ local MirrorBar = AceOO.Class(IceBarElement)
MirrorBar.prototype.timer = nil MirrorBar.prototype.timer = nil
MirrorBar.prototype.value = nil MirrorBar.prototype.value = nil
MirrorBar.prototype.maxValue = nil MirrorBar.prototype.maxValue = nil
MirrorBar.prototype.scale = nil MirrorBar.prototype.timerScale = nil
MirrorBar.prototype.paused = nil MirrorBar.prototype.paused = nil
MirrorBar.prototype.label = nil MirrorBar.prototype.label = nil
@ -65,7 +65,7 @@ function MirrorBar.prototype:OnUpdate(elapsed)
self:Update() self:Update()
self.value = self.value + (self.scale * elapsed * 1000) self.value = self.value + (self.timerScale * elapsed * 1000)
scale = self.value / self.maxValue scale = self.value / self.maxValue
@ -77,12 +77,15 @@ function MirrorBar.prototype:OnUpdate(elapsed)
end end
local timeRemaining = (self.maxValue - self.value) / 1000 local timeRemaining = (self.value) / 1000
local remaining = string.format("%.1f", timeRemaining) local remaining = string.format("%.1f", timeRemaining)
if (timeRemaining < 0) then -- lag compensation if (timeRemaining < 0) then -- lag compensation
remaining = 0 remaining = 0
end end
if (timeRemaining > self.maxValue/1000) then
remaining = self.maxValue/1000
end
self:UpdateBar(scale, self.timer) self:UpdateBar(scale, self.timer)
@ -102,7 +105,7 @@ function MirrorBar.prototype:MirrorStart(timer, value, maxValue, scale, paused,
self.timer = timer self.timer = timer
self.value = value self.value = value
self.maxValue = maxValue self.maxValue = maxValue
self.scale = scale self.timerScale = scale
self.paused = (paused > 0) self.paused = (paused > 0)
self.label = label self.label = label
@ -134,7 +137,7 @@ function MirrorBar.prototype:CleanUp()
self.timer = nil self.timer = nil
self.value = nil self.value = nil
self.maxValue = nil self.maxValue = nil
self.scale = nil self.timerScale = nil
self.paused = nil self.paused = nil
self.label = nil self.label = nil
self.startTime = nil self.startTime = nil
@ -399,6 +402,7 @@ function MirrorBarHandler.prototype:SetSettings(bar)
bar.moduleSettings.barFontBold = self.moduleSettings.barFontBold bar.moduleSettings.barFontBold = self.moduleSettings.barFontBold
bar.moduleSettings.lockTextAlpha = self.moduleSettings.lockTextAlpha bar.moduleSettings.lockTextAlpha = self.moduleSettings.lockTextAlpha
bar.moduleSettings.textVisible = self.moduleSettings.textVisible bar.moduleSettings.textVisible = self.moduleSettings.textVisible
bar.moduleSettings.scale = self.moduleSettings.scale
end end

View File

@ -7,47 +7,24 @@ function PetHealth.prototype:init()
PetHealth.super.prototype.init(self, "PetHealth", "pet") PetHealth.super.prototype.init(self, "PetHealth", "pet")
self:SetColor("petHealth", 37, 164, 30) self:SetColor("petHealth", 37, 164, 30)
end
self.scalingEnabled = true
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 end
-- OVERRIDE -- OVERRIDE
function PetHealth.prototype:GetOptions() function PetHealth.prototype:GetDefaultSettings()
local opts = PetHealth.super.prototype.GetOptions(self) local settings = PetHealth.super.prototype.GetDefaultSettings(self)
opts["scale"] = settings["side"] = IceCore.Side.Left
{ settings["offset"] = -1
type = 'range', settings.scale = 0.7
name = 'Scale', return settings
desc = 'Scale of the bar',
min = 0.2,
max = 1,
step = 0.05,
isPercent = true,
get = function()
return self.moduleSettings.scale
end,
set = function(value)
self.moduleSettings.scale = value
self:Redraw()
end,
order = 51
}
return opts
end end
-- OVERRIDE -- OVERRIDE
function PetHealth.prototype:CreateFrame() function PetHealth.prototype:CreateFrame()
PetHealth.super.prototype.CreateFrame(self) PetHealth.super.prototype.CreateFrame(self)
self.frame:SetScale(self.moduleSettings.scale)
local point, relativeTo, relativePoint, xoff, yoff = self.frame.bottomUpperText:GetPoint() local point, relativeTo, relativePoint, xoff, yoff = self.frame.bottomUpperText:GetPoint()
if (point == "TOPLEFT") then if (point == "TOPLEFT") then

View File

@ -10,39 +10,17 @@ function PetMana.prototype:init()
self:SetColor("petRage", 171, 59, 59) self:SetColor("petRage", 171, 59, 59)
self:SetColor("petEnergy", 218, 231, 31) self:SetColor("petEnergy", 218, 231, 31)
self:SetColor("targetFocus", 242, 149, 98) self:SetColor("targetFocus", 242, 149, 98)
self.scalingEnabled = true
end end
-- OVERRIDE -- 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,
isPercent = true,
get = function()
return self.moduleSettings.scale
end,
set = function(value)
self.moduleSettings.scale = value
self:Redraw()
end,
order = 51
}
return opts
end
function PetMana.prototype:GetDefaultSettings() function PetMana.prototype:GetDefaultSettings()
local settings = PetMana.super.prototype.GetDefaultSettings(self) local settings = PetMana.super.prototype.GetDefaultSettings(self)
settings["side"] = IceCore.Side.Right settings["side"] = IceCore.Side.Right
settings["offset"] = -1 settings["offset"] = -1
settings["scale"] = 0.7 settings.scale = 0.7
return settings return settings
end end
@ -50,7 +28,6 @@ end
-- OVERRIDE -- OVERRIDE
function PetMana.prototype:CreateFrame() function PetMana.prototype:CreateFrame()
PetMana.super.prototype.CreateFrame(self) PetMana.super.prototype.CreateFrame(self)
self.frame:SetScale(self.moduleSettings.scale)
local point, relativeTo, relativePoint, xoff, yoff = self.frame.bottomUpperText:GetPoint() local point, relativeTo, relativePoint, xoff, yoff = self.frame.bottomUpperText:GetPoint()
if (point == "TOPLEFT") then if (point == "TOPLEFT") then

View File

@ -135,6 +135,15 @@ function PlayerMana.prototype:Update(unit)
end end
self:UpdateBar(self.mana/self.maxMana, color) self:UpdateBar(self.mana/self.maxMana, color)
-- hide ticker if rest of the bar is not visible
if (self.alpha == 0) then
self.tickerFrame:SetStatusBarColor(self:GetColor("playerEnergy", 0))
else
self.tickerFrame:SetStatusBarColor(self:GetColor("playerEnergy", self.moduleSettings.tickerAlpha))
end
self:SetBottomText1(self.manaPercentage) self:SetBottomText1(self.manaPercentage)
local amount = self:GetFormattedText(self.mana, self.maxMana) local amount = self:GetFormattedText(self.mana, self.maxMana)
@ -203,7 +212,7 @@ function PlayerMana.prototype:CreateTickerFrame()
self.tickerFrame:Hide() self.tickerFrame:Hide()
end end
self.tickerFrame.spark:SetTexture(IceBarElement.TexturePath .. self.settings.barTexture) self.tickerFrame.spark:SetTexture(IceElement.TexturePath .. self.settings.barTexture)
self.tickerFrame.spark:SetBlendMode("ADD") self.tickerFrame.spark:SetBlendMode("ADD")
self.tickerFrame.spark:ClearAllPoints() self.tickerFrame.spark:ClearAllPoints()
self.tickerFrame.spark:SetAllPoints(self.tickerFrame) self.tickerFrame.spark:SetAllPoints(self.tickerFrame)

View File

@ -10,8 +10,9 @@ TargetInfo.prototype.buffSize = nil
function TargetInfo.prototype:init() function TargetInfo.prototype:init()
TargetInfo.super.prototype.init(self, "TargetInfo") TargetInfo.super.prototype.init(self, "TargetInfo")
self:SetColor("combo", 1, 1, 0)
self.buffSize = math.floor((TargetInfo.Width - 15) / 16) self.buffSize = math.floor((TargetInfo.Width - 15) / 16)
self.scalingEnabled = true
end end
@ -23,6 +24,23 @@ end
function TargetInfo.prototype:GetOptions() function TargetInfo.prototype:GetOptions()
local opts = TargetInfo.super.prototype.GetOptions(self) local opts = TargetInfo.super.prototype.GetOptions(self)
opts["vpos"] = {
type = "range",
name = "Vertical Position",
desc = "Vertical Position",
get = function()
return self.moduleSettings.vpos
end,
set = function(v)
self.moduleSettings.vpos = v
self:Redraw()
end,
min = -300,
max = 300,
step = 10,
order = 31
}
opts["fontSize"] = { opts["fontSize"] = {
type = 'range', type = 'range',
name = 'Font Size', name = 'Font Size',
@ -37,23 +55,6 @@ function TargetInfo.prototype:GetOptions()
min = 8, min = 8,
max = 20, max = 20,
step = 1, step = 1,
order = 31
}
opts["comboFontSize"] = {
type = 'range',
name = 'Combo Points Font Size',
desc = 'Combo Points Font Size',
get = function()
return self.moduleSettings.comboFontSize
end,
set = function(v)
self.moduleSettings.comboFontSize = v
self:Redraw()
end,
min = 10,
max = 40,
step = 1,
order = 32 order = 32
} }
@ -65,7 +66,7 @@ end
function TargetInfo.prototype:GetDefaultSettings() function TargetInfo.prototype:GetDefaultSettings()
local defaults = TargetInfo.super.prototype.GetDefaultSettings(self) local defaults = TargetInfo.super.prototype.GetDefaultSettings(self)
defaults["fontSize"] = 13 defaults["fontSize"] = 13
defaults["comboFontSize"] = 20 defaults["vpos"] = -50
return defaults return defaults
end end
@ -74,9 +75,7 @@ end
function TargetInfo.prototype:Redraw() function TargetInfo.prototype:Redraw()
TargetInfo.super.prototype.Redraw(self) TargetInfo.super.prototype.Redraw(self)
self:CreateTextFrame() self:CreateFrame()
self:CreateInfoTextFrame()
self:CreateComboFrame()
end end
@ -93,8 +92,6 @@ function TargetInfo.prototype:Enable()
self:RegisterEvent("UNIT_DYNAMIC_FLAGS", "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")
end end
@ -108,7 +105,8 @@ function TargetInfo.prototype:CreateFrame()
self.frame:SetWidth(TargetInfo.Width) self.frame:SetWidth(TargetInfo.Width)
self.frame:SetHeight(42) self.frame:SetHeight(42)
self.frame:ClearAllPoints() self.frame:ClearAllPoints()
self.frame:SetPoint("TOP", self.parent, "BOTTOM", 0, -50) self.frame:SetPoint("TOP", self.parent, "BOTTOM", 0, self.moduleSettings.vpos)
self.frame:SetScale(self.moduleSettings.scale)
self.frame:Show() self.frame:Show()
@ -117,7 +115,6 @@ function TargetInfo.prototype:CreateFrame()
self:CreateBuffFrame() self:CreateBuffFrame()
self:CreateDebuffFrame() self:CreateDebuffFrame()
self:CreateRaidIconFrame() self:CreateRaidIconFrame()
self:CreateComboFrame()
end end
@ -147,18 +144,11 @@ function TargetInfo.prototype:CreateInfoTextFrame()
end end
function TargetInfo.prototype:CreateComboFrame()
self.frame.comboPoints = self:FontFactory("Bold", self.moduleSettings.comboFontSize, nil, self.frame.comboPoints)
self.frame.comboPoints:SetWidth(TargetInfo.Width)
self.frame.comboPoints:SetJustifyH("CENTER")
self.frame.comboPoints:SetPoint("BOTTOM", self.frame, "TOP", 0, 5)
self.frame.comboPoints:Show()
end
function TargetInfo.prototype:CreateRaidIconFrame() function TargetInfo.prototype:CreateRaidIconFrame()
if (self.frame.raidIcon) then
return
end
self.frame.raidIcon = self.frame:CreateTexture(nil, "BACKGROUND") self.frame.raidIcon = self.frame:CreateTexture(nil, "BACKGROUND")
self.frame.raidIcon:SetTexture("Interface\\TargetingFrame\\UI-RaidTargetingIcons") self.frame.raidIcon:SetTexture("Interface\\TargetingFrame\\UI-RaidTargetingIcons")
@ -171,6 +161,10 @@ end
function TargetInfo.prototype:CreateBuffFrame() function TargetInfo.prototype:CreateBuffFrame()
if (self.frame.buffFrame) then
return
end
self.frame.buffFrame = CreateFrame("Frame", nil, self.frame) self.frame.buffFrame = CreateFrame("Frame", nil, self.frame)
self.frame.buffFrame:SetFrameStrata("BACKGROUND") self.frame.buffFrame:SetFrameStrata("BACKGROUND")
@ -185,6 +179,10 @@ end
function TargetInfo.prototype:CreateDebuffFrame() function TargetInfo.prototype:CreateDebuffFrame()
if (self.frame.debuffFrame) then
return
end
self.frame.debuffFrame = CreateFrame("Frame", nil, self.frame) self.frame.debuffFrame = CreateFrame("Frame", nil, self.frame)
self.frame.debuffFrame:SetFrameStrata("BACKGROUND") self.frame.debuffFrame:SetFrameStrata("BACKGROUND")
@ -263,11 +261,6 @@ function TargetInfo.prototype:AuraChanged(unit)
end end
function TargetInfo.prototype:ComboPointsChanged()
self:UpdateComboPoints()
end
function TargetInfo.prototype:RaidIconChanged(unit) function TargetInfo.prototype:RaidIconChanged(unit)
if (unit == "target") then if (unit == "target") then
self:UpdateRaidTargetIcon() self:UpdateRaidTargetIcon()
@ -291,18 +284,6 @@ function TargetInfo.prototype:UpdateRaidTargetIcon()
end end
function TargetInfo.prototype:UpdateComboPoints()
local points = GetComboPoints("target")
self.frame.comboPoints:SetTextColor(self:GetColor("combo", 0.7))
if (points == 0) then
points = nil
end
self.frame.comboPoints:SetText(points)
end
function TargetInfo.prototype:TargetChanged() function TargetInfo.prototype:TargetChanged()
local name = UnitName("target") local name = UnitName("target")
local _, unitClass = UnitClass("target") local _, unitClass = UnitClass("target")
@ -312,16 +293,9 @@ function TargetInfo.prototype:TargetChanged()
self.frame.targetInfo:SetText(self:GetInfoString()) self.frame.targetInfo:SetText(self:GetInfoString())
self:UpdateBuffs() self:UpdateBuffs()
self:UpdateRaidTargetIcon() self:UpdateRaidTargetIcon()
self:UpdateComboPoints()
end end
function TargetInfo.prototype:CombatCheck(arg1)
print(arg1)
end
function TargetInfo.prototype:GetInfoString() function TargetInfo.prototype:GetInfoString()
local u = "target" local u = "target"

View File

@ -16,6 +16,8 @@ function TargetOfTarget.prototype:init()
self.buffSize = 15 self.buffSize = 15
self.stackedDebuffs = {} self.stackedDebuffs = {}
self.scalingEnabled = true
end end
@ -23,6 +25,23 @@ end
function TargetOfTarget.prototype:GetOptions() function TargetOfTarget.prototype:GetOptions()
local opts = TargetOfTarget.super.prototype.GetOptions(self) local opts = TargetOfTarget.super.prototype.GetOptions(self)
opts["vpos"] = {
type = "range",
name = "Vertical Position",
desc = "Vertical Position",
get = function()
return self.moduleSettings.vpos
end,
set = function(v)
self.moduleSettings.vpos = v
self:Redraw()
end,
min = -300,
max = 300,
step = 10,
order = 31
}
opts["showDebuffs"] = { opts["showDebuffs"] = {
type = "toggle", type = "toggle",
name = "Show stacking debuffs", name = "Show stacking debuffs",
@ -34,7 +53,7 @@ function TargetOfTarget.prototype:GetOptions()
self.moduleSettings.showDebuffs = value self.moduleSettings.showDebuffs = value
self:UpdateBuffs() self:UpdateBuffs()
end, end,
order = 31 order = 32
} }
opts["fontSize"] = { opts["fontSize"] = {
@ -51,7 +70,7 @@ function TargetOfTarget.prototype:GetOptions()
min = 8, min = 8,
max = 20, max = 20,
step = 1, step = 1,
order = 32 order = 33
} }
return opts return opts
@ -61,6 +80,7 @@ end
-- OVERRIDE -- OVERRIDE
function TargetOfTarget.prototype:GetDefaultSettings() function TargetOfTarget.prototype:GetDefaultSettings()
local defaults = TargetOfTarget.super.prototype.GetDefaultSettings(self) local defaults = TargetOfTarget.super.prototype.GetDefaultSettings(self)
defaults["vpos"] = -50
defaults["showDebuffs"] = true defaults["showDebuffs"] = true
defaults["fontSize"] = 13 defaults["fontSize"] = 13
return defaults return defaults
@ -71,8 +91,7 @@ end
function TargetOfTarget.prototype:Redraw() function TargetOfTarget.prototype:Redraw()
TargetOfTarget.super.prototype.Redraw(self) TargetOfTarget.super.prototype.Redraw(self)
self:CreateToTFrame() self:CreateFrame()
self:CreateToTHPFrame()
end end
@ -103,7 +122,8 @@ function TargetOfTarget.prototype:CreateFrame()
self.frame:SetFrameStrata("BACKGROUND") self.frame:SetFrameStrata("BACKGROUND")
self.frame:SetWidth(260) self.frame:SetWidth(260)
self.frame:SetHeight(50) self.frame:SetHeight(50)
self.frame:SetPoint("TOP", self.parent, "BOTTOM", 0, -50) self.frame:SetPoint("TOP", self.parent, "BOTTOM", 0, self.moduleSettings.vpos)
self.frame:SetScale(self.moduleSettings.scale)
self.frame:Show() self.frame:Show()
self:CreateToTFrame() self:CreateToTFrame()
@ -139,6 +159,9 @@ end
function TargetOfTarget.prototype:CreateDebuffFrame() function TargetOfTarget.prototype:CreateDebuffFrame()
if (self.frame.debuffFrame) then
return
end
self.frame.debuffFrame = CreateFrame("Frame", nil, self.frame) self.frame.debuffFrame = CreateFrame("Frame", nil, self.frame)
self.frame.debuffFrame:SetFrameStrata("BACKGROUND") self.frame.debuffFrame:SetFrameStrata("BACKGROUND")

BIN
textures/Combo.blp Normal file

Binary file not shown.

BIN
textures/ComboBG.blp Normal file

Binary file not shown.