Skip to content

Commit

Permalink
System - Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
CuteOne committed Nov 20, 2023
1 parent fc76c2c commit b800309
Show file tree
Hide file tree
Showing 27 changed files with 710 additions and 576 deletions.
62 changes: 34 additions & 28 deletions BadRotations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -218,36 +218,42 @@ end

-- [[ Event Listeners ]] --
local frame = br._G.CreateFrame("FRAME")

-- Registering events
frame:RegisterEvent("PLAYER_LOGOUT")
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:RegisterEvent("LOADING_SCREEN_ENABLED")
frame:RegisterEvent("LOADING_SCREEN_DISABLED")
function frame:OnEvent(event)
if event == "LOADING_SCREEN_ENABLED" then
br.disablePulse = true
end
if event == "LOADING_SCREEN_DISABLED" then
br.disablePulse = false
end
if event == "PLAYER_LOGOUT" then
if br.unlocked then
-- Return queue window to previous setting
if br._G.C_CVar.GetCVar("SpellQueueWindow") == "0" then
br._G.RunMacroText("/console SpellQueueWindow " .. br.prevQueueWindow)
end
br.ui:saveWindowPosition()
if br.getOptionCheck("Reset Options") then
-- Reset Settings
br:saveSettings(nil, nil, br.selectedSpec, br.selectedProfileName, true)
else
-- Save Settings
br:saveSettings(nil, nil, br.selectedSpec, br.selectedProfileName)
end
br.saveLastProfileTracker()
end
end
if event == "PLAYER_ENTERING_WORLD" then
br.load()
end

-- Separate OnEvent function
local function OnEvent(self, event)
if event == "LOADING_SCREEN_ENABLED" then
br.disablePulse = true
end
if event == "LOADING_SCREEN_DISABLED" then
br.disablePulse = false
end
if event == "PLAYER_LOGOUT" then
if br.unlocked then
-- Return queue window to previous setting
if br._G.C_CVar.GetCVar("SpellQueueWindow") == "0" then
br._G.RunMacroText("/console SpellQueueWindow " .. br.prevQueueWindow)
end
br.ui:saveWindowPosition()
if br.getOptionCheck("Reset Options") then
-- Reset Settings
br:saveSettings(nil, nil, br.selectedSpec, br.selectedProfileName, true)
else
-- Save Settings
br:saveSettings(nil, nil, br.selectedSpec, br.selectedProfileName)
end
br.saveLastProfileTracker()
end
end
if event == "PLAYER_ENTERING_WORLD" then
br.load()
end
end
frame:SetScript("OnEvent", frame.OnEvent)

-- Setting the OnEvent script handler
frame:SetScript("OnEvent", OnEvent)
2 changes: 1 addition & 1 deletion Rotations/Priest/Initial/PriestInitial.lua
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ local function runRotation()
br._G.StartAttack(units.dyn5)
end
--Power Word:Shield
if cast.able.powerWordShield("player") and not buff.powerWordShield.exists(thisUnit) and unit.inCombat() then
if cast.able.powerWordShield("player") and not buff.powerWordShield.exists("player") and unit.inCombat() then
if cast.powerWordShield("player") then ui.debug("Casting Power Word:Shield") return true end
end
--Shadow Word:Pain
Expand Down
28 changes: 14 additions & 14 deletions Rotations/Warlock/Support/PetCuteOne.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ br.rotations.support["PetCuteOne"] = function()
local spell = br.player.spell
local units = br.player.units
-- General Locals
local profileStop = profileStop or false
local profileStop = false
local haltProfile = (inCombat and profileStop) or (IsMounted() or IsFlying()) or br.pause(true) or mode.rotation==4
-- Units
units.get(5)
Expand All @@ -43,19 +43,19 @@ br.rotations.support["PetCuteOne"] = function()
enemies.get(40,"player",false,true)
enemies.yards40r = br.getEnemiesInRect(10,40,false) or 0

-- local petTarget
-- if petTarget == nil or not UnitExists(petTarget) or not br.isValidUnit(petTarget) then
-- if br.getOptionValue("Pet Target") == 1 and br.isValidUnit(units.dyn40) then
-- petTarget = units.dyn40
-- elseif br.getOptionValue("Pet Target") == 2 and br.isValidUnit("target") then
-- petTarget = "target"
-- elseif br.getOptionValue("Pet Target") == 3 then
-- for i=1, #enemies.yards40 do
-- local thisUnit = enemies.yards40[i]
-- if (br.isValidUnit(thisUnit) or br.isDummy()) then petTarget = thisUnit break end
-- end
-- end
-- end
local petTarget
if petTarget == nil or not UnitExists(petTarget) or not br.isValidUnit(petTarget) then
if br.getOptionValue("Pet Target") == 1 and br.isValidUnit(units.dyn40) then
petTarget = units.dyn40
elseif br.getOptionValue("Pet Target") == 2 and br.isValidUnit("target") then
petTarget = "target"
elseif br.getOptionValue("Pet Target") == 3 then
for i=1, #enemies.yards40 do
local thisUnit = enemies.yards40[i]
if (br.isValidUnit(thisUnit) or br.isDummy()) then petTarget = thisUnit break end
end
end
end

local friendUnit = br.friend[1].unit
local petActive = IsPetActive()
Expand Down
16 changes: 15 additions & 1 deletion System/API/CD.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
-- For item CDs, `item` in the function represent the name in the item list defined in System/List/Items.lua
-- @module br.player.cd
local _, br = ...

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

br.api.cd = function(self,spell,id)
Expand Down Expand Up @@ -101,4 +102,17 @@ br.api.itemCD = function(self,item,id)
if itemID == nil then itemID = id end
return br._G.GetSpellBaseCooldown(select(2,br._G.GetItemSpell(itemID))) / 1000
end
end

--- Gets the time remaining on the equipment slot item cooldown or 0 if not.
-- @function cd.slot.remain
-- @number[opt] slotID The ID of the equipment slot to check.
-- @treturn number
cd.slot = cd.slot or {}
cd.slot.remain = function(slotID)
if slotID == nil then slotID = id end
if br._G.GetInventoryItemCooldown("player", slotID) ~= 0 then
return (br._G.GetInventoryItemCooldown("player", slotID) + select(2,br._G.GetInventoryItemCooldown("player", slotID)) - br._G.GetTime())
end
return 0
end
end
27 changes: 19 additions & 8 deletions System/API/Cast.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
-- `spell` in the function represent the name in the actions list (Spec, Shared Class, Shared Global Lists) defined in System/List/Spells.lua
-- @module br.player.cast
local _, br = ...

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

br.api.cast = function(self,spell,id)
Expand Down Expand Up @@ -213,12 +214,10 @@ br.api.cast = function(self,spell,id)

--- Checks if the spell can free you of a "no control" effect.
-- @function cast.noControl.spell
-- @string thisUnit The target unit to check for the "no control" effect. Defaults to "player" if not provided.
-- @treturn boolean
cast.noControl[spell] = function(thisUnit)
local hasNoControl = br["hasNoControl"]
if thisUnit == nil then thisUnit = "player" end
return hasNoControl(id,thisUnit)
cast.noControl[spell] = function()
local hasNoControl = br.hasNoControl
return hasNoControl(id)
end

--- Casts special opener condition spell.
Expand Down Expand Up @@ -255,8 +254,8 @@ br.api.cast = function(self,spell,id)
specificAmt = specificAmt or 0
multiplier = multiplier or 1
if altPower == nil then altPower = false end
return power[powerType].amount() < cast.cost[spell](altPower) * multiplier or
power[powerType].amount() < specificAmt
return power[powerType]() < cast.cost[spell](altPower) * multiplier or
power[powerType]() < specificAmt
end

--- Gets the spell's range, if it has one.
Expand Down Expand Up @@ -308,4 +307,16 @@ br.api.cast = function(self,spell,id)
if br.lastCastTable.castTime[id] == nil then br.lastCastTable.castTime[id] = br._G.GetTime() end
return br._G.GetTime() - br.lastCastTable.castTime[id]
end
end

--- Checks if the provided condition is true else it waits for 0.1sec.
-- @function cast.wait
-- @param condition The condition to check.
-- @treturn boolean
cast.wait = function(condition, callback)
if condition then
br._G.C_Timer.After(0.1, callback)
else
return true
end
end
end
35 changes: 21 additions & 14 deletions System/API/Debuff.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
---
-- These functions help in retrieving information about debuffs.
-- Debuff functions are stored in br.player.debuff and can be utilized by `local debuff = br.player.debuff` in your profile.
-- `spell` in the function represent the name in the debuffs list (Spec, Shared Class, Shared Global Lists) defined in System/List/Spells.lua
-- Debuff functions are stored in br.player.debuff and can be utilized
-- by `local debuff = br.player.debuff` in your profile.
-- `spell` in the function represent the name in the
-- debuffs list (Spec, Shared Class, Shared Global Lists) defined in System/List/Spells.lua
-- @module br.player.debuff
local _, br = ...

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

-- Local function needed to facilitate debuff.calc
local function getSnapshotValue(dot)
local self = br.player
-- Feral Bleeds
if br._G.GetSpecializationInfo(br._G.GetSpecialization()) == 103 then
local multiplier = 1.00
Expand All @@ -17,27 +19,29 @@ local function getSnapshotValue(dot)
local TigersFury = 1.15
local RakeMultiplier = 1
-- Tigers Fury
if self.buff.tigersFury.exists() then multiplier = multiplier*TigersFury end
if br.player.buff.tigersFury.exists() then multiplier = multiplier*TigersFury end
-- moonfire feral
if dot == self.spell.debuffs.moonfireFeral then
if dot == br.player.spell.debuffs.moonfireFeral then
-- return moonfire
return multiplier
end
-- Bloodtalons
if self.buff.bloodtalons.exists() and dot == self.spell.debuffs.rip then multiplier = multiplier*Bloodtalons end
if br.player.buff.bloodtalons.exists() and dot == br.player.spell.debuffs.rip then multiplier = multiplier*Bloodtalons end
-- Savage Roar
-- if self.buff.savageRoar.exists() then multiplier = multiplier*SavageRoar end
-- rip
if dot == self.spell.debuffs.rip then
if dot == br.player.spell.debuffs.rip then
-- -- Versatility
-- multiplier = multiplier*(1+Versatility*0.1)
-- return rip
return 5*multiplier
end
-- rake
if dot == self.spell.debuffs.rake then
if dot == br.player.spell.debuffs.rake then
-- Incarnation/Prowl/Sudden Ambush
if self.buff.berserk.exists() or self.buff.incarnationAvatarOfAshamane.exists() or self.buff.prowl.exists() or self.buff.shadowmeld.exists() or self.buff.suddenAmbush.exists() then
if br.player.buff.berserk.exists() or br.player.buff.incarnationAvatarOfAshamane.exists() or br.player.buff.prowl.exists()
or br.player.buff.shadowmeld.exists() or br.player.buff.suddenAmbush.exists()
then
RakeMultiplier = 1.6
end
-- return rake
Expand All @@ -47,10 +51,13 @@ local function getSnapshotValue(dot)
-- Assassination Bleeds
if br._G.GetSpecializationInfo(br._G.GetSpecialization()) == 259 then
local multiplier = 1
if self.buff.stealth.exists() and self.talent.nightstalker and (dot == self.spell.debuffs.rupture or dot == self.spell.debuffs.garrote) then multiplier = 1.5 end
if (self.buff.stealth.exists() or self.buff.vanish.exists()
or (self.buff.subterfuge.exists() and self.buff.subterfuge.remain() >= 0.1 and self.buff.subterfuge.remain() >= br.getSpellCD(61304)))
and dot == self.spell.debuffs.garrote and self.talent.subterfuge
if br.player.buff.stealth.exists() and br.player.talent.nightstalker and (dot == br.player.spell.debuffs.rupture
or dot == br.player.spell.debuffs.garrote) then multiplier = 1.5
end
if (br.player.buff.stealth.exists() or br.player.buff.vanish.exists()
or (br.player.buff.subterfuge.exists() and br.player.buff.subterfuge.remain() >= 0.1
and br.player.buff.subterfuge.remain() >= br.getSpellCD(61304)))
and dot == br.player.spell.debuffs.garrote and br.player.talent.subterfuge
then
multiplier = 1.8
end
Expand Down Expand Up @@ -257,4 +264,4 @@ br.api.debuffs = function(debuff,k,v)
debuff.applied = function(thisUnit)
return (spec == 103 or spec == 259) and debuff.bleed[thisUnit] or 0
end
end
end
4 changes: 2 additions & 2 deletions System/API/Equiped.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ br.api.equiped = function(self,item,id)
-- @function equiped.tier
-- @param tierLevel string|number The tier level to check for. (e.g. "T20" or 20)
-- @treturn number
equiped.tier = function(tierLevel)
equiped.tier = function(tierLevel,numEquiped)
if type(tierLevel) == "number" then tierLevel = "T"..tierLevel end
return br.TierScan(tierLevel)
return br.TierScan(tierLevel) >= numEquiped
end

if equiped.type == nil then
Expand Down
Loading

0 comments on commit b800309

Please sign in to comment.