Skip to content

Instantly share code, notes, and snippets.

@brandonjank
Last active August 29, 2015 14:04
Show Gist options
  • Save brandonjank/38ebd273adfaee2486a0 to your computer and use it in GitHub Desktop.
Save brandonjank/38ebd273adfaee2486a0 to your computer and use it in GitHub Desktop.
Backburn's Survival Hunter Rotation for the Device Addon
-- Backburn's Survival Hunter Rotation
-- Updated on July 17th, 2014
-- PLAYER CONTROLLED: Rabid MUST be on Auto-Cast for Stampede pets to use them :)
-- SUGGESTED TALENTS:
-- CONTROLS: Pause - Left Control, Explosive/Ice/Snake Traps - Left Alt, Freezing Trap - Right Alt, Scatter Shot - Right Control
-- VARIABLES
local apiVersion = '1:0:0-alpha'
local rotationVersion = '1:0:0-alpha'
local developerName = 'Backburn'
local rotationDesc = 'A combined PvP and PvE rotation for Survival Hunters.'
local class = 'HUNTER'
local spec = 'SURVIVAL'
-- IMPORTS & SHORTCUTS
local Actions, Targets, Modifiers = Device:actions, Device:targets, Device:modifiers
-- Actions
local spell, pause = Actions:Spell, Actions:Pause
-- Targets
local unit, ground = Targets:Unit, Targets:Ground
-- Modifiers
local key, mouse, toggle = Modifiers:Key, Modifiers:Mouse, Modifiers:Toggle
-- Shortcuts
local target, pet, focus, player, mouseover = unit('target'), unit('pet'), unit('focus'), unit('player'), unit('mouseover')
-- tank? heals?
-- CUSTOM Functions
--TODO: Alpha, Beta, and Raid Ready Alert
local function bossMods()
-- Darkmoon Faerie Cannon
--if select(7, UnitBuffID("player", 102116))
--and select(7, UnitBuffID("player", 102116)) - GetTime() < 1.07 then
--CancelUnitBuff("player", "Magic Wings")
--end
-- Raid Boss Checks
if UnitExists("boss1") then
for i = 1,4 do
local bossCheck = "boss"..i
if UnitExists(bossCheck) then
local npcID = tonumber(UnitGUID(bossCheck):sub(6, 10), 16)
--local bossCasting,_,_,_,_,castEnd = UnitCastingInfo(bossCheck)
if npcID == 71515 then -- SoO: General Nazgrim
--if UnitBuffID("target", 71) then
--SpellStopCasting()
--return true
--end
end
end
end
end
return false
end
local function stackCheck(spell, otherTank, stacks)
local debuffName, _, _, debuffCount = UnitDebuff(otherTank, spell)
if debuffName and debuffCount >= stacks and not UnitDebuff("player", spell) then
return true
end
return false
end
local function useAgiPot()
-- 76089 = Virmen's Bite
if GetItemCount(76089) > 1
and GetItemCooldown(76089) == 0
and ( UnitBuff("player", 3045) or ProbablyEngine.condition["player.hashero"] ) then
return true
end
return false
end
local badMisdirectTargets = { "Kor'kron Warshaman" }
local function canMisdirect(target)
local targetName = UnitName(target)
for _,v in pairs(badMisdirectTargets) do
if v == targetName then
return false
end
end
return true
end
local function isTargetingMe(target)
if UnitExists(target) then
return UnitGUID(target.."target") == UnitGUID("player")
end
return false
end
local function highThreatOnPlayerTarget(target)
if UnitExists(target) and UnitExists("target") then
local threat = UnitThreatSituation(target,"target")
if threat and threat > 0 then --not tanking, higher threat than tank.
return true
end
end
return false
end
local function useHealthPot()
-- 76098 = Master health() Potion
if GetItemCount(76097) > 1
and GetItemCooldown(76097) == 0 then
return true
end
return false
end
local function BGFlag()
if GetBattlefieldStatus(1)=='active'
or GetBattlefieldStatus(2)=='active' then
InteractUnit('Horde flag')
InteractUnit('Alliance flag')
end
return false
end
-- TOGGLES
local toggles = {
-- {id, icon, title, description, toggleKey?}
{'callpet', 'Interface\\Icons\\ability_hunter_beastcall', 'Call Pet 1', 'Toggle to keep the pet in your first pet slot out:'},
{'misdirect', 'Interface\\Icons\\ability_hunter_misdirection', 'Auto Misdirect', 'Toggle to automatically misdirect to your Focus>Tank>Pet when high on threat:'},
{'consume', 'Interface\\Icons\\inv_alchemy_endlessflask_06', 'Use Consumables', 'Toggle the usage of Flasks/Food/Potions etc::'},
{'autotarget', 'Interface\\Icons\\ability_hunter_snipershot', 'Auto Target', 'Automatically target the nearest enemy() when target dies or does not exist:'},
{'aspect', 'Interface\\Icons\\ability_mount_jungletiger', 'Auto Aspect', 'Automatically switch aspect when moving() and not in combat:'},
{'mouseovers', 'Interface\\Icons\\ability_hunter_quickshot', 'Use Mouseovers', 'Toggle automatic usage of stings/scatter/etc on eligible mouseover targets:'},
{'pvpmode', 'Interface\\Icons\\achievement_pvp_o_h', 'Enable PvP', 'Toggle the usage of PvP abilities:'},
{'camomode', 'Interface\\Icons\\ability_hunter_displacement', 'Use Camouflage', 'Toggle the usage Camouflage when out of combat:'},
{'cleavemode', 'Interface\\Icons\\ability_upgrademoonglaive', 'Cleave Mode', 'Toggle the automatic usage of AoE abilities for 2 to 3 enemies:'},
{'cooldowns', 'Interface\\Icons\\ability_upgrademoonglaive', 'cooldown() Mode', 'Enable usage of 3+ minute cooldowns'}
{'multitarget', 'Interface\\Icons\\ability_upgrademoonglaive', 'AoE Mode', 'Enable usage of aoe abilities'}
}
-- COMBAT
local combat = {
-- Rotation Utilities
-- TODO: Explosive Trap timer cooldown() OSD
-- cant place traps without target?
-- TODO: DPS Test Function
pause(function() return key('lcontrol') -- Pause Key
or player:buff(5384) end), -- Feign Death
-- Auto Target
macro('/targetenemy() [noexists]', function() return toggle('autotarget') and not target:exists() end),
macro('/targetenemy() [dead]', function() return toggle('autotarget') and target:exists() and target:dead() end),
-- Interrupts
spell(147362, function() return target:range() < 40 and target:randinterrupt() end), -- Counter Shot
-- Pet
spell(883, function() return toggle('callpet') and not pet:exists() end), -- Call Pet 1
spell(55709, function() return toggle('callpet') and pet:dead() end), -- Heart of the Phoenix
spell(136, function() return pet:health() < 50 and not pet:buff(136) and pet:range() < 40 end), -- Mend Pet
-- PvP Abilities
-- TODO: Binding Shot (ground)
-- TODO: Reactive Deterrence
spell(53271, function() return player:state('disorient') or player:state('stun') or player:state('root') or player:state('snare') end, player), -- Master's Call
spell(19503, function() return toggle('pvpmode') and target:exists() and target:enemy() and target:alive() and not target:status('disorient') -- Scatter Shot on Target
and not target:status('sleep') and not target:status('incapacitate') and not target:status('fear') and not target:status('misc') and not target:status('root')
and not target:status('stun') and not target:status('snare') and not target:immune('all') and not target:immune('disorient') end),
spell(19503, function() return ((toggle('mouseovers') and toggle('pvpmode')) or key('rcontrol')) and mouseover:exists() and mouseover:enemy() and mouseover:alive() and not mouseover:status('disorient') -- Scatter Shot on Mouseover
and not mouseover:status('sleep') and not mouseover:status('incapacitate') and not mouseover:status('fear') and not mouseover:status('misc') and not mouseover:status('root')
and not mouseover:status('stun') and not mouseover:status('snare') and not mouseover:immune('all') and not mouseover:immune('disorient') end, mouseover),
spell(19386, function() return ((toggle('mouseovers') and toggle('pvpmode')) or key('rcontrol')) and player:spell(19503):cooldown() > 0 and mouseover:exists() and mouseover:enemy() and mouseover:alive() -- Wyvern Sting on Mouseover
and not mouseover:status('disorient') and not mouseover:status('sleep') and not mouseover:status('incapacitate') and not mouseover:status('fear')
and not mouseover:status('misc') and not mouseover:status('root') and not mouseover:status('stun') and not mouseover:status('snare') and not mouseover:immune('all')
and not mouseover:immune('sleep') end, mouseover),
spell(13809, function() return key('rcontrol') and player:spell(19503):cooldown() > 0 and mouseover:exists() and mouseover:enemy() and mouseover:alive() and mouseover:status('disorient') -- Ice Trap on Ground by Disoriented targets
and not mouseover:immune('all') and not mouseover:immune('sleep') end, ground),
spell(1513, function() return toggle('mouseovers') and toggle('pvpmode') and mouseover:exists() and mouseover:enemy() and mouseover:alive() and not mouseover:debuff(1513) and mouseover:creatureType('beast') end, mouseover), -- Scare Beast on Mouseover
spell(1513, function() return toggle('pvpmode') and target:exists() and target:enemy() and target:alive() and not target:debuff(1513) and target:creatureType('beast') end), -- Scare Beast on Target
-- Traps
spell(1499, function() return key('ralt') and player:buff(77769) end, ground), -- Freezing Trap
spell(77769, function() return key('lalt') and not player:buff(77769)), -- Trap Launcher
spell(13813, function() return key('lalt') and player:buff(77769) end, ground), -- Explosive Trap
spell(13809, function() return key('lalt') and player:buff(77769) end, ground), -- Ice Trap
spell(34600, function() return key('lalt') and player:buff(77769) end, ground), -- Snake Trap
-- Mouseovers
spell(1978, function() return not toggle('pvpmode') and toggle('mouseovers') and mouseover:exists() -- Serpent Sting on Mouseover
and mouseover:enemy() and mouseover:alive() and not mouseover:debuff(118253)
and not mouseover:state('charm') and mouseover:deathin() > 10 end, mouseover),
spell(19801, function() return target:dispellable(19801) end), -- Tranquillizing Shot
-- TODO: Boss Functions + hold cooldowns
-- TODO: Energy Pooling Toggle
-- Misdirect ( focus() -> tank -> pet )
{
function() return toggle('misdirect') and not toggle('pvpmode') and not target:isPlayer and not player:buff(34477) and canMisdirect() and target:threat > 60 end, -- Condition
spell(34477, function() return focus:exists() and focus:alive() and not player:buff(34477) end, focus), -- Misdirection to Focus
spell(34477, function() return tank:exists() and tank:alive() and not focus:exists() end, tank), -- Misdirection to Tank
spell(34477, function() return pet:exists() and pet:alive() and not focus:exists() and not tank:exists() end, pet) -- Misdirection to Pet
},
-- Stances
spell(109260, function() return toggle('aspect') and not player:buff(13165) and not player:buff(109260) and not player:moving() end), -- Aspect of the Iron Hawk
spell(13165, function() return toggle('aspect') and not player:buff(13165) and not player:buff(109260) and not player:moving() end), -- Aspect of the Hawk
-- Pre DPS Pause
pause(function() return target:debuff(19386):any() -- Wyvern Sting
or target:debuff(19503):any() -- Scatter Shot
or target:immune('all') or target:status('disorient') or target:status('incapacitate') or target:status('sleep') end), -- Immunity
-- Cooldowns
spell(109304, function() return toggle('cooldowns') and player:health() < 50 end), -- Exhilaration
item(5512, function() return toggle('cooldowns') and player:health() < 40 end), -- Healthstone (5512)
--item(76097, function() return toggle('cooldowns') and player:health() < 40 and useHealthPot() end), -- Master Healing Potion (76097)
item(76089, function() return toggle('cooldowns') and toggle('consume') and pet:exists() and target:exists() and player:hashero and useAgiPot() end), -- Agility Potion (76089)
spell(20572, function() return toggle('cooldowns') end), -- Blood Fury (AP)
--item(gloves?, function() return toggle('cooldowns') and pet:exists() and target:exists() end), -- Synapse Springs
spell(26297, function() return toggle('cooldowns') and pet:exists() and target:exists() and not player:hashero() and not player:buff(3045) end), -- Berserking
-- Dual Use
spell(82726, function() return player:focus() <= 50 end), -- TIER 4: Fervor
spell(131894), -- TIER 5: A Murder of Crows
spell(120697), -- TIER 5: Lynx Rush
-- Multi Target
spell(2643, function() return toggle('multitarget') end), -- Multi-Shot
spell(117050, function() return toggle('multitarget') end), -- TIER 6: Glaive Toss --TODO: do range check
spell(109259, function() return toggle('multitarget') end), -- TIER 6: Powershot
spell(120360, function() return toggle('multitarget') end), -- TIER 6: Barrage
spell(13813, function() return toggle('multitarget') end, ground), -- Explosive Trap
spell(3674, function() return toggle('multitarget') and not target:debuff() and target:deathin() >= 8 and not target:state('charm') end), -- Black Arrow
spell(53301, function() return toggle('multitarget') and player:buff(56343) end), -- Explosive Shot, Lock and Load
spell(53351, function() return toggle('multitarget') and target:health() <= 20 end), -- Kill Shot
spell(77767, function() return toggle('multitarget') and player:focus() < 40 end), -- Cobra Shot
-- Single Target
spell(53301, function() return player:buff(56343) end), -- Explosive Shot, Lock and Load
spell(117050), -- TIER 6: Glaive Toss --TODO: do range check
spell(109259), -- TIER 6: Powershot
spell(120360), -- TIER 6: Barrage
spell(1978, function() return not target:debuff(118253) and target:deathin() >= 10 and not target:state('charm') end), -- Serpent Sting
spell(53301), -- Explosive Shot
spell(53351, function() return target:health() <= 20 end), -- Kill Shot
spell(5116, function() return toggle('pvpmode') and not target:debuff(5116):any() and target:moving() and not target:immune('snare') end), -- PvP: Concussive Shot
spell(82654, function() return toggle('pvpmode') and not target:debuff(82654):any() and target:health() > 20 end), -- PvP: Widow Venom
spell(3674, function() return not target:debuff and target:deathin() >= 8 and not target:state('charm') end), -- Black Arrow
spell(2643, function() return player:buff(34720) and target:debuff(118253):duration() < 2 end), -- Multi-Shot, Thrill of the Hunt, Serpent Sting
spell(2643, function() return toggle('cleavemode') and player:buff(34720) end), -- Multi-Shot, Thrill of the Hunt
spell(3044, function() return player:buff(34720) end), -- Arcane Shot, Thrill of the Hunt
spell(3045, function() return toggle('cooldowns') and pet:exists() and target:exists() and not player:hashero() end), -- Rapid Fire
spell(120679) -- TIER 4: Dire Beast -- Dire Beast
spell(121818, function() return toggle('cooldowns') and pet:exists() and player:hashero() end), -- Stampede
spell(121818, function() return toggle('cooldowns') and pet:exists() and player:buff(3045) end), -- Stampede
spell(77767, function() return target:debuff(118253):duration() < 6 end), -- Cobra Shot, Serpent Sting
spell(2643, function() return toggle('cleavemode') and player:focus() >= 67 end), -- Multi-Shot --and key('enemies > 1' } world?
spell(13813, function() return toggle('cleavemode') end), -- Explosive Trap --key('enemies > 2)
spell(3044, function() return player:focus() >= 67 end), -- Arcane Shot
spell(77767, function() return player:spell(53301):cooldown() > 1 end), -- Cobra Shot, Explosive Shot
spell(77767, function() return player:focus() < 40 end), -- Cobra Shot
}
-- OUT OF COMBAT
local nocombat = {
-- Pauses
pause(function() return key('lcontrol') -- Pause Key
or player:buff(5384) end), -- Feign Death
spell(5118, function() return toggle('aspect') and player:moving() and not player:buff(5118) and not player:buff(13159) end), -- Aspect of the Cheetah,
spell(51753, function() return toggle('camomode') and not player:buff(51753) and not player:debuff(Orb of Power) end), -- Camouflage
-- Pet
spell(883, function() return toggle('callpet') and not pet:exists() end), -- Call Pet 1
--spell(982, not pet:alive()) -- Revive Pet
spell(136, function() return pet:health() <= 90 and pet:exists() and pet:alive() and not pet:buff(136) end), -- Mend Pet
-- Traps
spell(1499, function() return key('ralt') end, ground), -- Freezing Trap
spell(13813, function() return key('lalt') end, ground), -- Explosive Trap
spell(13809, function() return key('lalt') end, ground), -- Ice Trap
spell(34600, function() return key('lalt') end, ground), -- Snake Trap
-- Mark
spell(1130, function() return target:exists() and target:alive() and not target:debuff(1130):any() end), -- Hunter's Mark
-- Food / Flask
-- TODO: flask of spring blossoms
-- TODO: food mist rice noodles
-- TODO: PRE POT: Virmen's Bite potion
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment