view SkeenCore3BeastMasteryHunter.lua @ 21:39f3f0dbf42e v1.5.2

Update to new cooldown system
author Emil Madsen <skeen@cs.au.dk>
date Wed, 08 May 2013 00:08:19 +0200
parents d268dd3509fa
children a03c3c813e3e
line wrap: on
line source
--
-- SkeenCore3BeastMasteryHunter
-- 
local LibSkeenCore = LibStub("LibSkeenCore");

local function Cooldowns()

    -- Ability SpellID
    local RapidFireID = 3045
    local StampedeID = 121818
    local ReadinessID = 23989
    local BestialWrathID = 19574

    return {RapidFireID, StampedeID, ReadinessID, BestialWrathID}
end

local function Rotation()

    -- Hide the frame, if the target is dead, non existing or friendly.
    if UnitName("target") == nil or UnitIsFriend("player","target") ~= nil or UnitHealth("target") == 0 then
        return nil
    end

    --Information from;
    --http://www.wowpedia.org/API_GetTalentInfo_(Mists)
    local a_murder_of_crows_chosen = LibSkeenCore:HasChosenTalent(13)
    local blink_strike_chosen = LibSkeenCore:HasChosenTalent(14)
    local lynx_rush_chosen = LibSkeenCore:HasChosenTalent(15)
    local glaive_toss_chosen = LibSkeenCore:HasChosenTalent(16)
    local powershot_chosen = LibSkeenCore:HasChosenTalent(17)
    local barrage_chosen = LibSkeenCore:HasChosenTalent(18)

    -- The table used for spell information (returned to the callee)
    local spell = {}
    spell.current = nil
    spell.next = nil
    spell.cd1 = nil
    spell.cd2 = nil
    spell.cd3 = nil
    spell.cd4 = nil

    -- Ability SpellID
    local KillCommandID = 34026
    local KillShotID = 53351
    local FocusFireID = 82692
    local FervorID = 82726
    local SerpentStingID = 1978
    local ArcaneShotID = 3044
    local CobraShotID = 77767
    local HuntersMarkID = 1130
    local AMurderOfCrowsID = 131894
    local BlinkStrikeID = 130392
    local LynxRushID = 120697
    local GlaiveTossID = 117050
    local PowershotID = 109259
    local BarrageID = 120360
    local FrenzyID = 19615

    local focus = UnitPower("player")

    --Cooldowns
    local kill_command_cooldown = LibSkeenCore:GetCooldown(KillCommandID) --"Kill Command"
    local kill_shot_cooldown = LibSkeenCore:GetCooldown(KillShotID) --"Kill Shot"
    local focus_fire_cooldown = LibSkeenCore:GetCooldown(FocusFireID) --"Focus Fire"
    local fervor_cooldown = LibSkeenCore:GetCooldown(FervorID) --"Fervor"
    local a_murder_of_crows_cooldown = LibSkeenCore:GetCooldown(AMurderOfCrowsID) --"A Murder of Crows"
    local blink_strike_cooldown = LibSkeenCore:GetCooldown(BlinkStrikeID) --"Blink Strike"
    local lynx_rush_cooldown = LibSkeenCore:GetCooldown(LynxRushID) --"Lynx Rush"
    local glaive_toss_cooldown = LibSkeenCore:GetCooldown(GlaiveTossID) --"Glaive Toss"
    local powershot_cooldown = LibSkeenCore:GetCooldown(PowershotID) --"Powershot"
    local barrage_cooldown = LibSkeenCore:GetCooldown(BarrageID) --"Barrage"

    --Debuff
    local serpent_sting_duration = LibSkeenCore:GetDebuffDuration(SerpentStingID) --"Serpent Sting"
    local HuntersMark_duration = LibSkeenCore:GetDebuffDuration(HuntersMarkID) --"Hunters Mark"

    --BuffStacks
    local frenzy_stacks = LibSkeenCore:GetBuffCount(FrenzyID)

    -- Get the target's health percentage
    local TargetsPercentOfHealth = (UnitHealth("target") / UnitHealthMax("target") * 100);

    if(HuntersMark_duration < 1) then
        spell.current = HuntersMarkID
    elseif (serpent_sting_duration < 1) then
        if (focus >= 25) then
            spell.current = SerpentStingID
        else
            spell.next = SerpentStingID
        end
    elseif (frenzy_stacks == 5) then
        spell.current = FocusFireID
    elseif (glaive_toss_chosen == true) and (glaive_toss_cooldown < 1) and (focus >= 15) then
        spell.current = GlaiveTossID
    elseif (powershot_chosen == true) and (powershot_cooldown < 1) and (focus >= 20) then
        spell.current = PowershotID
    elseif (barrage_chosen == true) and (barrage_cooldown < 1) and (focus >= 30) then
        spell.current = BarrageID
    elseif (a_murder_of_crows_chosen == true) and (a_murder_of_crows_cooldown < 1) then
        spell.current = AMurderOfCrowsID
    elseif (blink_strike_chosen == true) and (blink_strike_cooldown < 1) then
        spell.current = BlinkStrikeID
    elseif (lynx_rush_chosen == true) and (lynx_rush_cooldown < 1) then
        spell.current = LynxRushID
    elseif (kill_command_cooldown < 1) then
        if (focus >= 40) then
            spell.current = KillCommandID
        else
            spell.next = KillCommandID
        end
    elseif ((TargetsPercentOfHealth < 20) and (kill_shot_cooldown<1)) then
        spell.current = KillShotID
    elseif (focus >= 60) then
        spell.current = ArcaneShotID
    else
        spell.current = CobraShotID
    end

    return spell
end

local SkeenPlugin = {}
SkeenPlugin.Name = "Hunter: Beast Mastery"
SkeenPlugin.Class = "HUNTER"
SkeenPlugin.Spec = 1
SkeenPlugin.Version = "5.2.0"
SkeenPlugin.Rotation = Rotation
SkeenPlugin.Cooldowns = Cooldowns

local SkeenCore3 = _G["SkeenCore3"]
SkeenCore3:RegisterPlugin(SkeenPlugin)