cleanup
This commit is contained in:
parent
1c42523a2f
commit
2571df3052
@ -129,7 +129,7 @@ function Healthbar.OnEvent(self, event, unit)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Healthbar:SetHealthText(healthBar, health, healthMax)
|
function Healthbar:SetHealthText(healthBar, health, healthMax)
|
||||||
local healthText
|
local healthText = ""
|
||||||
local healthPercentage = floor(health * 100 / healthMax)
|
local healthPercentage = floor(health * 100 / healthMax)
|
||||||
|
|
||||||
if health == 0 and UnitExists(healthBar.unit) and UnitIsDeadOrGhost(healthBar.unit) then
|
if health == 0 and UnitExists(healthBar.unit) and UnitIsDeadOrGhost(healthBar.unit) then
|
||||||
@ -137,26 +137,9 @@ function Healthbar:SetHealthText(healthBar, health, healthMax)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if (Gladdy.db.healthActual) then
|
|
||||||
healthText = healthMax > 999 and ("%.1fk"):format(health / 1000) or health
|
|
||||||
end
|
|
||||||
|
|
||||||
if (Gladdy.db.healthMax) then
|
|
||||||
local text = healthMax > 999 and ("%.1fk"):format(healthMax / 1000) or healthMax
|
|
||||||
if (healthText) then
|
|
||||||
healthText = ("%s/%s"):format(healthText, text)
|
|
||||||
else
|
|
||||||
healthText = text
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if (Gladdy.db.healthPercentage) then
|
if (Gladdy.db.healthPercentage) then
|
||||||
if (healthText) then
|
|
||||||
healthText = ("%s (%d%%)"):format(healthText, healthPercentage)
|
|
||||||
else
|
|
||||||
healthText = ("%d%%"):format(healthPercentage)
|
healthText = ("%d%%"):format(healthPercentage)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
healthBar.healthText:SetText(healthText)
|
healthBar.healthText:SetText(healthText)
|
||||||
end
|
end
|
||||||
@ -271,28 +254,11 @@ function Healthbar:UNIT_HEALTH(unit, health, healthMax)
|
|||||||
Gladdy:SendMessage("UNIT_HEALTH", unit, health, healthMax)
|
Gladdy:SendMessage("UNIT_HEALTH", unit, health, healthMax)
|
||||||
|
|
||||||
local healthPercentage = floor(health * 100 / healthMax)
|
local healthPercentage = floor(health * 100 / healthMax)
|
||||||
local healthText
|
local healthText = ""
|
||||||
|
|
||||||
if (Gladdy.db.healthActual) then
|
|
||||||
healthText = healthMax > 999 and ("%.1fk"):format(health / 1000) or health
|
|
||||||
end
|
|
||||||
|
|
||||||
if (Gladdy.db.healthMax) then
|
|
||||||
local text = healthMax > 999 and ("%.1fk"):format(healthMax / 1000) or healthMax
|
|
||||||
if (healthText) then
|
|
||||||
healthText = ("%s/%s"):format(healthText, text)
|
|
||||||
else
|
|
||||||
healthText = text
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if (Gladdy.db.healthPercentage) then
|
if (Gladdy.db.healthPercentage) then
|
||||||
if (healthText) then
|
|
||||||
healthText = ("%s (%d%%)"):format(healthText, healthPercentage)
|
|
||||||
else
|
|
||||||
healthText = ("%d%%"):format(healthPercentage)
|
healthText = ("%d%%"):format(healthPercentage)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
healthBar.healthText:SetText(healthText)
|
healthBar.healthText:SetText(healthText)
|
||||||
healthBar.hp:SetValue(healthPercentage)
|
healthBar.hp:SetValue(healthPercentage)
|
||||||
|
@ -20,7 +20,6 @@ local Trinket = Gladdy:NewModule("Trinket", 80, {
|
|||||||
trinketXOffset = 0,
|
trinketXOffset = 0,
|
||||||
trinketYOffset = 0,
|
trinketYOffset = 0,
|
||||||
})
|
})
|
||||||
LibStub("AceComm-3.0"):Embed(Trinket)
|
|
||||||
|
|
||||||
function Trinket:Initialize()
|
function Trinket:Initialize()
|
||||||
self.frames = {}
|
self.frames = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user