comparison 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
comparison
equal deleted inserted replaced
28:daa3ef1b19f3 29:d3e8f63bd3b8
1 --
2 -- SkeenCore3BeastMasteryHunter
3 --
4 local LibSkeenCore = LibStub("LibSkeenCore");
5
6 local function Plugin_Registed()
7 -- Default saved variables
8 if SkeenBeastMasteryHunterdb == nil then
9 SkeenBeastMasteryHunterdb = {} -- fresh start
10 end
11
12 -- Load defaults
13 if SkeenBeastMasteryHunterdb.SuggestHuntersMark == nil then
14 SkeenBeastMasteryHunterdb.SuggestHuntersMark = false
15 end
16 end
17
18 local Option_Functions = {}
19
20 function Option_Functions:GetHuntersMark()
21 return SkeenBeastMasteryHunterdb.SuggestHuntersMark
22 end
23
24
25 function Option_Functions:ToggleHuntersMark()
26 SkeenBeastMasteryHunterdb.SuggestHuntersMark = not SkeenBeastMasteryHunterdb.SuggestHuntersMark
27 end
28
29
30 local function Option_Frame()
31 local panel = CreateFrame("FRAME")
32
33 local string
34 local checkbox
35
36 local y = -40
37 local string_X = 10
38 local checkbox_X = -10
39
40 string = panel:CreateFontString(nil,"OVERLAY","GameFontNormal")
41 string:SetText("Suggest Hunters Mark in Rotation")
42 string:SetPoint("TOPLEFT", string_X, y)
43
44 checkbox = CreateFrame("CheckButton", nil, panel, "OptionsCheckButtonTemplate")
45 checkbox:SetWidth(18)
46 checkbox:SetHeight(18)
47 checkbox:SetScript("OnClick", function() Option_Functions:ToggleVanish() end)
48 checkbox:SetPoint("TOPRIGHT", checkbox_X, y)
49 checkbox:SetChecked(Option_Functions:ToggleHuntersMark())
50
51 return panel
52 end
53
54 local function Cooldowns()
55
56 -- Ability SpellID
57 local RapidFireID = 3045
58 local StampedeID = 121818
59 local ReadinessID = 23989
60 local BestialWrathID = 19574
61
62 return {RapidFireID, StampedeID, ReadinessID, BestialWrathID}
63 end
64
65 local function Rotation()
66
67 -- Hide the frame, if the target is dead, non existing or friendly.
68 if UnitName("target") == nil or UnitIsFriend("player","target") ~= nil or UnitHealth("target") == 0 then
69 return nil
70 end
71
72 --Information from;
73 --http://www.wowpedia.org/API_GetTalentInfo_(Mists)
74 local fervor_chosen = LibSkeenCore:HasChosenTalent(10)
75 local dire_beast_chosen = LibSkeenCore:HasChosenTalent(11)
76 local thrill_of_the_hunt_chosen = LibSkeenCore:HasChosenTalent(12)
77 local glaive_toss_chosen = LibSkeenCore:HasChosenTalent(16)
78 local powershot_chosen = LibSkeenCore:HasChosenTalent(17)
79 local barrage_chosen = LibSkeenCore:HasChosenTalent(18)
80
81 -- The table used for spell information (returned to the callee)
82 local spell = {}
83 spell.current = nil
84 spell.next = nil
85 spell.cd1 = nil
86 spell.cd2 = nil
87 spell.cd3 = nil
88 spell.cd4 = nil
89
90 -- Ability SpellID
91 local KillCommandID = 34026
92 local KillShotID = 53351
93 local FocusFireID = 82692
94 local FervorID = 82726
95 local DireBeastID = 120679
96 local ThrillOfTheHuntID = 109306
97 local SerpentStingID = 1978
98 local ArcaneShotID = 3044
99 local CobraShotID = 77767
100 local HuntersMarkID = 1130
101 local GlaiveTossID = 117050
102 local PowershotID = 109259
103 local BarrageID = 120360
104 local FrenzyID = 19615
105
106 local focus = UnitPower("player")
107
108 --Cooldowns
109 local kill_command_cooldown = LibSkeenCore:GetCooldown(KillCommandID) --"Kill Command"
110 local kill_shot_cooldown = LibSkeenCore:GetCooldown(KillShotID) --"Kill Shot"
111 local fervor_cooldown = LibSkeenCore:GetCooldown(FervorID) --"Fervor"
112 local dire_beast_cooldown = LibSkeenCore:GetCooldown(DireBeastID) --"Dire Beast"
113 local thrill_of_the_hunt_cooldown = LibSkeenCore:GetCooldown(ThrillOfTheHuntID) --"Fervor"
114 local glaive_toss_cooldown = LibSkeenCore:GetCooldown(GlaiveTossID) --"Glaive Toss"
115 local powershot_cooldown = LibSkeenCore:GetCooldown(PowershotID) --"Powershot"
116 local barrage_cooldown = LibSkeenCore:GetCooldown(BarrageID) --"Barrage"
117
118 --Debuff
119 local serpent_sting_duration = LibSkeenCore:GetDebuffDuration(SerpentStingID) --"Serpent Sting"
120 local HuntersMark_duration = LibSkeenCore:GetDebuffDuration(HuntersMarkID) --"Hunters Mark"
121
122 --BuffStacks
123 local frenzy_stacks = LibSkeenCore:GetBuffCount(FrenzyID)
124
125 -- Get the target's health percentage
126 local TargetsPercentOfHealth = (UnitHealth("target") / UnitHealthMax("target") * 100);
127
128 -- Apply Hunter's Mark Icon Hunter's Mark on the target.
129 if (HuntersMark_duration < 1 and Option_Functions:GetHuntersMark()) then
130 spell.current = HuntersMarkID
131 -- Cast Kill Command Icon Kill Command on cooldown.
132 elseif(kill_command_cooldown < 1) then
133 if (focus >= 40) then
134 spell.current = KillCommandID
135 else
136 spell.next = KillCommandID
137 end
138 -- Cast Kill Shot Icon Kill Shot (only available below 20% health).
139 elseif ((TargetsPercentOfHealth < 20) and (kill_shot_cooldown<1)) then
140 spell.current = KillShotID
141 -- Apply and maintain Serpent Sting Icon Serpent Sting to the target
142 -- it will be refreshed by Cobra Shot Icon Cobra Shot so it only needs to be done once, normally.
143 elseif (serpent_sting_duration < 1) then
144 if (focus >= 25) then
145 spell.current = SerpentStingID
146 else
147 spell.next = SerpentStingID
148 end
149 -- Cast your Tier 6 talent (normally Glaive Toss Icon Glaive Toss)
150 elseif (glaive_toss_chosen == true) and (glaive_toss_cooldown < 1) then
151 if (focus >= 15) then
152 spell.current = GlaiveTossID
153 else
154 spell.next = GlaiveTossID
155 end
156 elseif (powershot_chosen == true) and (powershot_cooldown < 1) and (focus >= 20) then
157 if (focus >= 20) then
158 spell.current = PowershotID
159 else
160 spell.next = PowershotID
161 end
162 elseif (barrage_chosen == true) and (barrage_cooldown < 1) then
163 if (focus >= 30) then
164 spell.current = BarrageID
165 else
166 spell.next = BarrageID
167 end
168 -- Cast your Tier 4 talent (normally Dire Beast Icon Dire Beast).
169 elseif (fervor_chosen == true) and (fervor_cooldown < 1) then
170 spell.current = FervorID
171 elseif (dire_beast_chosen == true) and (dire_beast_cooldown < 1) then
172 spell.current = DireBeastID
173 elseif (thrill_of_the_hunt_chosen == true) and (thrill_of_the_hunt_cooldown < 1) then
174 spell.current = ThrillOfTheHuntID
175 -- Cast Focus Fire Icon Focus Fire when your pet's Frenzy Icon Frenzy reaches 5 stacks (the icon will glow)
176 elseif (frenzy_stacks == 5) then
177 spell.current = FocusFireID
178 elseif (focus >= 60) then
179 spell.current = ArcaneShotID
180 else
181 spell.current = CobraShotID
182 end
183
184 return spell
185 end
186
187 local SkeenPlugin = {}
188 SkeenPlugin.Name = "Hunter: Beast Mastery"
189 SkeenPlugin.Class = "HUNTER"
190 SkeenPlugin.Spec = 1
191 SkeenPlugin.Version = "5.4.0"
192 SkeenPlugin.Rotation = Rotation
193 SkeenPlugin.Cooldowns = Cooldowns
194 SkeenPlugin.Plugin_Registed = Plugin_Registed
195 SkeenPlugin.Option_Frame = Option_Frame
196
197 local SkeenCore3 = _G["SkeenCore3"]
198 SkeenCore3:RegisterPlugin(SkeenPlugin)