Skip to content

Commit 3e2a757

Browse files
committed
Removed Enum references from classic code paths.
1 parent 8a86f96 commit 3e2a757

File tree

1 file changed

+56
-13
lines changed

1 file changed

+56
-13
lines changed

Shims.lua

Lines changed: 56 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,35 @@ local SHIM = MOD.SHIM
44
local NOP = function(...)
55
return
66
end
7+
78
do -- C_Container
89
local GetContainerItemID, GetContainerNumSlots
10+
11+
-- GetContainerItemID
912
if C_Container and C_Container.GetContainerItemID then
1013
GetContainerItemID = C_Container.GetContainerItemID
1114
elseif _G.GetContainerItemID then
1215
GetContainerItemID = _G.GetContainerItemID
1316
end
17+
function SHIM:GetContainerItemID(bag, slot)
18+
return GetContainerItemID(bag, slot)
19+
end
20+
21+
-- GetContainerNumSlots
1422
if C_Container and C_Container.GetContainerNumSlots then
1523
GetContainerNumSlots = C_Container.GetContainerNumSlots
1624
elseif _G.GetContainerNumSlots then
1725
GetContainerNumSlots = _G.GetContainerNumSlots
1826
end
19-
function SHIM:GetContainerItemID(bag, slot)
20-
return GetContainerItemID(bag, slot)
21-
end
2227
function SHIM:GetContainerNumSlots(bag)
2328
return GetContainerNumSlots(bag)
2429
end
2530
end
31+
2632
do -- C_CurrencyInfo
2733
local GetCoinTextureString
34+
35+
-- GetCoinTextureString
2836
if C_CurrencyInfo and C_CurrencyInfo.GetCoinTextureString then
2937
GetCoinTextureString = C_CurrencyInfo.GetCoinTextureString
3038
elseif _G.GetCoinTextureString then
@@ -34,8 +42,11 @@ do -- C_CurrencyInfo
3442
return GetCoinTextureString(amount)
3543
end
3644
end
45+
3746
do -- C_Item/C_Container
3847
local GetItemCooldown, GetItemCount, GetItemIconByID, GetItemInfo, GetItemSpell, IsUsableItem
48+
49+
-- GetItemCooldown
3950
if C_Item and C_Item.GetItemCooldown then
4051
GetItemCooldown = C_Item.GetItemCooldown
4152
elseif C_Container and C_Container.GetItemCooldown then
@@ -46,6 +57,8 @@ do -- C_Item/C_Container
4657
function SHIM:GetItemCooldown(item)
4758
return GetItemCooldown(item)
4859
end
60+
61+
-- GetItemCount
4962
if C_Item and C_Item.GetItemCount then
5063
GetItemCount = C_Item.GetItemCount
5164
elseif _G.GetItemCount then
@@ -54,6 +67,8 @@ do -- C_Item/C_Container
5467
function SHIM:GetItemCount(item, includeBank, includeCharges)
5568
return GetItemCount(item, includeBank, includeCharges)
5669
end
70+
71+
-- GetItemIconByID
5772
if C_Item and C_Item.GetItemIconByID then
5873
GetItemIconByID = C_Item.GetItemIconByID
5974
elseif _G.GetItemIcon then
@@ -62,6 +77,8 @@ do -- C_Item/C_Container
6277
function SHIM:GetItemIconByID(itemID)
6378
return GetItemIconByID(itemID)
6479
end
80+
81+
-- GetItemInfo
6582
if C_Item and C_Item.GetItemInfo then
6683
GetItemInfo = C_Item.GetItemInfo
6784
elseif _G.GetItemInfo then
@@ -70,6 +87,8 @@ do -- C_Item/C_Container
7087
function SHIM:GetItemInfo(itemID)
7188
return GetItemInfo(itemID)
7289
end
90+
91+
-- GetItemSpell
7392
if C_Item and C_Item.GetItemSpell then
7493
GetItemSpell = C_Item.GetItemSpell
7594
elseif _G.GetItemSpell then
@@ -78,6 +97,8 @@ do -- C_Item/C_Container
7897
function SHIM:GetItemSpell(itemID)
7998
return GetItemSpell(itemID)
8099
end
100+
101+
-- IsUsableItem
81102
if C_Item and C_Item.IsUsableItem then
82103
IsUsableItem = C_Item.IsUsableItem
83104
elseif _G.IsUsableItem then
@@ -87,8 +108,11 @@ do -- C_Item/C_Container
87108
return IsUsableItem(item)
88109
end
89110
end
111+
90112
do -- C_Spell
91113
local GetSpellInfo, GetSpellTexture, GetSpellCooldown, IsUsableSpell, GetSpellChargesByID
114+
115+
-- GetSpellInfo
92116
if C_Spell and C_Spell.GetSpellInfo then
93117
GetSpellInfo = C_Spell.GetSpellInfo
94118
function SHIM:GetSpellInfo(spellID)
@@ -103,6 +127,8 @@ do -- C_Spell
103127
return GetSpellInfo(spellID)
104128
end
105129
end
130+
131+
-- GetSpellTexture
106132
if C_Spell and C_Spell.GetSpellInfo then
107133
GetSpellTexture = C_Spell.GetSpellInfo
108134
function SHIM:GetSpellTexture(spellID)
@@ -117,6 +143,8 @@ do -- C_Spell
117143
return GetSpellTexture(spellID)
118144
end
119145
end
146+
147+
-- GetSpellCooldown
120148
if C_Spell and C_Spell.GetSpellCooldown then
121149
GetSpellCooldown = C_Spell.GetSpellCooldown
122150
function SHIM:GetSpellCooldown(spellID)
@@ -132,6 +160,8 @@ do -- C_Spell
132160
return GetSpellCooldown(spellID)
133161
end
134162
end
163+
164+
-- IsUsableSpell
135165
if C_Spell and C_Spell.IsSpellUsable then
136166
IsUsableSpell = C_Spell.IsSpellUsable
137167
elseif _G.IsUsableSpell then
@@ -140,6 +170,8 @@ do -- C_Spell
140170
function SHIM:IsUsableSpell(spell)
141171
return IsUsableSpell(spell)
142172
end
173+
174+
-- GetSpellChargesByID
143175
if C_Spell and C_Spell.GetSpellChargesByID then
144176
GetSpellChargesByID = C_Spell.GetSpellChargesByID
145177
function SHIM:GetSpellChargesByID(spellID)
@@ -155,8 +187,11 @@ do -- C_Spell
155187
end
156188
end
157189
end
190+
158191
do -- C_SpellBook
159192
local GetNumSpellTabs, GetSpellTabInfo, GetSpellBookItemName, GetSpellBookItemInfo, HasPetSpells, GetSpellBookItemCooldown, GetSpellCharges
193+
194+
-- GetNumSpellTabs
160195
if C_SpellBook and C_SpellBook.GetNumSpellBookSkillLines then
161196
GetNumSpellTabs = C_SpellBook.GetNumSpellBookSkillLines
162197
elseif _G.GetNumSpellTabs then
@@ -165,6 +200,8 @@ do -- C_SpellBook
165200
function SHIM:GetNumSpellTabs()
166201
return GetNumSpellTabs()
167202
end
203+
204+
-- GetSpellTabInfo
168205
if C_SpellBook and C_SpellBook.GetSpellBookSkillLineInfo then
169206
GetSpellTabInfo = C_SpellBook.GetSpellBookSkillLineInfo
170207
function SHIM:GetSpellTabInfo(tabIndex)
@@ -179,6 +216,8 @@ do -- C_SpellBook
179216
return GetSpellTabInfo(tabIndex)
180217
end
181218
end
219+
220+
-- GetSpellBookItemName
182221
if C_SpellBook and C_SpellBook.GetSpellBookItemName then
183222
GetSpellBookItemName = C_SpellBook.GetSpellBookItemName
184223
function SHIM:GetSpellBookItemName(index, bookType)
@@ -195,6 +234,8 @@ do -- C_SpellBook
195234
return GetSpellBookItemName(index, bookType)
196235
end
197236
end
237+
238+
-- GetSpellBookItemInfo
198239
if C_SpellBook and C_SpellBook.GetSpellBookItemInfo then
199240
GetSpellBookItemInfo = C_SpellBook.GetSpellBookItemInfo
200241
function SHIM:GetSpellBookItemInfo(index, bookType)
@@ -203,6 +244,7 @@ do -- C_SpellBook
203244
elseif bookType == "pet" then
204245
bookType = Enum.SpellBookSpellBank.Pet
205246
end
247+
206248
local info = GetSpellBookItemInfo(index, bookType)
207249
if info then
208250
local spellID = info.actionID
@@ -233,11 +275,6 @@ do -- C_SpellBook
233275
GetSpellBookItemInfo = _G.GetSpellBookItemInfo
234276
local IsPassiveSpell = _G.IsPassiveSpell
235277
function SHIM:GetSpellBookItemInfo(index, bookType)
236-
if bookType == Enum.SpellBookSpellBank.Player then
237-
bookType = "spell"
238-
elseif bookType == Enum.SpellBookSpellBank.Pet then
239-
bookType = "pet"
240-
end
241278
local itemType, spellID = GetSpellBookItemInfo(index, bookType)
242279
if itemType == "PETACTION" then
243280
spellID = bit.band(0xFFFFFF, spellID)
@@ -246,6 +283,8 @@ do -- C_SpellBook
246283
return itemType, spellID, IsPassiveSpell(spellID)
247284
end
248285
end
286+
287+
-- HasPetSpells
249288
if C_SpellBook and C_SpellBook.HasPetSpells then
250289
HasPetSpells = C_SpellBook.HasPetSpells
251290
elseif _G.HasPetSpells then
@@ -254,6 +293,8 @@ do -- C_SpellBook
254293
function SHIM:HasPetSpells()
255294
return HasPetSpells()
256295
end
296+
297+
-- GetSpellBookItemCooldown
257298
if C_SpellBook and C_SpellBook.GetSpellBookItemCooldown then
258299
GetSpellBookItemCooldown = C_SpellBook.GetSpellBookItemCooldown
259300
function SHIM:GetSpellBookItemCooldown(index, spellBank)
@@ -271,14 +312,11 @@ do -- C_SpellBook
271312
return GetSpellBookItemCooldown(index, spellBank)
272313
end
273314
end
315+
316+
-- GetSpellCharges
274317
if C_SpellBook and C_SpellBook.GetSpellBookItemCharges then
275318
GetSpellCharges = C_SpellBook.GetSpellBookItemCharges
276319
function SHIM:GetSpellCharges(index, bookType)
277-
if bookType == "spell" then
278-
bookType = Enum.SpellBookSpellBank.Player
279-
elseif bookType == "pet" then
280-
bookType = Enum.SpellBookSpellBank.Pet
281-
end
282320
local info = GetSpellCharges(index, bookType)
283321
if info then
284322
return info.currentCharges, info.maxCharges, info.cooldownStartTime, info.cooldownDuration, info.chargeModRate
@@ -291,8 +329,11 @@ do -- C_SpellBook
291329
end
292330
end
293331
end
332+
294333
do -- C_SpecializationInfo
295334
local GetSpecialization, GetSpecializationInfo
335+
336+
-- GetSpecialization
296337
if C_SpecializationInfo and C_SpecializationInfo.GetSpecialization then
297338
GetSpecialization = C_SpecializationInfo.GetSpecialization
298339
elseif _G.GetSpecialization then
@@ -307,6 +348,8 @@ do -- C_SpecializationInfo
307348
function SHIM:GetSpecialization()
308349
return GetSpecialization()
309350
end
351+
352+
-- GetSpecializationInfo
310353
if C_SpecializationInfo and C_SpecializationInfo.GetSpecializationInfo then
311354
GetSpecializationInfo = C_SpecializationInfo.GetSpecializationInfo
312355
elseif _G.GetSpecializationInfo then

0 commit comments

Comments
 (0)