Skip to content

Commit

Permalink
v0.9.53
Browse files Browse the repository at this point in the history
  • Loading branch information
d4kir92 committed Apr 13, 2024
1 parent a59c143 commit 3609661
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 116 deletions.
2 changes: 1 addition & 1 deletion ImproveAny.toc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Interface-Cata: 40400
## Interface: 100206

## Version: 0.9.52
## Version: 0.9.53
## Title: ImproveAny by |cff3FC7EBD4KiR |T132115:16:16:0:0|t
## Notes: Improve Any Ui or Frame
## Author: D4KiR
Expand Down
2 changes: 1 addition & 1 deletion ImproveAny_Cata.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 40400
## Version: 0.9.52
## Version: 0.9.53
## Title: ImproveAny |T136033:16:16:0:0|t by |cff3FC7EBD4KiR |T132115:16:16:0:0|t
## Notes: Improve Any Ui or Frame
## Author: D4KiR
Expand Down
2 changes: 1 addition & 1 deletion ImproveAny_TBC.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 20504
## Version: 0.9.52
## Version: 0.9.53
## Title: ImproveAny |T136033:16:16:0:0|t by |cff3FC7EBD4KiR |T132115:16:16:0:0|t
## Notes: Improve Any Ui or Frame
## Author: D4KiR
Expand Down
2 changes: 1 addition & 1 deletion ImproveAny_Vanilla.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 11502
## Version: 0.9.52
## Version: 0.9.53
## Title: ImproveAny |T136033:16:16:0:0|t by |cff3FC7EBD4KiR |T132115:16:16:0:0|t
## Notes: Improve Any Ui or Frame
## Author: D4KiR
Expand Down
2 changes: 1 addition & 1 deletion ImproveAny_Wrath.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 30403
## Version: 0.9.52
## Version: 0.9.53
## Title: ImproveAny |T136033:16:16:0:0|t by |cff3FC7EBD4KiR |T132115:16:16:0:0|t
## Notes: Improve Any Ui or Frame
## Author: D4KiR
Expand Down
237 changes: 128 additions & 109 deletions libs/D4Lib/D4Lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -105,121 +105,140 @@ end

ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", FixIconChat)
if D4:GetWoWBuild() == "CLASSIC" then
-- FIX HEALTH
TargetFrameTextureFrame:CreateFontString("TargetFrameHealthBarText", "BORDER", "TextStatusBarText")
TargetFrameHealthBarText:SetPoint("CENTER", TargetFrameTextureFrame, "CENTER", -50, 3)
TargetFrameTextureFrame:CreateFontString("TargetFrameHealthBarTextLeft", "BORDER", "TextStatusBarText")
TargetFrameHealthBarTextLeft:SetPoint("LEFT", TargetFrameTextureFrame, "LEFT", 8, 3)
TargetFrameTextureFrame:CreateFontString("TargetFrameHealthBarTextRight", "BORDER", "TextStatusBarText")
TargetFrameHealthBarTextRight:SetPoint("RIGHT", TargetFrameTextureFrame, "RIGHT", -110, 3)
TargetFrameTextureFrame:CreateFontString("TargetFrameManaBarText", "BORDER", "TextStatusBarText")
TargetFrameManaBarText:SetPoint("CENTER", TargetFrameTextureFrame, "CENTER", -50, -8)
TargetFrameTextureFrame:CreateFontString("TargetFrameManaBarTextLeft", "BORDER", "TextStatusBarText")
TargetFrameManaBarTextLeft:SetPoint("LEFT", TargetFrameTextureFrame, "LEFT", 8, -8)
TargetFrameTextureFrame:CreateFontString("TargetFrameManaBarTextRight", "BORDER", "TextStatusBarText")
TargetFrameManaBarTextRight:SetPoint("RIGHT", TargetFrameTextureFrame, "RIGHT", -110, -8)
TargetFrameHealthBar.LeftText = TargetFrameHealthBarTextLeft
TargetFrameHealthBar.RightText = TargetFrameHealthBarTextRight
TargetFrameManaBar.LeftText = TargetFrameManaBarTextLeft
TargetFrameManaBar.RightText = TargetFrameManaBarTextRight
UnitFrameHealthBar_Initialize("target", TargetFrameHealthBar, TargetFrameHealthBarText, true)
UnitFrameManaBar_Initialize("target", TargetFrameManaBar, TargetFrameManaBarText, true)
if FocusFrame then
UnitFrameHealthBar_Initialize("focus", FocusFrameHealthBar, FocusFrameHealthBarText, true)
UnitFrameManaBar_Initialize("focus", FocusFrameManaBar, FocusFrameManaBarText, true)
end

local function TextStatusBar_UpdateTextStringWithValues(statusFrame, textString, value, valueMin, valueMax)
if statusFrame.LeftText and statusFrame.RightText then
statusFrame.LeftText:SetText("")
statusFrame.RightText:SetText("")
statusFrame.LeftText:Hide()
statusFrame.RightText:Hide()
end

if (tonumber(valueMax) ~= valueMax or valueMax > 0) and not statusFrame.pauseUpdates then
statusFrame:Show()
if (statusFrame.cvar and GetCVar(statusFrame.cvar) == "1" and statusFrame.textLockable) or statusFrame.forceShow then
textString:Show()
elseif statusFrame.lockShow > 0 and (not statusFrame.forceHideText) then
textString:Show()
else
textString:SetText("")
textString:Hide()

return
end

if value == 0 and statusFrame.zeroText then
textString:SetText(statusFrame.zeroText)
statusFrame.isZero = 1
textString:Show()

return
end

statusFrame.isZero = nil
local valueDisplay = value
local valueMaxDisplay = valueMax
if statusFrame.numericDisplayTransformFunc then
valueDisplay, valueMaxDisplay = statusFrame.numericDisplayTransformFunc(value, valueMax)
else
valueDisplay = AbbreviateLargeNumbers(value)
valueMaxDisplay = AbbreviateLargeNumbers(valueMax)
end

local shouldUsePrefix = statusFrame.prefix and (statusFrame.alwaysPrefix or not (statusFrame.cvar and GetCVar(statusFrame.cvar) == "1" and statusFrame.textLockable))
local displayMode = GetCVar("statusTextDisplay")
if statusFrame.showNumeric then
displayMode = "NUMERIC"
end

if statusFrame.disablePercentages and displayMode == "PERCENT" then
displayMode = "NUMERIC"
end

if valueMax <= 0 or displayMode == "NUMERIC" or displayMode == "NONE" then
if shouldUsePrefix then
textString:SetText(statusFrame.prefix .. " " .. valueDisplay .. " / " .. valueMaxDisplay)
else
textString:SetText(valueDisplay .. " / " .. valueMaxDisplay)
C_Timer.After(
3,
function()
-- FIX HEALTH
D4.fixedHealth = D4.fixedHealth or false
if D4.fixedHealth == false then
D4.fixedHealth = true
local foundText = false
local HealthBarTexts = {TargetFrameHealthBar.RightText, TargetFrameHealthBar.LeftText, TargetFrameHealthBar.TextString, TargetFrameTextureFrameDeadText}
for _, healthBar in pairs(HealthBarTexts) do
if TargetFrameHealthBar.TextString ~= nil then
foundText = true
end
end
elseif displayMode == "BOTH" then
if statusFrame.LeftText and statusFrame.RightText then
if not statusFrame.disablePercentages and (not statusFrame.powerToken or statusFrame.powerToken == "MANA") then
statusFrame.LeftText:SetText(math.ceil((value / valueMax) * 100) .. "%")
statusFrame.LeftText:Show()

if foundText == false then
TargetFrameTextureFrame:CreateFontString("TargetFrameHealthBarText", "BORDER", "TextStatusBarText")
TargetFrameHealthBarText:SetPoint("CENTER", TargetFrameTextureFrame, "CENTER", -50, 3)
TargetFrameTextureFrame:CreateFontString("TargetFrameHealthBarTextLeft", "BORDER", "TextStatusBarText")
TargetFrameHealthBarTextLeft:SetPoint("LEFT", TargetFrameTextureFrame, "LEFT", 8, 3)
TargetFrameTextureFrame:CreateFontString("TargetFrameHealthBarTextRight", "BORDER", "TextStatusBarText")
TargetFrameHealthBarTextRight:SetPoint("RIGHT", TargetFrameTextureFrame, "RIGHT", -110, 3)
TargetFrameTextureFrame:CreateFontString("TargetFrameManaBarText", "BORDER", "TextStatusBarText")
TargetFrameManaBarText:SetPoint("CENTER", TargetFrameTextureFrame, "CENTER", -50, -8)
TargetFrameTextureFrame:CreateFontString("TargetFrameManaBarTextLeft", "BORDER", "TextStatusBarText")
TargetFrameManaBarTextLeft:SetPoint("LEFT", TargetFrameTextureFrame, "LEFT", 8, -8)
TargetFrameTextureFrame:CreateFontString("TargetFrameManaBarTextRight", "BORDER", "TextStatusBarText")
TargetFrameManaBarTextRight:SetPoint("RIGHT", TargetFrameTextureFrame, "RIGHT", -110, -8)
TargetFrameHealthBar.LeftText = TargetFrameHealthBarTextLeft
TargetFrameHealthBar.RightText = TargetFrameHealthBarTextRight
TargetFrameManaBar.LeftText = TargetFrameManaBarTextLeft
TargetFrameManaBar.RightText = TargetFrameManaBarTextRight
UnitFrameHealthBar_Initialize("target", TargetFrameHealthBar, TargetFrameHealthBarText, true)
UnitFrameManaBar_Initialize("target", TargetFrameManaBar, TargetFrameManaBarText, true)
if FocusFrame then
UnitFrameHealthBar_Initialize("focus", FocusFrameHealthBar, FocusFrameHealthBarText, true)
UnitFrameManaBar_Initialize("focus", FocusFrameManaBar, FocusFrameManaBarText, true)
end

statusFrame.RightText:SetText(valueDisplay)
statusFrame.RightText:Show()
textString:Hide()
else
valueDisplay = valueDisplay .. " / " .. valueMaxDisplay
if not statusFrame.disablePercentages then
valueDisplay = "(" .. math.ceil((value / valueMax) * 100) .. "%) " .. valueDisplay
local function TextStatusBar_UpdateTextStringWithValues(statusFrame, textString, value, valueMin, valueMax)
if statusFrame.LeftText and statusFrame.RightText then
statusFrame.LeftText:SetText("")
statusFrame.RightText:SetText("")
statusFrame.LeftText:Hide()
statusFrame.RightText:Hide()
end

if (tonumber(valueMax) ~= valueMax or valueMax > 0) and not statusFrame.pauseUpdates then
statusFrame:Show()
if (statusFrame.cvar and GetCVar(statusFrame.cvar) == "1" and statusFrame.textLockable) or statusFrame.forceShow then
textString:Show()
elseif statusFrame.lockShow > 0 and (not statusFrame.forceHideText) then
textString:Show()
else
textString:SetText("")
textString:Hide()

return
end

if value == 0 and statusFrame.zeroText then
textString:SetText(statusFrame.zeroText)
statusFrame.isZero = 1
textString:Show()

return
end

statusFrame.isZero = nil
local valueDisplay = value
local valueMaxDisplay = valueMax
if statusFrame.numericDisplayTransformFunc then
valueDisplay, valueMaxDisplay = statusFrame.numericDisplayTransformFunc(value, valueMax)
else
valueDisplay = AbbreviateLargeNumbers(value)
valueMaxDisplay = AbbreviateLargeNumbers(valueMax)
end

local shouldUsePrefix = statusFrame.prefix and (statusFrame.alwaysPrefix or not (statusFrame.cvar and GetCVar(statusFrame.cvar) == "1" and statusFrame.textLockable))
local displayMode = GetCVar("statusTextDisplay")
if statusFrame.showNumeric then
displayMode = "NUMERIC"
end

if statusFrame.disablePercentages and displayMode == "PERCENT" then
displayMode = "NUMERIC"
end

if valueMax <= 0 or displayMode == "NUMERIC" or displayMode == "NONE" then
if shouldUsePrefix then
textString:SetText(statusFrame.prefix .. " " .. valueDisplay .. " / " .. valueMaxDisplay)
else
textString:SetText(valueDisplay .. " / " .. valueMaxDisplay)
end
elseif displayMode == "BOTH" then
if statusFrame.LeftText and statusFrame.RightText then
if not statusFrame.disablePercentages and (not statusFrame.powerToken or statusFrame.powerToken == "MANA") then
statusFrame.LeftText:SetText(math.ceil((value / valueMax) * 100) .. "%")
statusFrame.LeftText:Show()
end

statusFrame.RightText:SetText(valueDisplay)
statusFrame.RightText:Show()
textString:Hide()
else
valueDisplay = valueDisplay .. " / " .. valueMaxDisplay
if not statusFrame.disablePercentages then
valueDisplay = "(" .. math.ceil((value / valueMax) * 100) .. "%) " .. valueDisplay
end
end

textString:SetText(valueDisplay)
elseif displayMode == "PERCENT" then
valueDisplay = math.ceil((value / valueMax) * 100) .. "%"
if shouldUsePrefix then
textString:SetText(statusFrame.prefix .. " " .. valueDisplay)
else
textString:SetText(valueDisplay)
end
end
else
textString:Hide()
textString:SetText("")
if not statusFrame.alwaysShow then
statusFrame:Hide()
else
statusFrame:SetValue(0)
end
end
end
end

textString:SetText(valueDisplay)
elseif displayMode == "PERCENT" then
valueDisplay = math.ceil((value / valueMax) * 100) .. "%"
if shouldUsePrefix then
textString:SetText(statusFrame.prefix .. " " .. valueDisplay)
else
textString:SetText(valueDisplay)
hooksecurefunc("TextStatusBar_UpdateTextStringWithValues", TextStatusBar_UpdateTextStringWithValues)
end
end
else
textString:Hide()
textString:SetText("")
if not statusFrame.alwaysShow then
statusFrame:Hide()
else
statusFrame:SetValue(0)
end
end
end

hooksecurefunc("TextStatusBar_UpdateTextStringWithValues", TextStatusBar_UpdateTextStringWithValues)
)
end
4 changes: 2 additions & 2 deletions settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,8 @@ function ImproveAny:InitIASettings()
IASettings:Hide()
end

D4:SetVersion(AddonName, 136033, "0.9.52")
IASettings.TitleText:SetText(format("ImproveAny |T136033:16:16:0:0|t v|cff3FC7EB%s", "0.9.52"))
D4:SetVersion(AddonName, 136033, "0.9.53")
IASettings.TitleText:SetText(format("ImproveAny |T136033:16:16:0:0|t v|cff3FC7EB%s", "0.9.53"))
IASettings.CloseButton:SetScript(
"OnClick",
function()
Expand Down

0 comments on commit 3609661

Please sign in to comment.