Skip to content

Commit 93b0ddf

Browse files
committed
More updates
1 parent e4c00f9 commit 93b0ddf

27 files changed

Lines changed: 2430 additions & 641 deletions

BadRotations.toc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ System\Functions\Totem.lua
8989
## Lists
9090

9191
System\Lists\AoEDamage.lua
92+
System\Lists\Bosses.lua
9293
System\Lists\BurnUnits.lua
9394
System\Lists\CCUnits.lua
9495
System\Lists\Defensives.lua

Rotations/Druid/Druid/Druid-Classic_TBC.lua

Lines changed: 445 additions & 455 deletions
Large diffs are not rendered by default.
Lines changed: 107 additions & 98 deletions
Large diffs are not rendered by default.

System/API/Buff.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ if br.api == nil then br.api = {} end
88

99
br.api.buffs = function(buff, k, v)
1010
local buff = buff[k]
11+
if type(v) == "table" then v = br.functions.spell:getHighestKnownRank(v) end
12+
1113
--- Cancel a buff.
1214
-- @function buff.spell.cancel
1315
-- @string[opt="player"] thisUnit The unit to check.

System/API/CD.lua

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ br.api.cd = function(self, spell, id)
2323
-- @within cd.spell
2424
cd[spell].exists = function()
2525
-- Special handling for global CD in Classic
26-
local spellID = id
26+
local spellID = type(id) == "table" and (br.functions.spell and br.functions.spell.getHighestKnownRank and br.functions.spell:getHighestKnownRank(id) or id[1]) or id
2727
if spell == "global" and (br.isClassic or br.isBC) and br.api.wow.GetGCDSpellID then
2828
spellID = br.api.wow.GetGCDSpellID()
2929
end
@@ -40,7 +40,7 @@ br.api.cd = function(self, spell, id)
4040
-- @within cd.spell
4141
cd[spell].remain = function()
4242
-- Special handling for global CD in Classic
43-
local spellID = id
43+
local spellID = type(id) == "table" and (br.functions.spell and br.functions.spell.getHighestKnownRank and br.functions.spell:getHighestKnownRank(id) or id[1]) or id
4444
if spell == "global" and (br.isClassic or br.isBC) and br.api.wow.GetGCDSpellID then
4545
spellID = br.api.wow.GetGCDSpellID()
4646
end
@@ -56,7 +56,7 @@ br.api.cd = function(self, spell, id)
5656
-- @within cd.spell
5757
cd[spell].remains = function()
5858
-- Special handling for global CD in Classic
59-
local spellID = id
59+
local spellID = type(id) == "table" and (br.functions.spell and br.functions.spell.getHighestKnownRank and br.functions.spell:getHighestKnownRank(id) or id[1]) or id
6060
if spell == "global" and (br.isClassic or br.isBC) and br.api.wow.GetGCDSpellID then
6161
spellID = br.api.wow.GetGCDSpellID()
6262
end
@@ -72,7 +72,7 @@ br.api.cd = function(self, spell, id)
7272
-- @within cd.spell
7373
cd[spell].duration = function()
7474
-- Special handling for global CD in Classic
75-
local spellID = id
75+
local spellID = type(id) == "table" and (br.functions.spell and br.functions.spell.getHighestKnownRank and br.functions.spell:getHighestKnownRank(id) or id[1]) or id
7676
if spell == "global" and (br.isClassic or br.isBC) and br.api.wow.GetGCDSpellID then
7777
spellID = br.api.wow.GetGCDSpellID()
7878
end
@@ -89,7 +89,7 @@ br.api.cd = function(self, spell, id)
8989
-- @within cd.spell
9090
cd[spell].ready = function()
9191
-- Special handling for global CD in Classic
92-
local spellID = id
92+
local spellID = type(id) == "table" and (br.functions.spell and br.functions.spell.getHighestKnownRank and br.functions.spell:getHighestKnownRank(id) or id[1]) or id
9393
if spell == "global" and (br.isClassic or br.isBC) and br.api.wow.GetGCDSpellID then
9494
spellID = br.api.wow.GetGCDSpellID()
9595
end
@@ -104,7 +104,8 @@ br.api.cd = function(self, spell, id)
104104
-- @return number
105105
-- @within cd.spell
106106
cd[spell].prevgcd = function()
107-
return select(2, br._G.GetSpellBaseCooldown(id))
107+
local spellID = type(id) == "table" and (br.functions.spell and br.functions.spell.getHighestKnownRank and br.functions.spell:getHighestKnownRank(id) or id[1]) or id
108+
return select(2, br._G.GetSpellBaseCooldown(spellID))
108109
end
109110
end
110111

System/API/Cast.lua

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ br.api.cast = function(self, spell, id)
3030
if cast.safe == nil then cast.safe = {} end
3131
if cast.time == nil then cast.time = {} end
3232
if cast.timeSinceLast == nil then cast.timeSinceLast = {} end
33+
local resolvedID = type(id) == "table" and (br.functions.spell and br.functions.spell.getHighestKnownRank and br.functions.spell:getHighestKnownRank(id) or id[1]) or id
3334

3435
--- Cast a spell based on various parameters.
3536
-- The function name is dynamically generated based on the spell name.
@@ -59,6 +60,7 @@ br.api.cast = function(self, spell, id)
5960
-- @tab enemies A table of enemy units that the spell should be cast on.
6061
-- @treturn boolean
6162
cast.id = function(spellID, thisUnit, castType, minUnits, effectRng, predict, predictPad, enemies)
63+
if type(spellID) == "table" then spellID = (br.functions.spell and br.functions.spell.getHighestKnownRank and br.functions.spell:getHighestKnownRank(spellID)) or spellID[1] end
6264
return br.functions.cast:createCastFunction(thisUnit, castType, minUnits, effectRng, spellID, spell, predict, predictPad,
6365
enemies)
6466
end
@@ -136,14 +138,14 @@ br.api.cast = function(self, spell, id)
136138
-- @treturn boolean
137139
cast.active[spell] = function(thisUnit)
138140
if thisUnit == nil then thisUnit = "player" end
139-
return br.functions.cast:isCastingSpell(id, thisUnit)
141+
return br.functions.cast:isCastingSpell(resolvedID, thisUnit)
140142
end
141143

142144
--- Checks if the spell is set to auto-repeat or if it's the current spell being cast.
143145
-- @function cast.auto.spell
144146
-- @treturn boolean
145147
cast.auto[spell] = function()
146-
return br._G.C_Spell.IsAutoRepeatSpell(br.api.wow.GetSpellInfo(id)) or br._G.C_Spell.IsCurrentSpell(id)
148+
return br._G.C_Spell.IsAutoRepeatSpell(br.api.wow.GetSpellInfo(resolvedID)) or br._G.C_Spell.IsCurrentSpell(resolvedID)
147149
end
148150

149151
--- Cancels the current spell being cast if it matches the specified spell.
@@ -165,9 +167,9 @@ br.api.cast = function(self, spell, id)
165167
cast.cost[spell] = function(altPower)
166168
if altPower == nil then altPower = false end
167169
if altPower then
168-
return select(2, br.functions.power:getSpellCost(id))
170+
return select(2, br.functions.power:getSpellCost(resolvedID))
169171
else
170-
return select(1, br.functions.power:getSpellCost(id))
172+
return select(1, br.functions.power:getSpellCost(resolvedID))
171173
end
172174
end
173175

@@ -177,7 +179,7 @@ br.api.cast = function(self, spell, id)
177179
-- @treturn boolean
178180
cast.current[spell] = function(thisUnit)
179181
if thisUnit == nil then thisUnit = "player" end
180-
return br.functions.cast:isCastingSpell(id, thisUnit)
182+
return br.functions.cast:isCastingSpell(resolvedID, thisUnit)
181183
end
182184

183185
--- Gets the spell id of the current (or previously) cast spell by the API.
@@ -193,14 +195,14 @@ br.api.cast = function(self, spell, id)
193195
-- @treturn boolean
194196
cast.dispel[spell] = function(thisUnit)
195197
if thisUnit == nil then thisUnit = "target" end
196-
return br.functions.aura:canDispel(thisUnit, id) or false
198+
return br.functions.aura:canDispel(thisUnit, resolvedID) or false
197199
end
198200

199201
--- Gets current empowered rank of the spell or 0 if not empowered.
200202
-- @function cast.empowered.spell
201203
-- @treturn number
202204
cast.empowered[spell] = function()
203-
return br.functions.spell:getEmpoweredRank(id)
205+
return br.functions.spell:getEmpoweredRank(resolvedID)
204206
end
205207

206208
--- Casts the form corresponding to the provided formIndex number.
@@ -218,15 +220,15 @@ br.api.cast = function(self, spell, id)
218220
-- @treturn boolean
219221
cast.inFlight[spell] = function(thisUnit)
220222
if thisUnit == nil then thisUnit = "target" end
221-
return br.functions.InFlight:Check(id, thisUnit)
223+
return br.functions.InFlight:Check(resolvedID, thisUnit)
222224
end
223225

224226
--- Gets time remaining on a spell in flight to the target.
225227
-- @function cast.inFlightRemain.spell
226228
-- @string thisUnit The target unit to check for the spell in flight.
227229
-- @treturn number
228230
cast.inFlightRemain[spell] = function(thisUnit)
229-
return br.functions.InFlight:Remain(id, thisUnit)
231+
return br.functions.InFlight:Remain(resolvedID, thisUnit)
230232
end
231233

232234
--- Checks if the spell was the last one cast or not.
@@ -236,15 +238,15 @@ br.api.cast = function(self, spell, id)
236238
cast.last[spell] = function(index)
237239
local tracker = br.functions.lastCast.lastCastTable.tracker
238240
index = index or 1
239-
return tracker[index] and tracker[index] == id
241+
return tracker[index] and tracker[index] == resolvedID
240242
end
241243

242244
--- Gets the GetTime() value the last cast of this spell occurred.
243245
-- @function cast.last.time.spell
244246
-- @treturn number
245247
cast.last.time[spell] = function()
246-
if br.functions.lastCast.lastCastTable.castTime[id] == nil then br.functions.lastCast.lastCastTable.castTime[id] = br._G.GetTime() end
247-
return br.functions.lastCast.lastCastTable.castTime[id]
248+
if br.functions.lastCast.lastCastTable.castTime[resolvedID] == nil then br.functions.lastCast.lastCastTable.castTime[resolvedID] = br._G.GetTime() end
249+
return br.functions.lastCast.lastCastTable.castTime[resolvedID]
248250
end
249251

250252
--- Runs the macro text passed to it.
@@ -260,7 +262,7 @@ br.api.cast = function(self, spell, id)
260262
-- @function cast.noControl.spell
261263
-- @treturn boolean
262264
cast.noControl[spell] = function()
263-
return br.functions.combat:hasNoControl(id)
265+
return br.functions.combat:hasNoControl(resolvedID)
264266
end
265267

266268
--- Casts special opener condition spell.
@@ -305,14 +307,14 @@ br.api.cast = function(self, spell, id)
305307
-- @function cast.range.spell
306308
-- @treturn number
307309
cast.range[spell] = function()
308-
return br.functions.spell:getSpellRange(id)
310+
return br.functions.spell:getSpellRange(resolvedID)
309311
end
310312

311313
--- Gets the amount of power spell will generate when cast.
312314
-- @function cast.regen.spell
313315
-- @treturn number
314316
cast.regen[spell] = function()
315-
return br.functions.spell:getCastingRegen(id)
317+
return br.functions.spell:getCastingRegen(resolvedID)
316318
end
317319

318320
--- Checks if safe to cast specified aoe spell on unit given the aoe dimensions.
@@ -323,14 +325,14 @@ br.api.cast = function(self, spell, id)
323325
-- @number effectRng Specify the AoE's effect range to determine units hit by it.
324326
-- @treturn boolean
325327
cast.safe[spell] = function(thisUnit, aoeType, minUnits, effectRng)
326-
return br.functions.range:isSafeToAoE(id, thisUnit, effectRng, minUnits, aoeType)
328+
return br.functions.range:isSafeToAoE(resolvedID, thisUnit, effectRng, minUnits, aoeType)
327329
end
328330

329331
--- Gets the cast time of player's spell. If the spell has no cast time, it returns the global cooldown.
330332
-- @function cast.time.spell
331333
-- @treturn number
332334
cast.time[spell] = function()
333-
local castTime = br.functions.cast:getCastTime(id)
335+
local castTime = br.functions.cast:getCastTime(resolvedID)
334336
return castTime > 0 and castTime or br.functions.spell:getGlobalCD(true)
335337
end
336338

@@ -347,8 +349,8 @@ br.api.cast = function(self, spell, id)
347349
-- @function cast.timeSinceLast.spell
348350
-- @treturn number
349351
cast.timeSinceLast[spell] = function()
350-
if br.functions.lastCast.lastCastTable.castTime[id] == nil then br.functions.lastCast.lastCastTable.castTime[id] = br._G.GetTime() end
351-
return br._G.GetTime() - br.functions.lastCast.lastCastTable.castTime[id]
352+
if br.functions.lastCast.lastCastTable.castTime[resolvedID] == nil then br.functions.lastCast.lastCastTable.castTime[resolvedID] = br._G.GetTime() end
353+
return br._G.GetTime() - br.functions.lastCast.lastCastTable.castTime[resolvedID]
352354
end
353355

354356
--- Checks if the provided condition is true else it waits for 0.1sec.

System/API/Charges.lua

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,51 +15,58 @@ br.api.charges = function(self, spell, id)
1515
-- @function charges.spell.exists
1616
-- @return boolean
1717
charges.exists = function()
18-
return br.functions.spell:getCharges(id) >= 1
18+
local spellID = type(id) == "table" and (br.functions.spell and br.functions.spell.getHighestKnownRank and br.functions.spell:getHighestKnownRank(id) or id[1]) or id
19+
return br.functions.spell:getCharges(spellID) >= 1
1920
end
2021

2122
--- Gets the number of charges remaining on spell.
2223
-- @function charges.spell.count
2324
-- @return number
2425
charges.count = function()
25-
return br.functions.spell:getCharges(id)
26+
local spellID = type(id) == "table" and (br.functions.spell and br.functions.spell.getHighestKnownRank and br.functions.spell:getHighestKnownRank(id) or id[1]) or id
27+
return br.functions.spell:getCharges(spellID)
2628
end
2729

2830
charges.spellCount = function()
29-
return br._G.C_Spell.GetSpellCastCount(id)
31+
local spellID = type(id) == "table" and (br.functions.spell and br.functions.spell.getHighestKnownRank and br.functions.spell:getHighestKnownRank(id) or id[1]) or id
32+
return br._G.C_Spell.GetSpellCastCount(spellID)
3033
end
3134

3235
--- Gets the number of charges remaining on spell as a fraction. (e.g. 1.5 charges remaining)
3336
-- @function charges.spell.frac
3437
-- @return number
3538
charges.frac = function()
36-
return br.functions.spell:getChargesFrac(id)
39+
local spellID = type(id) == "table" and (br.functions.spell and br.functions.spell.getHighestKnownRank and br.functions.spell:getHighestKnownRank(id) or id[1]) or id
40+
return br.functions.spell:getChargesFrac(spellID)
3741
end
3842

3943
--- Gets the maximum number of charges the spell can have.
4044
-- @function charges.spell.max
4145
-- @return number
4246
charges.max = function()
43-
return br.functions.spell:getChargesFrac(id, true)
47+
local spellID = type(id) == "table" and (br.functions.spell and br.functions.spell.getHighestKnownRank and br.functions.spell:getHighestKnownRank(id) or id[1]) or id
48+
return br.functions.spell:getChargesFrac(spellID, true)
4449
end
4550

4651
--- Gets the time remaining on until next charge is available.
4752
-- @function charges.spell.remain
4853
-- @bool[opt] chargeMax If true, returns the time remaining until all charges are available.
4954
-- @return number
5055
charges.recharge = function(chargeMax)
56+
local spellID = type(id) == "table" and (br.functions.spell and br.functions.spell.getHighestKnownRank and br.functions.spell:getHighestKnownRank(id) or id[1]) or id
5157
if chargeMax then
52-
return br.functions.spell:getRecharge(id, true)
58+
return br.functions.spell:getRecharge(spellID, true)
5359
else
54-
return br.functions.spell:getRecharge(id)
60+
return br.functions.spell:getRecharge(spellID)
5561
end
5662
end
5763

5864
--- Gets the total time remaining until all charges are available.
5965
-- @function charges.spell.timeTillFull
6066
-- @return number
6167
charges.timeTillFull = function()
62-
return br.functions.spell:getFullRechargeTime(id)
68+
local spellID = type(id) == "table" and (br.functions.spell and br.functions.spell.getHighestKnownRank and br.functions.spell:getHighestKnownRank(id) or id[1]) or id
69+
return br.functions.spell:getFullRechargeTime(spellID)
6370
end
6471
end
6572

System/API/Debuff.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ local baseTickTimes = {
9090

9191
br.api.debuffs = function(debuff, k, v)
9292
local spec = br._G.C_SpecializationInfo.GetSpecializationInfo(br._G.C_SpecializationInfo.GetSpecialization())
93+
if type(v) == "table" then v = br.functions.spell:getHighestKnownRank(v) end
9394

9495
--- Checks if a debuff exists on a unit.
9596
-- @function debuff.spell.exists

System/API/Essence.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ br.api.essences = function(essence,k,v)
3030
local milestoneTable = br._G.C_AzeriteEssence.GetMilestones()
3131
local GetSpellInfo = br._G["GetSpellInfo"]
3232
local C_AzeriteEssence = br._G["C_AzeriteEssence"]
33-
local essenceIdName = GetSpellInfo(GetSpellInfo(v)) or "None"
34-
local essenceIcon = select(3,GetSpellInfo(v)) or 0
33+
local resolvedV = type(v) == "table" and (br.functions.spell and br.functions.spell.getHighestKnownRank and br.functions.spell:getHighestKnownRank(v) or v[1]) or v
34+
local essenceIdName = GetSpellInfo(GetSpellInfo(resolvedV)) or "None"
35+
local essenceIcon = select(3,GetSpellInfo(resolvedV)) or 0
3536
if milestoneTable then
3637
for i = 1, #milestoneTable do
3738
local thisMilestone = milestoneTable[i]
@@ -56,5 +57,5 @@ br.api.essences = function(essence,k,v)
5657
-- Other Data
5758
essence.key = k
5859
essence.id = v
59-
essence.spellID = select(7,essenceIdName) or v
60+
essence.spellID = select(7,essenceIdName) or resolvedV
6061
end

System/API/Spell.lua

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,18 @@ br.api.spell = function(self, k, v)
1818
-- @function spell.k.castTime
1919
-- @return number
2020
spell[k].castTime = function()
21-
local _, _, _, castTime = br.api.wow.GetSpellInfo(v)
21+
local spellID = type(v) == "table" and (br.functions.spell and br.functions.spell.getHighestKnownRank and br.functions.spell:getHighestKnownRank(v) or v[1]) or v
22+
local _, _, _, castTime = br.api.wow.GetSpellInfo(spellID)
2223
return castTime or 0
2324
end
2425

2526
--- Returns the spell's ID.
2627
-- @function spell.k.id
2728
-- @return number
2829
spell[k].id = function()
29-
local _, _, _, _, _, _, spellID = br.api.wow.GetSpellInfo(v)
30-
return spellID or 0
30+
local spellID = type(v) == "table" and (br.functions.spell and br.functions.spell.getHighestKnownRank and br.functions.spell:getHighestKnownRank(v) or v[1]) or v
31+
local _, _, _, _, _, _, realID = br.api.wow.GetSpellInfo(spellID)
32+
return realID or 0
3133
end
3234

3335
--- Checks if the spell is known.
@@ -41,38 +43,43 @@ br.api.spell = function(self, k, v)
4143
-- @function spell.k.maxRange
4244
-- @return number
4345
spell[k].maxRange = function()
44-
local _, _, _, _, _, maxRange = br.api.wow.GetSpellInfo(v)
46+
local spellID = type(v) == "table" and (br.functions.spell and br.functions.spell.getHighestKnownRank and br.functions.spell:getHighestKnownRank(v) or v[1]) or v
47+
local _, _, _, _, _, maxRange = br.api.wow.GetSpellInfo(spellID)
4548
return maxRange or 0
4649
end
4750

4851
--- Returns the spell's min range.
4952
-- @function spell.k.minRange
5053
-- @return number
5154
spell[k].minRange = function()
52-
local _, _, _, _, minRange = br.api.wow.GetSpellInfo(v)
55+
local spellID = type(v) == "table" and (br.functions.spell and br.functions.spell.getHighestKnownRank and br.functions.spell:getHighestKnownRank(v) or v[1]) or v
56+
local _, _, _, _, minRange = br.api.wow.GetSpellInfo(spellID)
5357
return minRange or 0
5458
end
5559

5660
--- Returns the spell's name (localized).
5761
-- @function spell.k.name
5862
-- @return string
5963
spell[k].name = function()
60-
local name = br.api.wow.GetSpellInfo(v)
64+
local spellID = type(v) == "table" and (br.functions.spell and br.functions.spell.getHighestKnownRank and br.functions.spell:getHighestKnownRank(v) or v[1]) or v
65+
local name = br.api.wow.GetSpellInfo(spellID)
6166
return name or ""
6267
end
6368

6469
--- Returns the spell's rank.
6570
-- @function spell.k.rank
6671
-- @return number
6772
spell[k].rank = function()
68-
local _, rank = br.api.wow.GetSpellInfo(v)
73+
local spellID = type(v) == "table" and (br.functions.spell and br.functions.spell.getHighestKnownRank and br.functions.spell:getHighestKnownRank(v) or v[1]) or v
74+
local _, rank = br.api.wow.GetSpellInfo(spellID)
6975
return rank or 0
7076
end
7177

7278
--- Returns the spell's icon texture.
7379
-- @function spell.k.texture
7480
-- @return number
7581
spell[k].texture = function()
76-
return br._G.C_Spell.GetSpellTexture(v)
82+
local spellID = type(v) == "table" and (br.functions.spell and br.functions.spell.getHighestKnownRank and br.functions.spell:getHighestKnownRank(v) or v[1]) or v
83+
return br._G.C_Spell.GetSpellTexture(spellID)
7784
end
7885
end

0 commit comments

Comments
 (0)