Skip to content

Commit

Permalink
[Classic] Fix lua error on character datatext.
Browse files Browse the repository at this point in the history
  • Loading branch information
tukz committed Oct 9, 2024
1 parent 3cd8d3c commit e2119e7
Showing 1 changed file with 26 additions and 24 deletions.
50 changes: 26 additions & 24 deletions Tukui/Modules/DataTexts/Elements/Character.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,34 +49,36 @@ local OnEnter = function(self)
if T.Classic then
GameTooltip:AddDoubleLine(ClassColor..T.MyName.."|r "..UnitLevel("player"), T.MyRealm)
GameTooltip:AddLine(" ")

if CharacterStatFrame then
for _, Frame in pairs(CharacterStatFrame) do
local Name = _G[Frame.."Label"]
local Value = _G[Frame.."StatText"]
local Tooltip = _G[Frame].tooltip2
local StatName, StatValue

if Name:GetText() then
StatName = "|cffff8000"..Name:GetText().."|r"
end

for _, Frame in pairs(CharacterStatFrame) do
local Name = _G[Frame.."Label"]
local Value = _G[Frame.."StatText"]
local Tooltip = _G[Frame].tooltip2
local StatName, StatValue

if Name:GetText() then
StatName = "|cffff8000"..Name:GetText().."|r"
end

if Value:GetText() then
StatValue = "|cffffffff"..Value:GetText().."|r"
end

if StatName and StatValue then
if IsAlternativeTooltip then
GameTooltip:AddLine("|CF00FFF00"..StatName.."|r |CFFFFFFFF"..StatValue.."|r")
else
GameTooltip:AddDoubleLine("|CF00FFF00"..StatName.."|r", "|CFFFFFFFF"..StatValue.."|r")
if Value:GetText() then
StatValue = "|cffffffff"..Value:GetText().."|r"
end

if Tooltip and IsAlternativeTooltip then
-- Remove double enter, for gaining tooltip space
Tooltip = string.gsub(Tooltip, "\n\n", " ")
if StatName and StatValue then
if IsAlternativeTooltip then
GameTooltip:AddLine("|CF00FFF00"..StatName.."|r |CFFFFFFFF"..StatValue.."|r")
else
GameTooltip:AddDoubleLine("|CF00FFF00"..StatName.."|r", "|CFFFFFFFF"..StatValue.."|r")
end

if Tooltip and IsAlternativeTooltip then
-- Remove double enter, for gaining tooltip space
Tooltip = string.gsub(Tooltip, "\n\n", " ")

GameTooltip:AddLine(Tooltip, .75, .75, .75)
GameTooltip:AddLine(" ")
GameTooltip:AddLine(Tooltip, .75, .75, .75)
GameTooltip:AddLine(" ")
end
end
end
end
Expand Down

0 comments on commit e2119e7

Please sign in to comment.