view SkeenCore3BeastMasteryHunter.lua @ 11:238cde09390d v1.4.2

Interface version update
author Emil Madsen <skeen@cs.au.dk>
date Tue, 21 Feb 2012 14:52:29 +0100
parents a6e2ff3a8f61
children 1040ce99b400
line wrap: on
line source
--
-- SkeenCore3BeastMasteryHunter
-- 
local LibSkeenCore = LibStub("LibSkeenCore");

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
	
    -- 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 RapidFireID       = 3045
    local FocusFireID       = 82692
    local FervorID          = 82726
    local BestialWrathID    = 19574
    local SerpentStingID    = 1978
    local ArcaneShotID      = 3044
    local CobraShotID       = 77767
    

	local focus = UnitPower("player")

    --Cooldowns
    local kill_command_cooldown = LibSkeenCore:GetCooldown(KillCommandID)   --"Kill Command"
    local kill_shot_cooldown    = LibSkeenCore:GetCooldown(KillShotID)      --"Kill Shot"
    local rapid_fire_cooldown   = LibSkeenCore:GetCooldown(RapidFireID)     --"Rapid Fire"
    local focus_fire_cooldown   = LibSkeenCore:GetCooldown(FocusFireID)     --"Focus Fire"
    local fervor_cooldown       = LibSkeenCore:GetCooldown(FervorID)        --"Fervor"
    local bestial_wrath_cooldown= LibSkeenCore:GetCooldown(BestialWrathID)  --"Bestial Wrath"
    
    --Debuff
    local serpent_sting_duration = LibSkeenCore:GetDebuffDuration(SerpentStingID) --"Serpent Sting"

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

    if (kill_command_cooldown < 1) then
        if (focus >= 40) then
             spell.current = KillCommandID --KC
        else
             spell.next = KillCommandID --KC
        end
    elseif (serpent_sting_duration < 1) then
        if (focus >= 25) then
            spell.current = SerpentStingID --SS;
        else
            spell.next = SerpentStingID --SS;
        end
    elseif ((TargetsPercentOfHealth < 20) and (kill_shot_cooldown<1)) then
        spell.current = KillShotID --Kill Shot
    elseif (focus >= 25) then
        spell.current = ArcaneShotID --Arcane Shot
    else
        spell.current = CobraShotID --Cobra Shot
    end
    
	if (rapid_fire_cooldown < 1) then
		spell.cd1 = RapidFireID --Rapid fire
	end
	
	if (focus_fire_cooldown < 1) then
		spell.cd2 = FocusFireID --Focus fire
	end
	
    if (fervor_cooldown < 1) then
		spell.cd3 = FervorID --Fervor
	end
	
	if (bestial_wrath_cooldown < 1) then
		spell.cd4 = BestialWrathID --Bestial Wrath
	end

    return spell
end

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

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