Skip to content

Commit f467be5

Browse files
committed
System - Use br.UnitBuff instead of br._G.UnitBuff
1 parent defd97f commit f467be5

File tree

6 files changed

+58
-58
lines changed

6 files changed

+58
-58
lines changed

System/Functions/Aura.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ end
1818
function br.CancelUnitBuffID(unit, spellID, filter)
1919
-- local spellName = GetSpellInfo(spellID)
2020
for i = 1, 40 do
21-
local _, _, _, _, _, _, _, _, _, buffSpellID = br._G.UnitBuff(unit, i)
21+
local _, _, _, _, _, _, _, _, _, buffSpellID = br.UnitBuff(unit, i)
2222
if buffSpellID ~= nil then
2323
if buffSpellID == spellID then
2424
br._G.CancelUnitBuff(unit, i, filter)
@@ -294,8 +294,8 @@ function br.canDispel(Unit, spellID)
294294
i = i + 1
295295
end
296296
else
297-
while br._G.UnitBuff(Unit, i) do
298-
local _, _, stacks, buffType, buffDuration, buffExpire, _, _, _, buffid = br._G.UnitBuff(Unit, i)
297+
while br.UnitBuff(Unit, i) do
298+
local _, _, stacks, buffType, buffDuration, buffExpire, _, _, _, buffid = br.UnitBuff(Unit, i)
299299
local buffRemain = buffExpire - br._G.GetTime()
300300
if (buffType and ValidType(buffType)) and not br._G.UnitIsPlayer(Unit) then
301301
local dispelUnitObj = Dispel(Unit, stacks, buffDuration, buffRemain, buffid, true)
@@ -680,7 +680,7 @@ function br.isBuffed(UnitID, SpellID, TimeLeft, Filter)
680680
for i = 1, #SpellID do
681681
local buff, _, _, _, _, _, buffID = br._G.GetSpellInfo(SpellID[i])
682682
if buff then
683-
local expire = select(6, br._G.UnitBuff(UnitID, buffID, Filter))
683+
local expire = select(6, br.UnitBuff(UnitID, buffID, Filter))
684684
if expire and (expire == 0 or expire - br._G.GetTime() > TimeLeft) then
685685
return true
686686
end

System/Functions/Custom.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -713,11 +713,11 @@ end
713713
-- hasBuff(12345)
714714
function br.hasBuff(spellID)
715715
local buffs, i = {}, 1
716-
local buff = br._G.UnitBuff("player", i)
716+
local buff = br.UnitBuff("player", i)
717717
while buff do
718718
buffs[#buffs + 1] = buff
719719
i = i + 1
720-
buff = select(10, br._G.UnitBuff("player", i))
720+
buff = select(10, br.UnitBuff("player", i))
721721
if buff ~= nil then
722722
if buff == spellID then return true end
723723
end
@@ -730,11 +730,11 @@ end
730730
-- cancelBuff(12345)
731731
function br.cancelBuff(spellID)
732732
local buffs, i = {}, 1
733-
local buff = br._G.UnitBuff("player", i)
733+
local buff = br.UnitBuff("player", i)
734734
while buff do
735735
buffs[#buffs + 1] = buff
736736
i = i + 1
737-
buff = select(10, br._G.UnitBuff("player", i))
737+
buff = select(10, br.UnitBuff("player", i))
738738
if buff ~= nil then
739739
if buff == spellID then
740740
br._G.CancelUnitBuff("player", i, "")

System/Misc/foodflaskpot.lua

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,24 @@ local staminaFoodBuff = 0
2828

2929
--playerHasBuff(x) @param spellID # returns true if player has buff x
3030
function br.playerHasBuff(spellID)
31-
local buffs, i = { }, 1
32-
local buff = br._G.UnitBuff("player", i)
33-
while buff do
34-
buffs[#buffs + 1] = buff
35-
i = i + 1
36-
buff = select(10,br._G.UnitBuff("player", i))
37-
if buff ~= nil then
38-
if buff == spellID then return true end
39-
end
40-
end
41-
return false
31+
local buffs, i = {}, 1
32+
local buff = br.UnitBuff("player", i)
33+
while buff do
34+
buffs[#buffs + 1] = buff
35+
i = i + 1
36+
buff = select(10, br.UnitBuff("player", i))
37+
if buff ~= nil then
38+
if buff == spellID then return true end
39+
end
40+
end
41+
return false
4242
end
4343

4444
--getClass # returns class as string
4545
function br.getClass()
4646
local myClass = "nil"
4747
local class = select(3, br._G.UnitClass("player"))
48-
if class == 1 then -- Warrior
48+
if class == 1 then -- Warrior
4949
myClass = "Warrior"
5050
elseif class == 2 then -- Paladin
5151
myClass = "Paladin"
@@ -78,31 +78,31 @@ function br.getClassType()
7878
local mySpec = br._G.GetSpecialization()
7979
--Agility
8080
if myClass == "Hunter"
81-
or myClass == "Rogue"
82-
or (myClass == "Shaman" and mySpec == 2)
83-
or (myClass == "Monk" and mySpec == 3)
84-
or (myClass == "Druid" and mySpec == 2) then
81+
or myClass == "Rogue"
82+
or (myClass == "Shaman" and mySpec == 2)
83+
or (myClass == "Monk" and mySpec == 3)
84+
or (myClass == "Druid" and mySpec == 2) then
8585
classType = "agilityClass"
86-
--Intellect
86+
--Intellect
8787
elseif (myClass == "Paladin" and mySpec == 1)
88-
or myClass == "Priest"
89-
or (myClass == "Shaman" and (mySpec == 1 or mySpec == 3))
90-
or myClass == "Mage"
91-
or myClass == "Warlock"
92-
or (myClass == "Monk" and mySpec == 2)
93-
or (myClass == "Druid" and (mySpec == 1 or mySpec == 4)) then
88+
or myClass == "Priest"
89+
or (myClass == "Shaman" and (mySpec == 1 or mySpec == 3))
90+
or myClass == "Mage"
91+
or myClass == "Warlock"
92+
or (myClass == "Monk" and mySpec == 2)
93+
or (myClass == "Druid" and (mySpec == 1 or mySpec == 4)) then
9494
classType = "intellectClass"
95-
--Strength
95+
--Strength
9696
elseif (myClass == "Warrior" and (mySpec == 1 or mySpec == 2))
97-
or (myClass == "Paladin" and mySpec == 3)
98-
or (myClass == "DeathKnight" and (mySpec == 2 or mySpec == 3)) then
97+
or (myClass == "Paladin" and mySpec == 3)
98+
or (myClass == "DeathKnight" and (mySpec == 2 or mySpec == 3)) then
9999
classType = "strengthClass"
100-
--Stamina
100+
--Stamina
101101
elseif (myClass == "Warrior" and mySpec == 3)
102-
or (myClass == "Paladin" and mySpec == 2)
103-
or (myClass == "DeathKnight" and mySpec == 1)
104-
or (myClass == "Monk" and mySpec == 1)
105-
or (myClass == "Druid" and mySpec == 3) then
102+
or (myClass == "Paladin" and mySpec == 2)
103+
or (myClass == "DeathKnight" and mySpec == 1)
104+
or (myClass == "Monk" and mySpec == 1)
105+
or (myClass == "Druid" and mySpec == 3) then
106106
classType = "staminaClass"
107107
end
108108
return classType
@@ -112,11 +112,11 @@ end
112112
function br.playerHasItem(itemID)
113113
if itemID == nil then return false end
114114
local itemFound = false
115-
for i = 0, 4 do --Let's look at each bag
115+
for i = 0, 4 do --Let's look at each bag
116116
local numBagSlots = C_Container.GetContainerNumSlots(i)
117-
if numBagSlots > 0 then --Only look for slots if bag present
118-
for x = 1, numBagSlots do --Let's look at each bag slot
119-
local bagItemID = C_Container.GetContainerItemID(i,x)
117+
if numBagSlots > 0 then --Only look for slots if bag present
118+
for x = 1, numBagSlots do --Let's look at each bag slot
119+
local bagItemID = C_Container.GetContainerItemID(i, x)
120120
if tostring(bagItemID) == tostring(itemID) then --Compare bagItemID to parameter
121121
itemFound = true
122122
end
@@ -149,23 +149,23 @@ function br.usePotion(skipSurvivability)
149149
return true
150150
end
151151
end
152-
--Intellect
152+
--Intellect
153153
elseif classType == "intellectClass" then
154154
if br.playerCanUseItem(intellectPotion) then
155155
if br.playerHasBuff(intellectPotionBuff) == false then
156156
br.useItem(intellectPotion)
157157
return true
158158
end
159159
end
160-
--Strength
160+
--Strength
161161
elseif classType == "strengthClass" or (classType == "staminaClass" and skipSurvivability == true) then
162162
if br.playerCanUseItem(strengthPotion) then
163163
if br.playerHasBuff(strengthPotionBuff) == false then
164164
br.useItem(strengthPotion)
165165
return true
166166
end
167167
end
168-
--Armor
168+
--Armor
169169
elseif classType == "staminaClass" and skipSurvivability == false then
170170
if br.playerCanUseItem(armorPotion) then
171171
if br.playerHasBuff(armorPotionBuff) == false then
@@ -189,23 +189,23 @@ function br.useFlask(skipSurvivability)
189189
return true
190190
end
191191
end
192-
--Intellect
192+
--Intellect
193193
elseif classType == "intellectClass" then
194194
if br.playerCanUseItem(intellectFlask) then
195195
if br.playerHasBuff(intellectFlaskBuff) == false then
196196
br.useItem(intellectFlask)
197197
return true
198198
end
199199
end
200-
--Strength
200+
--Strength
201201
elseif classType == "strengthClass" or (classType == "staminaClass" and skipSurvivability == true) then
202202
if br.playerCanUseItem(strengthFlask) then
203203
if br.playerHasBuff(strengthFlaskBuff) == false then
204204
br.useItem(strengthFlask)
205205
return true
206206
end
207207
end
208-
--Stamina
208+
--Stamina
209209
elseif classType == "staminaClass" and skipSurvivability == false then
210210
if br.playerCanUseItem(staminaFlask) then
211211
if br.playerHasBuff(staminaFlaskBuff) == false then
@@ -229,23 +229,23 @@ function br.useFood(skipSurvivability)
229229
return true
230230
end
231231
end
232-
--Intellect
232+
--Intellect
233233
elseif classType == "intellectClass" then
234234
if br.playerCanUseItem(intellectFood) then
235235
if br.playerHasBuff(intellectFoodBuff) == false then
236236
br.useItem(intellectFood)
237237
return true
238238
end
239239
end
240-
--Strength
240+
--Strength
241241
elseif classType == "strengthClass" or (classType == "staminaClass" and skipSurvivability == true) then
242242
if br.playerCanUseItem(strengthFood) then
243243
if br.playerHasBuff(strengthFoodBuff) == false then
244244
br.useItem(strengthFood)
245245
return true
246246
end
247247
end
248-
--Stamina
248+
--Stamina
249249
elseif classType == "staminaClass" and skipSurvivability == false then
250250
if br.playerCanUseItem(staminaFood) then
251251
if br.playerHasBuff(staminaFoodBuff) == false then

System/SlashCommands.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -485,10 +485,10 @@ function br._G.SlashCmdList.dumpInfo(msg, editbox)
485485
_G.targetInfo.name = br._G.UnitName("target")
486486
local thisUnit = br.enemy[k].unit
487487
_G.targetInfo.unitID = thisUnit.id
488-
local buff1 = br._G.UnitBuff("target", 1)
489-
local buff2 = br._G.UnitBuff("target", 2)
490-
local deBuff1 = br._G.UnitBuff("target", 1)
491-
local deBuff2 = br._G.UnitBuff("target", 2)
488+
local buff1 = br.UnitBuff("target", 1)
489+
local buff2 = br.UnitBuff("target", 2)
490+
local deBuff1 = br.UnitBuff("target", 1)
491+
local deBuff2 = br.UnitBuff("target", 2)
492492
if buff1 then
493493
_G.targetInfo.buff1 = buff1
494494
end

System/UsefulFeatures.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ end
1717
local hooksecurefunc, select, UnitBuff, UnitDebuff, UnitAura, UnitGUID, _, tonumber, strfind =
1818
br._G.hooksecurefunc,
1919
br._G.select,
20-
br._G.UnitBuff,
20+
br.UnitBuff,
2121
br._G.UnitDebuff,
2222
br._G.UnitAura,
2323
br._G.UnitGUID,

unusedFunctions.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function br.getVengeance()
8282
elseif select(3, br._G.UnitClass("player")) == 11 then
8383
VengeanceID = 84840 -- Druid
8484
end
85-
if br._G.UnitBuff("player", VengeanceID) then
85+
if br.UnitBuff("player", VengeanceID) then
8686
return select(14, br._G.UnitAura("player", br._G.GetSpellInfo(VengeanceID)))
8787
end
8888
return 0

0 commit comments

Comments
 (0)