Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create CronoMageInitial.lua #1291

Merged
merged 1 commit into from
Apr 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
254 changes: 254 additions & 0 deletions Rotations/Mage/Initial/CronoMageInitial.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,254 @@
local rotationName = "Crono" -- Change to name of profile listed in options drop down

---------------
--- Toggles ---
---------------
local function createToggles()
-- Rotation Button
local RotationModes = {
[1] = {mode = "Auto", value = 1, overlay = "Automatic Rotation", tip = "Swaps between Single and Multiple based on number of targets in range.", highlight = 1, icon = br.player.spell.arcaneExplosion},
[2] = {mode = "Sing", value = 2, overlay = "Single Target Rotation", tip = "Single target rotation used.", highlight = 0, icon = br.player.spell.frostbolt}
}
br.ui:createToggle(RotationModes,"Rotation", 1, 0)

-- Defensive Button
local DefensiveModes = {
[1] = {mode = "On", value = 1, overlay = "Defensive Enabled", tip = "Includes Defensive Cooldowns.", highlight = 1, icon = br.player.spell.frostNova},
[2] = {mode = "Off", value = 2, overlay = "Defensive Disabled", tip = "No Defensives will be used.", highlight = 0, icon = br.player.spell.frostNova}
}
br.ui:createToggle(DefensiveModes,"Defensive", 2, 0)

-- Interrupt Button
local InterruptModes = {
[1] = {mode = "On", value = 1, overlay = "Interrupts Enabled", tip = "Includes Basic Interrupts.", highlight = 1, icon = br.player.spell.counterspell},
[2] = {mode = "Off", value = 2, overlay = "Interrupts Disabled", tip = "No Interrupts will be used.", highlight = 0, icon = br.player.spell.counterspell}
}
br.ui:createToggle(InterruptModes,"Interrupt", 3, 0)

end

---------------
--- OPTIONS ---
---------------
local function createOptions()
local optionTable

local function rotationOptions()
local section
-----------------------
--- GENERAL OPTIONS --- -- Define General Options
-----------------------
section = br.ui:createSection(br.ui.window.profile, "General")

br.ui:checkSectionState(section)
-------------------------
--- DEFENSIVE OPTIONS --- -- Define Defensive Options
-------------------------
section = br.ui:createSection(br.ui.window.profile, "Defensive")

br.ui:checkSectionState(section)
-------------------------
--- INTERRUPT OPTIONS --- -- Define Interrupt Options
-------------------------
section = br.ui:createSection(br.ui.window.profile, "Interrupts")
-- Interrupt Percentage
br.ui:createSpinner(section, "Interrupt At", 0, 0, 95, 5, "|cffFFBB00Cast Percentage to use at.")
br.ui:checkSectionState(section)
----------------------
--- TOGGLE OPTIONS --- -- Degine Toggle Options
----------------------
section = br.ui:createSection(br.ui.window.profile, "Toggle Keys")
-- Single/Multi Toggle
br.ui:createDropdown(section, "Rotation Mode", br.dropOptions.Toggle, 4)
--Defensive Key Toggle
br.ui:createDropdown(section, "Defensive Mode", br.dropOptions.Toggle, 6)
-- Interrupts Key Toggle
br.ui:createDropdown(section, "Interrupt Mode", br.dropOptions.Toggle, 6)
-- Pause Toggle
br.ui:createDropdown(section, "Pause Mode", br.dropOptions.Toggle, 6)
br.ui:checkSectionState(section)
end
optionTable = {{
[1] = "Rotation Options",
[2] = rotationOptions,
}}
return optionTable
end

--------------
--- Locals ---
--------------
-- BR API Locals - Many of these are located from System/API, this is a sample of commonly used ones but no all inclusive
local buff
local cast
local cd
local debuff
local has
local mode
local power
local talent
local ui
local pet
local spell
local unit
local units
local use
-- General Locals
local haltProfile
local profileStop
-- Profile Specific Locals
-- Any variables/functions made should have a local here to prevent possible conflicts with other things.


-----------------
--- Functions --- -- List all profile specific custom functions here
-----------------

--------------------
--- Action Lists --- -- All Action List functions from SimC (or other rotation logic) here, some common ones provided
--------------------
local actionList = {} -- Table for holding action lists.
-- Action List - Extra
actionList.Extra = function()

end -- End Action List - Extra

-- Action List - Defensive
actionList.Defensive = function()
--Frost Nova
if unit.hp() < 95 then
if cast.able.frostNova("player","aoe",1,12) then
if cast.frostNova("player","aoe",1,12) then ui.debug("Casting Frost Nova") return true end
end
end
end -- End Action List - Defensive

-- Action List - Interrrupt
actionList.Interrupt = function()
--Counterspell Interrupt
if unit.interruptable(units.dyn40) then
if cast.able.counterspell() and unit.distance(units.dyn40) then
if cast.counterspell() then ui.debug("Casting Counterspell") return true end
end
end
end -- End Action List - Interrupt

-- Action List - Cooldowns
actionList.Cooldown = function()

end -- End Action List - Cooldowns

-- Action List - Pre-Combat
actionList.PreCombat = function()
if not unit.inCombat() and not (unit.flying() or unit.mounted() or unit.taxi()) then -- Only run when not in combat and not flying/mounted/taxi
if ui.checked("Pre-Pull Timer") and ui.pullTimer() <= ui.value("Pre-Pull Timer") then
-- Logic based on pull timers (IE: DBM/BigWigs)
end -- End Pre-Pull
if unit.valid("target") then -- Abilities below this only used when target is valid
-- Start Attack
if unit.distance("target") < 5 then -- Starts attacking if enemy is within 5yrds
if cast.able.autoAttack("target") then
if cast.autoAttack("target") then ui.debug("Casting Auto Attack [Pre-Combat]") return true end
end
end
end
end -- End No Combat
end -- End Action List - PreCombat

----------------
--- ROTATION ---
----------------
local function runRotation()
---------------------
--- Define Locals ---
---------------------
-- BR API Locals
buff = br.player.buff
cast = br.player.cast
cd = br.player.cd
debuff = br.player.debuff
has = br.player.has
mode = br.player.ui.mode
ui = br.player.ui
pet = br.player.pet
spell = br.player.spell
ui = br.player.ui
unit = br.player.unit
units = br.player.units
use = br.player.use
-- General Locals
profileStop = profileStop or false
haltProfile = (unit.inCombat() and profileStop) or br._G.IsMounted() or br.pause() or mode.rotation==4
-- Units
units.get(5) -- Makes a variable called, units.dyn5
units.get(40) -- Makes a variable called, units.dyn40
units.get(40,true)

-- Pause Timer
if br.pauseTime == nil then br.pauseTime = br._G.GetTime() end

---------------------
--- Begin Profile ---
---------------------
-- Profile Stop | Pause
if not unit.inCombat() and not unit.exists("target") and profileStop then
profileStop = false
elseif haltProfile then
br.pauseTime = br._G.GetTime()
return true
else
---------------------------------
--- Out Of Combat - Rotations ---
---------------------------------
-----------------
--- Defensive ---
-----------------
if actionList.Defensive() then return true end
------------------
--- Pre-Combat ---
------------------
if actionList.PreCombat() then return true end
--Arcane Intellect
if cast.able.arcaneIntellect("player") and not buff.arcaneIntellect.exists("player") then
if cast.arcaneIntellect("player") then ui.debug("Casting Arcane Intellect") return true end
end
-----------------------------
--- In Combat - Rotations ---
-----------------------------
-- Check for combat
if unit.valid("target") and cd.global.remain() == 0 then
if unit.exists(units.dyn40) and unit.distance(units.dyn40) < 40 then
------------------------------
--- In Combat - Interrupts ---
------------------------------
if actionList.Interrupt() then return true end
-- Start Attack
-- actions=auto_attack
if not br._G.IsAutoRepeatSpell(br._G.GetSpellInfo(6603)) and unit.exists(units.dyn5) and unit.distance(units.dyn5) < 5 then
br._G.StartAttack(units.dyn5)
end
--Arcane Explosion
if cast.able.arcaneExplosion("player","aoe",1,8) then
if cast.arcaneExplosion("player","aoe",1,8) then ui.debug("Casting Arcane Explosion") return true end
end
--Fire Blast
if cast.able.fireBlast() and unit.distance(units.dyn40) then
if cast.fireBlast() then ui.debug("Casting Fire Blast") return true end
end
--Frost Bolt
if cast.able.frostBolt(units.dyn40) and not unit.moving() then
if cast.frostBolt() then ui.debug("Casting Frost Bolt") return true end
end
end -- End In Combat Rotation
end
end -- Pause
end -- End runRotation
local id = 1449 -- Change to the spec id profile is for. Spec ID can be found at: https://wowpedia.fandom.com/wiki/SpecializationID
-- DO NOT EDIT ANYTHING BELOW THIS LINE, WILL BREAK PROFILE --
if br.rotations[id] == nil then br.rotations[id] = {} end
br._G.tinsert(br.rotations[id],{
name = rotationName,
toggles = createToggles,
options = createOptions,
run = runRotation,
})