Mercurial > wow > skeencore3beastmasteryhunter
diff SkeenCore3HunterBeastMastery.lua @ 29:d3e8f63bd3b8 v1.5.6
Changed addon name, to emp class rather than spec
| author | Emil Madsen <skeen@cs.au.dk> |
|---|---|
| date | Thu, 12 Dec 2013 22:22:16 +0100 |
| parents | |
| children | 3c1e49471599 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SkeenCore3HunterBeastMastery.lua Thu Dec 12 22:22:16 2013 +0100 @@ -0,0 +1,198 @@ +-- +-- SkeenCore3BeastMasteryHunter +-- +local LibSkeenCore = LibStub("LibSkeenCore"); + +local function Plugin_Registed() + -- Default saved variables + if SkeenBeastMasteryHunterdb == nil then + SkeenBeastMasteryHunterdb = {} -- fresh start + end + + -- Load defaults + if SkeenBeastMasteryHunterdb.SuggestHuntersMark == nil then + SkeenBeastMasteryHunterdb.SuggestHuntersMark = false + end +end + +local Option_Functions = {} + +function Option_Functions:GetHuntersMark() + return SkeenBeastMasteryHunterdb.SuggestHuntersMark +end + + +function Option_Functions:ToggleHuntersMark() + SkeenBeastMasteryHunterdb.SuggestHuntersMark = not SkeenBeastMasteryHunterdb.SuggestHuntersMark +end + + +local function Option_Frame() + local panel = CreateFrame("FRAME") + + local string + local checkbox + + local y = -40 + local string_X = 10 + local checkbox_X = -10 + + string = panel:CreateFontString(nil,"OVERLAY","GameFontNormal") + string:SetText("Suggest Hunters Mark in Rotation") + string:SetPoint("TOPLEFT", string_X, y) + + checkbox = CreateFrame("CheckButton", nil, panel, "OptionsCheckButtonTemplate") + checkbox:SetWidth(18) + checkbox:SetHeight(18) + checkbox:SetScript("OnClick", function() Option_Functions:ToggleVanish() end) + checkbox:SetPoint("TOPRIGHT", checkbox_X, y) + checkbox:SetChecked(Option_Functions:ToggleHuntersMark()) + + return panel +end + +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 fervor_chosen = LibSkeenCore:HasChosenTalent(10) + local dire_beast_chosen = LibSkeenCore:HasChosenTalent(11) + local thrill_of_the_hunt_chosen = LibSkeenCore:HasChosenTalent(12) + 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 DireBeastID = 120679 + local ThrillOfTheHuntID = 109306 + local SerpentStingID = 1978 + local ArcaneShotID = 3044 + local CobraShotID = 77767 + local HuntersMarkID = 1130 + 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 fervor_cooldown = LibSkeenCore:GetCooldown(FervorID) --"Fervor" + local dire_beast_cooldown = LibSkeenCore:GetCooldown(DireBeastID) --"Dire Beast" + local thrill_of_the_hunt_cooldown = LibSkeenCore:GetCooldown(ThrillOfTheHuntID) --"Fervor" + 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); + + -- Apply Hunter's Mark Icon Hunter's Mark on the target. + if (HuntersMark_duration < 1 and Option_Functions:GetHuntersMark()) then + spell.current = HuntersMarkID + -- Cast Kill Command Icon Kill Command on cooldown. + elseif(kill_command_cooldown < 1) then + if (focus >= 40) then + spell.current = KillCommandID + else + spell.next = KillCommandID + end + -- Cast Kill Shot Icon Kill Shot (only available below 20% health). + elseif ((TargetsPercentOfHealth < 20) and (kill_shot_cooldown<1)) then + spell.current = KillShotID + -- Apply and maintain Serpent Sting Icon Serpent Sting to the target + -- it will be refreshed by Cobra Shot Icon Cobra Shot so it only needs to be done once, normally. + elseif (serpent_sting_duration < 1) then + if (focus >= 25) then + spell.current = SerpentStingID + else + spell.next = SerpentStingID + end + -- Cast your Tier 6 talent (normally Glaive Toss Icon Glaive Toss) + elseif (glaive_toss_chosen == true) and (glaive_toss_cooldown < 1) then + if (focus >= 15) then + spell.current = GlaiveTossID + else + spell.next = GlaiveTossID + end + elseif (powershot_chosen == true) and (powershot_cooldown < 1) and (focus >= 20) then + if (focus >= 20) then + spell.current = PowershotID + else + spell.next = PowershotID + end + elseif (barrage_chosen == true) and (barrage_cooldown < 1) then + if (focus >= 30) then + spell.current = BarrageID + else + spell.next = BarrageID + end + -- Cast your Tier 4 talent (normally Dire Beast Icon Dire Beast). + elseif (fervor_chosen == true) and (fervor_cooldown < 1) then + spell.current = FervorID + elseif (dire_beast_chosen == true) and (dire_beast_cooldown < 1) then + spell.current = DireBeastID + elseif (thrill_of_the_hunt_chosen == true) and (thrill_of_the_hunt_cooldown < 1) then + spell.current = ThrillOfTheHuntID + -- Cast Focus Fire Icon Focus Fire when your pet's Frenzy Icon Frenzy reaches 5 stacks (the icon will glow) + elseif (frenzy_stacks == 5) then + spell.current = FocusFireID + 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.4.0" +SkeenPlugin.Rotation = Rotation +SkeenPlugin.Cooldowns = Cooldowns +SkeenPlugin.Plugin_Registed = Plugin_Registed +SkeenPlugin.Option_Frame = Option_Frame + +local SkeenCore3 = _G["SkeenCore3"] +SkeenCore3:RegisterPlugin(SkeenPlugin)
