view SkeenCore3BeastMasteryHunter.lua @ 15:6ac320834be1 v1.4.5

Issue fixed
author Emil Madsen <skeen@cs.au.dk>
date Thu, 06 Sep 2012 21:56:35 +0200
parents 1040ce99b400
children 58086ea2f944
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 HuntersMarkID     = 1130
    local ReadinessID       = 23989

	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"
    local Readiness_cooldown    = LibSkeenCore:GetCooldown(ReadinessID)

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

    -- 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 --SS;
        else
            spell.next = SerpentStingID --SS;
        end
    elseif (kill_command_cooldown < 1) then
        if (focus >= 40) then
             spell.current = KillCommandID --KC
        else
             spell.next = KillCommandID --KC
        end
    elseif ((TargetsPercentOfHealth < 20) and (kill_shot_cooldown<1)) then
        spell.current = KillShotID --Kill Shot
    --TODO: FOCUS FIRE
    elseif (focus >= 60) 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 (Readiness_cooldown < 1) then
		spell.cd3 = ReadinessID --Readiness
	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)