Power-/HealthBar customize texts added and UNIT_DESTROYED added
This commit is contained in:
parent
a152cb6045
commit
1fb3fce980
@ -17,7 +17,9 @@ local Healthbar = Gladdy:NewModule("Healthbar", 100, {
|
|||||||
healthBarBorderColor = { r = 0, g = 0, b = 0, a = 1 },
|
healthBarBorderColor = { r = 0, g = 0, b = 0, a = 1 },
|
||||||
healthBarBgColor = { r = 0, g = 0, b = 0, a = 0.4 },
|
healthBarBgColor = { r = 0, g = 0, b = 0, a = 0.4 },
|
||||||
healthBarFontColor = { r = 1, g = 1, b = 1, a = 1 },
|
healthBarFontColor = { r = 1, g = 1, b = 1, a = 1 },
|
||||||
healthBarFontSize = 12,
|
healthBarNameFontSize = 12,
|
||||||
|
healthBarHealthFontSize = 12,
|
||||||
|
healthName = true,
|
||||||
healthActual = false,
|
healthActual = false,
|
||||||
healthMax = true,
|
healthMax = true,
|
||||||
healthPercentage = true,
|
healthPercentage = true,
|
||||||
@ -26,6 +28,7 @@ local Healthbar = Gladdy:NewModule("Healthbar", 100, {
|
|||||||
function Healthbar:Initialize()
|
function Healthbar:Initialize()
|
||||||
self.frames = {}
|
self.frames = {}
|
||||||
self:RegisterMessage("ENEMY_SPOTTED")
|
self:RegisterMessage("ENEMY_SPOTTED")
|
||||||
|
self:RegisterMessage("UNIT_DESTROYED")
|
||||||
self:RegisterMessage("UNIT_DEATH")
|
self:RegisterMessage("UNIT_DEATH")
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -51,11 +54,11 @@ function Healthbar:CreateFrame(unit)
|
|||||||
healthBar.bg:SetVertexColor(Gladdy.db.healthBarBgColor.r, Gladdy.db.healthBarBgColor.g, Gladdy.db.healthBarBgColor.b, Gladdy.db.healthBarBgColor.a)
|
healthBar.bg:SetVertexColor(Gladdy.db.healthBarBgColor.r, Gladdy.db.healthBarBgColor.g, Gladdy.db.healthBarBgColor.b, Gladdy.db.healthBarBgColor.a)
|
||||||
|
|
||||||
healthBar.nameText = healthBar:CreateFontString(nil, "LOW", "GameFontNormalSmall")
|
healthBar.nameText = healthBar:CreateFontString(nil, "LOW", "GameFontNormalSmall")
|
||||||
if (Gladdy.db.healthBarFontSize < 1) then
|
if (Gladdy.db.healthBarNameFontSize < 1) then
|
||||||
healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), 1)
|
healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarNameFont), 1)
|
||||||
healthBar.nameText:Hide()
|
healthBar.nameText:Hide()
|
||||||
else
|
else
|
||||||
healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), Gladdy.db.healthBarFontSize)
|
healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), Gladdy.db.healthBarNameFontSize)
|
||||||
healthBar.nameText:Show()
|
healthBar.nameText:Show()
|
||||||
end
|
end
|
||||||
healthBar.nameText:SetTextColor(Gladdy.db.healthBarFontColor.r, Gladdy.db.healthBarFontColor.g, Gladdy.db.healthBarFontColor.b, Gladdy.db.healthBarFontColor.a)
|
healthBar.nameText:SetTextColor(Gladdy.db.healthBarFontColor.r, Gladdy.db.healthBarFontColor.g, Gladdy.db.healthBarFontColor.b, Gladdy.db.healthBarFontColor.a)
|
||||||
@ -65,11 +68,11 @@ function Healthbar:CreateFrame(unit)
|
|||||||
healthBar.nameText:SetPoint("LEFT", 5, 0)
|
healthBar.nameText:SetPoint("LEFT", 5, 0)
|
||||||
|
|
||||||
healthBar.healthText = healthBar:CreateFontString(nil, "LOW")
|
healthBar.healthText = healthBar:CreateFontString(nil, "LOW")
|
||||||
if (Gladdy.db.healthBarFontSize < 1) then
|
if (Gladdy.db.healthBarHealthFontSize < 1) then
|
||||||
healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), 1)
|
healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), 1)
|
||||||
healthBar.healthText:Hide()
|
healthBar.healthText:Hide()
|
||||||
else
|
else
|
||||||
healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), Gladdy.db.healthBarFontSize)
|
healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), Gladdy.db.healthBarHealthFontSize)
|
||||||
healthBar.healthText:Hide()
|
healthBar.healthText:Hide()
|
||||||
end
|
end
|
||||||
healthBar.healthText:SetTextColor(Gladdy.db.healthBarFontColor.r, Gladdy.db.healthBarFontColor.g, Gladdy.db.healthBarFontColor.b, Gladdy.db.healthBarFontColor.a)
|
healthBar.healthText:SetTextColor(Gladdy.db.healthBarFontColor.r, Gladdy.db.healthBarFontColor.g, Gladdy.db.healthBarFontColor.b, Gladdy.db.healthBarFontColor.a)
|
||||||
@ -166,17 +169,24 @@ function Healthbar:UpdateFrame(unit)
|
|||||||
healthBar.hp:SetPoint("TOPLEFT", healthBar, "TOPLEFT", (Gladdy.db.healthBarBorderSize/Gladdy.db.statusbarBorderOffset), -(Gladdy.db.healthBarBorderSize/Gladdy.db.statusbarBorderOffset))
|
healthBar.hp:SetPoint("TOPLEFT", healthBar, "TOPLEFT", (Gladdy.db.healthBarBorderSize/Gladdy.db.statusbarBorderOffset), -(Gladdy.db.healthBarBorderSize/Gladdy.db.statusbarBorderOffset))
|
||||||
healthBar.hp:SetPoint("BOTTOMRIGHT", healthBar, "BOTTOMRIGHT", -(Gladdy.db.healthBarBorderSize/Gladdy.db.statusbarBorderOffset), (Gladdy.db.healthBarBorderSize/Gladdy.db.statusbarBorderOffset))
|
healthBar.hp:SetPoint("BOTTOMRIGHT", healthBar, "BOTTOMRIGHT", -(Gladdy.db.healthBarBorderSize/Gladdy.db.statusbarBorderOffset), (Gladdy.db.healthBarBorderSize/Gladdy.db.statusbarBorderOffset))
|
||||||
|
|
||||||
if (Gladdy.db.healthBarFontSize < 1) then
|
if (Gladdy.db.healthBarHealthFontSize < 1) then
|
||||||
healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), 1)
|
|
||||||
healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), 1)
|
healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), 1)
|
||||||
healthBar.nameText:Hide()
|
|
||||||
healthBar.healthText:Hide()
|
healthBar.healthText:Hide()
|
||||||
else
|
else
|
||||||
healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), Gladdy.db.healthBarFontSize)
|
healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), Gladdy.db.healthBarHealthFontSize)
|
||||||
healthBar.nameText:Show()
|
|
||||||
healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), Gladdy.db.healthBarFontSize)
|
|
||||||
healthBar.healthText:Show()
|
healthBar.healthText:Show()
|
||||||
end
|
end
|
||||||
|
if (Gladdy.db.healthBarNameFontSize < 1) then
|
||||||
|
healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarNameFont), 1)
|
||||||
|
healthBar.nameText:Hide()
|
||||||
|
else
|
||||||
|
healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), Gladdy.db.healthBarNameFontSize)
|
||||||
|
if Gladdy.db.healthName then
|
||||||
|
healthBar.nameText:Show()
|
||||||
|
else
|
||||||
|
healthBar.nameText:Hide()
|
||||||
|
end
|
||||||
|
end
|
||||||
healthBar.nameText:SetTextColor(Gladdy.db.healthBarFontColor.r, Gladdy.db.healthBarFontColor.g, Gladdy.db.healthBarFontColor.b, Gladdy.db.healthBarFontColor.a)
|
healthBar.nameText:SetTextColor(Gladdy.db.healthBarFontColor.r, Gladdy.db.healthBarFontColor.g, Gladdy.db.healthBarFontColor.b, Gladdy.db.healthBarFontColor.a)
|
||||||
healthBar.healthText:SetTextColor(Gladdy.db.healthBarFontColor.r, Gladdy.db.healthBarFontColor.g, Gladdy.db.healthBarFontColor.b, Gladdy.db.healthBarFontColor.a)
|
healthBar.healthText:SetTextColor(Gladdy.db.healthBarFontColor.r, Gladdy.db.healthBarFontColor.g, Gladdy.db.healthBarFontColor.b, Gladdy.db.healthBarFontColor.a)
|
||||||
end
|
end
|
||||||
@ -270,6 +280,17 @@ function Healthbar:UNIT_DEATH(unit)
|
|||||||
healthBar.healthText:SetText(L["DEAD"])
|
healthBar.healthText:SetText(L["DEAD"])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Healthbar:UNIT_DESTROYED(unit)
|
||||||
|
local healthBar = self.frames[unit]
|
||||||
|
if (not healthBar) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
healthBar.hp:SetValue(0)
|
||||||
|
healthBar.healthText:SetText(L["LEAVE"])
|
||||||
|
healthBar.nameText:SetText("")
|
||||||
|
end
|
||||||
|
|
||||||
local function option(params)
|
local function option(params)
|
||||||
local defaults = {
|
local defaults = {
|
||||||
get = function(info)
|
get = function(info)
|
||||||
@ -283,6 +304,9 @@ local function option(params)
|
|||||||
if Gladdy.db.healthBarBorderSize > Gladdy.db.healthBarHeight/2 then
|
if Gladdy.db.healthBarBorderSize > Gladdy.db.healthBarHeight/2 then
|
||||||
Gladdy.db.healthBarBorderSize = Gladdy.db.healthBarHeight/2
|
Gladdy.db.healthBarBorderSize = Gladdy.db.healthBarHeight/2
|
||||||
end
|
end
|
||||||
|
for i=1,Gladdy.curBracket do
|
||||||
|
Healthbar:Test("arena" .. i)
|
||||||
|
end
|
||||||
Gladdy:UpdateFrame()
|
Gladdy:UpdateFrame()
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
@ -368,11 +392,21 @@ function Healthbar:GetOptions()
|
|||||||
order = 12,
|
order = 12,
|
||||||
hasAlpha = true,
|
hasAlpha = true,
|
||||||
}),
|
}),
|
||||||
healthBarFontSize = option({
|
healthBarNameFontSize = option({
|
||||||
type = "range",
|
type = "range",
|
||||||
name = L["Font size"],
|
name = L["Name font size"],
|
||||||
desc = L["Size of the text"],
|
desc = L["Size of the name text"],
|
||||||
order = 13,
|
order = 13,
|
||||||
|
step = 0.1,
|
||||||
|
min = 0,
|
||||||
|
max = 20,
|
||||||
|
}),
|
||||||
|
healthBarHealthFontSize = option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Health font size"],
|
||||||
|
desc = L["Size of the health text"],
|
||||||
|
order = 14,
|
||||||
|
step = 0.1,
|
||||||
min = 0,
|
min = 0,
|
||||||
max = 20,
|
max = 20,
|
||||||
}),
|
}),
|
||||||
@ -415,14 +449,20 @@ function Healthbar:GetOptions()
|
|||||||
},
|
},
|
||||||
healthValues = {
|
healthValues = {
|
||||||
type = "group",
|
type = "group",
|
||||||
name = L["Health Values"],
|
name = L["Health Bar Text"],
|
||||||
order = 4,
|
order = 4,
|
||||||
args = {
|
args = {
|
||||||
header = {
|
header = {
|
||||||
type = "header",
|
type = "header",
|
||||||
name = L["Health Values"],
|
name = L["Health Bar Text"],
|
||||||
order = 1,
|
order = 1,
|
||||||
},
|
},
|
||||||
|
healthName = option({
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Show the name"],
|
||||||
|
desc = L["Show the units name"],
|
||||||
|
order = 30,
|
||||||
|
}),
|
||||||
healthActual = option({
|
healthActual = option({
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = L["Show the actual health"],
|
name = L["Show the actual health"],
|
||||||
|
@ -16,6 +16,8 @@ local Powerbar = Gladdy:NewModule("Powerbar", 90, {
|
|||||||
powerBarFontColor = { r = 1, g = 1, b = 1, a = 1 },
|
powerBarFontColor = { r = 1, g = 1, b = 1, a = 1 },
|
||||||
powerBarBgColor = { r = 0.3, g = 0.3, b = 0.3, a = 0.7 },
|
powerBarBgColor = { r = 0.3, g = 0.3, b = 0.3, a = 0.7 },
|
||||||
powerBarFontSize = 10,
|
powerBarFontSize = 10,
|
||||||
|
powerShowSpec = true,
|
||||||
|
powerShowRace = true,
|
||||||
powerActual = true,
|
powerActual = true,
|
||||||
powerMax = true,
|
powerMax = true,
|
||||||
powerPercentage = false,
|
powerPercentage = false,
|
||||||
@ -27,6 +29,7 @@ function Powerbar:Initialize()
|
|||||||
self:RegisterMessage("ENEMY_SPOTTED")
|
self:RegisterMessage("ENEMY_SPOTTED")
|
||||||
self:RegisterMessage("UNIT_SPEC")
|
self:RegisterMessage("UNIT_SPEC")
|
||||||
self:RegisterMessage("UNIT_DEATH")
|
self:RegisterMessage("UNIT_DEATH")
|
||||||
|
self:RegisterMessage("UNIT_DESTROYED")
|
||||||
end
|
end
|
||||||
|
|
||||||
function Powerbar:CreateFrame(unit)
|
function Powerbar:CreateFrame(unit)
|
||||||
@ -185,9 +188,9 @@ function Powerbar:ENEMY_SPOTTED(unit)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local raceText = button.raceLoc
|
local raceText = Gladdy.db.powerShowRace and button.raceLoc or ""
|
||||||
|
|
||||||
if (button.spec) then
|
if (button.spec and Gladdy.db.powerShowSpec) then
|
||||||
raceText = button.spec .. " " .. raceText
|
raceText = button.spec .. " " .. raceText
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -263,6 +266,15 @@ function Powerbar:UNIT_DEATH(unit)
|
|||||||
powerBar.powerText:SetText("0%")
|
powerBar.powerText:SetText("0%")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Powerbar:UNIT_DESTROYED(unit)
|
||||||
|
local powerBar = self.frames[unit]
|
||||||
|
if (not powerBar) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
powerBar.energy:SetValue(0)
|
||||||
|
powerBar.powerText:SetText("0%")
|
||||||
|
end
|
||||||
|
|
||||||
local function option(params)
|
local function option(params)
|
||||||
local defaults = {
|
local defaults = {
|
||||||
get = function(info)
|
get = function(info)
|
||||||
@ -272,10 +284,13 @@ local function option(params)
|
|||||||
set = function(info, value)
|
set = function(info, value)
|
||||||
local key = info.arg or info[#info]
|
local key = info.arg or info[#info]
|
||||||
Gladdy.dbi.profile[key] = value
|
Gladdy.dbi.profile[key] = value
|
||||||
Gladdy.options.args.Powerbar.args.group.args.border.arg.powerBarBorderSize.max = Gladdy.db.powerBarHeight/2
|
Gladdy.options.args.Powerbar.args.group.args.border.args.powerBarBorderSize.max = Gladdy.db.powerBarHeight/2
|
||||||
if Gladdy.db.powerBarBorderSize > Gladdy.db.powerBarHeight/2 then
|
if Gladdy.db.powerBarBorderSize > Gladdy.db.powerBarHeight/2 then
|
||||||
Gladdy.db.powerBarBorderSize = Gladdy.db.powerBarHeight/2
|
Gladdy.db.powerBarBorderSize = Gladdy.db.powerBarHeight/2
|
||||||
end
|
end
|
||||||
|
for i=1,Gladdy.curBracket do
|
||||||
|
Powerbar:Test("arena" .. i)
|
||||||
|
end
|
||||||
Gladdy:UpdateFrame()
|
Gladdy:UpdateFrame()
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
@ -366,6 +381,7 @@ function Powerbar:GetOptions()
|
|||||||
name = L["Font size"],
|
name = L["Font size"],
|
||||||
desc = L["Size of the text"],
|
desc = L["Size of the text"],
|
||||||
order = 13,
|
order = 13,
|
||||||
|
step = 0.1,
|
||||||
min = 1,
|
min = 1,
|
||||||
max = 20,
|
max = 20,
|
||||||
}),
|
}),
|
||||||
@ -408,14 +424,26 @@ function Powerbar:GetOptions()
|
|||||||
},
|
},
|
||||||
powerValues = {
|
powerValues = {
|
||||||
type = "group",
|
type = "group",
|
||||||
name = L["Power Values"],
|
name = L["Power Bar Text"],
|
||||||
order = 4,
|
order = 4,
|
||||||
args = {
|
args = {
|
||||||
header = {
|
header = {
|
||||||
type = "header",
|
type = "header",
|
||||||
name = L["Power Values"],
|
name = L["Power Texts"],
|
||||||
order = 1,
|
order = 1,
|
||||||
},
|
},
|
||||||
|
powerShowRace = option({
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Show race"],
|
||||||
|
desc = L["Show race"],
|
||||||
|
order = 2,
|
||||||
|
}),
|
||||||
|
powerShowSpec= option({
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Show spec"],
|
||||||
|
desc = L["Show spec"],
|
||||||
|
order = 3,
|
||||||
|
}),
|
||||||
powerActual = option({
|
powerActual = option({
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = L["Show the actual power"],
|
name = L["Show the actual power"],
|
||||||
|
Loading…
Reference in New Issue
Block a user