Bastion aims to serve as a highly performant, simplisitic, and expandable World of Warcraft data visualization framework.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Bastion/scripts/brewmaster.lua

106 lines
3.6 KiB

local Tinkr, _Bastion = ...
---@type Bastion
local Bastion = _Bastion
local BrewModule = Bastion.Module:New('brewmaster')
local Player = Bastion.UnitManager:Get('player')
local Target = Bastion.UnitManager:Get('target')
local None = Bastion.UnitManager:Get('none')
local PurifyingBrew = Bastion.SpellBook:GetSpell(119582)
local CelestialBrew = Bastion.SpellBook:GetSpell(322507)
local PurifiedChi = Bastion.SpellBook:GetSpell(325092)
local AutoAttack = Bastion.SpellBook:GetSpell(6603)
local ImpCelestialBrew = Bastion.SpellBook:GetSpell(322510)
local ChiWave = Bastion.SpellBook:GetSpell(115098)
local RushingJadeWind = Bastion.SpellBook:GetSpell(116847)
local BreathOfFire = Bastion.SpellBook:GetSpell(115181)
local KegSmash = Bastion.SpellBook:GetSpell(121253)
local WeaponsOfOrder = Bastion.SpellBook:GetSpell(387184)
local BlackoutKick = Bastion.SpellBook:GetSpell(205523)
local RisingSunKick = Bastion.SpellBook:GetSpell(107428)
local CDsEnabled = false
---@return boolean
local function CombatRotation()
-- Attack the target is auto attack isnt active.
if AutoAttack:IsKnownAndUsable() and not IsCurrentSpell(AutoAttack:GetID()) and Player:InMelee(Target) and not Target:IsDead() then
AutoAttack:Cast(Target)
end
local Stagger = UnitStagger("player")
if Stagger > 10000 and PurifyingBrew:IsKnownAndUsable() and PurifyingBrew:GetChargesRemaining() > 1 or (PurifyingBrew:GetNextChargeCooldown() <= 3 and PurifyingBrew:GetChargesRemaining() == 1) then
PurifyingBrew:Cast(Player)
end
if CelestialBrew:IsKnownAndUsable() and (not ImpCelestialBrew:IsKnown() or (ImpCelestialBrew:IsKnown() and Player:GetAuras():FindMy(PurifiedChi):IsUp())) then
return CelestialBrew:Cast(Player)
end
if not Player:InMelee(Target) then
if not Player:GetAuras():FindMy(RushingJadeWind):IsUp() and RushingJadeWind:IsKnownAndUsable() then
return RushingJadeWind:Cast(Player)
end
if ChiWave:IsKnownAndUsable() and Target:Exists() and ChiWave:IsInRange(Target) then
return ChiWave:Cast(Target)
end
end
if BreathOfFire:IsKnownAndUsable() and BreathOfFire:IsInRange(Target) then
return BreathOfFire:Cast(Player)
end
if KegSmash:IsKnownAndUsable() and Target:Exists() and KegSmash:IsInRange(Target) and (KegSmash:GetChargesRemaining() == KegSmash:GetMaxCharges() or (KegSmash:GetChargesRemaining() == (KegSmash:GetMaxCharges() - 1)) and KegSmash:GetNextChargeCooldown() <= 2) then
return KegSmash:Cast(Target)
end
if WeaponsOfOrder:IsKnownAndUsable() and CDsEnabled then
return WeaponsOfOrder:Cast(Player)
end
-- Exploding Keg in AOE here
-- Rising Sun Kick In AOE here
if BlackoutKick:IsKnownAndUsable() and Target:Exists() and BlackoutKick:IsInRange(Target) then
return BlackoutKick:Cast(Target)
end
if RisingSunKick:IsKnownAndUsable() and Target:Exists() and RisingSunKick:IsInRange(Target) then
return RisingSunKick:Cast(Target)
end
-- Exploding Keg in ST here
return false
end
---@return boolean
local function OutOfCombatRotation()
return false
end
local isRunning = false
BrewModule:Sync(function()
if not isRunning then
Bastion:Print('Brewmaster Started')
isRunning = true
end
if not Player:IsAlive() or Player:IsMounted() then
return false
end
if Player:IsAffectingCombat() or IsCurrentSpell(AutoAttack:GetID()) then
-- Combat Rotation
return CombatRotation()
else
-- Out Of Combat Rotation
return OutOfCombatRotation()
end
end)
Bastion:Register(BrewModule)