Skip to content

Commit a59fd1a

Browse files
committed
Merge branch 'master' of https://github.com/CuteOne/BadRotations
2 parents 14a5cd5 + 4d8add1 commit a59fd1a

16 files changed

+317
-145
lines changed

Diff for: .github/workflows/lintPR.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ jobs:
8282
check_name: Luacheck Report
8383
comment_mode: always
8484
action_fail: true
85-
fail_on: 'errors'
8685

8786
# name: Luacheck
8887
# on: [push, pull_request]

Diff for: .luacheckrc

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ exclude_files = {
55
"**/Libs",
66
"**/Unlockers",
77
}
8-
-- only = {
9-
-- "011", -- syntax
10-
-- "1", -- globals
11-
-- }
8+
only = {
9+
"011", -- syntax
10+
"1", -- globals
11+
}
1212
ignore = {
1313
"11/SLASH_.*", -- slash handlers
1414
"1/[A-Z][A-Z][A-Z0-9_]+", -- three letter+ constants
15-
"211", -- unused local variables
16-
"212", -- unused arguments
17-
"213", -- unused loop variable
18-
"542", -- empty if branches
15+
-- "211", -- unused local variables
16+
-- "212", -- unused arguments
17+
-- "213", -- unused loop variable
18+
-- "542", -- empty if branches
1919
}
2020
globals = {
2121
"br",

Diff for: System/API/CD.lua

+46-34
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,24 @@
33
-- CD functions are stored in br.player.cd and can be utilized by `local cd = br.player.cd` in your profile.
44
-- For spell CDs, `spell` in the function represent the name in the actions list (Spec, Shared Class, Shared Global Lists) defined in System/List/Spells.lua
55
-- For item CDs, `item` in the function represent the name in the item list defined in System/List/Items.lua
6+
-- For slot CDs, `slot` in the function represents equipement slots, pass the ID matching the equipement slot id you wish to check.
67
-- @module br.player.cd
78
local _, br = ...
89

910
if br.api == nil then br.api = {} end
1011

1112
br.api.cd = function(self,spell,id)
12-
if self.cd == nil then self.cd = {} end
13-
if self.cd[spell] == nil then self.cd[spell] = {} end
13+
self.cd = self.cd or {}
1414
local cd = self.cd
1515

16+
--- Spell Cooldown Functions - [spell] denotes placeholder for name of spell listed in System/Lists/Spells.lua
17+
-- @section cd[spell]
18+
cd[spell] = cd[spell] or {}
19+
1620
--- Checks if spell is on cooldown or not.
1721
-- @function cd.spell.exists
18-
-- @treturn boolean
22+
-- @return boolean
23+
-- @within cd.spell
1924
cd[spell].exists = function()
2025
local level = br._G.UnitLevel("player")
2126
local spellLevel = br._G.GetSpellLevelLearned(id)
@@ -25,7 +30,8 @@ br.api.cd = function(self,spell,id)
2530

2631
--- Gets the time remaining on spell cooldown or 0 if not.
2732
-- @function cd.spell.remain
28-
-- @treturn number
33+
-- @return number
34+
-- @within cd.spell
2935
cd[spell].remain = function()
3036
local level = br._G.UnitLevel("player")
3137
local spellLevel = br._G.GetSpellLevelLearned(id)
@@ -35,7 +41,8 @@ br.api.cd = function(self,spell,id)
3541

3642
--- Gets the time remaining on spell cooldown or 0 if not (alternate to cd.spell.remain() incase of typo).
3743
-- @function cd.spell.remains
38-
-- @treturn number
44+
-- @return number
45+
-- @within cd.spell
3946
cd[spell].remains = function()
4047
local level = br._G.UnitLevel("player")
4148
local spellLevel = br._G.GetSpellLevelLearned(id)
@@ -45,15 +52,17 @@ br.api.cd = function(self,spell,id)
4552

4653
--- Gets the total time of the spell cooldown
4754
-- @function cd.spell.duration
48-
-- @treturn number
55+
-- @return number
56+
-- @within cd.spell
4957
cd[spell].duration = function()
5058
local _, CD = br._G.GetSpellCooldown(id)
5159
return CD
5260
end
5361

5462
--- Checks if the spell is not on cooldown or is (opposite of cd.spell.exists()).
5563
-- @function cd.spell.ready
56-
-- @treturn boolean
64+
-- @return boolean
65+
-- @within cd.spell
5766
cd[spell].ready = function()
5867
local level = br._G.UnitLevel("player")
5968
local spellLevel = br._G.GetSpellLevelLearned(id)
@@ -63,67 +72,70 @@ br.api.cd = function(self,spell,id)
6372

6473
--- Gets the duration of the spells Global Cooldown.
6574
-- @function cd.spell.prevgcd
66-
-- @treturn number
75+
-- @return number
76+
-- @within cd.spell
6777
cd[spell].prevgcd = function()
6878
return select(2, br._G.GetSpellBaseCooldown(id))
6979
end
7080
end
7181

7282
br.api.itemCD = function(self,item,id)
73-
if self[item] == nil then self[item] = {} end
83+
--if self[item] == nil then self[item] = {} end
7484
local cd = self
7585

86+
--- Item Cooldown Functions - [item] denotes placeholder for name of item listed in System/Lists/Items.lua
87+
-- @section cd[item]
88+
cd[item] = cd[item] or {}
89+
7690
--- Checks if item is on cooldown or not.
7791
-- @function cd.item.exists
78-
-- @number[opt] itemID The ID of the item to check.
79-
-- @treturn boolean
80-
cd[item].exists = function(itemID)
81-
if itemID == nil then itemID = id end
82-
return br._G.GetItemCooldown(itemID) > 0
92+
-- @return boolean
93+
-- @within cd.item
94+
cd[item].exists = function()
95+
return br._G.GetItemCooldown(id) > 0
8396
end
8497

8598
--- Gets the time remaining on item cooldown or 0 if not.
8699
-- @function cd.item.remain
87-
-- @number[opt] itemID The ID of the item to check.
88-
-- @treturn number
89-
cd[item].remain = function(itemID)
90-
if itemID == nil then itemID = id end
91-
if br._G.GetItemCooldown(itemID) ~= 0 then
92-
return (br._G.GetItemCooldown(itemID) + select(2,br._G.GetItemCooldown(itemID)) - br._G.GetTime())
100+
-- @return number
101+
-- @within cd.item
102+
cd[item].remain = function()
103+
if br._G.GetItemCooldown(id) ~= 0 then
104+
return (br._G.GetItemCooldown(id) + select(2,br._G.GetItemCooldown(id)) - br._G.GetTime())
93105
end
94106
return 0
95107
end
96108

97109
--- Gets the total cooldown time of the item in seconds.
98110
-- @function cd.item.duration
99-
-- @number[opt] itemID The ID of the item to check.
100-
-- @treturn number
101-
cd[item].duration = function(itemID)
102-
if itemID == nil then itemID = id end
103-
return br._G.GetSpellBaseCooldown(select(2,br._G.GetItemSpell(itemID))) / 1000
111+
-- @return number
112+
-- @within cd.item
113+
cd[item].duration = function()
114+
return br._G.GetSpellBaseCooldown(select(2,br._G.GetItemSpell(id))) / 1000
104115
end
105116

117+
--- Equipment Slot Cooldown Functions
118+
-- @section cd.slot
106119
cd.slot = cd.slot or {}
107120

108-
--- This function gets the base cooldown of a given item spell
109-
-- from an inventory slot, specific to the player character in game.
110-
-- @usage cd.slot.duration() or cd.slot.duration(slotID)
111-
-- @tparam[opt=id] number slotID The ID of the inventory slot. If not provided, the default is 'id'.
112-
-- @treturn number The base cooldown of the item spell divided by 1000.
121+
--- This function gets the base cooldown of a given item spell from an inventory slot, specific to the player character in game.
122+
-- @param slotID - The ID of the inventory slot.
123+
-- @return number - The base cooldown of the item spell divided by 1000.
113124
-- This division is done to convert the time from milliseconds to seconds.
114125
-- @within cd.slot
115126
cd.slot.duration = function(slotID)
116-
if slotID == nil then slotID = id end
127+
if slotID == nil then return nil end
117128
local _, duration = br._G.GetInventoryItemCooldown("player", slotID)
118129
return duration
119130
end
120131

121132
--- Gets the time remaining on the equipment slot item cooldown or 0 if not.
122133
-- @function cd.slot.remain
123-
-- @number[opt] slotID The ID of the equipment slot to check.
124-
-- @treturn number
134+
-- @param slotID - The ID of the equipment slot to check.
135+
-- @return number
136+
-- @within cd.slot
125137
cd.slot.remain = function(slotID)
126-
if slotID == nil then slotID = id end
138+
if slotID == nil then return nil end
127139
local start, duration, enable = br._G.GetInventoryItemCooldown("player", slotID)
128140
if enable == 0 or duration == 0 then
129141
return 0 -- No cooldown is active, or the item has no cooldown

Diff for: System/API/Charges.lua

+8-8
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ br.api.charges = function(self,spell,id)
1313

1414
--- Checks if spell has charges or not.
1515
-- @function charges.spell.exists
16-
-- @treturn boolean
16+
-- @return boolean
1717
charges.exists = function()
1818
return br.getCharges(id) >= 1
1919
end
2020

2121
--- Gets the number of charges remaining on spell.
2222
-- @function charges.spell.count
23-
-- @treturn number
23+
-- @return number
2424
charges.count = function()
2525
return br.getCharges(id)
2626
end
@@ -31,22 +31,22 @@ br.api.charges = function(self,spell,id)
3131

3232
--- Gets the number of charges remaining on spell as a fraction. (e.g. 1.5 charges remaining)
3333
-- @function charges.spell.frac
34-
-- @treturn number
34+
-- @return number
3535
charges.frac = function()
3636
return br.getChargesFrac(id)
3737
end
3838

3939
--- Gets the maximum number of charges the spell can have.
4040
-- @function charges.spell.max
41-
-- @treturn number
41+
-- @return number
4242
charges.max = function()
4343
return br.getChargesFrac(id,true)
4444
end
4545

4646
--- Gets the time remaining on until next charge is available.
4747
-- @function charges.spell.remain
4848
-- @bool[opt] chargeMax If true, returns the time remaining until all charges are available.
49-
-- @treturn number
49+
-- @return number
5050
charges.recharge = function(chargeMax)
5151
if chargeMax then
5252
return br.getRecharge(id,true)
@@ -57,7 +57,7 @@ br.api.charges = function(self,spell,id)
5757

5858
--- Gets the total time remaining until all charges are available.
5959
-- @function charges.spell.timeTillFull
60-
-- @treturn number
60+
-- @return number
6161
charges.timeTillFull = function()
6262
return br.getFullRechargeTime(id)
6363
end
@@ -69,14 +69,14 @@ br.api.itemCharges = function(self,item,id)
6969

7070
--- Checks if item has charges or not.
7171
-- @function charges.item.exists
72-
-- @treturn boolean
72+
-- @return boolean
7373
charges.exists = function()
7474
return br.itemCharges(id) > 0
7575
end
7676

7777
--- Gets the number of charges remaining on item.
7878
-- @function charges.item.count
79-
-- @treturn number
79+
-- @return number
8080
charges.count = function()
8181
return br.itemCharges(id)
8282
end

Diff for: System/API/Conduit.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ br.api.conduit = function(conduit,spell,id)
3535
local spellName, _, spellIcon, _, _, _, spellID = br._G.GetSpellInfo(id)
3636

3737
--- Gets information about a specific conduit.
38+
-- @table conduit.spell
3839
-- @field state The current state of the conduit. Default is `0`.
3940
-- @field icon The icon associated with the conduit, represented by the spell icon.
4041
-- @field row The row in which the conduit is located. Default is `0`.
@@ -43,7 +44,6 @@ br.api.conduit = function(conduit,spell,id)
4344
-- @field rank The rank of the conduit. Currently set to default `0`.
4445
-- @field id The unique identifier for the spell associated with the conduit.
4546
-- @field enabled A boolean indicating whether the conduit is enabled. Default is `false`.
46-
-- @table conduit.spell
4747
conduit[spell] = {
4848
state = 0,
4949
icon = spellIcon,

Diff for: System/API/Debuff.lua

+4
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,10 @@ br.api.debuffs = function(debuff,k,v)
274274
return (spec == 103 or spec == 259) and debuff.bleed[thisUnit] or 0
275275
end
276276

277+
--- Gets the number of debuff ticks that will be gained by reapplying the debuff to the specified unit.
278+
-- @function debuff.spell.ticksGainedOnRefresh
279+
-- string[opt="target"] thisUnit The unit to check the ticks gained by reapplying the debuff on.
280+
-- @treturn number
277281
debuff.ticksGainedOnRefresh = function(thisUnit)
278282
local name, _, _, _, duration, expirationTime = br.UnitDebuffID(thisUnit, v, nil, "PLAYER")
279283
local haste = br._G.UnitSpellHaste("player")

Diff for: System/API/Enemies.lua

+3-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ local function setVariable(self,unit,range,checkNoCombat,facing,type,table,count
3434
-- Build enemies.yards variable
3535
local insertTable = "yards"..range..type -- Ex: enemies.yards8 (returns all enemies around player in 8yrds), Adds Table Type (r for Rect, c for Cone, blank for Normal)
3636
if unit ~= "player" then
37-
-- letter tag on end based on type of unit passed, if target or enemy unit then "t" otherwise first letter of what is passed in: f - "focus", p - "pet", m - "mouseover", etc
37+
-- letter tag on end based on type of unit passed, if target or enemy unit then "t" otherwise first letter of what is passed in: f - "focus", p - "pet", m - "mouseover", etc
3838
if br.units[unit] ~= nil then
3939
insertTable = insertTable.."t" -- Ex: enemies.yards8t (returns all enemies around target in 8yrds)
4040
else
@@ -47,7 +47,8 @@ local function setVariable(self,unit,range,checkNoCombat,facing,type,table,count
4747
if count > 0 then br.insertTableIntoTable(self.enemies[insertTable],table) end
4848
end
4949
br.api.enemies = function(self)
50-
local enemies = self.enemies
50+
---@class self.enemies
51+
local enemies --= self.enemies
5152
if enemies.cone == nil then enemies.cone = {} end
5253
if enemies.rect == nil then enemies.rect = {} end
5354

Diff for: System/API/Equiped.lua

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ br.api.equiped = function(self,item,id)
1212
local equiped = self
1313

1414
--- Checks if item is equiped or not.
15-
-- @function equiped.item.exists
15+
-- @function equiped.item
1616
-- @number[opt] slotID The equipment slot number to check.
1717
-- @treturn boolean
1818
equiped[item] = function(slotID)
@@ -27,8 +27,7 @@ br.api.equiped = function(self,item,id)
2727
-- It can also check a specific slotID.
2828
-- If no slotID is provided, it checks all slots for that item.
2929
-- @param itemID the ID of the item you want to check if it's equipped
30-
-- @param slotID optional parameter. If specified, it represents the ID
31-
-- of the slot you want to check for the existence of the given item.
30+
-- @param slotID optional parameter. If specified, it represents the ID of the slot you want to check for the existence of the given item.
3231
-- @return boolean value indicating whether the item with specific ID is equipped in the specified slot (if provided)
3332
-- @usage equipes.item(12345) -- will return true if item with ID 12345 is equipped anywhere
3433
-- @usage equipes.item(12345, 1) -- will return true if item with ID 12345 is equipped in slot 1

Diff for: System/API/Essence.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
--
1919
-- * `br.player.essence.spellID` - Indicates the spellID of the essence.
2020
--
21-
-- @module br.player.covenant
21+
-- @module br.player.essence
2222
local _, br = ...
2323
if br.api == nil then br.api = {} end
2424
br.api.essences = function(essence,k,v)

Diff for: System/API/Item.lua

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
---
2-
-- These functions help in retrieving information about items.
3-
-- Item functions are stored in br.player.item and can be utilized by `local item = br.player.item` in your profile.
4-
-- `item` in the function represent the name in the item list defined in System/List/Items.lua
5-
-- @module br.player.item
1+
-- ---
2+
-- -- These functions help in retrieving information about items.
3+
-- -- Item functions are stored in br.player.item and can be utilized by `local item = br.player.item` in your profile.
4+
-- -- `item` in the function represent the name in the item list defined in System/List/Items.lua
5+
-- -- @module br.player.item
66

77
local _, br = ...
88
if br.api == nil then br.api = {} end

0 commit comments

Comments
 (0)