Skip to content

Commit ba9d6a9

Browse files
committed
Add custom UnitTokenFromGUID for classic clients
1 parent f71daaf commit ba9d6a9

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

KillTrack.lua

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,51 @@ if KT.Version == "@" .. "project-version" .. "@" then
109109
KT.Debug = true
110110
end
111111

112+
if not UnitTokenFromGUID then
113+
local units = {
114+
"player",
115+
"vehicle",
116+
"pet",
117+
"party1", "party2", "party3", "party4",
118+
"partypet1", "partypet2", "partypet3", "partypet4"
119+
}
120+
-- Multiple loops to get the same ordering as mainline API
121+
for i = 1, 40 do
122+
units[#units + 1] = "raid" .. i
123+
end
124+
for i = 1, 40 do
125+
units[#units + 1] = "raidpet" .. i
126+
end
127+
for i = 1, 40 do
128+
units[#units + 1] = "nameplate" .. i
129+
end
130+
for i = 1, 5 do
131+
units[#units + 1] = "arena" .. i
132+
end
133+
for i = 1, 5 do
134+
units[#units + 1] = "arenapet" .. i
135+
end
136+
for i = 1, 8 do
137+
units[#units + 1] = "boss" .. i
138+
end
139+
units[#units + 1] = "target"
140+
units[#units + 1] = "focus"
141+
units[#units + 1] = "npc"
142+
units[#units + 1] = "mouseover"
143+
units[#units + 1] = "softenemy"
144+
units[#units + 1] = "softfriend"
145+
units[#units + 1] = "softinteract"
146+
147+
UnitTokenFromGUID = function(guid)
148+
for _, unit in ipairs(units) do
149+
if UnitGUID(unit) == guid then
150+
return unit
151+
end
152+
end
153+
return nil
154+
end
155+
end
156+
112157
function KT:OnEvent(_, event, ...)
113158
if self.Events[event] then
114159
self.Events[event](self, ...)

0 commit comments

Comments
 (0)