Skip to content

Commit

Permalink
fix: assorted remaining classic compatibility issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ascott18 committed Aug 26, 2023
1 parent 6249bee commit 417ec7a
Show file tree
Hide file tree
Showing 10 changed files with 1,018 additions and 56 deletions.
16 changes: 3 additions & 13 deletions Components/Core/Conditions/Categories/BuffsDebuffs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ local strlowerCache = TMW.strlowerCache
local huge = math.huge
local empty = {}

local UnitAura = UnitAura
local UnitAura = TMW.UnitAura
local GetAuras = TMW.COMMON.Auras and TMW.COMMON.Auras.GetAuras

function Env.AuraStacks(unit, name, filter)
Expand Down Expand Up @@ -268,7 +268,7 @@ function Env.AuraTooltipNumber(...)
local index = 0
Parser:SetOwner(UIParent, "ANCHOR_NONE")
Parser:SetUnitAura(unit, n, filter)
local text = (TMW.isRetail and LT1 or LT2):GetText() or ""
local text = LT2:GetText() or ""
Parser:Hide()

local number
Expand Down Expand Up @@ -324,17 +324,7 @@ function Env.AuraTooltipNumberPacked(unit, name, kindKey, onlyMine, requestedInd

local data = C_TooltipInfo[kindKey == "isHelpful" and "GetUnitBuffByAuraInstanceID" or "GetUnitDebuffByAuraInstanceID"](unit, auraInstanceID)

local text
-- TODO: wow 10.1: The C_TooltipInfo APIs now return data with all data and line arguments surfaced, removing the need to call TooltipUtil.SurfaceArgs().
-- Only look at the second line (first line after the title):
-- (third line is the duration)
for _, arg in pairs(data.lines[2].args) do
if arg.field == "leftText" then
text = arg.stringVal
break
end
end

local text = data.lines[2].leftText
instance.tmwTooltipNumbers = {}
local index = 0
local number
Expand Down
27 changes: 22 additions & 5 deletions Components/Core/Conditions/Categories/PlayerAttributes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,28 @@ ConditionCategory:RegisterSpacer(15.5)


Env.Tracking = {}
function CNDT:MINIMAP_UPDATE_TRACKING()
wipe(Env.Tracking)
for i = 1, GetNumTrackingTypes() do
local name, _, active = GetTrackingInfo(i)
Env.Tracking[strlower(name)] = active and 1 or nil
if not TMW.isClassic then
-- Wrath+
function CNDT:MINIMAP_UPDATE_TRACKING()
wipe(Env.Tracking)
for i = 1, GetNumTrackingTypes() do
local name, _, active = GetTrackingInfo(i)
Env.Tracking[strlower(name)] = active and 1 or nil
end
end
else
-- WoW Classic
local Parser, LT1 = TMW:GetParser()
function CNDT:MINIMAP_UPDATE_TRACKING()
wipe(Env.Tracking)
Parser:SetOwner(UIParent, "ANCHOR_NONE")
Parser:SetTrackingSpell()
local text = LT1:GetText() or ""
Parser:Hide()

if text and text ~= "" then
Env.Tracking[strlower(text)] = 1
end
end
end
ConditionCategory:RegisterCondition(16, "TRACKING", {
Expand Down
74 changes: 56 additions & 18 deletions Components/Core/Conditions/Categories/PlayerAttributes_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ Module.stances = TMW.isWrath and {
[768] = GetSpellInfo(768), -- Cat Form
[783] = GetSpellInfo(783), -- Travel Form
[24858] = GetSpellInfo(24858), -- Moonkin Form
[33891] = GetSpellInfo(33891), -- Incarnation: Tree of Life
},
PRIEST = {
[15473] = GetSpellInfo(15473), -- Shadowform
Expand Down Expand Up @@ -151,28 +150,67 @@ Module.showColorHelp = false
Module.helpText = L["SUG_TOOLTIPTITLE_GENERIC"]

local TrackingCache = {}
function Module:Table_Get()
for i = 1, GetNumTrackingTypes() do
local name, _, active = GetTrackingInfo(i)
TrackingCache[i] = strlower(name)
if not TMW.isClassic then
function Module:Table_Get()
for i = 1, GetNumTrackingTypes() do
local name, _, active = GetTrackingInfo(i)
TrackingCache[i] = strlower(name)
end

return TrackingCache
end

function Module:Entry_AddToList_1(f, id)
local name, texture = GetTrackingInfo(id)

return TrackingCache
end
function Module:Table_GetSorter()
return nil
end
function Module:Entry_AddToList_1(f, id)
local name, texture = GetTrackingInfo(id)
f.Name:SetText(name)
f.ID:SetText(nil)

f.tooltiptitle = name

f.insert = name

f.Icon:SetTexture(texture)
end
else
-- WoW Classic
for _, id in pairs{
2580, -- Find Minerals
2383, -- Find Herbs
2481, -- Find Treasure
1494, -- Track Beasts
19878, -- Track Demons
19879, -- Track Dragonkin
19880, -- Track Elementals
19882, -- Track Giants
19885, -- Track Hidden
5225, -- Track Humanoids (druid)
19883, -- Track Humanoids
19884, -- Track Undead
} do
local name = GetSpellInfo(id)
TrackingCache[id] = strlower(name)
end

f.Name:SetText(name)
f.ID:SetText(nil)
function Module:Table_Get()
return TrackingCache
end

f.tooltiptitle = name
function Module:Entry_AddToList_1(f, id)
local name, _, texture = GetSpellInfo(id)

f.insert = name

f.Icon:SetTexture(texture)
f.Name:SetText(name)
f.ID:SetText(nil)

f.tooltiptitle = name

f.insert = name

f.Icon:SetTexture(texture)
end
end
function Module:Table_GetSorter()
return nil
end


Expand Down
921 changes: 921 additions & 0 deletions Components/Core/Spells/AuraDurations.lua

Large diffs are not rendered by default.

23 changes: 9 additions & 14 deletions Components/Core/Utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1609,27 +1609,22 @@ do -- TMW:GetParser()
local Parser, LT1, LT2, LT3, RT1, RT2, RT3
function TMW:GetParser()
if not Parser then
Parser = CreateFrame("GameTooltip")
Parser = CreateFrame("GameTooltip", "TMWParser", nil, "GameTooltipTemplate")
if TooltipDataHandlerMixin then
-- in theory this could use TooltipDataHandlerMixin,
-- but the blizzard PTR tooltips explode if we dont use GameTooltipDataMixin
-- because somehow for some reason they need GetUnit?
Mixin(Parser, GameTooltipDataMixin)
end

LT1 = Parser:CreateFontString()
RT1 = Parser:CreateFontString()
Parser:AddFontStrings(LT1, RT1)

LT2 = Parser:CreateFontString()
RT2 = Parser:CreateFontString()
Parser:AddFontStrings(LT2, RT2)

LT3 = Parser:CreateFontString()
RT3 = Parser:CreateFontString()
Parser:AddFontStrings(LT3, RT3)
end
return Parser, LT1, LT2, LT3, RT1, RT2, RT3
return
Parser,
TMWParserTextLeft1,
TMWParserTextLeft2,
TMWParserTextLeft3,
TMWParserTextRight1,
TMWParserTextRight2,
TMWParserTextRight3
end
end

Expand Down
3 changes: 2 additions & 1 deletion Components/IconModules/IconModule_TimerBar/TimerBar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,11 @@ function TimerBar:OnEnable()
end
self.texture:SetTexture(LSM:Fetch("statusbar", texture))

self:SetCooldown(attributes.start, attributes.start, attributes.chargeStart, attributes.chargeDur)
self:SetCooldown(attributes.start, attributes.duration, attributes.chargeStart, attributes.chargeDur)
end
function TimerBar:OnDisable()
self.__oldPercent = -1
self.__value = -1
self.bar:Hide()
self:UpdateTable_Unregister()
end
Expand Down
3 changes: 1 addition & 2 deletions Components/IconTypes/IconType_buff/buff.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ local L = TMW.L
local print = TMW.print
local tonumber, pairs, type, format, select =
tonumber, pairs, type, format, select
local UnitAura =
UnitAura
local UnitAura = TMW.UnitAura

local GetSpellTexture = TMW.GetSpellTexture
local strlowerCache = TMW.strlowerCache
Expand Down
4 changes: 2 additions & 2 deletions Components/IconTypes/IconType_buffcheck/buffcheck.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ local L = TMW.L
local print = TMW.print
local tonumber, pairs =
tonumber, pairs
local UnitAura, UnitIsDeadOrGhost =
UnitAura, UnitIsDeadOrGhost
local UnitIsDeadOrGhost = UnitIsDeadOrGhost
local UnitAura = TMW.UnitAura

local GetSpellTexture = TMW.GetSpellTexture
local strlowerCache = TMW.strlowerCache
Expand Down
2 changes: 1 addition & 1 deletion Options/TellMeWhen_Options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ IE.Defaults = {
global = {
LastChangelogVersion = 0,
TellMeWhenDBBackupDate = 0,
ScaleIE = false,
ScaleIE = true,
EditorScale = 1,
EditorHeight = 600,
ConfigWarning = true,
Expand Down
1 change: 1 addition & 0 deletions includes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@

<Script file="Components\Core\Spells\Spells.lua" />
<Script file="Components\Core\Spells\AuraCache.lua" />
<Script file="Components\Core\Spells\AuraDurations.lua" />
<Script file="Components\Core\Spells\ClassSpellCache.lua" />

<Script file="Components\Core\BaseClasses\GenericComponentImplementor.lua" />
Expand Down

0 comments on commit 417ec7a

Please sign in to comment.