vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --[[ |
2 | |||
3 | AutoBuff -- Automatically casts self-buffs, weapon buffs, tracking abilites, and aspects. |
||
4 | Originally authored by Frosty @ http://www.curse-gaming.com/mod.php?addid=1400 |
||
5 | |||
6 | ADOPTED 2005-08 by Dsanai, as Frosty is no longer playing World of Warcraft. |
||
7 | Please direct any suggestions, comments, or blame, to Dsanai. Frosty still deserves the praise, though. :-) |
||
8 | |||
9 | http://membersui.worldofwar.net/ui.php?id=1475 |
||
10 | http://www.curse-gaming.com/mod.php?addid=2442 |
||
11 | http://www.wowinterface.com/downloads/fileinfo.php?s=&id=4259 |
||
12 | |||
13 | FEATURE REQUESTS (Not added yet) |
||
14 | -- Option to not cast while Resting (removed it a while back, add back in with default Off) |
||
15 | -- Option to not cast while in Battlegrounds (check MetaMap for method to test this state) |
||
16 | -- Figure out what changed to make the Expiration flag unknowable (won't cast until spell is gone). |
||
17 | |||
18 | -[ MOST RECENT HISTORY ]- (For older history, see ReadMe.txt) |
||
19 | |||
20 | v11200-3 |
||
21 | -- Fixed error caused by not having Titan installed. |
||
22 | |||
23 | v11200-2 |
||
24 | -- Fixed error caused by not having FuBar installed. |
||
25 | |||
26 | v11200-1 |
||
27 | -- Updated TOC for Patch 1.12. |
||
28 | -- Added Warlock Life Tap scaling (code from ScaledLifeTap by Kimilly). Requires BonusScanner mod. |
||
29 | -- Added option to recast Priests' Inner Fire spell at a set number of charges or less (5/20 is default). |
||
30 | -- Added option to change Inner Fire recast charges to anything from 1 to 19 (/ab innercharges <integer>). |
||
31 | -- Removed check for weapons before casting Shaman weapon buffs (fixes tooltip bug). If you're working on your Unarmed skill, disable the selected weapon buff in /autobuff and all will be well. |
||
32 | -- Hid options on Titan and FuBar tooltips if they do not apply to the currently-played character class. |
||
33 | |||
34 | v11100-3b/c |
||
35 | -- Fixed bug introduced by Detect Traps removal. |
||
36 | |||
37 | v11100-3 |
||
38 | -- Added FuBar 2+ support. |
||
39 | -- Priest: Will no longer cast while Spirit of Redemption is active (EN,DE,FR clients) |
||
40 | -- Fixed DE Windfury translation (courtesy Helaku@WorldOfWar) |
||
41 | -- Fixed DE Sense Undead translation (courtesy DelphiDie@WorldOfWar) |
||
42 | -- Fixed DE Ice Barrier translation (courtesy DelphiDie@WorldOfWar) |
||
43 | -- Removed Detect Traps (Blizzard passive spell now) |
||
44 | |||
45 | ]] |
||
46 | |||
47 | -- Constants |
||
48 | --AUTOBUFF_USAGE_LIST = "/autobuff on|off|toggle|track|weapon|mana\n/autobuff trigger|rebuff|combat|enable|disable|list\n/autobuff hide|resetbutton"; |
||
49 | AUTOBUFF_USAGE_LIST = "/autobuff on | off | toggle\n"; |
||
50 | AUTOBUFF_USAGE_LIST = AUTOBUFF_USAGE_LIST.."/autobuff track | weapon\n"; |
||
51 | AUTOBUFF_USAGE_LIST = AUTOBUFF_USAGE_LIST.."/autobuff mana | trigger | rebuff | combat | enable | disable | list\n"; |
||
52 | AUTOBUFF_USAGE_LIST = AUTOBUFF_USAGE_LIST.."/autobuff reset\n"; |
||
53 | AUTOBUFF_USAGE_LIST = AUTOBUFF_USAGE_LIST.."/autobuff water | tap | scaled | inner\n"; |
||
54 | AUTOBUFF_USAGE_LIST = AUTOBUFF_USAGE_LIST.."/autobuff innercharges <num>\n"; |
||
55 | AUTOBUFF_USAGE_LIST = AUTOBUFF_USAGE_LIST.."/autobuff hide | resetbutton\n"; |
||
56 | AUTOBUFF_USAGE_LIST = AUTOBUFF_USAGE_LIST.."To Run Autobuff: /autobuff run\n"; |
||
57 | |||
58 | BINDING_HEADER_AUTOBUFF = "AutoBuff"; |
||
59 | |||
60 | local AUTOBUFF_GUI_ABILITY_TOTALROWS = 30; |
||
61 | local AUTOBUFF_GUI_ABILITY_OVERHEAD = 14; |
||
62 | local AUTOBUFF_GUI_ABILITY_INTERVAL = 18; |
||
63 | |||
64 | cSpellList = { |
||
65 | [AUTOBUFF_ABILITY_FORTITUDE] = { ["type"] = "friendly", |
||
66 | [0] = string.lower(AUTOBUFF_ABILITY_PRAYEROFFORTITUDE) }, |
||
67 | [AUTOBUFF_ABILITY_PWSHIELD] = { ["type"] = "friendly", |
||
68 | [0] = string.lower(AUTOBUFF_ABILITY_WEAKENEDSOUL) }, |
||
69 | [AUTOBUFF_ABILITY_INNER_FIRE] = { ["type"] = "self" }, |
||
70 | [AUTOBUFF_ABILITY_SHADOW_PROTECTION] = { ["type"] = "friendly", |
||
71 | [0] = string.lower(AUTOBUFF_ABILITY_PRAYEROFSHADOWPROTECTION) }, |
||
72 | [AUTOBUFF_ABILITY_FEARWARD] = { ["type"] = "friendly" }, |
||
73 | [AUTOBUFF_ABILITY_DIVINESPIRIT] = { ["type"] = "friendly", |
||
74 | [0] = string.lower(AUTOBUFF_ABILITY_PRAYEROFSPIRIT) }, |
||
75 | [AUTOBUFF_ABILITY_MOTW] = { ["type"] = "friendly", |
||
76 | [0] = string.lower(AUTOBUFF_ABILITY_GOTW) }, |
||
77 | [AUTOBUFF_ABILITY_THORNS] = { ["type"] = "friendly" }, |
||
78 | [AUTOBUFF_ABILITY_ELUNESGRACE] = { ["type"] = "self" }, |
||
79 | [AUTOBUFF_ABILITY_LIGHTNING_SHIELD] = { ["type"] = "self" }, |
||
80 | [AUTOBUFF_ABILITY_INTELLECT] = { ["type"] = "friendly", |
||
81 | [0] = string.lower(AUTOBUFF_ABILITY_ARCANEBRILLIANCE) }, |
||
82 | [AUTOBUFF_ABILITY_MAGE_ARMOR] = { ["type"] = "self", |
||
83 | [0] = string.lower(AUTOBUFF_ABILITY_ICE_ARMOR) }, |
||
84 | [AUTOBUFF_ABILITY_ICE_ARMOR] = { ["type"] = "self", |
||
85 | [0] = string.lower(AUTOBUFF_ABILITY_MAGE_ARMOR) }, |
||
86 | [AUTOBUFF_ABILITY_FROST_ARMOR] = { ["type"] = "self" }, |
||
87 | [AUTOBUFF_ABILITY_MANASHIELD] = { ["type"] = "self" }, |
||
88 | [AUTOBUFF_ABILITY_ICEBARRIER] = { ["type"] = "self" }, |
||
89 | [AUTOBUFF_ABILITY_FIREWARD] = { ["type"] = "self" }, |
||
90 | [AUTOBUFF_ABILITY_FROSTWARD] = { ["type"] = "self" }, |
||
91 | [AUTOBUFF_ABILITY_AMPLIFYMAGIC] = { ["type"] = "friendly" }, |
||
92 | [AUTOBUFF_ABILITY_DAMPENMAGIC] = { ["type"] = "friendly", |
||
93 | [0] = string.lower(AUTOBUFF_ABILITY_AMPLIFYMAGIC) }, |
||
94 | [AUTOBUFF_ABILITY_DEMON_SKIN] = { ["type"] = "self" }, |
||
95 | [AUTOBUFF_ABILITY_DEMON_ARMOR] = { ["type"] = "self" }, |
||
96 | [AUTOBUFF_ABILITY_DETECT_LINVIS] = { ["type"] = "friendly" }, |
||
97 | [AUTOBUFF_ABILITY_DETECT_INVIS] = { ["type"] = "friendly" }, |
||
98 | [AUTOBUFF_ABILITY_DETECT_GINVIS] = { ["type"] = "friendly" }, |
||
99 | [AUTOBUFF_ABILITY_UNENDING_BREATH] = { ["type"] = "friendly" }, |
||
100 | [AUTOBUFF_ABILITY_SOULLINK] = { ["type"] = "self" }, |
||
101 | [AUTOBUFF_ABILITY_SHADOWWARD] = { ["type"] = "self" }, |
||
102 | [AUTOBUFF_ABILITY_TRUESHOTAURA] = { ["type"] = "self" }, |
||
103 | [AUTOBUFF_ABILITY_BATTLESHOUT] = { ["type"] = "self" }, |
||
104 | [AUTOBUFF_ABILITY_NATURES_GRASP] = { ["type"] = "self" }, |
||
105 | [AUTOBUFF_ABILITY_OMENOFCLARITY] = { ["type"] = "self" }, |
||
106 | [AUTOBUFF_ABILITY_BARKSKIN] = { ["type"] = "self" }, |
||
107 | [AUTOBUFF_ABILITY_FEINT] = { ["type"] = "self" }, |
||
108 | [AUTOBUFF_ABILITY_BLADE_FLURRY] = { ["type"] = "self" }, |
||
109 | [AUTOBUFF_ABILITY_SHADOWGUARD] = { ["type"] = "self" }, |
||
110 | [AUTOBUFF_ABILITY_TOUCHOFWEAKNESS] = { ["type"] = "self" }, |
||
111 | [AUTOBUFF_ABILITY_WATER_BREATHING] = { ["type"] = "friendly" }, |
||
112 | [AUTOBUFF_ABILITY_RIGHTFURY] = { ["type"] = "self" }, |
||
113 | [AUTOBUFF_ABILITY_LIFE_TAP] = { ["type"] = "self" }, |
||
114 | [AUTOBUFF_ABILITY_DARK_PACT] = { ["type"] = "self" }, |
||
115 | [AUTOBUFF_ABILITY_BERSERKING] = { ["type"] = "self" }, |
||
116 | [AUTOBUFF_ABILITY_FADE] = { ["type"] = "self" }, |
||
117 | [AUTOBUFF_ABILITY_COWER] = { ["type"] = "self" }, |
||
118 | [AUTOBUFF_ABILITY_PERCEPTION] = { ["type"] = "self" }, |
||
119 | [AUTOBUFF_ABILITY_BLOODFURY] = { ["type"] = "self" }, |
||
120 | [AUTOBUFF_ABILITY_REJUV] = { ["type"] = "friendly" }, |
||
121 | [AUTOBUFF_ABILITY_RENEW] = { ["type"] = "friendly" }, |
||
122 | [AUTOBUFF_ABILITY_ICEBLOCK] = { ["type"] = "self" }, |
||
123 | [AUTOBUFF_ABILITY_BLOODRAGE] = { ["type"] = "self" }, |
||
124 | [AUTOBUFF_ABILITY_EVASION] = { ["type"] = "self" }, |
||
125 | [AUTOBUFF_ABILITY_SPRINT] = { ["type"] = "self" }, |
||
126 | [AUTOBUFF_ABILITY_STONEFORM] = { ["type"] = "self" }, |
||
127 | [AUTOBUFF_ABILITY_FOCUSEDCASTING] = { ["type"] = "self" }, |
||
128 | [AUTOBUFF_ABILITY_HOLYSHIELD] = { ["type"] = "self" }, |
||
129 | [AUTOBUFF_ABILITY_BERSERKERRAGE] = { ["type"] = "self" }, |
||
130 | [AUTOBUFF_ABILITY_DIVINEFAVOR] = { ["type"] = "self" }, |
||
131 | [AUTOBUFF_ABILITY_COLDBLOOD] = { ["type"] = "self" }, |
||
132 | }; |
||
133 | |||
134 | local cBlessing = { |
||
135 | [0] = AUTOBUFF_ABILITY_BLESSING_MIGHT, |
||
136 | [1] = AUTOBUFF_ABILITY_BLESSING_WISDOM, |
||
137 | [2] = AUTOBUFF_ABILITY_BLESSING_SALVATION, |
||
138 | [3] = AUTOBUFF_ABILITY_BLESSING_KINGS, |
||
139 | [4] = AUTOBUFF_ABILITY_BLESSING_SANCTUARY, |
||
140 | [5] = AUTOBUFF_ABILITY_BLESSING_LIGHT, |
||
141 | } |
||
142 | |||
143 | local cBlessingOther = { |
||
144 | [0] = AUTOBUFF_ABILITY_BLESSING_FREEDOM, |
||
145 | [1] = AUTOBUFF_ABILITY_BLESSING_PROTECTION, |
||
146 | } |
||
147 | |||
148 | local cBlessingPoly = { |
||
149 | [AUTOBUFF_ABILITY_GREATBLESSING_MIGHT] = AUTOBUFF_ABILITY_BLESSING_MIGHT, |
||
150 | [AUTOBUFF_ABILITY_GREATBLESSING_WISDOM] = AUTOBUFF_ABILITY_BLESSING_WISDOM, |
||
151 | [AUTOBUFF_ABILITY_GREATBLESSING_SALVATION] = AUTOBUFF_ABILITY_BLESSING_SALVATION, |
||
152 | [AUTOBUFF_ABILITY_GREATBLESSING_KINGS] = AUTOBUFF_ABILITY_BLESSING_KINGS, |
||
153 | [AUTOBUFF_ABILITY_GREATBLESSING_SANCTUARY] = AUTOBUFF_ABILITY_BLESSING_SANCTUARY, |
||
154 | [AUTOBUFF_ABILITY_GREATBLESSING_LIGHT] = AUTOBUFF_ABILITY_BLESSING_LIGHT, |
||
155 | } |
||
156 | |||
157 | local cAura = { |
||
158 | [0] = AUTOBUFF_ABILITY_AURA_DEVOTION, |
||
159 | [1] = AUTOBUFF_ABILITY_AURA_RETRIBUTION, |
||
160 | [2] = AUTOBUFF_ABILITY_AURA_CONCENTRATION, |
||
161 | [3] = AUTOBUFF_ABILITY_AURA_SHADOWRESIST, |
||
162 | [4] = AUTOBUFF_ABILITY_AURA_FROSTRESIST, |
||
163 | [5] = AUTOBUFF_ABILITY_AURA_FIRERESIST, |
||
164 | [6] = AUTOBUFF_ABILITY_AURA_SANCTITY, |
||
165 | } |
||
166 | |||
167 | local cTrackList = { |
||
168 | [AUTOBUFF_ABILITY_FIND_MINERALS] = "Spell_Nature_Earthquake", |
||
169 | [AUTOBUFF_ABILITY_FIND_HERBS] = "Unknown", |
||
170 | [AUTOBUFF_ABILITY_SENSE_DEMONS] = "Spell_Shadow_Metamorphosis", |
||
171 | [AUTOBUFF_ABILITY_TRACK_BEASTS] = "Unknown", |
||
172 | [AUTOBUFF_ABILITY_TRACK_UNDEAD] = "Unknown", |
||
173 | [AUTOBUFF_ABILITY_TRACK_HIDDEN] = "Unknown", |
||
174 | [AUTOBUFF_ABILITY_TRACK_ELEMENTAL] = "Unknown", |
||
175 | [AUTOBUFF_ABILITY_TRACK_DEMONS] = "Unknown", |
||
176 | [AUTOBUFF_ABILITY_TRACK_GIANTS] = "Unknown", |
||
177 | [AUTOBUFF_ABILITY_TRACK_DRAGONKIN] = "Unknown", |
||
178 | [AUTOBUFF_ABILITY_FIND_TREASURE] = "Unknown", |
||
179 | [AUTOBUFF_ABILITY_SENSE_UNDEAD] = "Unknown", |
||
180 | }; -- [AUTOBUFF_ABILITY_TRACK_HUMANOIDS] = "Unknown", |
||
181 | -- Added dynamically now, based on if you're a Druid (goes to cSpellList) or a Hunter (goes to cTrackList). |
||
182 | |||
183 | local cAspectList = { |
||
184 | [AUTOBUFF_ASPECT_MONKEY] = "Unknown", |
||
185 | [AUTOBUFF_ASPECT_HAWK] = "Unknown", |
||
186 | [AUTOBUFF_ASPECT_CHEETAH] = "Unknown", |
||
187 | [AUTOBUFF_ASPECT_PACK] = "Unknown", |
||
188 | [AUTOBUFF_ASPECT_WILD] = "Unknown", |
||
189 | [AUTOBUFF_ASPECT_BEAST] = "Unknown", |
||
190 | }; |
||
191 | |||
192 | local cSealList = { |
||
193 | [AUTOBUFF_ABILITY_SEAL_COMMAND] = { ["i"] = 1, ["type"] = "self" }, |
||
194 | [AUTOBUFF_ABILITY_SEAL_FURY] = { ["i"] = 2, ["type"] = "self" }, |
||
195 | [AUTOBUFF_ABILITY_SEAL_JUSTICE] = { ["i"] = 3, ["type"] = "self" }, |
||
196 | [AUTOBUFF_ABILITY_SEAL_LIGHT] = { ["i"] = 4, ["type"] = "self" }, |
||
197 | [AUTOBUFF_ABILITY_SEAL_RIGHT] = { ["i"] = 5, ["type"] = "self" }, |
||
198 | [AUTOBUFF_ABILITY_SEAL_WISDOM] = { ["i"] = 6, ["type"] = "self" }, |
||
199 | [AUTOBUFF_ABILITY_SEAL_CRUSADER] = { ["i"] = 7, ["type"] = "self" }, |
||
200 | }; |
||
201 | |||
202 | local cWarlockPet = { ["Lesser Invisibility"] = "Spell_Magic_LesserInvisibilty"; }; -- Beta function. /autobuff succubus |
||
203 | |||
204 | local cWeaponList = { |
||
205 | [AUTOBUFF_ABILITY_PRIEST_FEEDBACK] = 0, |
||
206 | [AUTOBUFF_ABILITY_SHAMAN_FLAMETONGUE] = 0, |
||
207 | [AUTOBUFF_ABILITY_SHAMAN_FROSTBRAND] = 0, |
||
208 | [AUTOBUFF_ABILITY_SHAMAN_ROCKBITER] = 0, |
||
209 | [AUTOBUFF_ABILITY_SHAMAN_WINDFURY] = 0, |
||
210 | }; |
||
211 | |||
212 | local cPolyList = { |
||
213 | ["all"] = { |
||
214 | [AUTOBUFF_POLY_ALL_INVISIBILITY] = true, |
||
215 | [AUTOBUFF_POLY_ALL_LESSERINVISIBILITY] = true, |
||
216 | [AUTOBUFF_POLY_ALL_SHADOWMELD] = true, |
||
217 | [AUTOBUFF_POLY_ALL_DRINK] = true, |
||
218 | [AUTOBUFF_POLY_ALL_FOOD] = true, |
||
219 | [AUTOBUFF_POLY_ALL_FIRSTAID] = true, |
||
220 | }, |
||
221 | [string.lower(AUTOBUFF_CLASS_PRIEST)] = { |
||
222 | [AUTOBUFF_POLY_PRIEST_MINDCONTROL] = true, |
||
223 | [AUTOBUFF_POLY_PRIEST_SPIRITTAP] = true, |
||
224 | [AUTOBUFF_POLY_PRIEST_MINDVISION] = true, |
||
225 | [AUTOBUFF_POLY_PRIEST_INNERFOCUS] = true, |
||
226 | [AUTOBUFF_POLY_PRIEST_SPIRITOFREDEMPTION] = true, |
||
227 | }, |
||
228 | [string.lower(AUTOBUFF_CLASS_ROGUE)] = {}, |
||
229 | [string.lower(AUTOBUFF_CLASS_PALADIN)] = {}, |
||
230 | [string.lower(AUTOBUFF_CLASS_WARLOCK)] = { |
||
231 | [AUTOBUFF_POLY_WARLOCK] = true, |
||
232 | [AUTOBUFF_POLY_WARLOCK_SOULSIPHON] = true, |
||
233 | }, |
||
234 | [string.lower(AUTOBUFF_CLASS_WARRIOR)] = {}, |
||
235 | [string.lower(AUTOBUFF_CLASS_HUNTER)] = {}, |
||
236 | [string.lower(AUTOBUFF_CLASS_MAGE)] = { |
||
237 | [AUTOBUFF_POLY_MAGE] = true, |
||
238 | }, |
||
239 | [string.lower(AUTOBUFF_CLASS_SHAMAN)] = { |
||
240 | [AUTOBUFF_POLY_SHAMAN] = true, |
||
241 | }, |
||
242 | [string.lower(AUTOBUFF_CLASS_DRUID)] = { |
||
243 | [AUTOBUFF_POLY_DRUID_BEAR] = true, |
||
244 | [AUTOBUFF_POLY_DRUID_CAT] = true, |
||
245 | [AUTOBUFF_POLY_DRUID_AQUATIC] = true, |
||
246 | [AUTOBUFF_POLY_DRUID_TRAVEL] = true, |
||
247 | [AUTOBUFF_POLY_DRUID_DIREBEAR] = true, |
||
248 | [AUTOBUFF_POLY_DRUID_MOONKIN] = true, |
||
249 | } |
||
250 | }; |
||
251 | |||
252 | local cDefault = { -- Default saved settings. |
||
253 | ['e'] = 1, -- Enabled |
||
254 | ['x'] = { -- Spell Settings |
||
255 | ['d'] = { -- Default Settings |
||
256 | ['c'] = 3, -- Combat |
||
257 | ['h'] = 1, -- Health |
||
258 | ['m'] = 40, -- Mana |
||
259 | ['r'] = 10, -- Rebuff |
||
260 | ['t'] = 126, -- Hook Trigger |
||
261 | ['z'] = 1, -- Class Specific (Stealth/Breath) UNUSED |
||
262 | ['p'] = 3, -- Party |
||
263 | }, |
||
264 | [AUTOBUFF_ABILITY_PWSHIELD] = { |
||
265 | ['d'] = 1, |
||
266 | }, |
||
267 | [AUTOBUFF_ABILITY_ICEBARRIER] = { |
||
268 | ['d'] = 1, |
||
269 | }, |
||
270 | [AUTOBUFF_ABILITY_BATTLESHOUT] = { |
||
271 | ['m'] = 10, |
||
272 | ['r'] = 5, |
||
273 | }, |
||
274 | [AUTOBUFF_ABILITY_FIREWARD] = { |
||
275 | ['d'] = 1, |
||
276 | }, |
||
277 | [AUTOBUFF_ABILITY_FROSTWARD] = { |
||
278 | ['d'] = 1, |
||
279 | }, |
||
280 | [AUTOBUFF_ABILITY_WATER_BREATHING] = { |
||
281 | ['d'] = 1, |
||
282 | }, |
||
283 | [AUTOBUFF_ABILITY_TRACK_HUMANOIDS] = { |
||
284 | ['m'] = 1, |
||
285 | }, |
||
286 | [AUTOBUFF_ABILITY_LIFE_TAP] = { |
||
287 | ['m'] = -40, -- < 40% mana |
||
288 | ['h'] = 80, -- > 80% health |
||
289 | }, |
||
290 | [AUTOBUFF_ABILITY_BERSERKING] = { |
||
291 | ['c'] = 1, -- IN Combat |
||
292 | ['h'] = -70, -- < 70% health |
||
293 | }, |
||
294 | [AUTOBUFF_ABILITY_FADE] = { |
||
295 | ['c'] = 1, -- IN Combat |
||
296 | }, |
||
297 | }, |
||
298 | ['z'] = 0, |
||
299 | ['v'] = "11200-3", -- VERSION |
||
300 | ['b'] = true, -- Button visibility |
||
301 | ["water"] = true, -- Warlock/Shaman Underwater 30-second trap (ON by default) |
||
302 | ["tap"] = true, -- Prevent casting while Spirit Tap / Soul Siphon are active (ON by default) |
||
303 | ["scaled"] = true, -- Warlock Life Tap scaling based on Item Bonuses (ON by default) |
||
304 | ["inner"] = true, -- Inner Fire casts at XX/20 charges (ON by default) |
||
305 | ["innercharges"] = 5, -- Number of charges (between 1 and 19) (5 by default) |
||
306 | }; |
||
307 | |||
308 | local cSheep = "Spell_Nature_Polymorph"; |
||
309 | local cEnslave = "Spell_Shadow_EnslaveDemon"; |
||
310 | local cBanish = "Spell_Shadow_Cripple"; |
||
311 | local cTracking = "Ability_Tracking"; |
||
312 | local cStealth = "Ability_Stealth"; |
||
313 | local cPre = "Interface\\Icons\\"; |
||
314 | local cTime = 1000; |
||
315 | local cIconOn = "Interface\\AddOns\\AutoBuff\\ABEnabled"; |
||
316 | local cIconOff = "Interface\\AddOns\\AutoBuff\\ABDisabled"; |
||
317 | local cIconInnerFire = "Interface\\Icons\\Spell_Holy_InnerFire"; |
||
318 | |||
319 | -- Used for the table index finder function. |
||
320 | local bIndex = nil; |
||
321 | local bValue = nil; |
||
322 | |||
323 | -- Used for LifeTap Scaling |
||
324 | local overtapEnabled = true; |
||
325 | local AFFLICTION_TAB = 1; |
||
326 | local IMP_LIFETAP_ID = 5; |
||
327 | local RANK_MULTIPLIER = {0.38,0.68,0.8,0.8,0.8,0.8}; |
||
328 | local BASE_DAMAGE = {30,75,140,220,310,424}; |
||
329 | |||
330 | -- Temp variables. |
||
331 | local vSit = 0; |
||
332 | local vBreath = 0; |
||
333 | local vRestingAlertTimer = 0; |
||
334 | local vError = {}; |
||
335 | local vGUI = {}; |
||
336 | local vTime = 0; |
||
337 | local vRejuv = 0; |
||
338 | local vTrack = nil; |
||
339 | local vWeapon = nil; |
||
340 | local vAspect = nil; |
||
341 | local vSeal = nil; |
||
342 | local vClass = nil; |
||
343 | local vSpellList = { }; |
||
344 | local sSpellList = { }; |
||
345 | local vTrackList = { }; |
||
346 | local vAspectList = { }; |
||
347 | local vSealList = { }; |
||
348 | local vWeaponList = { }; |
||
349 | local vC = nil; |
||
350 | local vLoaded = nil; |
||
351 | local vLoaded = { |
||
352 | var = false; |
||
353 | player = false; |
||
354 | autobuff = false; |
||
355 | }; |
||
356 | local vCombat = nil; |
||
357 | local AutoBuff_MFSx, AutoBuff_MBSx, AutoBuff_MLSx, AutoBuff_MRSx, AutoBuff_SRSx, AutoBuff_SLSx, AutoBuff_TARx, AutoBuff_TASx, AutoBuff_TAFx, AutoBuffCMSx, AutoBuff_CMFx, AutoBuff_WHEELUx, AutoBuff_WHEELDx, AutoBuff_TARGETx; |
||
358 | |||
359 | -- Titan Variables |
||
360 | TITAN_AUTOBUFF_ID = "AutoBuff"; |
||
361 | TITAN_AUTOBUFF_DESC = "Auto-casts self-buffs, weapon buffs, tracking abilites, aspects, and seals."; |
||
362 | TITAN_AUTOBUFF_MENU_TEXT = "AutoBuff"; |
||
363 | TITAN_AUTOBUFF_BUTTON_LABEL = "AutoBuff"; |
||
364 | TITAN_AUTOBUFF_TOOLTIP = "AutoBuff v"..cDefault['v']; |
||
365 | TITAN_AUTOBUFF_ICON_ON = "Interface\\AddOns\\AutoBuff\\ABEnabled"; |
||
366 | TITAN_AUTOBUFF_ICON_OFF = "Interface\\AddOns\\AutoBuff\\ABDisabled"; |
||
367 | TITAN_AUTOBUFF_ENABLE = "Enable AutoBuff"; |
||
368 | TITAN_AUTOBUFF_BUTTONSHOW = "Show UI Button"; |
||
369 | TITAN_AUTOBUFF_BUTTONRESET = "Reset UI Button"; |
||
370 | TITAN_AUTOBUFF_DEBUG = "Debug Mode"; |
||
371 | TITAN_AUTOBUFF_WATER = "Wait 30s to cast WaterBreathing"; |
||
372 | TITAN_AUTOBUFF_TAP = "Off while Spirit Tap or Soul Siphon active"; |
||
373 | TITAN_AUTOBUFF_SCALED = "Warlock Life Tap scaling (w/BonusScanner)"; |
||
374 | TITAN_AUTOBUFF_INNER = "Priest Inner Fire casts at XX charges left"; |
||
375 | TitanAutoBuffStates = {}; |
||
376 | TitanAutoBuffStates.Enabled = nil; |
||
377 | TitanAutoBuffStates.Button = nil; |
||
378 | TitanAutoBuffStates.Debug = nil; |
||
379 | TitanAutoBuffStates.Water = nil; |
||
380 | TitanAutoBuffStates.Tap = nil; |
||
381 | TitanAutoBuffStates.Scaled = nil; |
||
382 | TitanAutoBuffStates.Inner = nil; |
||
383 | TITAN_AUTOBUFF_TOOLTIP_CONTENTS = ""; |
||
384 | local u = {}; |
||
385 | |||
386 | -- AutoBuffOptionsButton functions |
||
387 | local AutoBuffOptionsButton_BeingDragged = false; |
||
388 | |||
389 | function AutoBuffOptionsButton_OnLoad() |
||
390 | this:RegisterForClicks("LeftButtonUp", "RightButtonUp"); |
||
391 | this:RegisterForDrag("LeftButton"); |
||
392 | end |
||
393 | |||
394 | function AutoBuffOptionsButton_OnClick(arg1) |
||
395 | if (arg1 == "LeftButton") then |
||
396 | -- Open Options Window |
||
397 | AutoBuffFrame_Toggle(); |
||
398 | elseif (arg1 == "RightButton") then |
||
399 | -- Toggle on/off status |
||
400 | AutoBuffToggle(); |
||
401 | end |
||
402 | end |
||
403 | |||
404 | function AutoBuffToggle() |
||
405 | if (AutoBuff_Data[vC]['e'] == 1) then |
||
406 | AutoBuff_Off(); |
||
407 | else |
||
408 | AutoBuff_On(); |
||
409 | end |
||
410 | end |
||
411 | |||
412 | function AutoBuffDebug() |
||
413 | if (AutoBuff_Data[vC]['d']) then |
||
414 | AutoBuff_Data[vC]['d'] = nil; |
||
415 | AutoBuff_Print("Debug is now off."); |
||
416 | TitanAutoBuffStates.Debug = nil; |
||
417 | else |
||
418 | AutoBuff_Data[vC]['d'] = 1; |
||
419 | AutoBuff_Print("Debug is now on."); |
||
420 | TitanAutoBuffStates.Debug = 1; |
||
421 | end |
||
422 | end |
||
423 | |||
424 | function AutoBuffWaterToggle() |
||
425 | if (AutoBuff_Data[vC]["water"]) then |
||
426 | AutoBuff_Data[vC]["water"] = false; |
||
427 | AutoBuff_Print("Underwater Breathing spells will ignore swim timers."); |
||
428 | TitanAutoBuffStates.Water = nil; |
||
429 | else |
||
430 | AutoBuff_Data[vC]["water"] = true; |
||
431 | AutoBuff_Print("Underwater Breathing spells will require 30 seconds underwater time before casting (Default Behavior)."); |
||
432 | TitanAutoBuffStates.Water = 1; |
||
433 | end |
||
434 | end |
||
435 | |||
436 | function AutoBuffTapToggle() |
||
437 | if (AutoBuff_Data[vC]["tap"]) then |
||
438 | AutoBuff_Data[vC]["tap"] = false; |
||
439 | AutoBuff_Print("Will now cast spells while Spirit Tap or Soul Siphon are active."); |
||
440 | TitanAutoBuffStates.Tap = nil; |
||
441 | else |
||
442 | AutoBuff_Data[vC]["tap"] = true; |
||
443 | AutoBuff_Print("Will not cast spells while Spirit Tap or Soul Siphon are active (Default Behavior)."); |
||
444 | TitanAutoBuffStates.Tap = 1; |
||
445 | end |
||
446 | end |
||
447 | |||
448 | function AutoBuffScaledToggle() |
||
449 | if (AutoBuff_Data[vC]["scaled"]) then |
||
450 | AutoBuff_Data[vC]["scaled"] = false; |
||
451 | AutoBuff_Print("Warlock Life Tap spell will ignore scaling routines."); |
||
452 | TitanAutoBuffStates.Scaled = nil; |
||
453 | else |
||
454 | AutoBuff_Data[vC]["scaled"] = true; |
||
455 | if (IsAddOnLoaded("BonusScanner")) then |
||
456 | AutoBuff_Print("Warlock Life Tap spell will be scaled for efficiency (Default Behavior)."); |
||
457 | else |
||
458 | AutoBuff_Print("Warlock Life Tap scaling is dependent on BonusScanner. You must have that mod loaded before scaling will work."); |
||
459 | end |
||
460 | TitanAutoBuffStates.Scaled = 1; |
||
461 | end |
||
462 | end |
||
463 | |||
464 | function AutoBuffInnerToggle() |
||
465 | if (AutoBuff_Data[vC]["inner"]) then |
||
466 | AutoBuff_Data[vC]["inner"] = false; |
||
467 | AutoBuff_Print("Inner Fire will only cast when totally removed (or recast timer is up)."); |
||
468 | TitanAutoBuffStates.Inner = nil; |
||
469 | else |
||
470 | AutoBuff_Data[vC]["inner"] = true; |
||
471 | AutoBuff_Print("Inner Fire will cast when "..AutoBuff_Data[vC]["innercharges"].." charges are left (Default Behavior)."); |
||
472 | TitanAutoBuffStates.Inner = 1; |
||
473 | end |
||
474 | end |
||
475 | |||
476 | function AutoBuffOptionsButton_OnDragStart() |
||
477 | if (not AutoBuffOptionsButton_BeingDragged) then |
||
478 | this:StartMoving(); |
||
479 | AutoBuffOptionsButton_BeingDragged = true; |
||
480 | end |
||
481 | end |
||
482 | |||
483 | function AutoBuffOptionsButton_OnDragStop() |
||
484 | if (AutoBuffOptionsButton_BeingDragged) then |
||
485 | this:StopMovingOrSizing() |
||
486 | AutoBuffOptionsButton_BeingDragged = false; |
||
487 | end |
||
488 | end |
||
489 | |||
490 | local function AutoBuff_ScaledLifeTap_GetLifeTapMultiplier() |
||
491 | local name,iconPath,tier,column,rank = GetTalentInfo(AFFLICTION_TAB, IMP_LIFETAP_ID); |
||
492 | local multiplier = 1; |
||
493 | if (name == AUTOBUFF_ABILITY_LIFE_TAP_TALENT) then |
||
494 | if rank == 1 then |
||
495 | multiplier = 1.1; |
||
496 | elseif rank == 2 then |
||
497 | multiplier = 1.2; |
||
498 | end |
||
499 | else |
||
500 | AutoBuff_Debug("Talent tree has changed. Cannot determine Improved Life Tap Rank. Assuming 0 ranks."); |
||
501 | end |
||
502 | return multiplier; |
||
503 | end |
||
504 | |||
505 | local function AutoBuff_ScaledLifeTap_GetMaxLifeTapRank() |
||
506 | local rank = 0; |
||
507 | local count = 1; |
||
508 | local foundSpell = false; |
||
509 | |||
510 | while true do |
||
511 | local spellName, spellRank = GetSpellName(count, BOOKTYPE_SPELL); |
||
512 | |||
513 | if spellName == AUTOBUFF_ABILITY_LIFE_TAP then |
||
514 | startPos,endPos,rank = string.find(spellRank, AUTOBUFF_SCALEDLIFETAP_RANKREGEXP); |
||
515 | foundSpell = true; |
||
516 | else |
||
517 | if foundSpell then |
||
518 | break; |
||
519 | end |
||
520 | end |
||
521 | count = count + 1; |
||
522 | end |
||
523 | |||
524 | AutoBuff_Debug("Highest rank of Life Tap is " .. rank); |
||
525 | return rank; |
||
526 | end |
||
527 | |||
528 | local function AutoBuff_ScaledLifeTap_GetDamageBonus() |
||
529 | local damageBonus = 0; |
||
530 | local sentDebug = false; |
||
531 | if IsAddOnLoaded("BonusScanner") then |
||
532 | damageBonus = BonusScanner:GetBonus("SHADOWDMG") + BonusScanner:GetBonus("DMG"); |
||
533 | else |
||
534 | AutoBuff_Debug("BonusScanner is not loaded."); |
||
535 | sentDebug = true; |
||
536 | end |
||
537 | if (not sentDebug) then AutoBuff_Debug("BonusScanner reports total shadow damage bonus as: " .. damageBonus); end |
||
538 | return damageBonus; |
||
539 | end |
||
540 | |||
541 | function AutoBuff_ScaledLifeTap_CastLifeTap() |
||
542 | local damageModifier = AutoBuff_ScaledLifeTap_GetDamageBonus(); |
||
543 | local lifetapMultiplier = AutoBuff_ScaledLifeTap_GetLifeTapMultiplier(); |
||
544 | local maxRank = AutoBuff_ScaledLifeTap_GetMaxLifeTapRank(); |
||
545 | local castSpell = false; |
||
546 | |||
547 | for i=maxRank,1,-1 do |
||
548 | if ((i == 1 and overtapEnabled and (UnitManaMax("player") ~= UnitMana("player")))) or ((UnitHealth("player")>=BASE_DAMAGE[i]+RANK_MULTIPLIER[i]*damageModifier and (UnitManaMax("player")-UnitMana("player")>=(BASE_DAMAGE[i]+RANK_MULTIPLIER[i]*damageModifier)*lifetapMultiplier))) then |
||
549 | CastSpellByName(AUTOBUFF_ABILITY_LIFE_TAP .. "(" .. AUTOBUFF_LIST_RANK .. " "..i..")"); |
||
550 | AutoBuff_Debug("Casting Scaled Life Tap (Rank " .. i .. ")"); |
||
551 | castSpell = true; |
||
552 | break; |
||
553 | end |
||
554 | end |
||
555 | |||
556 | if not castSpell then |
||
557 | AutoBuff_Debug("Canceling Life Tap (it isn't needed right now)."); |
||
558 | end |
||
559 | end |
||
560 | |||
561 | -- myAddOns Support |
||
562 | AutoBuff_myAddOns = { |
||
563 | name = 'AutoBuff', |
||
564 | description = 'Auto-self buff', |
||
565 | version = cDefault['v'], |
||
566 | author = 'Dsanai', |
||
567 | category = MYADDONS_CATEGORY_CLASS, |
||
568 | frame = '_AutoBuff', |
||
569 | optionsframe = 'AutoBuffFrame' |
||
570 | }; |
||
571 | |||
572 | UIPanelWindows["AutoBuffFrame"] = {area = "center", pushable = 0}; |
||
573 | |||
574 | function AutoBuff_OnLoad() |
||
575 | this:RegisterEvent("UNIT_NAME_UPDATE"); |
||
576 | this:RegisterEvent("PLAYER_ENTERING_WORLD"); |
||
577 | this:RegisterEvent("VARIABLES_LOADED"); |
||
578 | this:RegisterEvent("PLAYER_REGEN_ENABLED"); |
||
579 | this:RegisterEvent("PLAYER_REGEN_DISABLED"); |
||
580 | this:RegisterEvent("LEARNED_SPELL_IN_TAB"); |
||
581 | this:RegisterEvent("UI_ERROR_MESSAGE"); |
||
582 | this:RegisterEvent("MIRROR_TIMER_START"); |
||
583 | this:RegisterEvent("MIRROR_TIMER_STOP"); |
||
584 | this:RegisterEvent("PLAYER_TARGET_CHANGED"); |
||
585 | |||
586 | SlashCmdList["AUTOBUFF"] = AutoBuff_SlashHandler; |
||
587 | SLASH_AUTOBUFF1 = "/autobuff"; |
||
588 | SLASH_AUTOBUFF2 = "/ab"; |
||
589 | |||
590 | -- Fubar Includes |
||
591 | if (IsAddOnLoaded("FuBar")) then |
||
592 | FuBarAutoBuff_OnLoad(); |
||
593 | end |
||
594 | |||
595 | -- AutoBuff_MFSx = MoveForwardStart; -- [Start] These hook the movement functions. |
||
596 | -- AutoBuff_MBSx = MoveBackwardStart; |
||
597 | -- AutoBuff_TLSx = TurnLeftStart; |
||
598 | -- AutoBuff_TRSx = TurnRightStart; |
||
599 | -- AutoBuff_SLSx = StrafeLeftStart; |
||
600 | -- AutoBuff_SRSx = StrafeRightStart; |
||
601 | -- AutoBuff_MFFx = MoveForwardStop; -- [Stop] |
||
602 | -- AutoBuff_MBFx = MoveBackwardStop; |
||
603 | -- AutoBuff_TLFx = TurnLeftStop; |
||
604 | -- AutoBuff_TRFx = TurnRightStop; |
||
605 | -- AutoBuff_SLFx = StrafeLeftStop; |
||
606 | -- AutoBuff_SRFx = StrafeRightStop; |
||
607 | -- AutoBuff_TARx = ToggleAutoRun; -- [ToggleAutorun] |
||
608 | |||
609 | -- AutoBuff_TASx = TurnOrActionStart; |
||
610 | -- AutoBuff_TAFx = TurnOrActionStop; |
||
611 | --AutoBuff_CMSx = CameraOrSelectOrMoveStart; |
||
612 | --AutoBuff_CMFx = CameraOrSelectOrMoveStop; |
||
613 | |||
614 | --AutoBuff_JMPx = Jump; |
||
615 | |||
616 | --Jump = AutoBuff_JMP; |
||
617 | -- MoveForwardStart = AutoBuff_MFS; |
||
618 | -- MoveBackwardStart = AutoBuff_MBS; |
||
619 | -- TurnLeftStart = AutoBuff_TLS; |
||
620 | -- TurnRightStart = AutoBuff_TRS; |
||
621 | -- StrafeLeftStart = AutoBuff_SLS; |
||
622 | -- StrafeRightStart = AutoBuff_SRS; |
||
623 | -- MoveForwardStop = AutoBuff_MFF; |
||
624 | -- MoveBackwardStop = AutoBuff_MBF; |
||
625 | -- TurnLeftStop = AutoBuff_TLF; |
||
626 | -- TurnRightStop = AutoBuff_TRF; |
||
627 | -- StrafeLeftStop = AutoBuff_SLF; |
||
628 | -- StrafeRightStop = AutoBuff_SRF; |
||
629 | -- ToggleAutoRun = AutoBuff_TAR; |
||
630 | -- TurnOrActionStart = AutoBuff_TAS; |
||
631 | -- TurnOrActionStop = AutoBuff_TAF; |
||
632 | --CameraOrSelectOrMoveStart = AutoBuff_CMS; |
||
633 | --CameraOrSelectOrMoveStop = AutoBuff_CMF; |
||
634 | |||
635 | AutoBuff_WHEELUx = CameraZoomIn; |
||
636 | AutoBuff_WHEELDx = CameraZoomOut; |
||
637 | CameraZoomIn = AutoBuff_WHEELU; |
||
638 | CameraZoomOut = AutoBuff_WHEELD; |
||
639 | |||
640 | AutoBuff_TableConfig(); |
||
641 | AutoBuff_PaladinSetup(); |
||
642 | |||
643 | -- Apply INDEX numbers to the cSpellList (add element to each, named ["i"] = # |
||
644 | local indexAssignment = 1; |
||
645 | for key, value in cSpellList do |
||
646 | cSpellList[key]["i"] = indexAssignment; |
||
647 | indexAssignment = indexAssignment + 1; |
||
648 | --AutoBuff_Print("cSpellList INDEXING: "..key.." to "..indexAssignment); |
||
649 | end |
||
650 | |||
651 | if ButtonHole then -- ButtonHole support (did it like author said, but don't think it works) |
||
652 | ButtonHole.application.RegisterMod({id='AutoBuffEmerald1800', name='AutoBuff',tooltip='Automatically casts self-buffs, weapon buffs, tracking abilites, and aspects.',buttonFrame='AutoBuffOptionsButton',updateFunction='AutoBuffOptionsButton_OnDragStart'}); |
||
653 | end |
||
654 | |||
655 | u = Utility_Class:New(); |
||
656 | |||
657 | end |
||
658 | |||
659 | function AutoBuff_ZMI(arg1) |
||
660 | AutoBuff_Check(0); |
||
661 | AutoBuff_ZMIx(arg1); |
||
662 | end |
||
663 | |||
664 | function AutoBuff_ZMO(arg1) |
||
665 | AutoBuff_Check(0); |
||
666 | AutoBuff_ZMOx(arg1); |
||
667 | end |
||
668 | |||
669 | function AutoBuff_OnEvent(event) |
||
670 | |||
671 | if (event == "UNIT_NAME_UPDATE" and arg1 == "player") or (event == "PLAYER_ENTERING_WORLD") then |
||
672 | if (vLoaded.autobuff ~= true) then |
||
673 | vLoaded.player = true; |
||
674 | end |
||
675 | |||
676 | elseif (event == "VARIABLES_LOADED") then |
||
677 | vLoaded.var = true; |
||
678 | if (myAddOnsFrame_Register) then |
||
679 | myAddOnsFrame_Register(AutoBuff_myAddOns); |
||
680 | elseif (myAddOnsFrame) then |
||
681 | myAddOnsList.AutoBuff = AutoBuff_myAddOns; |
||
682 | end |
||
683 | |||
684 | elseif (event == "PLAYER_TARGET_CHANGED") then |
||
685 | --AutoBuff_Check(0); |
||
686 | AutoBuff_TARGET(); |
||
687 | |||
688 | elseif (event == "PLAYER_REGEN_ENABLED") then |
||
689 | vCombat = nil; |
||
690 | |||
691 | elseif (event == "PLAYER_REGEN_DISABLED") then |
||
692 | vCombat = true; |
||
693 | |||
694 | elseif (event == "LEARNED_SPELL_IN_TAB") then |
||
695 | AutoBuff_Reload(); |
||
696 | |||
697 | elseif (event == "MIRROR_TIMER_START" and arg6=="Breath") then |
||
698 | --AutoBuff_Debug("---MirrorTimerStart with arg6="..arg6); |
||
699 | vBreath = time() +30; |
||
700 | |||
701 | elseif (event == "MIRROR_TIMER_STOP") then |
||
702 | --AutoBuff_Debug("---MirrorTimerStop"); |
||
703 | vBreath = 0; |
||
704 | |||
705 | elseif (event == "UI_ERROR_MESSAGE") then |
||
706 | if (arg1 == SPELL_FAILED_AURA_BOUNCED) then |
||
707 | vTime = time() + 30; end -- A more powerful spell is already active |
||
708 | if (arg1 == SPELL_FAILED_ONLY_OUTDOORS) then |
||
709 | vTime = time() + 30; end -- Nature's Grasp trap |
||
710 | if (arg1 == SPELL_FAILED_SILENCED) then |
||
711 | vTime = time() + 5; end -- Silenced |
||
712 | if (arg1 == SPELL_FAILED_REAGENTS) then |
||
713 | vTime = time() + 30; end -- Out of regeant(s) |
||
714 | if (arg1 == SPELL_FAILED_MAINHAND_EMPTY) then |
||
715 | vTime = time() + 30; end -- No main-hand weapon |
||
716 | if (arg1 == SPELL_FAILED_NOT_STANDING) then |
||
717 | vSit = time() + 5; end |
||
718 | |||
719 | end |
||
720 | |||
721 | if (vLoaded.player) and (vLoaded.var) and (vLoaded.autobuff ~= true) then |
||
722 | -- Only load when Character + Vars are loaded |
||
723 | |||
724 | -- Expand Trigger text on GUI if using french locale. |
||
725 | if (GetLocale() == "frFR") then |
||
726 | AutoBuffFrameOptionsTrigger_Text:SetWidth(AutoBuffFrameOptionsTrigger_Text:GetWidth() +40); |
||
727 | end |
||
728 | |||
729 | local vServer = GetCVar("realmName"); |
||
730 | local vPlayer = UnitName("player"); |
||
731 | |||
732 | vClass = string.lower(UnitClass("player")); |
||
733 | vC = vPlayer.." of "..vServer; -- Used for character specific saved variables |
||
734 | |||
735 | if (vClass == string.lower(AUTOBUFF_CLASS_DRUID)) then -- fix Druid Track Humanoids setup |
||
736 | if not cSpellList[AUTOBUFF_ABILITY_TRACK_HUMANOIDS] then |
||
737 | cSpellList[AUTOBUFF_ABILITY_TRACK_HUMANOIDS] = { ["i"] = table.getn(cSpellList)+1, ["type"] = "self" }; |
||
738 | end |
||
739 | elseif (vClass == string.lower(AUTOBUFF_CLASS_HUNTER)) then |
||
740 | --table.insert(cTrackList, AUTOBUFF_ABILITY_TRACK_HUMANOIDS); |
||
741 | if not cTrackList[AUTOBUFF_ABILITY_TRACK_HUMANOIDS] then |
||
742 | cTrackList[AUTOBUFF_ABILITY_TRACK_HUMANOIDS] = "Unknown"; |
||
743 | end |
||
744 | end |
||
745 | |||
746 | AutoBuff_LoadDefaults(); -- Check SavedVariables against defaults, |
||
747 | -- if any missing entries, defaults for those entries are loaded |
||
748 | AutoBuff_TableConfig(); -- table.setn's the 3 constant tables, cSpellList, cTrackList and cWeaponList |
||
749 | |||
750 | -- Fix my ['w'] vs. ['water'] screw-up |
||
751 | if (AutoBuff_Data[vC]['w']==true or not AutoBuff_Data[vC]['w']) then |
||
752 | AutoBuff_Data[vC]['w'] = "off"; |
||
753 | end |
||
754 | |||
755 | AutoBuff_Reload(); -- Next we run through the constant tables for list of spells, |
||
756 | -- and create temporary ones that have just those that are truly available |
||
757 | |||
758 | if (cPolyList[vClass] == nil) then |
||
759 | AutoBuff_Print("Your language is not supported!"); |
||
760 | else |
||
761 | vLoaded.autobuff = true; -- Loading complete. |
||
762 | AutoBuff_Debug("AutoBuff Loaded."); |
||
763 | end |
||
764 | |||
765 | if (AutoBuff_Data[vC]['b']) then -- Set Button Visibility State |
||
766 | AutoBuffOptionsButton:Show(); |
||
767 | TitanAutoBuffStates.Button = 1; |
||
768 | else |
||
769 | AutoBuffOptionsButton:Hide(); |
||
770 | TitanAutoBuffStates.Button = nil; |
||
771 | end |
||
772 | |||
773 | if (AutoBuff_Data[vC]['d']) then -- Set Debug State |
||
774 | TitanAutoBuffStates.Debug = 1; |
||
775 | else |
||
776 | TitanAutoBuffStates.Debug = nil; |
||
777 | end |
||
778 | |||
779 | if (AutoBuff_Data[vC]["water"]) then -- Set Water State |
||
780 | TitanAutoBuffStates.Water = 1; |
||
781 | else |
||
782 | TitanAutoBuffStates.Water = nil; |
||
783 | end |
||
784 | |||
785 | if (AutoBuff_Data[vC]["tap"]) then -- Set Spirit Tap Block State |
||
786 | TitanAutoBuffStates.Tap = 1; |
||
787 | else |
||
788 | TitanAutoBuffStates.Tap = nil; |
||
789 | end |
||
790 | |||
791 | if (AutoBuff_Data[vC]["scaled"]) then -- Set Life Tap Scaling State |
||
792 | TitanAutoBuffStates.Scaled = 1; |
||
793 | else |
||
794 | TitanAutoBuffStates.Scaled = nil; |
||
795 | end |
||
796 | |||
797 | if (AutoBuff_Data[vC]["inner"]) then -- Set Inner Fire recast State |
||
798 | TitanAutoBuffStates.Inner = 1; |
||
799 | else |
||
800 | TitanAutoBuffStates.Inner = nil; |
||
801 | end |
||
802 | |||
803 | if (AutoBuff_Data[vC]["innercharges"]) then -- Set Inner Fire recast charges |
||
804 | TITAN_AUTOBUFF_INNER = "Priest Inner Fire casts at "..AutoBuff_Data[vC]["innercharges"].." charges left"; |
||
805 | else |
||
806 | AutoBuff_Data[vC]["innercharges"] = cDefault["innercharges"]; |
||
807 | TITAN_AUTOBUFF_INNER = "Priest Inner Fire casts at "..AutoBuff_Data[vC]["innercharges"].." charges left"; |
||
808 | end |
||
809 | if (IsAddOnLoaded("FuBar")) then AutoBuffFu:Update(); end |
||
810 | |||
811 | if (AutoBuff_Data[vC]['e'] == 1) then -- Fix button texture based on On/Off state |
||
812 | AutoBuffOptionsButton:SetNormalTexture(cIconOn); |
||
813 | AutoBuffOptionsButton:SetPushedTexture(cIconOff); |
||
814 | if (AutoBuffFu) then |
||
815 | AutoBuffFu:SetIcon(TITAN_AUTOBUFF_ICON_ON..".tga"); |
||
816 | end |
||
817 | if (IsAddOnLoaded("Titan")) then |
||
818 | local button = TitanUtils_GetButton(TITAN_AUTOBUFF_ID, true); |
||
819 | if (button) then |
||
820 | button.registry.icon = TITAN_AUTOBUFF_ICON_ON; |
||
821 | TitanPanelButton_UpdateButton(TITAN_AUTOBUFF_ID); |
||
822 | end |
||
823 | --TITAN_AUTOBUFF_TOOLTIP_CONTENTS = TitanUtils_GetColoredText("Enabled", u.ColorList[string.lower("green")]).."\t"..TitanUtils_GetColoredText("", u.ColorList[string.lower("yellow")]).."\n"; |
||
824 | end |
||
825 | TitanAutoBuffStates.Enabled = 1; |
||
826 | else |
||
827 | AutoBuffOptionsButton:SetNormalTexture(cIconOff); |
||
828 | AutoBuffOptionsButton:SetPushedTexture(cIconOn); |
||
829 | if (AutoBuffFu) then |
||
830 | AutoBuffFu:SetIcon(TITAN_AUTOBUFF_ICON_OFF..".tga"); |
||
831 | end |
||
832 | if (IsAddOnLoaded("Titan")) then |
||
833 | local button = TitanUtils_GetButton(TITAN_AUTOBUFF_ID, true); |
||
834 | if (button) then |
||
835 | button.registry.icon = TITAN_AUTOBUFF_ICON_OFF; |
||
836 | TitanPanelButton_UpdateButton(TITAN_AUTOBUFF_ID); |
||
837 | end |
||
838 | --TITAN_AUTOBUFF_TOOLTIP_CONTENTS = TitanUtils_GetColoredText("Disabled", u.ColorList[string.lower("red")]).."\t"..TitanUtils_GetColoredText("", u.ColorList[string.lower("yellow")]).."\n"; |
||
839 | end |
||
840 | TitanAutoBuffStates.Enabled = nil; |
||
841 | end |
||
842 | |||
843 | end |
||
844 | --UpdateABClickyBox(); |
||
845 | end |
||
846 | |||
847 | function AutoBuff_Trigger(spell) |
||
848 | local n = AutoBuff_Option(spell, 't'); |
||
849 | if (n == nil) then n = AutoBuff_Option('d', 't'); end |
||
850 | local i,t; local z = { 0, 0, 0, 0, 0, 0 }; |
||
851 | for i=6,1,-1 do |
||
852 | t = n - 2^i; |
||
853 | if (t >= 0) then |
||
854 | n = t; z[i] = 1; |
||
855 | end |
||
856 | if (n == 0) then |
||
857 | break; end |
||
858 | end |
||
859 | -- forward, strafe, turn, lmb, rmb |
||
860 | AutoBuff_Debug("["..z[1]..", "..z[2]..", "..z[3]..", "..z[4]..", "..z[5]..", "..z[6].."]"); |
||
861 | return z; |
||
862 | end |
||
863 | |||
864 | function AutoBuff_On() |
||
865 | AutoBuff_Data[vC]['e'] = 1; |
||
866 | AutoBuff_Print(AUTOBUFF_ENABLED); |
||
867 | AutoBuffOptionsButton:SetNormalTexture(cIconOn); |
||
868 | AutoBuffOptionsButton:SetPushedTexture(cIconOff); |
||
869 | if (AutoBuffFu) then |
||
870 | AutoBuffFu:SetIcon(TITAN_AUTOBUFF_ICON_ON..".tga"); |
||
871 | end |
||
872 | -- Change Titan icon, if applicable |
||
873 | if (IsAddOnLoaded("Titan")) then |
||
874 | local button = TitanUtils_GetButton(TITAN_AUTOBUFF_ID, true); |
||
875 | if (button) then |
||
876 | button.registry.icon = TITAN_AUTOBUFF_ICON_ON; |
||
877 | TitanPanelButton_UpdateButton(TITAN_AUTOBUFF_ID); |
||
878 | end |
||
879 | --TITAN_AUTOBUFF_TOOLTIP_CONTENTS = TitanUtils_GetColoredText("Enabled", u.ColorList[string.lower("green")]).."\t"..TitanUtils_GetColoredText("", u.ColorList[string.lower("yellow")]).."\n"; |
||
880 | end |
||
881 | TitanAutoBuffStates.Enabled = 1; |
||
882 | end |
||
883 | |||
884 | function AutoBuff_Off() |
||
885 | AutoBuff_Data[vC]['e'] = 0; |
||
886 | AutoBuff_Print(AUTOBUFF_DISABLED); |
||
887 | AutoBuffOptionsButton:SetNormalTexture(cIconOff); |
||
888 | AutoBuffOptionsButton:SetPushedTexture(cIconOn); |
||
889 | if (AutoBuffFu) then |
||
890 | AutoBuffFu:SetIcon(TITAN_AUTOBUFF_ICON_OFF..".tga"); |
||
891 | end |
||
892 | -- Change Titan icon, if applicable |
||
893 | if (IsAddOnLoaded("Titan")) then |
||
894 | local button = TitanUtils_GetButton(TITAN_AUTOBUFF_ID, true); |
||
895 | if (button) then |
||
896 | button.registry.icon = TITAN_AUTOBUFF_ICON_OFF; |
||
897 | TitanPanelButton_UpdateButton(TITAN_AUTOBUFF_ID); |
||
898 | end |
||
899 | --TITAN_AUTOBUFF_TOOLTIP_CONTENTS = TitanUtils_GetColoredText("Disabled", u.ColorList[string.lower("red")]).."\t"..TitanUtils_GetColoredText("", u.ColorList[string.lower("yellow")]).."\n"; |
||
900 | end |
||
901 | TitanAutoBuffStates.Enabled = nil; |
||
902 | end |
||
903 | |||
904 | function AutoBuff_HideButton() -- toggle |
||
905 | if (AutoBuff_Data[vC]['b']) then |
||
906 | AutoBuff_Data[vC]['b'] = false; |
||
907 | AutoBuffOptionsButton:Hide(); |
||
908 | AutoBuff_Print(AUTOBUFF_BUTTON_HIDDEN); |
||
909 | TitanAutoBuffStates.Button = nil; |
||
910 | else |
||
911 | AutoBuff_Data[vC]['b'] = true; |
||
912 | AutoBuffOptionsButton:Show(); |
||
913 | AutoBuff_Print(AUTOBUFF_BUTTON_SHOWN); |
||
914 | TitanAutoBuffStates.Button = 1; |
||
915 | end |
||
916 | end |
||
917 | |||
918 | function AutoBuff_ResetButton() -- reset position |
||
919 | AutoBuffOptionsButton:ClearAllPoints(); |
||
920 | AutoBuffOptionsButton:SetPoint("CENTER", "UIParent", "CENTER", 200, 200); |
||
921 | AutoBuff_Data[vC]['b'] = true; |
||
922 | AutoBuffOptionsButton:Show(); |
||
923 | TitanAutoBuffStates.Button = 1; |
||
924 | end |
||
925 | |||
926 | function AutoBuff_SlashHandler(msg) |
||
927 | |||
928 | -- Thanks to AutoRepair for this wicked seperator :) |
||
929 | if (msg) then msg = string.lower(msg); end |
||
930 | local _,_,c,p = string.find(msg,"([%w%p]+)%s*(.*)$"); |
||
931 | |||
932 | if (c == "on") then |
||
933 | AutoBuff_On(); |
||
934 | |||
935 | elseif (c == "off") then |
||
936 | AutoBuff_Off(); |
||
937 | |||
938 | elseif (c == "hide") then |
||
939 | AutoBuff_HideButton(); |
||
940 | |||
941 | elseif (c == "resetbutton") then |
||
942 | AutoBuff_ResetButton(); |
||
943 | |||
944 | elseif (c == "toggle") then |
||
945 | if (p) and (strlen(p) > 0) then |
||
946 | if (vSpellList[p]) then |
||
947 | local g = 1; |
||
948 | if (AutoBuff_Option(p, 'd') == 1) then g = "default"; end |
||
949 | AutoBuff_Option(p, 'd', g, 1); |
||
950 | if (AutoBuff_IsBlessing(p)) then AutoBuff_FixBlessing(p); end if (AutoBuff_IsAura(p)) then AutoBuff_FixAura(p); end |
||
951 | elseif (vWeaponList[p]) then |
||
952 | if (vWeapon == p) then p = "off"; end |
||
953 | AutoBuff_Data[vC]['w'] = p; |
||
954 | AutoBuff_WeaponLoad("show") |
||
955 | else AutoBuff_Print(string.format(AUTOBUFF_NOTSUPPORTED, p)); end |
||
956 | else |
||
957 | if (AutoBuff_Data[vC]['e'] == 1) then |
||
958 | AutoBuff_Off(); |
||
959 | else |
||
960 | AutoBuff_On(); |
||
961 | end |
||
962 | end |
||
963 | |||
964 | elseif (c == "debug") then |
||
965 | AutoBuffDebug(); |
||
966 | |||
967 | elseif (c == "water") then |
||
968 | AutoBuffWaterToggle(); |
||
969 | |||
970 | elseif (c == "tap") then |
||
971 | AutoBuffTapToggle(); |
||
972 | |||
973 | elseif (c == "scaled") then |
||
974 | AutoBuffScaledToggle(); |
||
975 | |||
976 | elseif (c == "inner") then |
||
977 | AutoBuffInnerToggle(); |
||
978 | |||
979 | elseif (c == "checkbuffs") or (c == "check") or (c == "run") then |
||
980 | AutoBuff_Check(0); |
||
981 | |||
982 | elseif (c == "reset") then |
||
983 | if (p == "confirm") then |
||
984 | AutoBuff_Data[vC] = nil; |
||
985 | AutoBuff_LoadDefaults(); |
||
986 | AutoBuff_Reload(); |
||
987 | AutoBuff_Print(AUTOBUFF_RESET); |
||
988 | else |
||
989 | AutoBuff_Print(AUTOBUFF_RESET_CONFIRM); |
||
990 | end |
||
991 | |||
992 | elseif (c == "rank") then |
||
993 | local _,_,v,a = string.find(p,"([%w%p]+)%s*(.*)$"); |
||
994 | if (v) and (strlen(v) > 0) and ((v == "default") or ((tonumber(v)) and (tonumber(v) > 0) and (tonumber(v) < 20))) then |
||
995 | if (v ~= "default") then v = math.floor(tonumber(v)); end |
||
996 | if (not a) or (strlen(a) == 0) then a = "none"; end |
||
997 | if (not vSpellList[a]) and (not vWeaponList[a]) then AutoBuff_Print(string.format(AUTOBUFF_NOTSUPPORTED, a)); |
||
998 | elseif (v == "default") or ((vSpellList[a]) and (vSpellList[a]['k']) and (v <= vSpellList[a]['k'])) or ((vWeaponList[a]) and (vWeaponList[a] ~= true) and (v <= vWeaponList[a])) or ((vSealList[a]) and (vSealList[a]['k']) and (v <= vSealList[a]['k'])) then |
||
999 | AutoBuff_Option(a, 'k', v, 1); |
||
1000 | else |
||
1001 | AutoBuff_Print(AUTOBUFF_NOSUCHRANK); |
||
1002 | end |
||
1003 | else AutoBuff_Print(AUTOBUFF_RANK_USAGE1.."\n"..AUTOBUFF_RANK_USAGE2.."\n"..AUTOBUFF_RANK_USAGE3.."\n"..AUTOBUFF_RANK_USAGE4); end |
||
1004 | elseif (c == "rebuff") then |
||
1005 | local _,_,v,a = string.find(p,"([%w%p]+)%s*(.*)$"); |
||
1006 | if (v) and (strlen(v) > 0) and ((v == "default") or ((tonumber(v)) and (tonumber(v) >= 0) and (tonumber(v) < 300))) then |
||
1007 | if (v ~= "default") then v = math.floor(tonumber(v)); end |
||
1008 | if (a) and (strlen(a) > 0) and (not vSpellList[a]) and (not vWeaponList[a]) then AutoBuff_Print(string.format(AUTOBUFF_NOTSUPPORTED, a)); |
||
1009 | else AutoBuff_Option(a, 'r', v, 1); end |
||
1010 | else AutoBuff_Print(AUTOBUFF_REBUFF_USAGE1.."\n"..AUTOBUFF_REBUFF_USAGE2.."\n"..AUTOBUFF_REBUFF_USAGE3.."\n"..AUTOBUFF_REBUFF_USAGE4.."\n" |
||
1011 | ..AUTOBUFF_REBUFF_USAGE5); end |
||
1012 | |||
1013 | elseif (c == "trigger") then |
||
1014 | local _,_,v,a = string.find(p,"([%w%p]+)%s*(.*)$"); |
||
1015 | if (v) and |
||
1016 | (strlen(v) > 0) and ((v == "default") or ((tonumber(v)) and (tonumber(v) >= 0) and (tonumber(v) <= 126) and ((tonumber(v) /2) == floor(tonumber(v) /2)))) then |
||
1017 | if (a) and (strlen(a) > 0) and (not vSpellList[a]) and (not vWeaponList[a]) then AutoBuff_Print(string.format(AUTOBUFF_NOTSUPPORTED, a)); |
||
1018 | else AutoBuff_Option(a, 't', v, 1); end |
||
1019 | else AutoBuff_Print(AUTOBUFF_TRIGGER_USAGE1.."\n"..AUTOBUFF_TRIGGER_USAGE2.."\n"..AUTOBUFF_TRIGGER_USAGE3.."\n"..AUTOBUFF_TRIGGER_USAGE4.."\n" |
||
1020 | ..AUTOBUFF_TRIGGER_USAGE5); end |
||
1021 | |||
1022 | elseif (c == "reload") then |
||
1023 | AutoBuff_Reload(); |
||
1024 | AutoBuff_Print(AUTOBUFF_RELOADED); |
||
1025 | |||
1026 | elseif (c == "combat") then |
||
1027 | local _,_,v,a = string.find(p,"([%w%p]+)%s*(.*)$"); |
||
1028 | if (v) and (strlen(v) > 0) and ((v == "default") or (v == ">") or (v == "<") or (v == "<>")) then |
||
1029 | if (v == "<") then v = 1; elseif (v == ">") then v = 2; elseif (v == "<>") then v = 3; end |
||
1030 | if (a) and (strlen(a) > 0) and (not vSpellList[a]) and (not vWeaponList[a]) then AutoBuff_Print(string.format(AUTOBUFF_NOTSUPPORTED, a)); |
||
1031 | else AutoBuff_Option(a, 'c', v, 1); end |
||
1032 | else AutoBuff_Print(AUTOBUFF_COMBAT_USAGE1.."\n"..AUTOBUFF_COMBAT_USAGE2.."\n"..AUTOBUFF_COMBAT_USAGE3.."\n"..AUTOBUFF_COMBAT_USAGE4 |
||
1033 | .."\n"..AUTOBUFF_COMBAT_USAGE5); end |
||
1034 | |||
1035 | elseif (c == "party") then |
||
1036 | local _,_,v,a = string.find(p,"([%w%p]+)%s*(.*)$"); |
||
1037 | if (v) and (strlen(v) > 0) and ((v == "default") or (v == ">") or (v == "<") or (v == "<>")) then |
||
1038 | if (v == "<") then v = 1; elseif (v == ">") then v = 2; elseif (v == "<>") then v = 3; end |
||
1039 | if (a) and (strlen(a) > 0) and (not vSpellList[a]) and (not vWeaponList[a]) then AutoBuff_Print(string.format(AUTOBUFF_NOTSUPPORTED, a)); |
||
1040 | else AutoBuff_Option(a, 'p', v, 1); end |
||
1041 | else AutoBuff_Print(AUTOBUFF_PARTY_USAGE1.."\n"..AUTOBUFF_PARTY_USAGE2.."\n"..AUTOBUFF_PARTY_USAGE3.."\n"..AUTOBUFF_PARTY_USAGE4 |
||
1042 | .."\n"..AUTOBUFF_PARTY_USAGE5); end |
||
1043 | |||
1044 | elseif (c == "track") then |
||
1045 | if (p) and (strlen(p) > 0) then |
||
1046 | if (p == "auto") then p = nil; |
||
1047 | elseif (p ~= "off") and (not vTrackList[p]) then AutoBuff_Print(string.format(AUTOBUFF_NOTSUPPORTED, p)); end |
||
1048 | AutoBuff_Data[vC]['t'] = p; |
||
1049 | AutoBuff_TrackLoad("show") |
||
1050 | else |
||
1051 | AutoBuff_Print(AUTOBUFF_TRACK_USAGE1.."\n"..AUTOBUFF_TRACK_USAGE2); |
||
1052 | end |
||
1053 | |||
1054 | elseif (c == "aspect") then |
||
1055 | if (p) and (strlen(p) > 0) then |
||
1056 | if (p == "auto") then p = nil; |
||
1057 | elseif (p ~= "off") and (not vAspectList[p]) then AutoBuff_Print(string.format(AUTOBUFF_NOTSUPPORTED, p)); end |
||
1058 | AutoBuff_Data[vC]['a'] = p; |
||
1059 | AutoBuff_AspectLoad("show"); |
||
1060 | else |
||
1061 | AutoBuff_Print(AUTOBUFF_ASPECT_USAGE1.."\n"..AUTOBUFF_ASPECT_USAGE2); |
||
1062 | end |
||
1063 | |||
1064 | elseif (c == "seal") then |
||
1065 | if (p) and (strlen(p) > 0) then |
||
1066 | if (p == "auto") then p = nil; |
||
1067 | elseif (p ~= "off") and (not vSealList[p]) then AutoBuff_Print(string.format(AUTOBUFF_NOTSUPPORTED, p)); end |
||
1068 | AutoBuff_Data[vC]['seal'] = p; |
||
1069 | AutoBuff_SealLoad("show"); |
||
1070 | else |
||
1071 | AutoBuff_Print(AUTOBUFF_SEAL_USAGE1.."\n"..AUTOBUFF_SEAL_USAGE2); |
||
1072 | end |
||
1073 | |||
1074 | elseif (c == "weapon") then |
||
1075 | if (p) and (strlen(p) > 0) then |
||
1076 | if (p == "auto") then p = nil; |
||
1077 | elseif (p ~= "off") and (not vWeaponList[p]) then AutoBuff_Print(string.format(AUTOBUFF_NOTSUPPORTED, p)); end |
||
1078 | AutoBuff_Data[vC]['w'] = p; |
||
1079 | AutoBuff_WeaponLoad("show") |
||
1080 | else |
||
1081 | AutoBuff_Print(AUTOBUFF_WEAPON_USAGE1.."\n"..AUTOBUFF_WEAPON_USAGE2); |
||
1082 | end |
||
1083 | |||
1084 | elseif (c == "mana") then |
||
1085 | local _,_,v,a = string.find(p,"([%w%p]+)%s*(.*)$"); |
||
1086 | if (v) and (strlen(v) > 0) and ((v == "default") or ((tonumber(v)) and (tonumber(v) >= -100) and (tonumber(v) < 100))) then |
||
1087 | if (v ~= "default") then v = math.floor(tonumber(v)); end |
||
1088 | if (a) and (strlen(a) > 0) and (not vSpellList[a]) and (not vWeaponList[a]) then AutoBuff_Print(string.format(AUTOBUFF_NOTSUPPORTED, a)); |
||
1089 | else AutoBuff_Option(a, 'm', v, 1); end |
||
1090 | else AutoBuff_Print(AUTOBUFF_MANA_USAGE1.."\n"..AUTOBUFF_MANA_USAGE2.."\n"..AUTOBUFF_MANA_USAGE3); end |
||
1091 | |||
1092 | elseif (c == "health") then |
||
1093 | local _,_,v,a = string.find(p,"([%w%p]+)%s*(.*)$"); |
||
1094 | if (v) and (strlen(v) > 0) and ((v == "default") or ((tonumber(v)) and (tonumber(v) >= -100) and (tonumber(v) < 100))) then |
||
1095 | if (v ~= "default") then v = math.floor(tonumber(v)); end |
||
1096 | if (a) and (strlen(a) > 0) and (not vSpellList[a]) and (not vWeaponList[a]) then AutoBuff_Print(string.format(AUTOBUFF_NOTSUPPORTED, a)); |
||
1097 | else AutoBuff_Option(a, 'h', v, 1); end |
||
1098 | else AutoBuff_Print(AUTOBUFF_HEALTH_USAGE1.."\n"..AUTOBUFF_HEALTH_USAGE2.."\n"..AUTOBUFF_HEALTH_USAGE3); end |
||
1099 | |||
1100 | elseif (c == "innercharges") then |
||
1101 | local _,_,v = string.find(p,"([%w%p]+)$"); |
||
1102 | if (v) and (strlen(v) > 0) and ((v == "default") or ((tonumber(v)) and (tonumber(v) > 0) and (tonumber(v) <= 19))) then |
||
1103 | if (v ~= "default") then |
||
1104 | AutoBuff_Data[vC]["innercharges"] = math.floor(tonumber(v)); |
||
1105 | else |
||
1106 | AutoBuff_Data[vC]["innercharges"] = 5; |
||
1107 | end |
||
1108 | TITAN_AUTOBUFF_INNER = "Priest Inner Fire casts at "..AutoBuff_Data[vC]["innercharges"].." charges left"; |
||
1109 | AutoBuff_Print("Inner Fire will now be cast when there are "..AutoBuff_Data[vC]["innercharges"].." charges left"); |
||
1110 | if (IsAddOnLoaded("FuBar")) then AutoBuffFu:Update(); end |
||
1111 | else AutoBuff_Print(AUTOBUFF_INNERCHARGES_USAGE1.."\n"..AUTOBUFF_INNERCHARGES_USAGE2.."\n"..AUTOBUFF_INNERCHARGES_USAGE3); AutoBuff_Print("It is currently set to "..AutoBuff_Data[vC]["innercharges"].."."); end |
||
1112 | |||
1113 | elseif (vClass == string.lower(AUTOBUFF_CLASS_WARLOCK)) and (c == "succubus") then |
||
1114 | if (AutoBuff_Data[vC]['s'] == nil) then |
||
1115 | AutoBuff_Data[vC]['s'] = 1; |
||
1116 | AutoBuff_Print("Succubus, |cffa0ffa0"..AUTOBUFF_ENABLED..FONT_COLOR_CODE_CLOSE); |
||
1117 | else |
||
1118 | AutoBuff_Data[vC]['s'] = nil; |
||
1119 | AutoBuff_Print("Succubus, |cffffa0a0"..AUTOBUFF_DISABLED..FONT_COLOR_CODE_CLOSE); |
||
1120 | end |
||
1121 | |||
1122 | elseif (c == "enable") then |
||
1123 | if (p) and (strlen(p) > 0) then |
||
1124 | if (vSpellList[p]) then AutoBuff_Option(p, 'd', "default", 1); if (AutoBuff_IsBlessing(p)) then AutoBuff_FixBlessing(p); end if (AutoBuff_IsAura(p)) then AutoBuff_FixAura(p); end |
||
1125 | else AutoBuff_Print(string.format(AUTOBUFF_NOTSUPPORTED, p)); end |
||
1126 | else |
||
1127 | AutoBuff_Print(AUTOBUFF_SETABILITY_ENABLE_USAGE1.."\n"..AUTOBUFF_SETABILITY_ENABLE_USAGE2.."\n" |
||
1128 | ..AUTOBUFF_SETABILITY_ENABLE_USAGE3.."\n"..AUTOBUFF_SETABILITY_ENABLE_USAGE4); |
||
1129 | end |
||
1130 | |||
1131 | elseif (c == "disable") then |
||
1132 | if (p) and (strlen(p) > 0) then |
||
1133 | if (vSpellList[p]) then AutoBuff_Option(p, 'd', 1, 1); |
||
1134 | else AutoBuff_Print(string.format(AUTOBUFF_NOTSUPPORTED, p)); end |
||
1135 | else |
||
1136 | AutoBuff_Print(AUTOBUFF_SETABILITY_DISABLE_USAGE1.."\n"..AUTOBUFF_SETABILITY_DISABLE_USAGE2.."\n" |
||
1137 | ..AUTOBUFF_SETABILITY_DISABLE_USAGE3.."\n"..AUTOBUFF_SETABILITY_DISABLE_USAGE4); |
||
1138 | end |
||
1139 | |||
1140 | elseif (c == "list") then |
||
1141 | local i,x,v,k,m; |
||
1142 | AutoBuff_Seperator(); |
||
1143 | local default, spell, weapon, track, aspect, seal, text = "", "", "", "", "", "", ""; |
||
1144 | text = AUTOBUFF_LIST_START.."\n-\n"; |
||
1145 | i = 1; |
||
1146 | while (i > -1) do |
||
1147 | x = AutoBuff_SpellList(i); |
||
1148 | if (not x) then break; end |
||
1149 | x = string.lower(x); |
||
1150 | if (vSpellList[x]) then spell = spell..AutoBuff_ListItem(x).."\n"; end |
||
1151 | i=i+1; |
||
1152 | end |
||
1153 | for iName, xName in vWeaponList do |
||
1154 | weapon = weapon..AutoBuff_ListItem(iName).."\n"; |
||
1155 | end |
||
1156 | for iName, xName in vTrackList do |
||
1157 | track = track..AutoBuff_ListItem(iName).."\n"; |
||
1158 | end |
||
1159 | for iName, xName in vAspectList do |
||
1160 | aspect = aspect..AutoBuff_ListItem(iName).."\n"; |
||
1161 | end |
||
1162 | for iName, xName in vSealList do |
||
1163 | seal = seal..AutoBuff_ListItem(iName).."\n"; |
||
1164 | end |
||
1165 | default = AutoBuff_ListItem('d'); |
||
1166 | if (strlen(spell) >0) then text = text..spell.."-\n"; end |
||
1167 | if (strlen(weapon) >0) then text = text..weapon.."-\n"; end |
||
1168 | if (strlen(track) >0) then text = text..track.."-\n"; end |
||
1169 | if (strlen(aspect) >0) then text = text..aspect.."-\n"; end |
||
1170 | if (strlen(seal) >0) then text = text..seal.."-\n"; end |
||
1171 | text = text..string.upper(AUTOBUFF_LIST_DEFAULT).." - "..default.."\n-"; |
||
1172 | AutoBuff_Print(text); |
||
1173 | elseif (c == "help") then |
||
1174 | AutoBuff_Print(AUTOBUFF_USAGE.."\n"..AUTOBUFF_USAGE_LIST); |
||
1175 | |||
1176 | else |
||
1177 | AutoBuffFrame_Toggle(); |
||
1178 | |||
1179 | end |
||
1180 | end |
||
1181 | |||
1182 | function AutoBuff_ListItem(i) |
||
1183 | local m = ""; |
||
1184 | if (i ~= 'd') then m = m.."|cffffffa0"..string.upper(i)..FONT_COLOR_CODE_CLOSE.." - "; end |
||
1185 | if ((AutoBuff_Data[vC]['x'][i]) and (AutoBuff_Data[vC]['x'][i]['d'] == 1)) or ((vTrackList[i]) and (vTrack ~= i)) or ((vWeaponList[i]) and (vWeapon ~= i)) or ((vAspectList[i]) and (vAspect ~= i)) or ((vSealList[i]) and (vSeal ~= i)) then return m.."|cffff5050"..AUTOBUFF_LIST_DISABLED..FONT_COLOR_CODE_CLOSE; |
||
1186 | -- EMERALD: I think this is where the "change aspect, AB disables" is happening. Why was this written? |
||
1187 | elseif (vTrackList[i]) then return m..AUTOBUFF_ENABLED; |
||
1188 | elseif (vAspectList[i]) then return m..AUTOBUFF_ENABLED; |
||
1189 | elseif (vSealList[i]) then return m..AUTOBUFF_ENABLED; end |
||
1190 | if (AutoBuff_Data[vC]['x'][i] == nil) then return m..AUTOBUFF_LIST_USINGDEFAULTS; end |
||
1191 | local trigger, health, mana, rebuff, combat, rank = "","","","","",""; |
||
1192 | for v, k in AutoBuff_Data[vC]['x'][i] do |
||
1193 | if (v == 'h') then |
||
1194 | if (k < 0) then t = "<"; k = k * -1; |
||
1195 | else t = ">"; end |
||
1196 | health = "|cffffa0a0"..AUTOBUFF_LIST_HEALTH..", "..t..k.."%"..FONT_COLOR_CODE_CLOSE.." "; |
||
1197 | elseif (v == 'm') then |
||
1198 | if (k < 0) then t = "<"; k = k * -1; |
||
1199 | else t = ">"; end |
||
1200 | mana = "|cff5e9ae4"..AUTOBUFF_LIST_MANA..", "..t..k.."%"..FONT_COLOR_CODE_CLOSE.." "; |
||
1201 | elseif (v == 'c') then |
||
1202 | if (k == 1) then combat = AUTOBUFF_LIST_COMBAT_IN; end |
||
1203 | if (k == 2) then combat = AUTOBUFF_LIST_COMBAT_OUT; end |
||
1204 | if (k == 3) then combat = AUTOBUFF_LIST_COMBAT_ALWAYS; end |
||
1205 | combat = "|cfff0802e"..combat..FONT_COLOR_CODE_CLOSE.." "; |
||
1206 | --elseif (v == 'r') and (not AutoBuff_IsAura(i)) and (i ~= string.lower(AUTOBUFF_ABILITY_TRUESHOTAURA)) then |
||
1207 | elseif (v == 'r') and (not AutoBuff_IsAura(i)) then |
||
1208 | rebuff = "|cffa0a0a0"..string.format(AUTOBUFF_LIST_REBUFF,k)..FONT_COLOR_CODE_CLOSE.." "; |
||
1209 | elseif (v == 't') then |
||
1210 | trigger = "|cffe0e0e0"..AUTOBUFF_LIST_TRIGGER..", "..k..FONT_COLOR_CODE_CLOSE.." "; |
||
1211 | elseif (v == 'k') then |
||
1212 | rank = "|cffffa0ff"..AUTOBUFF_LIST_RANK..", "..k..FONT_COLOR_CODE_CLOSE.." "; |
||
1213 | end |
||
1214 | end |
||
1215 | if (strlen(trigger..health..mana..rebuff..combat..rank) < 1) then rebuff = AUTOBUFF_LIST_USINGDEFAULTS; end |
||
1216 | m = m..trigger..health..mana..rebuff..combat..rank; |
||
1217 | return m; |
||
1218 | end |
||
1219 | |||
1220 | function AutoBuff_IsBlessing(n) |
||
1221 | local a,d; |
||
1222 | n = string.lower(n); |
||
1223 | for _, d in cBlessing do |
||
1224 | a = string.lower(d); |
||
1225 | if (n == a) then a = 1; break; end |
||
1226 | end |
||
1227 | if (a == 1) then return 1; end |
||
1228 | end |
||
1229 | |||
1230 | function AutoBuff_IsAura(n) |
||
1231 | local a,d; |
||
1232 | n = string.lower(n); |
||
1233 | for _, d in cAura do |
||
1234 | a = string.lower(d); |
||
1235 | if (n == a) then a = 1; break; end |
||
1236 | end |
||
1237 | if (a == 1) then return 1; end |
||
1238 | end |
||
1239 | |||
1240 | function AutoBuff_FixBlessing(b) |
||
1241 | b = string.lower(b); |
||
1242 | local n,a; |
||
1243 | for _, n in cBlessing do |
||
1244 | a = string.lower(n); |
||
1245 | if (a ~= b) and (vSpellList[a]) then AutoBuff_Option(a, 'd', 1); end |
||
1246 | end |
||
1247 | end |
||
1248 | |||
1249 | function AutoBuff_FixAura(b) |
||
1250 | b = string.lower(b); |
||
1251 | local n,a; |
||
1252 | for _, n in cAura do |
||
1253 | a = string.lower(n); |
||
1254 | if (a ~= b) and (vSpellList[a]) then AutoBuff_Option(a, 'd', 1); end |
||
1255 | end |
||
1256 | end |
||
1257 | |||
1258 | function AutoBuff_PaladinSetup() |
||
1259 | local i,n,d,o,x; |
||
1260 | x = table.getn(cSpellList); |
||
1261 | o = 0; |
||
1262 | while (o > -1) do |
||
1263 | n = cBlessing[o]; |
||
1264 | if (not n) then break; end |
||
1265 | i=0; |
||
1266 | cSpellList[n] = { ['type'] = "friendly", ['i'] = (x+o+1) }; |
||
1267 | for _, d in cBlessing do |
||
1268 | if (n ~= d) then cSpellList[n][i] = string.lower(d); i=i+1; end |
||
1269 | end |
||
1270 | for _, d in cBlessingOther do |
||
1271 | cSpellList[n][i] = string.lower(d); i=i+1 |
||
1272 | end |
||
1273 | o=o+1; |
||
1274 | end |
||
1275 | x = x+o; |
||
1276 | o = 0; |
||
1277 | while (o > -1) do |
||
1278 | n = cAura[o]; |
||
1279 | if (not n) then break; end |
||
1280 | i=0; |
||
1281 | cSpellList[n] = { ['type'] = "self", ['i'] = (x+o+1) }; |
||
1282 | for _, d in cAura do |
||
1283 | if (n ~= d) then cSpellList[n][i] = string.lower(d); i=i+1; end |
||
1284 | end |
||
1285 | o=o+1; |
||
1286 | end |
||
1287 | end |
||
1288 | |||
1289 | function AutoBuff_BuffName(i, filter) |
||
1290 | --AutoBuffTooltip:SetOwner(WorldFrame,"ANCHOR_NONE"); |
||
1291 | if (filter == nil) then filter = "HELPFUL|HARMFUL"; end |
||
1292 | local iBuff,iBuffConc = GetPlayerBuff(i, filter); |
||
1293 | if (iBuff >= 0) and (iBuff < 24) then |
||
1294 | --local tooltip = AutoBuffTooltip; |
||
1295 | --tooltip:Hide(); |
||
1296 | --tooltip:SetPlayerBuff(iBuff); |
||
1297 | local tooltip = AutoBuffTooltip; |
||
1298 | tooltip:SetOwner(tooltip,"ANCHOR_NONE"); |
||
1299 | tooltip:ClearLines(); |
||
1300 | tooltip:SetPlayerBuff(iBuff); |
||
1301 | local toolTipText = getglobal("AutoBuffTooltipTextLeft1"); |
||
1302 | if (toolTipText) then |
||
1303 | local name = toolTipText:GetText(); |
||
1304 | if ( name ~= nil ) then return iBuff, name, iBuffConc; end |
||
1305 | end |
||
1306 | end |
||
1307 | end |
||
1308 | |||
1309 | function AutoBuff_IsBuffActive(buffname) |
||
1310 | --AutoBuffTooltip:SetOwner("UIParent", "ANCHOR_NONE"); |
||
1311 | if (not buffname) then |
||
1312 | return; |
||
1313 | end; |
||
1314 | unit="player"; |
||
1315 | local i = 1; |
||
1316 | while UnitBuff(unit, i) do |
||
1317 | AutoBuffTooltip:ClearLines(); |
||
1318 | AutoBuffTooltip:SetUnitBuff(unit,i); |
||
1319 | if string.find(AutoBuffTooltipTextLeft1:GetText() or "", buffname) then |
||
1320 | return true, i |
||
1321 | end; |
||
1322 | i = i + 1; |
||
1323 | end; |
||
1324 | end |
||
1325 | |||
1326 | function AutoBuff_IsDebuffActive(buffname) |
||
1327 | --AutoBuffTooltip:SetOwner("UIParent", "ANCHOR_NONE"); |
||
1328 | if (not buffname) then |
||
1329 | return; |
||
1330 | end; |
||
1331 | unit="player"; |
||
1332 | local i = 1; |
||
1333 | while UnitDebuff(unit, i) do |
||
1334 | AutoBuffTooltip:ClearLines(); |
||
1335 | AutoBuffTooltip:SetUnitDebuff(unit,i); |
||
1336 | if string.find(AutoBuffTooltipTextLeft1:GetText() or "", buffname) then |
||
1337 | return true, i |
||
1338 | end; |
||
1339 | i = i + 1; |
||
1340 | end; |
||
1341 | end |
||
1342 | |||
1343 | function AutoBuff_BuffLine(i, line, filter) |
||
1344 | --AutoBuffTooltip:SetOwner(WorldFrame,"ANCHOR_NONE"); |
||
1345 | if (filter == nil) then filter = "HELPFUL|HARMFUL"; end |
||
1346 | local iBuff,_ = GetPlayerBuff(i, filter); |
||
1347 | if (iBuff >= 0) and (iBuff < 24) then |
||
1348 | --local tooltip = AutoBuffTooltip; |
||
1349 | --tooltip:SetPlayerBuff(iBuff); |
||
1350 | --tooltip:Hide(); |
||
1351 | local tooltip = AutoBuffTooltip; |
||
1352 | tooltip:SetOwner(tooltip,"ANCHOR_NONE"); |
||
1353 | tooltip:ClearLines(); |
||
1354 | tooltip:SetPlayerBuff(iBuff); |
||
1355 | local toolTipText = getglobal("AutoBuffTooltipTextLeft"..line); |
||
1356 | if (toolTipText) then |
||
1357 | local name = toolTipText:GetText(); |
||
1358 | if ( name ~= nil ) then return iBuff, name; end |
||
1359 | end |
||
1360 | end |
||
1361 | end |
||
1362 | |||
1363 | function AutoBuff_ShieldMod_SetCTShieldMod() -- EMERALD |
||
1364 | --local highestRank = AutoBuff_GetHighestSpellRank("Power Word: Shield"); |
||
1365 | local highestRank = AutoBuff_Rank(AUTOBUFF_ABILITY_PWSHIELD); |
||
1366 | highestRank = tonumber(highestRank); |
||
1367 | AutoBuff_Debug("highestRank="..tostring(highestRank)); |
||
1368 | local dmg; |
||
1369 | if (highestRank) then |
||
1370 | if (highestRank==1) then |
||
1371 | dmg = "48"; |
||
1372 | elseif (highestRank==2) then |
||
1373 | dmg = "94"; |
||
1374 | elseif (highestRank==3) then |
||
1375 | dmg = "166"; |
||
1376 | elseif (highestRank==4) then |
||
1377 | dmg = "242"; |
||
1378 | elseif (highestRank==5) then |
||
1379 | dmg = "301"; |
||
1380 | elseif (highestRank==6) then |
||
1381 | dmg = "381"; |
||
1382 | elseif (highestRank==7) then |
||
1383 | dmg = "484"; |
||
1384 | elseif (highestRank==8) then |
||
1385 | dmg = "605"; |
||
1386 | elseif (highestRank==9) then |
||
1387 | dmg = "763"; |
||
1388 | elseif (highestRank==10) then |
||
1389 | dmg = "942"; |
||
1390 | end |
||
1391 | if (dmg) then |
||
1392 | CT_ShieldMod_ShieldDamageLeft = tonumber(dmg); |
||
1393 | CT_ShieldFrame:Hide(); |
||
1394 | CT_ShieldFrame:Show(); |
||
1395 | end |
||
1396 | end |
||
1397 | end |
||
1398 | |||
1399 | function AutoBuff_CanCast(spell, trigger, ltime) |
||
1400 | local translatedSpell = spell; |
||
1401 | if (spell=="track") then translatedSpell = string.lower(vTrack); |
||
1402 | elseif (spell=="aspect") then translatedSpell = string.lower(vAspect); |
||
1403 | elseif (spell=="seal") then translatedSpell = string.lower(vSeal); |
||
1404 | end |
||
1405 | local t = AutoBuff_Trigger(translatedSpell); |
||
1406 | AutoBuff_Debug("CanCast: trigger="..trigger..", translatedSpell="..translatedSpell); |
||
1407 | if (AutoBuff_CheckCombat(translatedSpell)) then AutoBuff_Debug("AutoBuff_CheckCombat=true"); else AutoBuff_Debug("AutoBuff_CheckCombat=false"); end |
||
1408 | if (AutoBuff_CheckParty(translatedSpell)) then AutoBuff_Debug("AutoBuff_CheckParty=true"); else AutoBuff_Debug("AutoBuff_CheckParty=false"); end |
||
1409 | if (AutoBuff_Mana(translatedSpell)) then AutoBuff_Debug("AutoBuff_Mana=true"); else AutoBuff_Debug("AutoBuff_Mana=false"); end |
||
1410 | if (AutoBuff_Health(translatedSpell)) then AutoBuff_Debug("AutoBuff_Health=true"); else AutoBuff_Debug("AutoBuff_Health=false"); end |
||
1411 | if (AutoBuff_Option(translatedSpell,'d')) then AutoBuff_Debug("Enabled=false"); else AutoBuff_Debug("Enabled=true"); end |
||
1412 | --if () then AutoBuff_Debug(""); else AutoBuff_Debug(""); end |
||
1413 | --AutoBuff_Debug(""); |
||
1414 | |||
1415 | if (translatedSpell == string.lower(AUTOBUFF_ABILITY_UNENDING_BREATH) or translatedSpell == string.lower(AUTOBUFF_ABILITY_WATER_BREATHING)) then |
||
1416 | local ltimer = time(); |
||
1417 | if (AutoBuff_Data[vC]["water"]) then |
||
1418 | if (vBreath > ltimer) or vBreath == 0 then |
||
1419 | AutoBuff_Debug(" Cannot cast "..translatedSpell.." because you haven't been underwater for more than 30 seconds. Type \"/autobuff water\" to change this behavior."); |
||
1420 | AutoBuff_Debug(" vBreath="..vBreath..", ltimer="..ltimer); |
||
1421 | return nil; |
||
1422 | end |
||
1423 | end |
||
1424 | end |
||
1425 | |||
1426 | if ((trigger == 0) or (t[trigger] == 1)) and |
||
1427 | (not AutoBuff_Option(translatedSpell,'d')) and |
||
1428 | (AutoBuff_CheckCombat(translatedSpell)) and |
||
1429 | (AutoBuff_CheckParty(translatedSpell)) and |
||
1430 | ((not ltime) or ((ltime ~= -1) and (AutoBuff_Rebuff(translatedSpell, ltime)))) and |
||
1431 | (((spell == "track") or (spell == "aspect")) or |
||
1432 | (AutoBuff_Mana(translatedSpell)) and |
||
1433 | (AutoBuff_Health(translatedSpell))) then |
||
1434 | local spell_texture = GetSpellTexture(AutoBuff_Ability(translatedSpell), BOOKTYPE_SPELL); |
||
1435 | if (spell=="track") then return 1; end |
||
1436 | if (vClass == string.lower(AUTOBUFF_CLASS_WARLOCK)) then |
||
1437 | if (spell == string.lower(AUTOBUFF_ABILITY_SOULLINK)) then |
||
1438 | if (UnitHealth("pet") > 1) then -- Only cast Soul Link if the demon is out |
||
1439 | -- Scan debuffs, don't cast if your pet is Banished or Enslaved |
||
1440 | local i = 1; |
||
1441 | while (UnitDebuff("pet", i)) do |
||
1442 | if (UnitDebuff("pet", i)==cPre..cEnslave or UnitDebuff("pet", i)==cPre..cBanish) then |
||
1443 | return nil; |
||
1444 | end |
||
1445 | i = i + 1; |
||
1446 | end |
||
1447 | return 1; |
||
1448 | end |
||
1449 | elseif (spell == string.lower(AUTOBUFF_ABILITY_DARK_PACT)) then |
||
1450 | if (UnitMana("pet") > 1) then -- Only Dark Pact if demon is out and has mana |
||
1451 | if ((UnitManaMax("player")-UnitMana("player")) >= 150) then -- Only if needed |
||
1452 | return 1; |
||
1453 | else |
||
1454 | return nil; |
||
1455 | end |
||
1456 | else |
||
1457 | return nil; |
||
1458 | end |
||
1459 | else |
||
1460 | return 1; |
||
1461 | end |
||
1462 | |||
1463 | elseif (vClass == string.lower(AUTOBUFF_CLASS_ROGUE)) then |
||
1464 | -- Don't cast any spells when rogue is stealthed |
||
1465 | local i = 1; |
||
1466 | while (UnitBuff("player", i)) do |
||
1467 | if (UnitBuff("player", i)==cPre..cStealth) then |
||
1468 | AutoBuff_Debug("ROGUE: Can't cast spells in Stealth Mode!"); |
||
1469 | return nil; |
||
1470 | end |
||
1471 | i = i + 1; |
||
1472 | end |
||
1473 | return 1; |
||
1474 | |||
1475 | else |
||
1476 | return 1; |
||
1477 | end |
||
1478 | |||
1479 | end |
||
1480 | end |
||
1481 | |||
1482 | function AutoBuff_Check(trigger) -- EMERALD: TriggerFire |
||
1483 | -- Check for frames that, while visible, should block spellcasting |
||
1484 | if (CastingBarFrame and CastingBarFrame:IsVisible()) then return; end |
||
1485 | if (eCastingBar and eCastingBar:IsVisible()) then return; end |
||
1486 | if (Perl_ArcaneBarFrame and Perl_ArcaneBarFrame:IsVisible()) then return; end |
||
1487 | if (LootFrame and LootFrame:IsVisible()) then AutoBuff_Debug("Can't cast: LootFrame is visible!"); return; end |
||
1488 | |||
1489 | local ltime = time(); |
||
1490 | if (vTime > ltime) or (vSit > ltime) then return; end |
||
1491 | |||
1492 | if (AutoBuff_Data[vC]['e'] == 1) and |
||
1493 | (not UnitOnTaxi("player")) and |
||
1494 | (not CursorHasItem()) and |
||
1495 | (not CursorHasSpell()) and |
||
1496 | (not SpellIsTargeting()) and |
||
1497 | (not UnitIsDeadOrGhost("player")) then |
||
1498 | AutoBuff_Debug("----------------------------"); |
||
1499 | AutoBuff_Debug("### Beginning buff-check ###"); |
||
1500 | local buffline,mounted,poly,buffIndex,buffName,buffConc,i,done,iName,xName,iiName,xxName,id; |
||
1501 | local polyShadowform = nil; |
||
1502 | local polyMoon = nil; |
||
1503 | local polyCat = nil; |
||
1504 | local polyBlessing = nil; |
||
1505 | local iBuff = {}; |
||
1506 | |||
1507 | for i=0,23 do -- Cycle currently active buffs |
||
1508 | buffIndex, buffName, buffConc = AutoBuff_BuffName(i, "HELPFUL|HARMFUL"); |
||
1509 | if (buffName) then |
||
1510 | |||
1511 | -- This is done outside of the Class Poly loop because we don't store Greater Blessings in Class Poly's |
||
1512 | if (vClass == string.lower(AUTOBUFF_CLASS_PALADIN)) then |
||
1513 | if (cBlessingPoly[buffName]) then -- A greater blessing was found on the player |
||
1514 | polyBlessing = string.lower(buffName); |
||
1515 | end |
||
1516 | end |
||
1517 | |||
1518 | buffName = string.lower(buffName); |
||
1519 | |||
1520 | for iName, xName in cPolyList[vClass] do -- Cycle list of Class Poly's |
||
1521 | |||
1522 | -- Don't POLY for AUTOBUFF_POLY_PRIEST_SPIRITTAP if mana is currently full |
||
1523 | if (vClass == string.lower(AUTOBUFF_CLASS_PRIEST)) then |
||
1524 | if (buffName == string.lower(AUTOBUFF_POLY_PRIEST_SPIRITTAP) and AutoBuff_Data[vC]["tap"]) then |
||
1525 | AutoBuff_Debug(" Spirit Tap is currently active..."); |
||
1526 | if (UnitMana("player")==UnitManaMax("player")) then |
||
1527 | -- Mana is full, we can go ahead and cast even though Spirit Tap is active. |
||
1528 | AutoBuff_Debug(" Player's Mana is full, ignoring Spirit Tap."); |
||
1529 | else |
||
1530 | AutoBuff_Debug(" Player's Mana is regenerating -- blocking other spells from firing."); |
||
1531 | poly = string.lower(iName); |
||
1532 | do break end; |
||
1533 | end |
||
1534 | end |
||
1535 | -- Prevent Holy spells from firing while in Shadowform |
||
1536 | if (buffName == string.lower(AUTOBUFF_POLY_PRIEST_SHADOWFORM)) then |
||
1537 | polyShadowform = true; |
||
1538 | end |
||
1539 | |||
1540 | elseif (vClass == string.lower(AUTOBUFF_CLASS_WARLOCK)) then |
||
1541 | if (buffName == string.lower(AUTOBUFF_POLY_WARLOCK_SOULSIPHON) and AutoBuff_Data[vC]["tap"]) then |
||
1542 | AutoBuff_Debug(" Soul Siphon is currently active..."); |
||
1543 | if (UnitMana("player")==UnitManaMax("player")) then |
||
1544 | -- Mana is full, we can go ahead and cast even though Soul Siphon is active. |
||
1545 | AutoBuff_Debug(" Player's Mana is full, ignoring Soul Siphon."); |
||
1546 | else |
||
1547 | AutoBuff_Debug(" Player's Mana is regenerating -- blocking other spells from firing."); |
||
1548 | poly = string.lower(iName); |
||
1549 | do break end; |
||
1550 | end |
||
1551 | end |
||
1552 | |||
1553 | elseif (vClass == string.lower(AUTOBUFF_CLASS_DRUID)) then |
||
1554 | -- Don't POLY for AUTOBUFF_POLY_DRUID_CAT if casting Track Humanoids |
||
1555 | if (buffName == string.lower(AUTOBUFF_POLY_DRUID_CAT)) then |
||
1556 | polyCat = true; |
||
1557 | -- Don't allow Mark of the Wild if you're a Moonkin |
||
1558 | elseif (buffName == string.lower(AUTOBUFF_POLY_DRUID_MOONKIN)) then |
||
1559 | polyMoon = true; |
||
1560 | end |
||
1561 | end |
||
1562 | |||
1563 | if (buffName == string.lower(iName)) then |
||
1564 | if (string.lower(iName)~=string.lower(AUTOBUFF_POLY_DRUID_CAT) and string.lower(iName)~=string.lower(AUTOBUFF_POLY_DRUID_MOONKIN) and string.lower(iName)~=string.lower(AUTOBUFF_POLY_PRIEST_SHADOWFORM) and string.lower(iName)~=string.lower(AUTOBUFF_POLY_PRIEST_SPIRITTAP) and string.lower(iName)~=string.lower(AUTOBUFF_POLY_WARLOCK_SOULSIPHON)) then |
||
1565 | -- Only break if this poly isn't polyCat, polyMoon, or polyShadowform (nor SpiritTap) |
||
1566 | AutoBuff_Debug(" STOP -- Poly found: "..iName); |
||
1567 | poly = string.lower(iName); |
||
1568 | do break end; |
||
1569 | end |
||
1570 | end |
||
1571 | |||
1572 | -- PRIEST LOGIC: |
||
1573 | -- SpiritTap+FullMana = GO |
||
1574 | -- SpiritTap+FullMana+Shadowform = GO |
||
1575 | -- SpiritTap+LowMana = STOP |
||
1576 | -- SpiritTap+LowMana+Shadowmeld(ALL_POLY) = STOP |
||
1577 | |||
1578 | end -- for iName, xName in cPolyList[vClass] do |
||
1579 | |||
1580 | for iName, xName in cPolyList["all"] do -- Cycle list of All Poly's (invis, shadowmeld) |
||
1581 | if (buffName == string.lower(iName)) then |
||
1582 | AutoBuff_Debug(" STOP -- Poly found: "..iName); |
||
1583 | poly = string.lower(iName); |
||
1584 | do break end; |
||
1585 | end |
||
1586 | end |
||
1587 | |||
1588 | if (buffConc == 1) then |
||
1589 | iBuff[buffName] = -1; |
||
1590 | else |
||
1591 | iBuff[buffName] = GetPlayerBuffTimeLeft(buffIndex); |
||
1592 | end |
||
1593 | |||
1594 | -- MOUNT CHECK |
||
1595 | _, buffline = AutoBuff_BuffLine(i, 2, "HELPFUL|HARMFUL"); |
||
1596 | if (buffline) then |
||
1597 | buffline = string.lower(buffline); |
||
1598 | if ((buffline == string.lower(AUTOBUFF_MOUNT_60)) or (buffline == string.lower(AUTOBUFF_MOUNT_100)) or (buffline == string.lower(AUTOBUFF_MOUNT_60_2)) or (buffline == string.lower(AUTOBUFF_MOUNT_100_2)) or (buffline == string.lower(AUTOBUFF_MOUNT_60_3)) or (buffline == string.lower(AUTOBUFF_MOUNT_100_3))) then |
||
1599 | mounted = true; |
||
1600 | end |
||
1601 | end -- if (buffline) then |
||
1602 | |||
1603 | end -- if (buffName) then |
||
1604 | end -- for i=0,23 do |
||
1605 | |||
1606 | for i=1,10 do buffName = UnitDebuff("player",i); |
||
1607 | if (buffName and buffName == cPre..cSheep) then |
||
1608 | poly = "Sheep"; |
||
1609 | end |
||
1610 | end |
||
1611 | |||
1612 | if (poly == nil) then |
||
1613 | |||
1614 | if (not mounted or (mounted and vClass==string.lower(AUTOBUFF_CLASS_PALADIN))) then |
||
1615 | for iName, xName in vSpellList do |
||
1616 | local several = nil; |
||
1617 | local polyCatCast = nil; |
||
1618 | local polyMoonCast = nil; |
||
1619 | local polyRogue = nil; |
||
1620 | local polyPaladin = nil; |
||
1621 | local polyRejuv = nil; |
||
1622 | if (AutoBuff_CanCast(iName, trigger, iBuff[iName])) then |
||
1623 | for iiName, xxName in vSpellList[iName] do |
||
1624 | if (iiName ~= "type") and (iBuff[xxName]) then several = true; break; end |
||
1625 | end |
||
1626 | if (not several) then |
||
1627 | id = AutoBuff_Ability(iName); |
||
1628 | if (AutoBuff_Cooldown(id) == 0) then |
||
1629 | |||
1630 | if (vClass==string.lower(AUTOBUFF_CLASS_PRIEST) and polyShadowform) then |
||
1631 | -- put Holy spells in if statements, below, to prevent casting those spells in Shadow form |
||
1632 | if (iName == string.lower(AUTOBUFF_ABILITY_FEARWARD) or iName == string.lower(AUTOBUFF_ABILITY_RENEW)) then |
||
1633 | AutoBuff_Debug(" Cannot cast "..iName.." - Shadowform is active."); |
||
1634 | else |
||
1635 | polyShadowform = nil; |
||
1636 | end |
||
1637 | |||
1638 | elseif (vClass==string.lower(AUTOBUFF_CLASS_ROGUE)) then |
||
1639 | if (iName == string.lower(AUTOBUFF_ABILITY_FEINT) or iName == string.lower(AUTOBUFF_ABILITY_BLADE_FLURRY)) then |
||
1640 | if (UnitAffectingCombat("player") and UnitExists("target") and UnitReaction("target","player") <= 4 and CheckInteractDistance("target",1)) then |
||
1641 | -- Only if (1) in combat, (2) has target, (3) target is attackable, (4) 5 yards or closer. |
||
1642 | polyRogue = nil; |
||
1643 | else |
||
1644 | polyRogue = true; |
||
1645 | AutoBuff_Debug(" Cannot cast "..iName.." - Combat conditions are not correct (in combat, target attackable, 5 yards or less)"); |
||
1646 | end |
||
1647 | end |
||
1648 | |||
1649 | elseif (vClass==string.lower(AUTOBUFF_CLASS_DRUID) and polyMoon and iName ~= string.lower(AUTOBUFF_ABILITY_TRACK_HUMANOIDS) and iName ~= string.lower(AUTOBUFF_ABILITY_COWER)) then |
||
1650 | -- put Balance spells in if statements, below, to prevent casting those spells in Moonkin form |
||
1651 | if (iName == string.lower(AUTOBUFF_ABILITY_MOTW) or iName == string.lower(AUTOBUFF_ABILITY_REJUV)) then |
||
1652 | AutoBuff_Debug(" Cannot cast "..iName.." - Moonkin form is active."); |
||
1653 | polyMoonCast = true; |
||
1654 | else |
||
1655 | polyMoonCast = nil; |
||
1656 | end |
||
1657 | |||
1658 | elseif (vClass==string.lower(AUTOBUFF_CLASS_DRUID)) then |
||
1659 | if (iName == string.lower(AUTOBUFF_ABILITY_TRACK_HUMANOIDS) or iName == string.lower(AUTOBUFF_ABILITY_COWER)) then |
||
1660 | if (polyCat) then |
||
1661 | if (iName == string.lower(AUTOBUFF_ABILITY_TRACK_HUMANOIDS)) then |
||
1662 | if (GetTrackingTexture()) then |
||
1663 | local iconTrack = GetTrackingTexture(); |
||
1664 | AutoBuff_Debug(" Track already enabled: "..iconTrack); |
||
1665 | if (iconTrack==cPre..cTracking) then |
||
1666 | polyCatCast = true; -- don't recast if it's already on! |
||
1667 | end |
||
1668 | else |
||
1669 | polyCatCast = nil; --polyCat = nil; -- Can cast, clear polyCatCast. |
||
1670 | end |
||
1671 | elseif (iName == string.lower(AUTOBUFF_ABILITY_COWER)) then |
||
1672 | if (UnitAffectingCombat("player") and UnitExists("target") and UnitReaction("target","player") <= 4 and CheckInteractDistance("target",1)) then |
||
1673 | -- Only if (1) in combat, (2) has target, (3) target is attackable, (4) 5 yards or closer. |
||
1674 | polyCatCast = nil; -- Can cast, clear polyCatCast. |
||
1675 | else |
||
1676 | AutoBuff_Debug(" Cannot cast "..iName.." - Combat conditions are not correct (in combat, target attackable, 5 yards or less)"); |
||
1677 | polyCatCast = true; |
||
1678 | end |
||
1679 | end |
||
1680 | elseif (polyMoon) then |
||
1681 | AutoBuff_Debug(" Cannot cast "..iName.." - You're not in cat form."); |
||
1682 | polyCatCast = true; |
||
1683 | else -- not polyCat |
||
1684 | AutoBuff_Debug(" Cannot cast "..iName.." - You're not in cat form."); |
||
1685 | polyCatCast = true; |
||
1686 | end |
||
1687 | else |
||
1688 | if (polyCat) then |
||
1689 | AutoBuff_Debug(" Cannot cast "..iName.." - Only Track Humanoids or Cower can be cast in cat form."); |
||
1690 | polyCatCast = true; |
||
1691 | end |
||
1692 | end |
||
1693 | |||
1694 | elseif (vClass == string.lower(AUTOBUFF_CLASS_PALADIN)) then |
||
1695 | if (mounted) then |
||
1696 | if (not AutoBuff_IsAura(iName)) then |
||
1697 | polyPaladin = true; -- don't cast anything other than an Aura while mounted |
||
1698 | end |
||
1699 | elseif (polyBlessing and polyBlessing==iName) then |
||
1700 | -- Lesser spell (same effect as the Greater Blessing on the player currently) attempting to be cast |
||
1701 | AutoBuff_Debug(" Cannot cast "..iName.." - A Greater Blessing with the same effect is already active."); |
||
1702 | polyPaladin = true; |
||
1703 | end |
||
1704 | |||
1705 | --elseif (vClass==string.lower(AUTOBUFF_CLASS_)) then |
||
1706 | end |
||
1707 | |||
1708 | if (iName==string.lower(AUTOBUFF_ABILITY_REJUV) or iName==string.lower(AUTOBUFF_ABILITY_RENEW)) then |
||
1709 | local ltime = time(); |
||
1710 | if (vRejuv > ltime) then polyRejuv = true; end |
||
1711 | end |
||
1712 | |||
1713 | -- CASTING ROUTINE |
||
1714 | if (not polyShadowform and not polyCatCast and not polyMoonCast and not polyRogue and not polyPaladin and not polyRejuv) then |
||
1715 | AutoBuff_Debug(" Casting Buff: "..iName); |
||
1716 | done = true; |
||
1717 | AutoBuff_UseAbility(iName,xName.type); |
||
1718 | AutoBuff_Debug(" iName="..iName); |
||
1719 | if (iName==string.lower(AUTOBUFF_ABILITY_PWSHIELD)) then |
||
1720 | -- Set CT_ShieldMod's initial damage ounter |
||
1721 | if (CT_ShieldFrame) then |
||
1722 | AutoBuff_ShieldMod_SetCTShieldMod(); |
||
1723 | AutoBuff_Debug("Setting CT_Shield"); |
||
1724 | end |
||
1725 | end |
||
1726 | if (iName==string.lower(AUTOBUFF_ABILITY_REJUV) or iName==string.lower(AUTOBUFF_ABILITY_RENEW)) then |
||
1727 | -- Set vRejuv, which allows the spell time to work before it can fire again |
||
1728 | vRejuv = time() + 15; -- Rejuv is 12 sec, but Renew is 15 (and Improved Rejuv Duration is 15), so I'm going with the higher common number. |
||
1729 | end |
||
1730 | do break end; |
||
1731 | end |
||
1732 | |||
1733 | end |
||
1734 | end |
||
1735 | end |
||
1736 | end |
||
1737 | if (not done) then |
||
1738 | local m,o,_,_,_,_ = GetWeaponEnchantInfo(); |
||
1739 | if (o) then o = floor(o/1000); end |
||
1740 | if (vWeapon) and AutoBuff_CanCast(vWeapon, trigger, o) then |
||
1741 | --local mhHasItem,_,_=GameTooltip:SetInventoryItem("player",16); |
||
1742 | --local ohHasItem,_,_=GameTooltip:SetInventoryItem("player",17); |
||
1743 | --if (mhHasItem or ohHasItem) then |
||
1744 | AutoBuff_Debug(" Weapon Buff: "..vWeapon); |
||
1745 | AutoBuff_UseAbility(vWeapon,'self'); |
||
1746 | --else |
||
1747 | --AutoBuff_Debug(" Weapon Buff cannot be cast. You have no melee weapon equipped."); |
||
1748 | --end |
||
1749 | end |
||
1750 | local a, b, c, d, e; |
||
1751 | if (vWeapon) then a = vWeapon; else a = "false"; end |
||
1752 | if (m) then |
||
1753 | b = m; |
||
1754 | if (AutoBuff_Rebuff(vWeapon, floor(o/1000))) then c = "true"; else c = "false"; end |
||
1755 | else b = "false"; c = "none"; |
||
1756 | end |
||
1757 | if (AutoBuff_Mana(vWeapon)) then d = "true"; else d = "false"; end |
||
1758 | if (AutoBuff_Health(vWeapon)) then e = "true"; else e = "false"; end |
||
1759 | AutoBuff_Debug(" Weapon, "..a.."; m, "..b.."; rebuff, "..c.."; mana, "..d.."; health, "..e); |
||
1760 | end |
||
1761 | end |
||
1762 | end |
||
1763 | |||
1764 | if (vSeal and not mounted and not poly) then |
||
1765 | AutoBuff_Debug("Check Seal Setting..."); |
||
1766 | local buffline,mounted,poly,buffIndex,buffName,buffConc,i,done,iName,xName,iiName,xxName,id; local iBuff = {}; |
||
1767 | local hasSeal = false; |
||
1768 | for i=0,23 do |
||
1769 | buffIndex, buffName, buffConc = AutoBuff_BuffName(i, "HELPFUL|HARMFUL"); |
||
1770 | if (buffName) then |
||
1771 | if (string.find(buffName,AUTOBUFF_SEAL)) then hasSeal = true; break; end |
||
1772 | end |
||
1773 | end |
||
1774 | if (not hasSeal) then |
||
1775 | if (AutoBuff_CanCast("seal", trigger, nil)) then |
||
1776 | AutoBuff_UseAbility(vSeal,'self'); |
||
1777 | AutoBuff_Debug(" Seal not found. Casting "..vSeal); |
||
1778 | else |
||
1779 | AutoBuff_Debug(" Seal not found, but I can't cast right now."); |
||
1780 | end |
||
1781 | else |
||
1782 | AutoBuff_Debug(" Seal found. Doing nothing."); |
||
1783 | end |
||
1784 | end |
||
1785 | |||
1786 | if (vAspect and not mounted and not poly) then |
||
1787 | AutoBuff_Debug("Check Aspect Setting..."); |
||
1788 | local buffline,mounted,poly,buffIndex,buffName,buffConc,i,done,iName,xName,iiName,xxName,id; local iBuff = {}; |
||
1789 | local hasAspect = false; |
||
1790 | for i=0,23 do |
||
1791 | buffIndex, buffName, buffConc = AutoBuff_BuffName(i, "HELPFUL|HARMFUL"); |
||
1792 | if (buffName) then |
||
1793 | --buffName = string.lower(buffName); |
||
1794 | --buffCompare = string.lower(AUTOBUFF_ASPECT_OF); |
||
1795 | --AutoBuff_Debug(" Comparing "..buffName.." to "..vAspect); |
||
1796 | if (string.find(buffName,AUTOBUFF_ASPECT_OF)) then hasAspect = true; break; end |
||
1797 | end |
||
1798 | end |
||
1799 | if (not hasAspect) then |
||
1800 | if (AutoBuff_CanCast("aspect", trigger, nil)) then |
||
1801 | AutoBuff_UseAbility(vAspect,'self'); |
||
1802 | AutoBuff_Debug(" Aspect not found. Casting "..vAspect); |
||
1803 | else |
||
1804 | AutoBuff_Debug(" Aspect not found, but I can't cast right now."); |
||
1805 | end |
||
1806 | else |
||
1807 | AutoBuff_Debug(" Aspect found. Doing nothing."); |
||
1808 | end |
||
1809 | end |
||
1810 | |||
1811 | if (vClass == string.lower(AUTOBUFF_CLASS_DRUID) and polyCat and not AutoBuff_Option(string.lower(AUTOBUFF_ABILITY_TRACK_HUMANOIDS),'d')) then -- Druid + Cat + Track Humanoids (enabled) |
||
1812 | done = true; -- Do NOT check normal tracking if Track Humanoids is being fired on the Cat form. |
||
1813 | end |
||
1814 | |||
1815 | if ((not done or vClass == string.lower(AUTOBUFF_CLASS_ROGUE))) then |
||
1816 | AutoBuff_Debug("Check Track Setting..."); |
||
1817 | if (vTrack) then |
||
1818 | AutoBuff_Debug(" Found: "..vTrack); |
||
1819 | if (not GetTrackingTexture()) then |
||
1820 | if (AutoBuff_CanCast("track", trigger, nil)) then |
||
1821 | AutoBuff_Debug(" Tracking Ability: "..vTrack); |
||
1822 | AutoBuff_UseAbility(vTrack,'self'); |
||
1823 | else |
||
1824 | AutoBuff_Debug(" Track failed 'CanCast'."); |
||
1825 | end |
||
1826 | else |
||
1827 | AutoBuff_Debug(" Track already enabled: "..GetTrackingTexture()); |
||
1828 | end |
||
1829 | end |
||
1830 | else AutoBuff_Debug(" Already done, not checking track."); |
||
1831 | end |
||
1832 | if (done) and (vTime < ltime) then vTime = ltime; end |
||
1833 | |||
1834 | if (vClass == string.lower(AUTOBUFF_CLASS_WARLOCK)) and (vCombat == nil) and (AutoBuff_Data[vC]['s']) and not poly then |
||
1835 | for iName, xName in cWarlockPet do |
||
1836 | local petspell = AutoBuff_CheckPetAbility(iName); |
||
1837 | local petbuff; |
||
1838 | if (petspell) then |
||
1839 | AutoBuff_Debug(" Petspell button: "..petspell); |
||
1840 | for i=1,10 do if (UnitBuff("pet",i) == cPre..xName) then petbuff = true; end end |
||
1841 | if (not petbuff) and AutoBuff_Mana_Pet() then CastPetAction(petspell); end |
||
1842 | end |
||
1843 | end |
||
1844 | end |
||
1845 | |||
1846 | AutoBuff_Debug("### Finished buff-check ###"); |
||
1847 | end |
||
1848 | end |
||
1849 | |||
1850 | function AutoBuff_CheckCombat(spell) |
||
1851 | local s = string.lower(spell); |
||
1852 | local x = AutoBuff_Option(s,'c'); |
||
1853 | if (not x) then x = AutoBuff_Option('d','c'); end |
||
1854 | if (UnitAffectingCombat("player")) then -- Should prevent most false positives |
||
1855 | vCombat = true; |
||
1856 | else |
||
1857 | vCombat = nil; |
||
1858 | end |
||
1859 | if (not x) or (x == 3) then return true; |
||
1860 | elseif (vCombat) and (x == 1) then return true; |
||
1861 | elseif (not vCombat) and (x == 2) then return true; end |
||
1862 | end |
||
1863 | |||
1864 | function AutoBuff_CheckParty(spell) |
||
1865 | local s = string.lower(spell); |
||
1866 | local x = AutoBuff_Option(s,'p'); |
||
1867 | local p = nil; |
||
1868 | if (GetNumPartyMembers() > 0) or (GetNumRaidMembers() > 0) then p = 1; end |
||
1869 | if (not x) then x = AutoBuff_Option('d','p'); end |
||
1870 | if (not x) or (x == 3) then return true; |
||
1871 | elseif (p) and (x == 1) then return true; |
||
1872 | elseif (not p) and (x == 2) then return true; end |
||
1873 | end |
||
1874 | |||
1875 | function AutoBuff_Rebuff(name, ltime) |
||
1876 | if (ltime) then ltime = floor(ltime); end |
||
1877 | local r = AutoBuff_Option(name, 'r'); |
||
1878 | if (not r) then r = AutoBuff_Option('d', 'r'); end |
||
1879 | local t = ltime; |
||
1880 | if (not t) then t = "nil"; end |
||
1881 | if (not name) then name = "[default]"; end |
||
1882 | |||
1883 | if (string.lower(name) == string.lower(AUTOBUFF_ABILITY_INNER_FIRE)) and (AutoBuff_Data[vC]["inner"]) then -- We want to fire this at XX/20 charges left, instead of removed totally |
||
1884 | local i = 1; |
||
1885 | while (UnitBuff("player", i)) do |
||
1886 | buff, numbuff = UnitBuff("player", i); |
||
1887 | -- Already buffed with Inner Fire |
||
1888 | if (buff==cIconInnerFire) then |
||
1889 | AutoBuff_Debug("Found InnerFire with "..numbuff.." out of "..AutoBuff_Data[vC]["innercharges"].." charges left."); |
||
1890 | end |
||
1891 | if (buff==cIconInnerFire) and (numbuff <= AutoBuff_Data[vC]["innercharges"]) then |
||
1892 | return true; -- Recast, because we're at or under XX charges |
||
1893 | end |
||
1894 | i = i + 1; |
||
1895 | end |
||
1896 | end |
||
1897 | |||
1898 | AutoBuff_Debug("Rebuff, "..name.." r:"..r.." t:"..t); |
||
1899 | if (not ltime) or (r > ltime) then |
||
1900 | AutoBuff_Debug("Rebuff should fire!"); |
||
1901 | return true; |
||
1902 | end |
||
1903 | end |
||
1904 | |||
1905 | function AutoBuff_Mana(name) |
||
1906 | local c = (UnitMana("player")/UnitManaMax("player"))*100; |
||
1907 | AutoBuff_Debug("Player Mana is at "..c.."%."); |
||
1908 | local n = AutoBuff_Option(name,'m'); |
||
1909 | if (n == nil) then n = AutoBuff_Option('d','m'); end |
||
1910 | if (n > 0) and (c > n) then return true; |
||
1911 | elseif (n < 0) and (c < (n*-1)) then return true; end |
||
1912 | end |
||
1913 | |||
1914 | function AutoBuff_Mana_Pet() |
||
1915 | local c = (UnitMana("pet")/UnitManaMax("pet"))*100; |
||
1916 | local n = 35; |
||
1917 | if (c > n) then return true; end |
||
1918 | end |
||
1919 | |||
1920 | function AutoBuff_CheckPetAbility(spellName) |
||
1921 | local name, i; |
||
1922 | for i=1,10 do |
||
1923 | name, _, _, _, _, _, _ = GetPetActionInfo(i) |
||
1924 | if (name) and (string.lower(name) == string.lower(spellName)) then return i; end |
||
1925 | end |
||
1926 | end |
||
1927 | |||
1928 | function AutoBuff_Health(name) |
||
1929 | local c = (UnitHealth("player")/UnitHealthMax("player"))*100; |
||
1930 | local n = AutoBuff_Option(name,'h'); |
||
1931 | if (n == nil) then n = AutoBuff_Option('d','h'); end |
||
1932 | if (n > 0) and (c > n) then return true; |
||
1933 | elseif (n < 0) and (c < (n*-1)) then return true; end |
||
1934 | end |
||
1935 | |||
1936 | function AutoBuff_GetHighestSpellRank(spell) |
||
1937 | if (spell) then spell = string.lower(spell); |
||
1938 | else return; end |
||
1939 | local i=1 |
||
1940 | local id = nil; |
||
1941 | while true do |
||
1942 | local spellName, spellRank = GetSpellName(i, BOOKTYPE_SPELL); |
||
1943 | if (not spellName) then break; end |
||
1944 | if (string.lower(spellName) == spell) then id = spellRank; end |
||
1945 | i = i+1; |
||
1946 | end |
||
1947 | |||
1948 | local _,_,realRank = string.find(id, "([%d]+)$"); |
||
1949 | |||
1950 | if (GetLocale() == "koKR") then -- Korean ranks are reversed. |
||
1951 | local _,_,realRank = string.find(id, "(%d+%.?%d*)"); |
||
1952 | end |
||
1953 | return tonumber(realRank); |
||
1954 | end |
||
1955 | |||
1956 | function AutoBuff_Cooldown(id) |
||
1957 | if (id) then return GetSpellCooldown(id, BOOKTYPE_SPELL); end |
||
1958 | end |
||
1959 | |||
1960 | function AutoBuff_UseAbility(spell, type) |
||
1961 | --local testScaled = ""; |
||
1962 | --if (AutoBuff_Data[vC]["scaled"]) then testScaled = "true"; else testScaled = "false"; end |
||
1963 | --AutoBuff_Debug("spell: "..spell.." life tap: "..AUTOBUFF_ABILITY_LIFE_TAP.." BonusScanner: "..IsAddOnLoaded("BonusScanner").." scaled? "..testScaled); |
||
1964 | if (spell==string.lower(AUTOBUFF_ABILITY_LIFE_TAP)) and IsAddOnLoaded("BonusScanner") and (AutoBuff_Data[vC]["scaled"]) then |
||
1965 | AutoBuff_ScaledLifeTap_CastLifeTap(); |
||
1966 | AutoBuff_Debug("Going into Scaled Life Tap routine."); |
||
1967 | else |
||
1968 | local i=1; local name, d; |
||
1969 | local id = AutoBuff_Ability(spell); |
||
1970 | if id then |
||
1971 | if (AutoBuff_Cooldown(id) == 0) then |
||
1972 | if (type == "friendly") and (UnitIsFriend("player", "target")) and (not UnitIsUnit("player","target")) then |
||
1973 | name = UnitName("target"); |
||
1974 | ClearTarget(); |
||
1975 | end |
||
1976 | CastSpell(id,BOOKTYPE_SPELL); |
||
1977 | if (SpellIsTargeting() and SpellCanTargetUnit("player")) then |
||
1978 | SpellTargetUnit("player"); |
||
1979 | end |
||
1980 | if (name) then TargetByName(name); end |
||
1981 | end |
||
1982 | end |
||
1983 | end |
||
1984 | end |
||
1985 | |||
1986 | function AutoBuff_Ability(spell, rank) |
||
1987 | if (spell) then spell = string.lower(spell); |
||
1988 | else return; end |
||
1989 | local o = AutoBuff_Option(spell, 'k'); |
||
1990 | local i=1; |
||
1991 | local id = nil; |
||
1992 | while true do |
||
1993 | local spellName, spellRank = GetSpellName(i, BOOKTYPE_SPELL); |
||
1994 | if (not spellName) then break; end |
||
1995 | if (string.lower(spellName) == spell) then |
||
1996 | id = i; |
||
1997 | if (o) then |
||
1998 | local _,_,realRank = string.find(spellRank, "([%d]+)$"); |
||
1999 | if (tonumber(realRank) == o) then break; end |
||
2000 | end |
||
2001 | end |
||
2002 | i = i+1; |
||
2003 | end |
||
2004 | if (id) then local a,b = "", ""; a,b = GetSpellName(id, BOOKTYPE_SPELL); AutoBuff_Debug("Got Spell ID for, "..a.." "..b); end |
||
2005 | return id; |
||
2006 | end |
||
2007 | |||
2008 | function AutoBuff_Rank(spell) |
||
2009 | AutoBuff_Debug("AutoBuff_Rank: entering function"); |
||
2010 | if (spell) then spell = string.lower(spell); |
||
2011 | else return; end |
||
2012 | local o = AutoBuff_Option(spell, 'k'); |
||
2013 | local i=1; |
||
2014 | while true do |
||
2015 | local spellName, spellRank = GetSpellName(i, BOOKTYPE_SPELL); |
||
2016 | if (not spellName) then break; end |
||
2017 | if (string.lower(spellName) == spell) then |
||
2018 | if (o) then |
||
2019 | local _,_,realRank = string.find(spellRank, "([%d]+)$"); |
||
2020 | if (tonumber(realRank) == o) then break; end |
||
2021 | end |
||
2022 | end |
||
2023 | i = i+1; |
||
2024 | end |
||
2025 | if (o) then return o; |
||
2026 | elseif (realRank) then return realRank; |
||
2027 | else |
||
2028 | return AutoBuff_GetHighestSpellRank(spell); |
||
2029 | end |
||
2030 | end |
||
2031 | |||
2032 | function AutoBuff_Debug(text) -- Prints debug information only if switched on |
||
2033 | if (AutoBuff_Data[vC]['d'] == 1) then DEFAULT_CHAT_FRAME:AddMessage("|cff5e9ae4AutoBuff"..FONT_COLOR_CODE_CLOSE.."/".."|cffffa0a0Debug"..FONT_COLOR_CODE_CLOSE..": "..text); end |
||
2034 | end |
||
2035 | |||
2036 | function AutoBuff_TableIndex(tbl, index) -- This and the next function are used to get the table index name |
||
2037 | bIndex = index; -- by giving the index as an integer. |
||
2038 | bValue = 0; |
||
2039 | return table.foreach(tbl, AutoBuff_foreach); |
||
2040 | end |
||
2041 | |||
2042 | function AutoBuff_foreach(index, value) |
||
2043 | if (bValue == bIndex) then return index; end |
||
2044 | bValue = bValue +1; |
||
2045 | end |
||
2046 | |||
2047 | function AutoBuff_TableConfig() |
||
2048 | AutoBuff_setn(cSpellList); |
||
2049 | AutoBuff_setn(cTrackList); |
||
2050 | AutoBuff_setn(cWeaponList); |
||
2051 | AutoBuff_setn(cAspectList); |
||
2052 | AutoBuff_setn(cSealList); |
||
2053 | end |
||
2054 | |||
2055 | function AutoBuff_setn(tbl) |
||
2056 | bValue = 0; |
||
2057 | table.foreach(tbl, AutoBuff_setn_foreach); |
||
2058 | table.setn(tbl, bValue); |
||
2059 | end |
||
2060 | |||
2061 | function AutoBuff_setn_foreach(index, value) |
||
2062 | bValue = bValue +1; |
||
2063 | end |
||
2064 | |||
2065 | function AutoBuff_Print(text) |
||
2066 | if (text) then DEFAULT_CHAT_FRAME:AddMessage("|cff5e9ae4AutoBuff"..FONT_COLOR_CODE_CLOSE..": "..text); end |
||
2067 | end |
||
2068 | |||
2069 | function AutoBuff_Seperator() |
||
2070 | DEFAULT_CHAT_FRAME:AddMessage("-"); |
||
2071 | end |
||
2072 | |||
2073 | function AutoBuff_WHEELU() -- Hook for scrollwheel-up |
||
2074 | AutoBuff_Check(1); |
||
2075 | AutoBuff_WHEELUx(); |
||
2076 | end |
||
2077 | function AutoBuff_WHEELD() -- Hook for scrollwheel-down |
||
2078 | AutoBuff_Check(2); |
||
2079 | AutoBuff_WHEELDx(); |
||
2080 | end |
||
2081 | function AutoBuff_TARGET() -- Hook for target-switching |
||
2082 | AutoBuff_Check(3); |
||
2083 | end |
||
2084 | |||
2085 | function AutoBuff_JMP() |
||
2086 | AutoBuff_Check(4); |
||
2087 | AutoBuff_JMPx(); |
||
2088 | end |
||
2089 | function AutoBuff_MFS() -- These are the hook functions for movement |
||
2090 | vSit = 0; |
||
2091 | AutoBuff_Check(1); |
||
2092 | AutoBuff_MFSx(); |
||
2093 | end |
||
2094 | function AutoBuff_MBS() |
||
2095 | vSit = 0; |
||
2096 | AutoBuff_Check(1); |
||
2097 | AutoBuff_MBSx(); |
||
2098 | end |
||
2099 | function AutoBuff_TLS() |
||
2100 | vSit = 0; |
||
2101 | AutoBuff_Check(3); |
||
2102 | AutoBuff_TLSx(); |
||
2103 | end |
||
2104 | function AutoBuff_TRS() |
||
2105 | vSit = 0; |
||
2106 | AutoBuff_Check(3); |
||
2107 | AutoBuff_TRSx(); |
||
2108 | end |
||
2109 | function AutoBuff_SLS() |
||
2110 | vSit = 0; |
||
2111 | AutoBuff_Check(2); |
||
2112 | AutoBuff_SLSx(); |
||
2113 | end |
||
2114 | function AutoBuff_SRS() |
||
2115 | vSit = 0; |
||
2116 | AutoBuff_Check(2); |
||
2117 | AutoBuff_SRSx(); |
||
2118 | end |
||
2119 | function AutoBuff_MFF() |
||
2120 | AutoBuff_Check(1); |
||
2121 | AutoBuff_MFFx(); |
||
2122 | end |
||
2123 | function AutoBuff_MBF() |
||
2124 | AutoBuff_Check(1); |
||
2125 | AutoBuff_MBFx(); |
||
2126 | end |
||
2127 | function AutoBuff_TLF() |
||
2128 | AutoBuff_Check(3); |
||
2129 | AutoBuff_TLFx(); |
||
2130 | end |
||
2131 | function AutoBuff_TRF() |
||
2132 | AutoBuff_Check(3); |
||
2133 | AutoBuff_TRFx(); |
||
2134 | end |
||
2135 | function AutoBuff_SLF() |
||
2136 | AutoBuff_Check(2); |
||
2137 | AutoBuff_SLFx(); |
||
2138 | end |
||
2139 | function AutoBuff_SRF() |
||
2140 | AutoBuff_Check(2); |
||
2141 | AutoBuff_SRFx(); |
||
2142 | end |
||
2143 | function AutoBuff_TAR() |
||
2144 | AutoBuff_Check(1); |
||
2145 | AutoBuff_TARx(); |
||
2146 | end |
||
2147 | function AutoBuff_TAS(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) |
||
2148 | AutoBuff_Check(6); |
||
2149 | AutoBuff_TASx(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); |
||
2150 | end |
||
2151 | function AutoBuff_TAF(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) |
||
2152 | AutoBuff_Check(6); |
||
2153 | AutoBuff_TAFx(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); |
||
2154 | end |
||
2155 | function AutoBuff_CMS(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) |
||
2156 | AutoBuff_Check(5); |
||
2157 | AutoBuff_CMSx(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); |
||
2158 | end |
||
2159 | function AutoBuff_CMF(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) |
||
2160 | AutoBuff_Check(5); |
||
2161 | AutoBuff_CMFx(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); |
||
2162 | end |
||
2163 | |||
2164 | function AutoBuff_Option(n, o, z, s) |
||
2165 | if (s == nil) then s = ""; end |
||
2166 | if (type(n) == "string") and (strlen(n) < 1) then n = nil; end |
||
2167 | local a,b,c = "|cffffa0a0nil","|cffa0ffa0nil","|cffa0a0ffnil"; |
||
2168 | if (n) then a = "|cffffa0a0"..n; end |
||
2169 | if (o) then b = "|cffa0ffa0"..o; end |
||
2170 | if (z) then c = "|cffa0a0ff"..z; end |
||
2171 | -- AutoBuff_Debug("Option -> "..a.." "..b.." "..c); |
||
2172 | if (not o) then return; end |
||
2173 | if (not n) then n = 'd'; end |
||
2174 | if (not vSpellList[n]) and (not vWeaponList[n]) and (not vTrackList[n]) and (not vAspectList[n]) and (not vSealList[n]) and (n ~= 'd') then return; end |
||
2175 | if (z == nil) then |
||
2176 | if (AutoBuff_Data[vC]['x'][n] ~= nil) then |
||
2177 | local r = AutoBuff_Data[vC]['x'][n][o]; |
||
2178 | if (r ~= nil) then |
||
2179 | return r; |
||
2180 | end |
||
2181 | end |
||
2182 | else |
||
2183 | if (z == "default") then z = nil; end |
||
2184 | if (AutoBuff_Data[vC]['x'][n] == nil) then AutoBuff_Data[vC]['x'][n] = {}; end |
||
2185 | AutoBuff_Data[vC]['x'][n][o] = z; |
||
2186 | |||
2187 | -- Output |
||
2188 | if (s == 1) then |
||
2189 | if (n == 'd') then n = "default"; end |
||
2190 | n = "'|cffffffa0"..n..FONT_COLOR_CODE_CLOSE.."'"; |
||
2191 | if (z == nil) then z = "default"; end |
||
2192 | if (o == 'm') then s = "|cff5e9ae4mana"; |
||
2193 | elseif (o == 'h') then s = "|cffffa0a0health"; |
||
2194 | elseif (o == 'c') then s = "|cfff0802ecombat"; |
||
2195 | elseif (o == 'r') then s = "|cffa0a0a0rebuff"; |
||
2196 | elseif (o == 't') then s = "|cffc0c0c0trigger"; |
||
2197 | elseif (o == 'k') then s = "|cffffa0ffrank"; |
||
2198 | end |
||
2199 | if (s ~= 1) then |
||
2200 | s = s..FONT_COLOR_CODE_CLOSE; |
||
2201 | z = "|cffa0ffa0"..z..FONT_COLOR_CODE_CLOSE; |
||
2202 | AutoBuff_Print(string.format(AUTOBUFF_CHANGE,s,n,z)); |
||
2203 | elseif (o == 'd') then |
||
2204 | if (z == 1) then o = "|cffffa0a0"..AUTOBUFF_DISABLED; |
||
2205 | else o = "|cffa0ffa0"..AUTOBUFF_ENABLED; end |
||
2206 | o = o..FONT_COLOR_CODE_CLOSE; |
||
2207 | AutoBuff_Print(n..", "..o); |
||
2208 | end |
||
2209 | end |
||
2210 | end |
||
2211 | if (n ~= 'd') and (AutoBuff_Data[vC]['x'][n] ~= nil) then |
||
2212 | local v,k,empty = nil,nil,1; |
||
2213 | for v, k in AutoBuff_Data[vC]['x'][n] do empty = nil; break; end |
||
2214 | if (empty) then AutoBuff_Data[vC]['x'][n] = nil; end |
||
2215 | end |
||
2216 | end |
||
2217 | |||
2218 | function AutoBuff_TrackLoad(s) |
||
2219 | local x = AutoBuff_Data[vC]['t']; -- Get stored tracking ability |
||
2220 | local d = AutoBuff_TableIndex(vTrackList,0); |
||
2221 | local z; |
||
2222 | if (d) then d = string.lower(d); end |
||
2223 | if (x) then |
||
2224 | x = string.lower(x); |
||
2225 | if (x == "off") then |
||
2226 | z = nil; |
||
2227 | elseif (vTrackList[x]) and (AutoBuff_Ability(x)) then |
||
2228 | z = x; |
||
2229 | elseif (d) then |
||
2230 | x = d; |
||
2231 | z = d; |
||
2232 | end |
||
2233 | elseif (d) then |
||
2234 | x = d; |
||
2235 | z = d; |
||
2236 | else |
||
2237 | z = nil; |
||
2238 | x = "off"; |
||
2239 | end |
||
2240 | AutoBuff_Data[vC]['t'] = x; |
||
2241 | vTrack = z; |
||
2242 | if (z) then |
||
2243 | z = "'|cffa0ffa0"..z..FONT_COLOR_CODE_CLOSE.."'"; |
||
2244 | else |
||
2245 | z = "'|cffffa0a0".."off"..FONT_COLOR_CODE_CLOSE.."'"; |
||
2246 | end |
||
2247 | if (s == "show") then AutoBuff_Print(AUTOBUFF_CHANGE_TRACK..", "..z); end |
||
2248 | end |
||
2249 | |||
2250 | function AutoBuff_AspectLoad(s) |
||
2251 | local x = AutoBuff_Data[vC]['a']; -- Get stored aspect ability |
||
2252 | local d = AutoBuff_TableIndex(vAspectList,0); |
||
2253 | local z; |
||
2254 | if (d) then d = string.lower(d); end |
||
2255 | if (x) then |
||
2256 | x = string.lower(x); |
||
2257 | if (x == "off") then |
||
2258 | z = nil; |
||
2259 | elseif (vAspectList[x]) and (AutoBuff_Ability(x)) then |
||
2260 | z = x; |
||
2261 | elseif (d) then |
||
2262 | x = d; |
||
2263 | z = d; |
||
2264 | end |
||
2265 | elseif (d) then |
||
2266 | x = d; |
||
2267 | z = d; |
||
2268 | else |
||
2269 | z = nil; |
||
2270 | x = "off"; |
||
2271 | end |
||
2272 | AutoBuff_Data[vC]['a'] = x; |
||
2273 | vAspect = z; |
||
2274 | if (z) then |
||
2275 | z = "'|cffa0ffa0"..z..FONT_COLOR_CODE_CLOSE.."'"; |
||
2276 | else |
||
2277 | z = "'|cffffa0a0".."off"..FONT_COLOR_CODE_CLOSE.."'"; |
||
2278 | end |
||
2279 | if (s == "show") then AutoBuff_Print(AUTOBUFF_CHANGE_ASPECT..", "..z); end |
||
2280 | end |
||
2281 | |||
2282 | function AutoBuff_SealLoad(s) |
||
2283 | local x = AutoBuff_Data[vC]["seal"]; -- Get stored seal ability |
||
2284 | local d = AutoBuff_TableIndex(vSealList,0); |
||
2285 | local z; |
||
2286 | if (d) then d = string.lower(d); end |
||
2287 | if (x) then |
||
2288 | x = string.lower(x); |
||
2289 | if (x == "off") then |
||
2290 | z = nil; |
||
2291 | elseif (vSealList[x]) and (AutoBuff_Ability(x)) then |
||
2292 | z = x; |
||
2293 | elseif (d) then |
||
2294 | x = d; |
||
2295 | z = d; |
||
2296 | end |
||
2297 | elseif (d) then |
||
2298 | x = d; |
||
2299 | z = d; |
||
2300 | else |
||
2301 | z = nil; |
||
2302 | x = "off"; |
||
2303 | end |
||
2304 | AutoBuff_Data[vC]["seal"] = x; |
||
2305 | vSeal = z; |
||
2306 | if (z) then |
||
2307 | z = "'|cffa0ffa0"..z..FONT_COLOR_CODE_CLOSE.."'"; |
||
2308 | else |
||
2309 | z = "'|cffffa0a0".."off"..FONT_COLOR_CODE_CLOSE.."'"; |
||
2310 | end |
||
2311 | if (s == "show") then AutoBuff_Print(AUTOBUFF_CHANGE_SEAL..", "..z); end |
||
2312 | end |
||
2313 | |||
2314 | function AutoBuff_WeaponLoad(s) |
||
2315 | local x = AutoBuff_Data[vC]['w']; -- Get stored weapon ability |
||
2316 | local d = AutoBuff_TableIndex(vWeaponList,0); |
||
2317 | local z; |
||
2318 | if (d) then d = string.lower(d); end |
||
2319 | if (x) then |
||
2320 | x = string.lower(x); |
||
2321 | if (x == "off") then |
||
2322 | z = nil; |
||
2323 | elseif (vWeaponList[x]) and (AutoBuff_Ability(x)) then |
||
2324 | z = x; |
||
2325 | elseif (d) then |
||
2326 | z = d; |
||
2327 | x = d; |
||
2328 | end |
||
2329 | elseif (d) then |
||
2330 | z = d; |
||
2331 | x = d; |
||
2332 | else |
||
2333 | z = nil; |
||
2334 | x = "off"; |
||
2335 | end |
||
2336 | AutoBuff_Data[vC]['w'] = x; |
||
2337 | vWeapon = z; |
||
2338 | if (z) then |
||
2339 | z = "'|cffa0ffa0"..z..FONT_COLOR_CODE_CLOSE.."'"; |
||
2340 | else |
||
2341 | z = "'|cffffa0a0".."off"..FONT_COLOR_CODE_CLOSE.."'"; |
||
2342 | end |
||
2343 | if (s == "show") then AutoBuff_Print(AUTOBUFF_CHANGE_WEAPON..", "..z); end |
||
2344 | end |
||
2345 | |||
2346 | function AutoBuff_LoadDefaults() |
||
2347 | if (not AutoBuff_Data) then AutoBuff_Data = { }; end |
||
2348 | if (AutoBuff_Data[vC] == nil) then AutoBuff_Data[vC] = { }; end |
||
2349 | if (AutoBuff_Data[vC]['version']) then AutoBuff_Data = { [vC] = {} }; end |
||
2350 | table.foreach(cDefault, AutoBuff_CheckDefaults); |
||
2351 | if (AutoBuff_Data[vC]['x'] == nil) then AutoBuff_Data[vC]['x'] = {}; end |
||
2352 | if (AutoBuff_Data[vC]['x']['d'] == nil) then AutoBuff_Data[vC]['x']['d'] = {}; end |
||
2353 | table.foreach(cDefault['x']['d'], AutoBuff_CheckDefaults_Ability); |
||
2354 | if (AutoBuff_Data[vC]['v'] ~= cDefault['v']) then AutoBuff_Upgrade(AutoBuff_Data[vC]['v']); end |
||
2355 | end |
||
2356 | |||
2357 | function AutoBuff_Upgrade(ver) |
||
2358 | local c = cDefault['v'] |
||
2359 | --if (ver < 31) then |
||
2360 | --AutoBuff_Data[vC]['h'] = cDefault['h']; |
||
2361 | --end |
||
2362 | AutoBuff_Data[vC]['v'] = c; |
||
2363 | end |
||
2364 | |||
2365 | function AutoBuff_CheckSpellList() |
||
2366 | local iName, xName; |
||
2367 | for iName, xName in AutoBuff_Data[vC]['x'] do |
||
2368 | if (iName ~= "d") and (not vSpellList[iName]) and (not vWeaponList[iName]) and (not vTrackList[iName]) and (not vAspectList[iName]) and (not vSealList[iName]) then AutoBuff_Data[vC]['x'][iName] = nil; end |
||
2369 | end |
||
2370 | end |
||
2371 | |||
2372 | function AutoBuff_CheckDefaults(index, value) |
||
2373 | if (AutoBuff_Data[vC][index] == nil) then AutoBuff_Data[vC][index] = cDefault[index]; end |
||
2374 | end |
||
2375 | |||
2376 | function AutoBuff_CheckDefaults_Ability(index, value) |
||
2377 | if (AutoBuff_Data[vC]['x']['d'][index] == nil) then AutoBuff_Data[vC]['x']['d'][index] = cDefault['x']['d'][index]; end |
||
2378 | end |
||
2379 | |||
2380 | function AutoBuff_Reload() |
||
2381 | AutoBuffFrame_Close(); |
||
2382 | vSpellList = { }; |
||
2383 | vTrackList = { }; |
||
2384 | vWeaponList = { }; |
||
2385 | vAspectList = { }; |
||
2386 | vSealList = { }; |
||
2387 | vTrack = nil; |
||
2388 | vWeapon = nil; |
||
2389 | vAspect = nil; |
||
2390 | vSeal = nil; |
||
2391 | AutoBuff_Debug("Total spells available -> "..table.getn(cSpellList)); |
||
2392 | local iName, xName; |
||
2393 | for iName, xName in cSpellList do |
||
2394 | if (AutoBuff_Ability(iName)) then |
||
2395 | AutoBuff_Debug("Adding Ability -> "..iName); |
||
2396 | vSpellList[string.lower(iName)] = xName; |
||
2397 | local rank = AutoBuff_GetHighestSpellRank(iName); |
||
2398 | if (rank) then vSpellList[string.lower(iName)]['k'] = rank; end |
||
2399 | end |
||
2400 | end |
||
2401 | -- Same for tracking abilities.. |
||
2402 | AutoBuff_Debug("Total track available -> "..table.getn(cTrackList)); |
||
2403 | for iName, xName in cTrackList do |
||
2404 | if (AutoBuff_Ability(iName)) then |
||
2405 | AutoBuff_Debug("Adding Track -> "..iName); |
||
2406 | vTrackList[string.lower(iName)] = xName; |
||
2407 | end |
||
2408 | end |
||
2409 | -- EMERALD: aspect buffs |
||
2410 | AutoBuff_Debug("Total aspect available -> "..table.getn(cAspectList)); |
||
2411 | for iName, xName in cAspectList do |
||
2412 | if (AutoBuff_Ability(iName)) then |
||
2413 | AutoBuff_Debug("Adding Aspect -> "..iName); |
||
2414 | vAspectList[string.lower(iName)] = xName; |
||
2415 | end |
||
2416 | end |
||
2417 | -- EMERALD: seal buffs |
||
2418 | AutoBuff_Debug("Total seals available -> "..table.getn(cSealList)); |
||
2419 | for iName, xName in cSealList do |
||
2420 | if (AutoBuff_Ability(iName)) then |
||
2421 | AutoBuff_Debug("Adding Seal -> "..iName); |
||
2422 | vSealList[string.lower(iName)] = xName; |
||
2423 | local rank = AutoBuff_GetHighestSpellRank(iName); |
||
2424 | if (rank) then vSealList[string.lower(iName)]['k'] = rank; end |
||
2425 | end |
||
2426 | end |
||
2427 | -- And weapon buffs... |
||
2428 | AutoBuff_Debug("Total weaponbuff available -> "..table.getn(cWeaponList)); |
||
2429 | for iName, xName in cWeaponList do |
||
2430 | if (AutoBuff_Ability(iName)) then |
||
2431 | AutoBuff_Debug("Adding WeaponBuff -> "..iName); |
||
2432 | vWeaponList[string.lower(iName)] = xName; |
||
2433 | local rank = AutoBuff_GetHighestSpellRank(iName); |
||
2434 | if (rank) then vWeaponList[string.lower(iName)] = rank; end |
||
2435 | end |
||
2436 | end |
||
2437 | |||
2438 | AutoBuff_setn(vSpellList); |
||
2439 | AutoBuff_setn(vWeaponList); |
||
2440 | AutoBuff_setn(vTrackList); |
||
2441 | AutoBuff_setn(vAspectList); |
||
2442 | AutoBuff_setn(vSealList); |
||
2443 | -- Some spells overwrite others, or are higher ranked |
||
2444 | -- versions of another spell but with a different name. |
||
2445 | -- So we make sure only the best version is in the table |
||
2446 | |||
2447 | if (vClass == string.lower(AUTOBUFF_CLASS_MAGE)) and (vSpellList[string.lower(AUTOBUFF_ABILITY_ICE_ARMOR)]) then vSpellList[string.lower(AUTOBUFF_ABILITY_FROST_ARMOR)] = nil; end |
||
2448 | if (vClass == string.lower(AUTOBUFF_CLASS_WARLOCK)) then |
||
2449 | if (vSpellList[string.lower(AUTOBUFF_ABILITY_DEMON_ARMOR)]) then vSpellList[string.lower(AUTOBUFF_ABILITY_DEMON_SKIN)] = nil; end |
||
2450 | if (vSpellList[string.lower(AUTOBUFF_ABILITY_DETECT_GINVIS)]) then vSpellList[string.lower(AUTOBUFF_ABILITY_DETECT_INVIS)] = nil; vSpellList[string.lower(AUTOBUFF_ABILITY_DETECT_LINVIS)] = nil; |
||
2451 | elseif (vSpellList[string.lower(AUTOBUFF_ABILITY_DETECT_INVIS)]) then vSpellList[string.lower(AUTOBUFF_ABILITY_DETECT_LINVIS)] = nil; end |
||
2452 | end |
||
2453 | AutoBuff_TrackLoad(); -- Checks for available Tracking Abilities |
||
2454 | AutoBuff_WeaponLoad(); |
||
2455 | AutoBuff_AspectLoad(); |
||
2456 | AutoBuff_SealLoad(); |
||
2457 | AutoBuff_CheckSpellList(); -- Checks the disabled, mana, and combat tables for spells that this character can't use. |
||
2458 | end |
||
2459 | |||
2460 | --[[ Dialog control functions ]] |
||
2461 | function AutoBuffFrame_OnShow() |
||
2462 | PlaySound("igMainMenuOpen"); |
||
2463 | AutoBuffFrameCheckButton:SetChecked(AutoBuff_Data[vC]['e']); |
||
2464 | if (AutoBuff_Data[vC]['e']) then |
||
2465 | AutoBuffFrameAbility:Show(); |
||
2466 | AutoBuff_Populate(); |
||
2467 | else |
||
2468 | AutoBuffFrameAbility:Hide(); |
||
2469 | end |
||
2470 | end |
||
2471 | |||
2472 | function AutoBuffFrame_OnHide() |
||
2473 | PlaySound("igMainMenuClose"); |
||
2474 | end |
||
2475 | |||
2476 | function AutoBuffFrame_Toggle() |
||
2477 | vGUI = {}; |
||
2478 | vGUI['m'] = { [1] = "default" }; -- EMERALD: Line 2205 bug (nil on field 'm') |
||
2479 | AutoBuffFrame:StopMovingOrSizing(); |
||
2480 | if (not AutoBuffFrame:IsVisible()) then |
||
2481 | AutoBuffFrame_Open(); |
||
2482 | else |
||
2483 | AutoBuffFrame_Close(); |
||
2484 | end |
||
2485 | end |
||
2486 | |||
2487 | function AutoBuffFrame_Open() |
||
2488 | ShowUIPanel(AutoBuffFrame); |
||
2489 | end |
||
2490 | |||
2491 | function AutoBuffFrame_Close() |
||
2492 | AutoBuffFrame:StopMovingOrSizing(); |
||
2493 | HideUIPanel(AutoBuffFrame); |
||
2494 | |||
2495 | -- myAddOns window |
||
2496 | if(MYADDONS_ACTIVE_OPTIONSFRAME == AutoBuffFrame) then ShowUIPanel(myAddOnsFrame); end |
||
2497 | end |
||
2498 | |||
2499 | function AutoBuff_Populate() |
||
2500 | local i,v,k,x,r,g,b = 1,nil,nil,nil,0.4,0.4,0.4; |
||
2501 | for x=1,AUTOBUFF_GUI_ABILITY_TOTALROWS do |
||
2502 | getglobal("AutoBuffName"..x):UnlockHighlight(); |
||
2503 | end |
||
2504 | vGUI['m'] = { [1] = "default" }; |
||
2505 | AutoBuff_PopulateInsert(1, AUTOBUFF_GUI_DEFAULTABILITY, 0.6, 0.6, 1) |
||
2506 | if (table.getn(vSpellList) > 0) then |
||
2507 | i=i+1; |
||
2508 | AutoBuff_PopulateInsert(2, "- "..AUTOBUFF_GUI_SPELLS, 1, 1, 1); |
||
2509 | getglobal("AutoBuffName"..i):Disable(); |
||
2510 | --for v, k in vSpellList do |
||
2511 | k = 1; |
||
2512 | while (k > -1) do |
||
2513 | v = AutoBuff_SpellList(k); |
||
2514 | if (not v) then break; end |
||
2515 | v = string.lower(v); |
||
2516 | if (vSpellList[v]) then |
||
2517 | i = i+1; |
||
2518 | if (AutoBuff_Option(v, 'd')) then r,g,b = 1, 0.6, 0.6; else r,g,b = 0.6, 1, 0.6; end |
||
2519 | AutoBuff_PopulateInsert(i, AutoBuff_CorrectName(v), r, g, b); |
||
2520 | vGUI['m'][i] = "spell"; |
||
2521 | end |
||
2522 | k = k+1; |
||
2523 | end |
||
2524 | end |
||
2525 | if (table.getn(vWeaponList) > 0) then |
||
2526 | i = i+1; |
||
2527 | AutoBuff_PopulateInsert(i, "- "..AUTOBUFF_GUI_WEAPON, 1, 1, 1); |
||
2528 | getglobal("AutoBuffName"..i):Disable(); |
||
2529 | for v, k in vWeaponList do |
||
2530 | i = i+1; |
||
2531 | if (v == vWeapon) then r,g,b = 0.6, 1, 0.6; else r,g,b = 1, 0.6, 0.6; end |
||
2532 | AutoBuff_PopulateInsert(i, AutoBuff_CorrectName(v), r, g, b); |
||
2533 | vGUI['m'][i] = "weapon"; |
||
2534 | end |
||
2535 | end |
||
2536 | if (table.getn(vTrackList) > 0) then |
||
2537 | i = i+1; |
||
2538 | AutoBuff_PopulateInsert(i, "- "..AUTOBUFF_GUI_TRACK, 1, 1, 1); |
||
2539 | getglobal("AutoBuffName"..i):Disable(); |
||
2540 | for v, k in vTrackList do |
||
2541 | i = i+1; |
||
2542 | if (v == vTrack) then r,g,b = 0.6, 1, 0.6; else r,g,b = 1, 0.6, 0.6; end |
||
2543 | AutoBuff_PopulateInsert(i, AutoBuff_CorrectName(v), r, g, b); |
||
2544 | vGUI['m'][i] = "track"; |
||
2545 | end |
||
2546 | end |
||
2547 | if (table.getn(vAspectList) > 0) then |
||
2548 | i = i+1; |
||
2549 | AutoBuff_PopulateInsert(i, "- "..AUTOBUFF_GUI_ASPECT, 1, 1, 1); |
||
2550 | getglobal("AutoBuffName"..i):Disable(); |
||
2551 | for v, k in vAspectList do |
||
2552 | i = i+1; |
||
2553 | if (v == vAspect) then r,g,b = 0.6, 1, 0.6; else r,g,b = 1, 0.6, 0.6; end |
||
2554 | AutoBuff_PopulateInsert(i, AutoBuff_CorrectName(v), r, g, b); |
||
2555 | vGUI['m'][i] = "aspect"; |
||
2556 | end |
||
2557 | end |
||
2558 | if (table.getn(vSealList) > 0) then |
||
2559 | i = i+1; |
||
2560 | AutoBuff_PopulateInsert(i, "- "..AUTOBUFF_GUI_SEAL, 1, 1, 1); |
||
2561 | getglobal("AutoBuffName"..i):Disable(); |
||
2562 | for v, k in vSealList do |
||
2563 | i = i+1; |
||
2564 | if (v == vSeal) then r,g,b = 0.6, 1, 0.6; else r,g,b = 1, 0.6, 0.6; end |
||
2565 | AutoBuff_PopulateInsert(i, AutoBuff_CorrectName(v), r, g, b); |
||
2566 | vGUI['m'][i] = "seal"; |
||
2567 | end |
||
2568 | end |
||
2569 | AutoBuffFrameAbility:SetHeight(AUTOBUFF_GUI_ABILITY_OVERHEAD + (AUTOBUFF_GUI_ABILITY_INTERVAL*i)); |
||
2570 | AutoBuffFrameOptions:Hide(); |
||
2571 | end |
||
2572 | |||
2573 | function AutoBuff_PopulateInsert(n, t, r, g, b) |
||
2574 | local itemButton = getglobal("AutoBuffName"..n); |
||
2575 | local itemText = getglobal("AutoBuffName"..n.."_Text"); |
||
2576 | if (t) and (n <= AUTOBUFF_GUI_ABILITY_TOTALROWS) then |
||
2577 | itemText:SetText(t); |
||
2578 | itemText:SetTextColor(r, g, b, 1); |
||
2579 | itemButton:Enable(); |
||
2580 | itemButton:Show(); |
||
2581 | end |
||
2582 | end |
||
2583 | |||
2584 | function AutoBuffFrameCloseButton_OnClick() |
||
2585 | AutoBuffFrame_Close(); |
||
2586 | end |
||
2587 | |||
2588 | function AutoBuffFrame_ResetAbility() |
||
2589 | vGUI['r'] = 1; |
||
2590 | local x,y; |
||
2591 | |||
2592 | AutoBuffFrameOptionsDefaultAbility:Hide(); |
||
2593 | |||
2594 | AutoBuffFrameOptionsEnable_Text:Show(); |
||
2595 | AutoBuffFrameOptionsEnableButton:Show(); |
||
2596 | AutoBuffFrameOptionsEnableButton:SetChecked(0); |
||
2597 | |||
2598 | AutoBuffFrameOptionsDefaultTrigger_Text:Hide(); |
||
2599 | AutoBuffFrameOptionsTrigger_Text:Hide(); |
||
2600 | AutoBuffFrameOptionsTriggerDefaultButton:Hide(); |
||
2601 | AutoBuffFrameOptionsTriggerDefaultButton:SetChecked(0); |
||
2602 | AutoBuffFrameOptionsTriggerWheelUp_Text:Hide(); |
||
2603 | AutoBuffFrameOptionsTriggerWheelUpButton:Hide(); |
||
2604 | AutoBuffFrameOptionsTriggerWheelUpButton:SetChecked(0); |
||
2605 | AutoBuffFrameOptionsTriggerWheelDown_Text:Hide(); |
||
2606 | AutoBuffFrameOptionsTriggerWheelDownButton:Hide(); |
||
2607 | AutoBuffFrameOptionsTriggerWheelDownButton:SetChecked(0); |
||
2608 | AutoBuffFrameOptionsTriggerTarget_Text:Hide(); |
||
2609 | AutoBuffFrameOptionsTriggerTargetButton:Hide(); |
||
2610 | AutoBuffFrameOptionsTriggerTargetButton:SetChecked(0); |
||
2611 | |||
2612 | |||
2613 | AutoBuffFrameOptionsCombat_Text:ClearAllPoints(); |
||
2614 | --AutoBuffFrameOptionsCombat_Text:SetPoint("TOPLEFT", "AutoBuffFrameOptionsTrigger_Text", "BOTTOMLEFT", 0, -110) |
||
2615 | AutoBuffFrameOptionsCombat_Text:SetPoint("TOPLEFT", "AutoBuffFrameOptionsTrigger_Text", "BOTTOMLEFT", 0, -55) |
||
2616 | AutoBuffFrameOptionsCombatDefaultButton:Hide(); |
||
2617 | AutoBuffFrameOptionsCombatDefaultButton:SetChecked(0); |
||
2618 | AutoBuffFrameOptionsCombat_Text:Hide(); |
||
2619 | AutoBuffFrameOptionsDefaultCombat_Text:Hide(); |
||
2620 | AutoBuffFrameOptionsCombatIn_Text:Hide(); |
||
2621 | AutoBuffFrameOptionsCombatInButton:Hide(); |
||
2622 | AutoBuffFrameOptionsCombatInButton:SetChecked(0); |
||
2623 | AutoBuffFrameOptionsCombatOut_Text:Hide(); |
||
2624 | AutoBuffFrameOptionsCombatOutButton:Hide(); |
||
2625 | AutoBuffFrameOptionsCombatOutButton:SetChecked(0); |
||
2626 | AutoBuffFrameOptionsCombatAlways_Text:Hide(); |
||
2627 | AutoBuffFrameOptionsCombatAlwaysButton:Hide(); |
||
2628 | AutoBuffFrameOptionsCombatAlwaysButton:SetChecked(0); |
||
2629 | |||
2630 | |||
2631 | AutoBuffFrameOptionsParty_Text:ClearAllPoints(); |
||
2632 | AutoBuffFrameOptionsParty_Text:SetPoint("TOPLEFT", "AutoBuffFrameOptionsCombat_Text", "BOTTOMLEFT", 0, -25) |
||
2633 | AutoBuffFrameOptionsPartyDefaultButton:Hide(); |
||
2634 | AutoBuffFrameOptionsPartyDefaultButton:SetChecked(0); |
||
2635 | AutoBuffFrameOptionsParty_Text:Hide(); |
||
2636 | AutoBuffFrameOptionsDefaultParty_Text:Hide(); |
||
2637 | AutoBuffFrameOptionsPartyIn_Text:Hide(); |
||
2638 | AutoBuffFrameOptionsPartyInButton:Hide(); |
||
2639 | AutoBuffFrameOptionsPartyInButton:SetChecked(0); |
||
2640 | AutoBuffFrameOptionsPartyOut_Text:Hide(); |
||
2641 | AutoBuffFrameOptionsPartyOutButton:Hide(); |
||
2642 | AutoBuffFrameOptionsPartyOutButton:SetChecked(0); |
||
2643 | AutoBuffFrameOptionsPartyAlways_Text:Hide(); |
||
2644 | AutoBuffFrameOptionsPartyAlwaysButton:Hide(); |
||
2645 | AutoBuffFrameOptionsPartyAlwaysButton:SetChecked(0); |
||
2646 | |||
2647 | |||
2648 | AutoBuffFrameOptionsHealth_Text:ClearAllPoints(); |
||
2649 | AutoBuffFrameOptionsHealth_Text:SetPoint("TOPLEFT", "AutoBuffFrameOptionsParty_Text", "BOTTOMLEFT", 0, -25) |
||
2650 | AutoBuffFrameOptionsHealthDefaultButton:Hide(); |
||
2651 | AutoBuffFrameOptionsHealthDefaultButton:SetChecked(0); |
||
2652 | AutoBuffFrameOptionsHealth_Text:Hide(); |
||
2653 | AutoBuffFrameOptionsDefaultHealth_Text:Hide(); |
||
2654 | AutoBuffFrameOptionsHealth:Hide(); |
||
2655 | x, y = AutoBuffFrameOptionsHealth:GetMinMaxValues(); |
||
2656 | AutoBuffFrameOptionsHealth:SetValue(x); |
||
2657 | AutoBuffFrameOptionsHealth_ValueText:Hide(); |
||
2658 | AutoBuffFrameOptionsHealth_ValueText:SetText("#"); |
||
2659 | AutoBuffFrameOptionsHealthButton:Hide(); |
||
2660 | AutoBuffFrameOptionsHealthButton:SetChecked(0); |
||
2661 | |||
2662 | AutoBuffFrameOptionsManaDefaultButton:Hide(); |
||
2663 | AutoBuffFrameOptionsManaDefaultButton:SetChecked(0); |
||
2664 | AutoBuffFrameOptionsMana_Text:Hide(); |
||
2665 | AutoBuffFrameOptionsDefaultMana_Text:Hide(); |
||
2666 | AutoBuffFrameOptionsMana:Hide(); |
||
2667 | x, y = AutoBuffFrameOptionsMana:GetMinMaxValues(); |
||
2668 | AutoBuffFrameOptionsMana_ValueText:Hide(); |
||
2669 | AutoBuffFrameOptionsMana_ValueText:SetText("#"); |
||
2670 | AutoBuffFrameOptionsManaButton:Hide(); |
||
2671 | AutoBuffFrameOptionsManaButton:SetChecked(0); |
||
2672 | |||
2673 | AutoBuffFrameOptionsRebuffDefaultButton:Hide(); |
||
2674 | AutoBuffFrameOptionsRebuffDefaultButton:SetChecked(0); |
||
2675 | AutoBuffFrameOptionsRebuff:Hide(); |
||
2676 | x, y = AutoBuffFrameOptionsRebuff:GetMinMaxValues(); |
||
2677 | AutoBuffFrameOptionsRebuff:SetValue(x); |
||
2678 | AutoBuffFrameOptionsDefaultRebuff_Text:Hide(); |
||
2679 | AutoBuffFrameOptionsRebuff_Text:Hide(); |
||
2680 | AutoBuffFrameOptionsRebuff_ValueText:Hide(); |
||
2681 | AutoBuffFrameOptionsRebuff_ValueText:SetText("#"); |
||
2682 | |||
2683 | AutoBuffFrameOptionsRankDefaultButton:Hide(); |
||
2684 | AutoBuffFrameOptionsRankDefaultButton:SetChecked(0); |
||
2685 | AutoBuffFrameOptionsRank:Hide(); |
||
2686 | x, y = AutoBuffFrameOptionsRank:GetMinMaxValues(); |
||
2687 | AutoBuffFrameOptionsRank:SetValue(x); |
||
2688 | AutoBuffFrameOptionsDefaultRank_Text:Hide(); |
||
2689 | AutoBuffFrameOptionsRank_Text:Hide(); |
||
2690 | AutoBuffFrameOptionsRank_ValueText:Hide(); |
||
2691 | AutoBuffFrameOptionsRank_ValueText:SetText("#"); |
||
2692 | AutoBuffFrameOptionsRank_Text:ClearAllPoints(); |
||
2693 | AutoBuffFrameOptionsRank_Text:SetPoint("TOPLEFT", "AutoBuffFrameOptionsRebuff_Text", "BOTTOMLEFT", 0, -9) |
||
2694 | AutoBuffFrameOptions:Show(); |
||
2695 | AutoBuffFrameOptions:SetHeight(40); |
||
2696 | vGUI['r'] = nil; |
||
2697 | end |
||
2698 | |||
2699 | function AutoBuffNameButton_OnClick(s) |
||
2700 | if (vGUI['r']) then return; end |
||
2701 | local n = string.lower(getglobal("AutoBuffName"..s.."_Text"):GetText()); |
||
2702 | local t,x; |
||
2703 | if (vGUI['s']) then getglobal("AutoBuffName"..vGUI['s']):UnlockHighlight(); end |
||
2704 | vGUI['s'] = s; |
||
2705 | getglobal("AutoBuffName"..s):LockHighlight(); |
||
2706 | AutoBuffFrame_ResetAbility(); |
||
2707 | if (s == 1) then n = nil; end |
||
2708 | vGUI['n'] = n; |
||
2709 | x = vGUI['m'][s]; |
||
2710 | if (x == "default") then |
||
2711 | AutoBuffFrameOptionsEnable_Text:Hide(); |
||
2712 | AutoBuffFrameOptionsEnableButton:Hide(); |
||
2713 | AutoBuffFrameOptionsDefaultAbility:Show(); |
||
2714 | AutoBuffFrameOptions:SetHeight(295); -- JURYRIG |
||
2715 | --AutoBuffFrameOptions:SetHeight(340); |
||
2716 | |||
2717 | AutoBuffFrameOptionsTrigger_Text:Show(); |
||
2718 | AutoBuffFrameOptionsTriggerWheelUp_Text:Show(); |
||
2719 | AutoBuffFrameOptionsTriggerWheelUpButton:Show(); |
||
2720 | AutoBuffFrameOptionsTriggerWheelDown_Text:Show(); |
||
2721 | AutoBuffFrameOptionsTriggerWheelDownButton:Show(); |
||
2722 | AutoBuffFrameOptionsTriggerTarget_Text:Show(); |
||
2723 | AutoBuffFrameOptionsTriggerTargetButton:Show(); |
||
2724 | |||
2725 | AutoBuffFrameOptionsCombat_Text:Show(); |
||
2726 | AutoBuffFrameOptionsCombatIn_Text:Show(); |
||
2727 | AutoBuffFrameOptionsCombatInButton:Show(); |
||
2728 | AutoBuffFrameOptionsCombatOut_Text:Show(); |
||
2729 | AutoBuffFrameOptionsCombatOutButton:Show(); |
||
2730 | AutoBuffFrameOptionsCombatAlways_Text:Show(); |
||
2731 | AutoBuffFrameOptionsCombatAlwaysButton:Show(); |
||
2732 | |||
2733 | AutoBuffFrameOptionsParty_Text:Show(); |
||
2734 | AutoBuffFrameOptionsPartyIn_Text:Show(); |
||
2735 | AutoBuffFrameOptionsPartyInButton:Show(); |
||
2736 | AutoBuffFrameOptionsPartyOut_Text:Show(); |
||
2737 | AutoBuffFrameOptionsPartyOutButton:Show(); |
||
2738 | AutoBuffFrameOptionsPartyAlways_Text:Show(); |
||
2739 | AutoBuffFrameOptionsPartyAlwaysButton:Show(); |
||
2740 | AutoBuffFrameOptionsHealth_Text:Show(); |
||
2741 | AutoBuffFrameOptionsHealth:Show(); |
||
2742 | AutoBuffFrameOptionsHealth_ValueText:Show(); |
||
2743 | AutoBuffFrameOptionsHealthButton:Show(); |
||
2744 | AutoBuffFrameOptionsMana_Text:Show(); |
||
2745 | AutoBuffFrameOptionsMana:Show(); |
||
2746 | AutoBuffFrameOptionsMana_ValueText:Show(); |
||
2747 | AutoBuffFrameOptionsManaButton:Show(); |
||
2748 | AutoBuffFrameOptionsRebuff:Show(); |
||
2749 | AutoBuffFrameOptionsRebuff_Text:Show(); |
||
2750 | AutoBuffFrameOptionsRebuff_ValueText:Show(); |
||
2751 | |||
2752 | local trigger = AutoBuff_Trigger('d'); |
||
2753 | AutoBuffFrameOptionsTriggerWheelUpButton:SetChecked(trigger[1]); |
||
2754 | AutoBuffFrameOptionsTriggerWheelDownButton:SetChecked(trigger[2]); |
||
2755 | AutoBuffFrameOptionsTriggerTargetButton:SetChecked(trigger[3]); |
||
2756 | |||
2757 | if (AutoBuff_Option(n, 'c') == 1) then AutoBuffFrameOptionsCombatInButton:SetChecked(1); end |
||
2758 | if (AutoBuff_Option(n, 'c') == 2) then AutoBuffFrameOptionsCombatOutButton:SetChecked(1); end |
||
2759 | if (AutoBuff_Option(n, 'c') == 3) then AutoBuffFrameOptionsCombatAlwaysButton:SetChecked(1); end |
||
2760 | |||
2761 | if (AutoBuff_Option(n, 'p') == 1) then AutoBuffFrameOptionsPartyInButton:SetChecked(1); end |
||
2762 | if (AutoBuff_Option(n, 'p') == 2) then AutoBuffFrameOptionsPartyOutButton:SetChecked(1); end |
||
2763 | if (AutoBuff_Option(n, 'p') == 3) then AutoBuffFrameOptionsPartyAlwaysButton:SetChecked(1); end |
||
2764 | |||
2765 | t = AutoBuff_Option(n, 'h'); |
||
2766 | if (t > 0) then |
||
2767 | AutoBuffFrameOptionsHealthButton:SetChecked(0); |
||
2768 | AutoBuffFrameOptionsHealth_ValueText:SetText(">"..t.."%"); |
||
2769 | AutoBuffFrameOptionsHealth:SetValue(t); |
||
2770 | else |
||
2771 | t = t*-1; |
||
2772 | AutoBuffFrameOptionsHealthButton:SetChecked(1); |
||
2773 | AutoBuffFrameOptionsHealth_ValueText:SetText("<"..t.."%"); |
||
2774 | AutoBuffFrameOptionsHealth:SetValue(t); |
||
2775 | end |
||
2776 | |||
2777 | t = AutoBuff_Option(n, 'm'); |
||
2778 | if (t > 0) then |
||
2779 | AutoBuffFrameOptionsManaButton:SetChecked(0); |
||
2780 | AutoBuffFrameOptionsMana:SetValue(t); |
||
2781 | AutoBuffFrameOptionsMana_ValueText:SetText(">"..t.."%"); |
||
2782 | else |
||
2783 | t = t*-1; |
||
2784 | AutoBuffFrameOptionsManaButton:SetChecked(1); |
||
2785 | AutoBuffFrameOptionsMana:SetValue(t); |
||
2786 | AutoBuffFrameOptionsMana_ValueText:SetText("<"..t.."%"); |
||
2787 | end |
||
2788 | |||
2789 | t = AutoBuff_Option(n, 'r'); |
||
2790 | AutoBuffFrameOptionsRebuff:SetValue(t); |
||
2791 | AutoBuffFrameOptionsRebuff_ValueText:SetText(AutoBuffFrame_RebuffValueText(t)); |
||
2792 | |||
2793 | |||
2794 | -- elseif (vGUI['m'][s] == "track") then |
||
2795 | -- if (vTrack == n) then AutoBuffFrameOptionsEnableButton:SetChecked(1); end |
||
2796 | -- elseif (vGUI['m'][s] == "aspect") then |
||
2797 | -- if (vAspect == n) then AutoBuffFrameOptionsEnableButton:SetChecked(1); end |
||
2798 | -- elseif (vGUI['m'][s] == "seal") then |
||
2799 | -- if (vSeal == n) then AutoBuffFrameOptionsEnableButton:SetChecked(1); end |
||
2800 | --elseif (x ~= "track" and x ~= "aspect" and x ~= "seal") then |
||
2801 | else |
||
2802 | --if ((x == "spell") and (not AutoBuff_Option(n, 'd'))) or ((x == "weapon") and (vWeapon == n)) then |
||
2803 | if ((x == "spell") and (not AutoBuff_Option(n, 'd'))) or ((x == "weapon") and (vWeapon == n)) or ((x == "track") and (vTrack == n)) or ((x == "aspect") and (vAspect == n)) or ((x == "seal") and (vSeal == n)) then |
||
2804 | AutoBuffFrameOptionsEnableButton:SetChecked(1); |
||
2805 | local height = 370; |
||
2806 | |||
2807 | AutoBuffFrameOptionsCombatDefaultButton:Show(); |
||
2808 | AutoBuffFrameOptionsCombat_Text:Show(); |
||
2809 | AutoBuffFrameOptionsCombatIn_Text:Show(); |
||
2810 | AutoBuffFrameOptionsCombatInButton:Show(); |
||
2811 | AutoBuffFrameOptionsCombatOut_Text:Show(); |
||
2812 | AutoBuffFrameOptionsCombatOutButton:Show(); |
||
2813 | AutoBuffFrameOptionsCombatAlways_Text:Show(); |
||
2814 | AutoBuffFrameOptionsCombatAlwaysButton:Show(); |
||
2815 | |||
2816 | AutoBuffFrameOptionsPartyDefaultButton:Show(); |
||
2817 | AutoBuffFrameOptionsParty_Text:Show(); |
||
2818 | AutoBuffFrameOptionsPartyIn_Text:Show(); |
||
2819 | AutoBuffFrameOptionsPartyInButton:Show(); |
||
2820 | AutoBuffFrameOptionsPartyOut_Text:Show(); |
||
2821 | AutoBuffFrameOptionsPartyOutButton:Show(); |
||
2822 | AutoBuffFrameOptionsPartyAlways_Text:Show(); |
||
2823 | AutoBuffFrameOptionsPartyAlwaysButton:Show(); |
||
2824 | |||
2825 | AutoBuffFrameOptionsHealthDefaultButton:Show(); |
||
2826 | AutoBuffFrameOptionsHealth_Text:Show(); |
||
2827 | AutoBuffFrameOptionsHealth:Show(); |
||
2828 | AutoBuffFrameOptionsHealth_ValueText:Show(); |
||
2829 | AutoBuffFrameOptionsHealthButton:Show(); |
||
2830 | AutoBuffFrameOptionsManaDefaultButton:Show(); |
||
2831 | AutoBuffFrameOptionsMana_Text:Show(); |
||
2832 | AutoBuffFrameOptionsMana:Show(); |
||
2833 | AutoBuffFrameOptionsMana_ValueText:Show(); |
||
2834 | AutoBuffFrameOptionsManaButton:Show(); |
||
2835 | AutoBuffFrameOptionsRebuffDefaultButton:Show(); |
||
2836 | AutoBuffFrameOptionsRebuff:Show(); |
||
2837 | AutoBuffFrameOptionsRebuff_Text:Show(); |
||
2838 | AutoBuffFrameOptionsRebuff_ValueText:Show(); |
||
2839 | |||
2840 | AutoBuffFrameOptionsRankDefaultButton:Show(); |
||
2841 | AutoBuffFrameOptionsRank:Show(); |
||
2842 | AutoBuffFrameOptionsRank_Text:Show(); |
||
2843 | AutoBuffFrameOptionsRank_ValueText:Show(); |
||
2844 | |||
2845 | AutoBuffFrameOptionsTrigger_Text:Show(); |
||
2846 | AutoBuffFrameOptionsTriggerDefaultButton:Show(); |
||
2847 | AutoBuffFrameOptionsTriggerWheelUp_Text:Show(); |
||
2848 | AutoBuffFrameOptionsTriggerWheelUpButton:Show(); |
||
2849 | AutoBuffFrameOptionsTriggerWheelDown_Text:Show(); |
||
2850 | AutoBuffFrameOptionsTriggerWheelDownButton:Show(); |
||
2851 | AutoBuffFrameOptionsTriggerTarget_Text:Show(); |
||
2852 | AutoBuffFrameOptionsTriggerTargetButton:Show(); |
||
2853 | |||
2854 | if (AutoBuff_Option(n, 't')) then |
||
2855 | AutoBuffFrameOptionsTriggerDefaultButton:SetChecked(1); |
||
2856 | local trigger = AutoBuff_Trigger(n); |
||
2857 | AutoBuffFrameOptionsTriggerWheelUpButton:SetChecked(trigger[1]); |
||
2858 | AutoBuffFrameOptionsTriggerWheelDownButton:SetChecked(trigger[2]); |
||
2859 | AutoBuffFrameOptionsTriggerTargetButton:SetChecked(trigger[3]); |
||
2860 | height = height - 55; |
||
2861 | else |
||
2862 | AutoBuffFrameOptionsDefaultTrigger_Text:Show(); |
||
2863 | AutoBuffFrameOptionsTriggerWheelUp_Text:Hide(); |
||
2864 | AutoBuffFrameOptionsTriggerWheelUpButton:Hide(); |
||
2865 | AutoBuffFrameOptionsTriggerWheelDown_Text:Hide(); |
||
2866 | AutoBuffFrameOptionsTriggerWheelDownButton:Hide(); |
||
2867 | AutoBuffFrameOptionsTriggerTarget_Text:Hide(); |
||
2868 | AutoBuffFrameOptionsTriggerTargetButton:Hide(); |
||
2869 | AutoBuffFrameOptionsCombat_Text:ClearAllPoints(); |
||
2870 | AutoBuffFrameOptionsCombat_Text:SetPoint("TOPLEFT", "AutoBuffFrameOptionsTrigger_Text", "BOTTOMLEFT", 0, -9); |
||
2871 | height = height - 105; |
||
2872 | end |
||
2873 | |||
2874 | if (AutoBuff_Option(n, 'c')) then |
||
2875 | AutoBuffFrameOptionsCombatDefaultButton:SetChecked(1); |
||
2876 | if (AutoBuff_Option(n, 'c') == 1) then AutoBuffFrameOptionsCombatInButton:SetChecked(1); end |
||
2877 | if (AutoBuff_Option(n, 'c') == 2) then AutoBuffFrameOptionsCombatOutButton:SetChecked(1); end |
||
2878 | if (AutoBuff_Option(n, 'c') == 3) then AutoBuffFrameOptionsCombatAlwaysButton:SetChecked(1); end |
||
2879 | else |
||
2880 | AutoBuffFrameOptionsCombatIn_Text:Hide(); |
||
2881 | AutoBuffFrameOptionsCombatInButton:Hide(); |
||
2882 | AutoBuffFrameOptionsCombatOut_Text:Hide(); |
||
2883 | AutoBuffFrameOptionsCombatOutButton:Hide(); |
||
2884 | AutoBuffFrameOptionsCombatAlways_Text:Hide(); |
||
2885 | AutoBuffFrameOptionsCombatAlwaysButton:Hide(); |
||
2886 | AutoBuffFrameOptionsDefaultCombat_Text:Show(); |
||
2887 | AutoBuffFrameOptionsParty_Text:ClearAllPoints(); |
||
2888 | AutoBuffFrameOptionsParty_Text:SetPoint("TOPLEFT", "AutoBuffFrameOptionsCombat_Text", "BOTTOMLEFT", 0, -9) |
||
2889 | height = height - 15; |
||
2890 | end |
||
2891 | |||
2892 | |||
2893 | if (AutoBuff_Option(n, 'p')) then |
||
2894 | AutoBuffFrameOptionsPartyDefaultButton:SetChecked(1); |
||
2895 | if (AutoBuff_Option(n, 'p') == 1) then AutoBuffFrameOptionsPartyInButton:SetChecked(1); end |
||
2896 | if (AutoBuff_Option(n, 'p') == 2) then AutoBuffFrameOptionsPartyOutButton:SetChecked(1); end |
||
2897 | if (AutoBuff_Option(n, 'p') == 3) then AutoBuffFrameOptionsPartyAlwaysButton:SetChecked(1); end |
||
2898 | else |
||
2899 | AutoBuffFrameOptionsPartyIn_Text:Hide(); |
||
2900 | AutoBuffFrameOptionsPartyInButton:Hide(); |
||
2901 | AutoBuffFrameOptionsPartyOut_Text:Hide(); |
||
2902 | AutoBuffFrameOptionsPartyOutButton:Hide(); |
||
2903 | AutoBuffFrameOptionsPartyAlways_Text:Hide(); |
||
2904 | AutoBuffFrameOptionsPartyAlwaysButton:Hide(); |
||
2905 | AutoBuffFrameOptionsDefaultParty_Text:Show(); |
||
2906 | AutoBuffFrameOptionsHealth_Text:ClearAllPoints(); |
||
2907 | AutoBuffFrameOptionsHealth_Text:SetPoint("TOPLEFT", "AutoBuffFrameOptionsParty_Text", "BOTTOMLEFT", 0, -9) |
||
2908 | height = height -15; |
||
2909 | end |
||
2910 | |||
2911 | t = AutoBuff_Option(n, 'h'); |
||
2912 | if (not t) then |
||
2913 | AutoBuffFrameOptionsHealth:Hide(); |
||
2914 | AutoBuffFrameOptionsHealth_ValueText:Hide(); |
||
2915 | AutoBuffFrameOptionsHealthButton:Hide(); |
||
2916 | AutoBuffFrameOptionsDefaultHealth_Text:Show(); |
||
2917 | else |
||
2918 | AutoBuffFrameOptionsHealthDefaultButton:SetChecked(1); |
||
2919 | if (t > 0) then |
||
2920 | AutoBuffFrameOptionsHealthButton:SetChecked(0); |
||
2921 | AutoBuffFrameOptionsHealth_ValueText:SetText(">"..t.."%"); |
||
2922 | AutoBuffFrameOptionsHealth:SetValue(t); |
||
2923 | else |
||
2924 | t = t*-1; |
||
2925 | AutoBuffFrameOptionsHealthButton:SetChecked(1); |
||
2926 | AutoBuffFrameOptionsHealth_ValueText:SetText("<"..t.."%"); |
||
2927 | AutoBuffFrameOptionsHealth:SetValue(t); |
||
2928 | end |
||
2929 | end |
||
2930 | |||
2931 | t = AutoBuff_Option(n, 'm'); |
||
2932 | if (not t) then |
||
2933 | AutoBuffFrameOptionsMana:Hide(); |
||
2934 | AutoBuffFrameOptionsMana_ValueText:Hide(); |
||
2935 | AutoBuffFrameOptionsManaButton:Hide(); |
||
2936 | AutoBuffFrameOptionsDefaultMana_Text:Show(); |
||
2937 | else |
||
2938 | AutoBuffFrameOptionsManaDefaultButton:SetChecked(1); |
||
2939 | if (t > 0) then |
||
2940 | AutoBuffFrameOptionsManaButton:SetChecked(0); |
||
2941 | AutoBuffFrameOptionsMana:SetValue(t); |
||
2942 | AutoBuffFrameOptionsMana_ValueText:SetText(">"..t.."%"); |
||
2943 | else |
||
2944 | t = t*-1; |
||
2945 | AutoBuffFrameOptionsManaButton:SetChecked(1); |
||
2946 | AutoBuffFrameOptionsMana:SetValue(t); |
||
2947 | AutoBuffFrameOptionsMana_ValueText:SetText("<"..t.."%"); |
||
2948 | end |
||
2949 | end |
||
2950 | --if (not AutoBuff_IsAura(n)) and (n ~= string.lower(AUTOBUFF_ABILITY_TRUESHOTAURA)) then |
||
2951 | if (not AutoBuff_IsAura(n)) then |
||
2952 | t = AutoBuff_Option(n, 'r'); |
||
2953 | if (not t) then |
||
2954 | AutoBuffFrameOptionsRebuff:Hide(); |
||
2955 | AutoBuffFrameOptionsRebuff_ValueText:Hide(); |
||
2956 | AutoBuffFrameOptionsDefaultRebuff_Text:Show(); |
||
2957 | else |
||
2958 | AutoBuffFrameOptionsRebuffDefaultButton:SetChecked(1); |
||
2959 | AutoBuffFrameOptionsRebuff:SetValue(t); |
||
2960 | AutoBuffFrameOptionsRebuff_ValueText:SetText(AutoBuffFrame_RebuffValueText(t)); |
||
2961 | end |
||
2962 | else |
||
2963 | AutoBuffFrameOptionsRebuffDefaultButton:Hide(); |
||
2964 | AutoBuffFrameOptionsRebuff:Hide(); |
||
2965 | AutoBuffFrameOptionsRebuff_Text:Hide(); |
||
2966 | AutoBuffFrameOptionsRebuff_ValueText:Hide(); |
||
2967 | height = height - 28; |
||
2968 | AutoBuffFrameOptionsRank_Text:ClearAllPoints(); |
||
2969 | AutoBuffFrameOptionsRank_Text:SetPoint("TOPLEFT", "AutoBuffFrameOptionsMana_Text", "BOTTOMLEFT", 0, -9) |
||
2970 | end |
||
2971 | local hr = 0; |
||
2972 | if (x == "weapon") then hr = vWeaponList[n]; end |
||
2973 | --if (x == "track") then hr = vTrackList[n]; end |
||
2974 | --if (x == "aspect") then hr = vAspectList[n]; end |
||
2975 | --if (x == "seal") then hr = vSealList[n]; end |
||
2976 | if (x == "spell") and (vSpellList[n]['k']) then hr = vSpellList[n]['k']; end |
||
2977 | --if (x == "track") and (vTrackList[n]['k']) then hr = vTrackList[n]['k']; end |
||
2978 | --if (x == "aspect") and (vAspectList[n]['k']) then hr = vAspectList[n]['k']; end |
||
2979 | if (x == "seal") and (vSealList[n]['k']) then hr = vSealList[n]['k']; end |
||
2980 | if (hr and hr > 1) then |
||
2981 | t = AutoBuff_Option(n, 'k'); |
||
2982 | AutoBuffFrameOptionsRank:SetMinMaxValues(1, hr); |
||
2983 | if (not t) then |
||
2984 | AutoBuffFrameOptionsRank:Hide(); |
||
2985 | AutoBuffFrameOptionsRank_ValueText:Hide(); |
||
2986 | AutoBuffFrameOptionsDefaultRank_Text:Show(); |
||
2987 | else |
||
2988 | AutoBuffFrameOptionsRankDefaultButton:SetChecked(1); |
||
2989 | AutoBuffFrameOptionsRank:SetValue(t); |
||
2990 | AutoBuffFrameOptionsRank_ValueText:SetText(t); |
||
2991 | end |
||
2992 | else |
||
2993 | AutoBuffFrameOptionsRankDefaultButton:Hide(); |
||
2994 | AutoBuffFrameOptionsRank:Hide(); |
||
2995 | AutoBuffFrameOptionsRank_Text:Hide(); |
||
2996 | AutoBuffFrameOptionsRank_ValueText:Hide(); |
||
2997 | height = height - 28; |
||
2998 | end |
||
2999 | |||
3000 | AutoBuffFrameOptions:SetHeight(height); |
||
3001 | end |
||
3002 | end |
||
3003 | end |
||
3004 | |||
3005 | function AutoBuffFrame_OnClick() |
||
3006 | if (vGUI['r']) then return; end |
||
3007 | local s = vGUI['s']; |
||
3008 | local x = vGUI['m'][s]; |
||
3009 | local frame, n = this:GetName(), vGUI['n'] |
||
3010 | if (not frame) then return; end |
||
3011 | local c = this:GetChecked(); |
||
3012 | if (frame == "AutoBuffFrameCheckButton") then |
||
3013 | if (not c or c==0) then AutoBuff_Off(); end -- EMERALD: Persistant on/off checkbox |
||
3014 | --else AutoBuff_On(); end |
||
3015 | if (not c or c==0) then |
||
3016 | AutoBuff_Off(); |
||
3017 | AutoBuffFrameAbility:Hide(); |
||
3018 | else |
||
3019 | AutoBuff_On(); |
||
3020 | AutoBuffFrameAbility:Show(); |
||
3021 | AutoBuff_Populate(); |
||
3022 | end |
||
3023 | elseif (frame == "AutoBuffFrameOptionsEnableButton") then |
||
3024 | local t = vGUI['m'][(vGUI['s'])]; |
||
3025 | if (t == "spell") then |
||
3026 | if (c == 1) then c = "default"; else c = 1; end |
||
3027 | AutoBuff_Option(n, 'd', c); |
||
3028 | if (AutoBuff_IsBlessing(n)) then AutoBuff_FixBlessing(n); end |
||
3029 | if (AutoBuff_IsAura(n)) then AutoBuff_FixAura(n); end |
||
3030 | elseif (t == "weapon") then |
||
3031 | if (c == 1) then AutoBuff_Data[vC]['w'] = vGUI['n']; |
||
3032 | else AutoBuff_Data[vC]['w'] = "off"; end |
||
3033 | AutoBuff_WeaponLoad(); |
||
3034 | elseif (t == "track") then |
||
3035 | if (c == 1) then AutoBuff_Data[vC]['t'] = vGUI['n']; |
||
3036 | else AutoBuff_Data[vC]['t'] = "off"; end |
||
3037 | AutoBuff_TrackLoad(); |
||
3038 | elseif (t == "aspect") then |
||
3039 | if (c == 1) then AutoBuff_Data[vC]['a'] = vGUI['n']; |
||
3040 | else AutoBuff_Data[vC]['a'] = "off"; end |
||
3041 | AutoBuff_AspectLoad(); |
||
3042 | elseif (t == "seal") then |
||
3043 | if (c == 1) then AutoBuff_Data[vC]["seal"] = vGUI['n']; |
||
3044 | else AutoBuff_Data[vC]["seal"] = "off"; end |
||
3045 | AutoBuff_SealLoad(); |
||
3046 | end |
||
3047 | AutoBuff_Populate(); |
||
3048 | AutoBuffNameButton_OnClick(vGUI['s']); |
||
3049 | |||
3050 | elseif (frame == "AutoBuffFrameOptionsHealthButton") then |
||
3051 | if (c == 1) then t = "<"; |
||
3052 | else t = ">"; end |
||
3053 | AutoBuffFrameOptionsHealth_ValueText:SetText(t..AutoBuffFrameOptionsHealth:GetValue().."%"); |
||
3054 | AutoBuff_Option(n, 'h', (AutoBuff_Option(n, 'h')*-1)); |
||
3055 | elseif (frame == "AutoBuffFrameOptionsManaButton") then |
||
3056 | if (c == 1) then t = "<"; |
||
3057 | else t = ">"; end |
||
3058 | AutoBuffFrameOptionsMana_ValueText:SetText(t..AutoBuffFrameOptionsMana:GetValue().."%"); |
||
3059 | AutoBuff_Option(n, 'm', (AutoBuff_Option(n, 'm')*-1)); |
||
3060 | elseif (frame == "AutoBuffFrameOptionsCombatInButton") then |
||
3061 | this:SetChecked(1); |
||
3062 | AutoBuffFrameOptionsCombatOutButton:SetChecked(0); |
||
3063 | AutoBuffFrameOptionsCombatAlwaysButton:SetChecked(0); |
||
3064 | AutoBuff_Option(n, 'c', 1); |
||
3065 | elseif (frame == "AutoBuffFrameOptionsCombatOutButton") then |
||
3066 | this:SetChecked(1); |
||
3067 | AutoBuffFrameOptionsCombatInButton:SetChecked(0); |
||
3068 | AutoBuffFrameOptionsCombatAlwaysButton:SetChecked(0); |
||
3069 | AutoBuff_Option(n, 'c', 2); |
||
3070 | elseif (frame == "AutoBuffFrameOptionsCombatAlwaysButton") then |
||
3071 | this:SetChecked(1); |
||
3072 | AutoBuffFrameOptionsCombatInButton:SetChecked(0); |
||
3073 | AutoBuffFrameOptionsCombatOutButton:SetChecked(0); |
||
3074 | AutoBuff_Option(n, 'c', 3); |
||
3075 | elseif (frame == "AutoBuffFrameOptionsCombatDefaultButton") then |
||
3076 | if (c == 1) then |
||
3077 | AutoBuff_Option(n, 'c', AutoBuff_Option('d', 'c')); |
||
3078 | else |
||
3079 | AutoBuff_Option(n, 'c', "default"); |
||
3080 | end |
||
3081 | AutoBuffNameButton_OnClick(vGUI['s']); |
||
3082 | |||
3083 | elseif (frame == "AutoBuffFrameOptionsPartyInButton") then |
||
3084 | this:SetChecked(1); |
||
3085 | AutoBuffFrameOptionsPartyOutButton:SetChecked(0); |
||
3086 | AutoBuffFrameOptionsPartyAlwaysButton:SetChecked(0); |
||
3087 | AutoBuff_Option(n, 'p', 1); |
||
3088 | elseif (frame == "AutoBuffFrameOptionsPartyOutButton") then |
||
3089 | this:SetChecked(1); |
||
3090 | AutoBuffFrameOptionsPartyInButton:SetChecked(0); |
||
3091 | AutoBuffFrameOptionsPartyAlwaysButton:SetChecked(0); |
||
3092 | AutoBuff_Option(n, 'p', 2); |
||
3093 | elseif (frame == "AutoBuffFrameOptionsPartyAlwaysButton") then |
||
3094 | this:SetChecked(1); |
||
3095 | AutoBuffFrameOptionsPartyInButton:SetChecked(0); |
||
3096 | AutoBuffFrameOptionsPartyOutButton:SetChecked(0); |
||
3097 | AutoBuff_Option(n, 'p', 3); |
||
3098 | elseif (frame == "AutoBuffFrameOptionsPartyDefaultButton") then |
||
3099 | if (c == 1) then |
||
3100 | AutoBuff_Option(n, 'p', AutoBuff_Option('d', 'p')); |
||
3101 | else |
||
3102 | AutoBuff_Option(n, 'p', "default"); |
||
3103 | end |
||
3104 | AutoBuffNameButton_OnClick(vGUI['s']); |
||
3105 | |||
3106 | |||
3107 | elseif (frame == "AutoBuffFrameOptionsTriggerWheelUpButton") or |
||
3108 | (frame == "AutoBuffFrameOptionsTriggerWheelDownButton") or |
||
3109 | (frame == "AutoBuffFrameOptionsTriggerTargetButton") then |
||
3110 | local trigger = 0; |
||
3111 | if (AutoBuffFrameOptionsTriggerWheelUpButton:GetChecked() == 1) then trigger = trigger + 2^1; end |
||
3112 | if (AutoBuffFrameOptionsTriggerWheelDownButton:GetChecked() == 1) then trigger = trigger + 2^2; end |
||
3113 | if (AutoBuffFrameOptionsTriggerTargetButton:GetChecked() == 1) then trigger = trigger + 2^3; end |
||
3114 | AutoBuff_Option(n, 't', trigger); |
||
3115 | elseif (frame == "AutoBuffFrameOptionsTriggerDefaultButton") then |
||
3116 | if (c == 1) then |
||
3117 | AutoBuff_Option(n, 't', AutoBuff_Option('d', 't')); |
||
3118 | else |
||
3119 | AutoBuff_Option(n, 't', "default"); |
||
3120 | end |
||
3121 | AutoBuffNameButton_OnClick(vGUI['s']); |
||
3122 | elseif (frame == "AutoBuffFrameOptionsHealthDefaultButton") then |
||
3123 | if (c == 1) then |
||
3124 | AutoBuff_Option(n, 'h', AutoBuff_Option('d', 'h')); |
||
3125 | else |
||
3126 | AutoBuff_Option(n, 'h', "default"); |
||
3127 | end |
||
3128 | AutoBuffNameButton_OnClick(vGUI['s']); |
||
3129 | elseif (frame == "AutoBuffFrameOptionsManaDefaultButton") then |
||
3130 | if (c == 1) then |
||
3131 | AutoBuff_Option(n, 'm', AutoBuff_Option('d', 'm')); |
||
3132 | else |
||
3133 | AutoBuff_Option(n, 'm', "default"); |
||
3134 | end |
||
3135 | AutoBuffNameButton_OnClick(vGUI['s']); |
||
3136 | elseif (frame == "AutoBuffFrameOptionsRebuffDefaultButton") then |
||
3137 | if (c == 1) then |
||
3138 | AutoBuff_Option(n, 'r', AutoBuff_Option('d', 'r')); |
||
3139 | else |
||
3140 | AutoBuff_Option(n, 'r', "default"); |
||
3141 | end |
||
3142 | AutoBuffNameButton_OnClick(vGUI['s']); |
||
3143 | elseif (frame == "AutoBuffFrameOptionsRankDefaultButton") then |
||
3144 | if (c == 1) then |
||
3145 | local a, b = AutoBuffFrameOptionsRank:GetMinMaxValues(); |
||
3146 | AutoBuff_Option(n, 'k', b); |
||
3147 | else |
||
3148 | AutoBuff_Option(n, 'k', "default"); |
||
3149 | end |
||
3150 | AutoBuffNameButton_OnClick(vGUI['s']); |
||
3151 | end |
||
3152 | end |
||
3153 | |||
3154 | function AutoBuffFrame_OnValueChanged() |
||
3155 | if (vGUI['r']) then return; end |
||
3156 | local frame = this:GetName(); |
||
3157 | if (not frame) then return; end |
||
3158 | local c = this:GetValue(); |
||
3159 | local t; |
||
3160 | if (frame == "AutoBuffFrameOptionsHealth") then |
||
3161 | if (AutoBuffFrameOptionsHealthButton:GetChecked() == 1) then t = "<"..c.."%"; c=c*-1; |
||
3162 | else t = ">"..c.."%"; end |
||
3163 | AutoBuffFrameOptionsHealth_ValueText:SetText(t); |
||
3164 | AutoBuff_Option(vGUI['n'],'h',c); |
||
3165 | elseif (frame == "AutoBuffFrameOptionsMana") then |
||
3166 | if (AutoBuffFrameOptionsManaButton:GetChecked() == 1) then t = "<"..c.."%"; c=c*-1; |
||
3167 | else t = ">"..c.."%"; end |
||
3168 | AutoBuffFrameOptionsMana_ValueText:SetText(t); |
||
3169 | AutoBuff_Option(vGUI['n'],'m',c); |
||
3170 | elseif (frame == "AutoBuffFrameOptionsRebuff") then |
||
3171 | AutoBuffFrameOptionsRebuff_ValueText:SetText(AutoBuffFrame_RebuffValueText(c)); |
||
3172 | AutoBuff_Option(vGUI['n'], 'r', c); |
||
3173 | elseif (frame == "AutoBuffFrameOptionsRank") then |
||
3174 | AutoBuffFrameOptionsRank_ValueText:SetText(c); |
||
3175 | AutoBuff_Option(vGUI['n'], 'k', c); |
||
3176 | end |
||
3177 | end |
||
3178 | |||
3179 | function AutoBuffFrame_RebuffValueText(c) |
||
3180 | c = tonumber(c); |
||
3181 | if (c == nil) then return; end |
||
3182 | local m = floor(c/60); |
||
3183 | local s = c - (m*60); |
||
3184 | local v = s.."s"; |
||
3185 | if (m>0) and (s == 0) then v = m.."m"; |
||
3186 | elseif (m>0) then v = m.."m"..v; end |
||
3187 | return v; |
||
3188 | end |
||
3189 | |||
3190 | |||
3191 | function AutoBuffFrame_Tooltip(arg1,arg2,arg3) |
||
3192 | if (not arg3) then arg3 = "ANCHOR_TOPLEFT"; end |
||
3193 | GameTooltip:SetOwner(this, arg3); |
||
3194 | GameTooltip:SetText(arg1); |
||
3195 | GameTooltip:AddLine(arg2, .75, .75, .75, 1); |
||
3196 | GameTooltip:Show(); |
||
3197 | end |
||
3198 | |||
3199 | function AutoBuffFrame_OnEnter() |
||
3200 | local frame = this:GetName(); |
||
3201 | if (not frame) then return; end |
||
3202 | if (frame == "AutoBuffFrameCheckButton") then |
||
3203 | AutoBuffFrame_Tooltip(AUTOBUFF_GUI_ENABLE_TOOLTIP_TITLE, AUTOBUFF_GUI_ENABLE_TOOLTIP); |
||
3204 | elseif (frame == "AutoBuffFrameOptionsEnableButton") then |
||
3205 | AutoBuffFrame_Tooltip(AUTOBUFF_GUI_ENABLEABILITY_TOOLTIP_TITLE, AUTOBUFF_GUI_ENABLEABILITY_TOOLTIP, "ANCHOR_BOTTOMRIGHT"); |
||
3206 | elseif (frame == "AutoBuffFrameOptionsRebuff") then |
||
3207 | AutoBuffFrame_Tooltip(AUTOBUFF_GUI_REBUFF_TOOLTIP_TITLE, AUTOBUFF_GUI_REBUFF_TOOLTIP); |
||
3208 | elseif (frame == "AutoBuffFrameOptionsHealth") then |
||
3209 | AutoBuffFrame_Tooltip(AUTOBUFF_GUI_HEALTH_TOOLTIP_TITLE, AUTOBUFF_GUI_HEALTH_TOOLTIP); |
||
3210 | elseif (frame == "AutoBuffFrameOptionsMana") then |
||
3211 | AutoBuffFrame_Tooltip(AUTOBUFF_GUI_MANA_TOOLTIP_TITLE, AUTOBUFF_GUI_MANA_TOOLTIP); |
||
3212 | elseif (frame == "AutoBuffFrameOptionsHealthButton") or (frame == "AutoBuffFrameOptionsManaButton") then |
||
3213 | AutoBuffFrame_Tooltip(AUTOBUFF_GUI_INVERT_TOOLTIP_TITLE, AUTOBUFF_GUI_INVERT_TOOLTIP); |
||
3214 | elseif (frame == "AutoBuffFrameOptionsCombatInButton") then |
||
3215 | AutoBuffFrame_Tooltip(AUTOBUFF_GUI_COMBAT_IN_TOOLTIP_TITLE, AUTOBUFF_GUI_COMBAT_IN_TOOLTIP); |
||
3216 | elseif (frame == "AutoBuffFrameOptionsCombatOutButton") then |
||
3217 | AutoBuffFrame_Tooltip(AUTOBUFF_GUI_COMBAT_OUT_TOOLTIP_TITLE, AUTOBUFF_GUI_COMBAT_OUT_TOOLTIP); |
||
3218 | elseif (frame == "AutoBuffFrameOptionsCombatAlwaysButton") then |
||
3219 | AutoBuffFrame_Tooltip(AUTOBUFF_GUI_COMBAT_ALWAYS_TOOLTIP_TITLE, AUTOBUFF_GUI_COMBAT_ALWAYS_TOOLTIP); |
||
3220 | |||
3221 | elseif (frame == "AutoBuffFrameOptionsPartyInButton") then |
||
3222 | AutoBuffFrame_Tooltip(AUTOBUFF_GUI_PARTY_IN_TOOLTIP_TITLE, AUTOBUFF_GUI_PARTY_IN_TOOLTIP); |
||
3223 | elseif (frame == "AutoBuffFrameOptionsPartyOutButton") then |
||
3224 | AutoBuffFrame_Tooltip(AUTOBUFF_GUI_PARTY_OUT_TOOLTIP_TITLE, AUTOBUFF_GUI_PARTY_OUT_TOOLTIP); |
||
3225 | elseif (frame == "AutoBuffFrameOptionsPartyAlwaysButton") then |
||
3226 | AutoBuffFrame_Tooltip(AUTOBUFF_GUI_PARTY_ALWAYS_TOOLTIP_TITLE, AUTOBUFF_GUI_PARTY_ALWAYS_TOOLTIP); |
||
3227 | |||
3228 | elseif (frame == "AutoBuffFrameOptionsCombatDefaultButton") or (frame == "AutoBuffFrameOptionsHealthDefaultButton") or (frame == "AutoBuffFrameOptionsTriggerDefaultButton") or |
||
3229 | (frame == "AutoBuffFrameOptionsManaDefaultButton") or (frame == "AutoBuffFrameOptionsRebuffDefaultButton") or (frame == "AutoBuffFrameOptionsPartyDefaultButton") then |
||
3230 | AutoBuffFrame_Tooltip(AUTOBUFF_GUI_DEFAULT_TOOLTIP_TITLE, AUTOBUFF_GUI_DEFAULT_TOOLTIP); |
||
3231 | elseif (frame == "AutoBuffFrameOptionsTriggerWheelUpButton") or (frame == "AutoBuffFrameOptionsTriggerWheelDownButton") or (frame == "AutoBuffFrameOptionsTriggerTargetButton") then |
||
3232 | AutoBuffFrame_Tooltip(AUTOBUFF_GUI_TRIGGER_TITLE, AUTOBUFF_GUI_TRIGGER_TOOLTIP); |
||
3233 | end |
||
3234 | end |
||
3235 | |||
3236 | function AutoBuffFrame_OnMouseDown(arg1) if arg1=="LeftButton" then AutoBuffFrame:StartMoving(); end end |
||
3237 | function AutoBuffFrame_OnMouseUp(arg1) if arg1=="LeftButton" then AutoBuffFrame:StopMovingOrSizing(); end end |
||
3238 | |||
3239 | |||
3240 | -- Had to make this function weird, as it was giving me an awful 'next' key is invalid error. |
||
3241 | function AutoBuff_CorrectName(s) |
||
3242 | s = string.lower(s); |
||
3243 | local a,b,c,d; |
||
3244 | for a, b in cSpellList do |
||
3245 | c = string.lower(a); |
||
3246 | if (c == s) then d = a; break; end |
||
3247 | end |
||
3248 | if (not d) then |
||
3249 | for a, b in cWeaponList do |
||
3250 | c = string.lower(a); |
||
3251 | if (c == s) then d = a; break; end |
||
3252 | end |
||
3253 | end |
||
3254 | if (not d) then |
||
3255 | for a, b in cTrackList do |
||
3256 | c = string.lower(a); |
||
3257 | if (c == s) then d = a; break; end |
||
3258 | end |
||
3259 | end |
||
3260 | if (not d) then |
||
3261 | for a, b in cAspectList do |
||
3262 | c = string.lower(a); |
||
3263 | if (c == s) then d = a; break; end |
||
3264 | end |
||
3265 | end |
||
3266 | if (not d) then |
||
3267 | for a, b in cSealList do |
||
3268 | c = string.lower(a); |
||
3269 | if (c == s) then d = a; break; end |
||
3270 | end |
||
3271 | end |
||
3272 | return d; |
||
3273 | end |
||
3274 | |||
3275 | function AutoBuff_SpellList(n) |
||
3276 | local a,b,r; |
||
3277 | for a,b in cSpellList do |
||
3278 | if (b['i'] == n) then r = a; break; end |
||
3279 | end |
||
3280 | return r; |
||
3281 | end |
||
3282 | |||
3283 | -- ================================================== |
||
3284 | |||
3285 | function TitanPanelAutoBuffButton_OnLoad() |
||
3286 | this.registry = { |
||
3287 | id = TITAN_AUTOBUFF_ID, |
||
3288 | menuText = TITAN_AUTOBUFF_MENU_TEXT, |
||
3289 | buttonTextFunction = nil, |
||
3290 | tooltipTitle = TITAN_AUTOBUFF_TOOLTIP, |
||
3291 | tooltipTextFunction = "TitanPanelAutoBuffButton_GetTooltipText", |
||
3292 | icon = TITAN_AUTOBUFF_ICON_ON, |
||
3293 | iconWidth = 16, |
||
3294 | frequency = 5, |
||
3295 | }; |
||
3296 | end |
||
3297 | |||
3298 | function TitanPanelAutoBuffButton_OnClick() |
||
3299 | if (arg1=="LeftButton") then |
||
3300 | AutoBuffOptionsButton_OnClick(arg1); |
||
3301 | end |
||
3302 | end |
||
3303 | |||
3304 | function TitanPanelAutoBuffButton_GetTooltipText() |
||
3305 | |||
3306 | --if (IsAddOnLoaded("Titan")) then TITAN_AUTOBUFF_TOOLTIP_CONTENTS = TITAN_AUTOBUFF_TOOLTIP_CONTENTS..TitanUtils_GetColoredText("Testing", u.ColorList[string.lower("red")]).."\t"..TitanUtils_GetColoredText("Testing", u.ColorList[string.lower("yellow")]).."\n"; end |
||
3307 | |||
3308 | TITAN_AUTOBUFF_TOOLTIP_CONTENTS = TitanUtils_GetColoredText(TITAN_AUTOBUFF_ENABLE, u.ColorList[string.lower("yellow")]).."\t"; |
||
3309 | |||
3310 | if (TitanAutoBuffStates.Enabled) then |
||
3311 | TITAN_AUTOBUFF_TOOLTIP_CONTENTS = TITAN_AUTOBUFF_TOOLTIP_CONTENTS..TitanUtils_GetColoredText("Enabled", u.ColorList[string.lower("green")]).."\n"; |
||
3312 | else |
||
3313 | TITAN_AUTOBUFF_TOOLTIP_CONTENTS = TITAN_AUTOBUFF_TOOLTIP_CONTENTS..TitanUtils_GetColoredText("Disabled", u.ColorList[string.lower("red")]).."\n"; |
||
3314 | end |
||
3315 | |||
3316 | TITAN_AUTOBUFF_TOOLTIP_CONTENTS = TITAN_AUTOBUFF_TOOLTIP_CONTENTS..TitanUtils_GetColoredText(TITAN_AUTOBUFF_DEBUG, u.ColorList[string.lower("yellow")]).."\t"; |
||
3317 | |||
3318 | if (TitanAutoBuffStates.Debug) then |
||
3319 | TITAN_AUTOBUFF_TOOLTIP_CONTENTS = TITAN_AUTOBUFF_TOOLTIP_CONTENTS..TitanUtils_GetColoredText("Enabled", u.ColorList[string.lower("green")]).."\n"; |
||
3320 | else |
||
3321 | TITAN_AUTOBUFF_TOOLTIP_CONTENTS = TITAN_AUTOBUFF_TOOLTIP_CONTENTS..TitanUtils_GetColoredText("Disabled", u.ColorList[string.lower("red")]).."\n"; |
||
3322 | end |
||
3323 | |||
3324 | if (vClass == string.lower(AUTOBUFF_CLASS_WARLOCK) or vClass == string.lower(AUTOBUFF_CLASS_SHAMAN)) then |
||
3325 | TITAN_AUTOBUFF_TOOLTIP_CONTENTS = TITAN_AUTOBUFF_TOOLTIP_CONTENTS..TitanUtils_GetColoredText(TITAN_AUTOBUFF_WATER, u.ColorList[string.lower("yellow")]).."\t"; |
||
3326 | |||
3327 | if (TitanAutoBuffStates.Water) then |
||
3328 | TITAN_AUTOBUFF_TOOLTIP_CONTENTS = TITAN_AUTOBUFF_TOOLTIP_CONTENTS..TitanUtils_GetColoredText("Enabled", u.ColorList[string.lower("green")]).."\n"; |
||
3329 | else |
||
3330 | TITAN_AUTOBUFF_TOOLTIP_CONTENTS = TITAN_AUTOBUFF_TOOLTIP_CONTENTS..TitanUtils_GetColoredText("Disabled", u.ColorList[string.lower("red")]).."\n"; |
||
3331 | end |
||
3332 | end |
||
3333 | |||
3334 | if (vClass == string.lower(AUTOBUFF_CLASS_WARLOCK) or vClass == string.lower(AUTOBUFF_CLASS_PRIEST)) then |
||
3335 | TITAN_AUTOBUFF_TOOLTIP_CONTENTS = TITAN_AUTOBUFF_TOOLTIP_CONTENTS..TitanUtils_GetColoredText(TITAN_AUTOBUFF_TAP, u.ColorList[string.lower("yellow")]).."\t"; |
||
3336 | |||
3337 | if (TitanAutoBuffStates.Tap) then |
||
3338 | TITAN_AUTOBUFF_TOOLTIP_CONTENTS = TITAN_AUTOBUFF_TOOLTIP_CONTENTS..TitanUtils_GetColoredText("Enabled", u.ColorList[string.lower("green")]).."\n"; |
||
3339 | else |
||
3340 | TITAN_AUTOBUFF_TOOLTIP_CONTENTS = TITAN_AUTOBUFF_TOOLTIP_CONTENTS..TitanUtils_GetColoredText("Disabled", u.ColorList[string.lower("red")]).."\n"; |
||
3341 | end |
||
3342 | end |
||
3343 | |||
3344 | if (vClass == string.lower(AUTOBUFF_CLASS_WARLOCK)) then |
||
3345 | TITAN_AUTOBUFF_TOOLTIP_CONTENTS = TITAN_AUTOBUFF_TOOLTIP_CONTENTS..TitanUtils_GetColoredText(TITAN_AUTOBUFF_SCALED, u.ColorList[string.lower("yellow")]).."\t"; |
||
3346 | |||
3347 | if (TitanAutoBuffStates.Scaled) then |
||
3348 | TITAN_AUTOBUFF_TOOLTIP_CONTENTS = TITAN_AUTOBUFF_TOOLTIP_CONTENTS..TitanUtils_GetColoredText("Enabled", u.ColorList[string.lower("green")]).."\n"; |
||
3349 | else |
||
3350 | TITAN_AUTOBUFF_TOOLTIP_CONTENTS = TITAN_AUTOBUFF_TOOLTIP_CONTENTS..TitanUtils_GetColoredText("Disabled", u.ColorList[string.lower("red")]).."\n"; |
||
3351 | end |
||
3352 | end |
||
3353 | |||
3354 | if (vClass == string.lower(AUTOBUFF_CLASS_PRIEST)) then |
||
3355 | TITAN_AUTOBUFF_TOOLTIP_CONTENTS = TITAN_AUTOBUFF_TOOLTIP_CONTENTS..TitanUtils_GetColoredText(TITAN_AUTOBUFF_INNER, u.ColorList[string.lower("yellow")]).."\t"; |
||
3356 | |||
3357 | if (TitanAutoBuffStates.Inner) then |
||
3358 | TITAN_AUTOBUFF_TOOLTIP_CONTENTS = TITAN_AUTOBUFF_TOOLTIP_CONTENTS..TitanUtils_GetColoredText("Enabled", u.ColorList[string.lower("green")]).."\n"; |
||
3359 | else |
||
3360 | TITAN_AUTOBUFF_TOOLTIP_CONTENTS = TITAN_AUTOBUFF_TOOLTIP_CONTENTS..TitanUtils_GetColoredText("Disabled", u.ColorList[string.lower("red")]).."\n"; |
||
3361 | end |
||
3362 | end |
||
3363 | |||
3364 | return TITAN_AUTOBUFF_TOOLTIP_CONTENTS; |
||
3365 | |||
3366 | end |
||
3367 | |||
3368 | function TitanPanelRightClickMenu_PrepareAutoBuffMenu() |
||
3369 | |||
3370 | local info; |
||
3371 | TitanPanelRightClickMenu_AddTitle(TitanPlugins[TITAN_AUTOBUFF_ID].menuText); |
||
3372 | |||
3373 | info = {}; |
||
3374 | info.text = TITAN_AUTOBUFF_ENABLE; |
||
3375 | info.func = AutoBuffToggle; |
||
3376 | info.checked = TitanAutoBuffStates.Enabled; |
||
3377 | UIDropDownMenu_AddButton(info); |
||
3378 | |||
3379 | TitanPanelRightClickMenu_AddSpacer(); |
||
3380 | |||
3381 | if (vClass == string.lower(AUTOBUFF_CLASS_WARLOCK) or vClass == string.lower(AUTOBUFF_CLASS_SHAMAN)) then |
||
3382 | info = {}; |
||
3383 | info.text = TITAN_AUTOBUFF_WATER; |
||
3384 | info.func = AutoBuffWaterToggle; |
||
3385 | info.checked = TitanAutoBuffStates.Water; |
||
3386 | UIDropDownMenu_AddButton(info); |
||
3387 | end |
||
3388 | |||
3389 | if (vClass == string.lower(AUTOBUFF_CLASS_WARLOCK) or vClass == string.lower(AUTOBUFF_CLASS_PRIEST)) then |
||
3390 | info = {}; |
||
3391 | info.text = TITAN_AUTOBUFF_TAP; |
||
3392 | info.func = AutoBuffTapToggle; |
||
3393 | info.checked = TitanAutoBuffStates.Tap; |
||
3394 | UIDropDownMenu_AddButton(info); |
||
3395 | end |
||
3396 | |||
3397 | if (vClass == string.lower(AUTOBUFF_CLASS_WARLOCK)) then |
||
3398 | info = {}; |
||
3399 | info.text = TITAN_AUTOBUFF_SCALED; |
||
3400 | info.func = AutoBuffScaledToggle; |
||
3401 | info.checked = TitanAutoBuffStates.Scaled; |
||
3402 | UIDropDownMenu_AddButton(info); |
||
3403 | end |
||
3404 | |||
3405 | if (vClass == string.lower(AUTOBUFF_CLASS_PRIEST)) then |
||
3406 | info = {}; |
||
3407 | info.text = TITAN_AUTOBUFF_INNER; |
||
3408 | info.func = AutoBuffInnerToggle; |
||
3409 | info.checked = TitanAutoBuffStates.Inner; |
||
3410 | UIDropDownMenu_AddButton(info); |
||
3411 | end |
||
3412 | |||
3413 | TitanPanelRightClickMenu_AddSpacer(); |
||
3414 | |||
3415 | info = {}; |
||
3416 | info.text = TITAN_AUTOBUFF_BUTTONSHOW; |
||
3417 | info.func = AutoBuff_HideButton; |
||
3418 | info.checked = TitanAutoBuffStates.Button; |
||
3419 | UIDropDownMenu_AddButton(info); |
||
3420 | |||
3421 | info = {}; |
||
3422 | info.text = TITAN_AUTOBUFF_BUTTONRESET; |
||
3423 | info.func = AutoBuff_ResetButton; |
||
3424 | info.checked = nil; |
||
3425 | UIDropDownMenu_AddButton(info); |
||
3426 | |||
3427 | TitanPanelRightClickMenu_AddSpacer(); |
||
3428 | |||
3429 | info = {}; |
||
3430 | info.text = TITAN_AUTOBUFF_DEBUG; |
||
3431 | info.func = AutoBuffDebug; |
||
3432 | info.checked = TitanAutoBuffStates.Debug; |
||
3433 | UIDropDownMenu_AddButton(info); |
||
3434 | |||
3435 | TitanPanelRightClickMenu_AddSpacer(); |
||
3436 | TitanPanelRightClickMenu_AddCommand(TITAN_PANEL_MENU_HIDE, TITAN_AUTOBUFF_ID, TITAN_PANEL_MENU_FUNC_HIDE); |
||
3437 | |||
3438 | end |
||
3439 | |||
3440 | -- Fubar Functions |
||
3441 | function FuBarAutoBuff_OnLoad() |
||
3442 | |||
3443 | AutoBuffFu = AceLibrary("AceAddon-2.0"):new("AceConsole-2.0", "AceDB-2.0", "FuBarPlugin-2.0"); |
||
3444 | local L = AceLibrary("AceLocale-2.0"):new("AutoBuffFu"); |
||
3445 | local Dewdrop = AceLibrary("Dewdrop-2.0"); |
||
3446 | local Tablet = AceLibrary("Tablet-2.0"); |
||
3447 | |||
3448 | L:RegisterTranslations("enUS", function() return { |
||
3449 | ["enable"] = TITAN_AUTOBUFF_ENABLE, |
||
3450 | ["buttonshow"] = TITAN_AUTOBUFF_BUTTONSHOW, |
||
3451 | ["buttonreset"] = TITAN_AUTOBUFF_BUTTONRESET, |
||
3452 | ["debug"] = TITAN_AUTOBUFF_DEBUG, |
||
3453 | ["water"] = TITAN_AUTOBUFF_WATER, |
||
3454 | ["tap"] = TITAN_AUTOBUFF_TAP, |
||
3455 | ["scaled"] = TITAN_AUTOBUFF_SCALED, |
||
3456 | ["inner"] = TITAN_AUTOBUFF_INNER, |
||
3457 | ["tablethint"] = "Left-Click for AutoBuff UI", |
||
3458 | } end); |
||
3459 | |||
3460 | AutoBuffFu:RegisterDB("AutoBuffFuDB"); |
||
3461 | AutoBuffFu.hasNoText = true; |
||
3462 | AutoBuffFu.hasIcon = true; |
||
3463 | AutoBuffFu.defaultPosition = "RIGHT"; |
||
3464 | --AutoBuffFu.title = TITAN_AUTOBUFF_ID; |
||
3465 | AutoBuffFu.title = TITAN_AUTOBUFF_TOOLTIP; -- With Version number |
||
3466 | AutoBuffFu:SetIcon(TITAN_AUTOBUFF_ICON_ON..".tga"); |
||
3467 | |||
3468 | local optionsTable = { |
||
3469 | handler = AutoBuffFu, |
||
3470 | type = "Buffs", |
||
3471 | args = {}; |
||
3472 | }; |
||
3473 | |||
3474 | AutoBuffFu.OnMenuRequest = optionsTable; |
||
3475 | |||
3476 | function AutoBuffFu:OnTooltipUpdate() |
||
3477 | |||
3478 | -- Have been unable to get the tooltip to work, keeps erroring out with: |
||
3479 | -- Count: 5 |
||
3480 | -- Error: ...rface\AddOns\AutoBuff\libs\Tablet-2.0\Tablet-2.0.lua:2265: attempt to index a nil value |
||
3481 | |||
3482 | local cat = Tablet:AddCategory( |
||
3483 | 'columns', 2 |
||
3484 | ); |
||
3485 | if (TitanAutoBuffStates.Enabled) then |
||
3486 | cat:AddLine( |
||
3487 | 'text', L"enable", |
||
3488 | 'textR', 1, |
||
3489 | 'textG', 1, |
||
3490 | 'textB', 0, |
||
3491 | 'text2', "Enabled", |
||
3492 | 'text2R', 0, |
||
3493 | 'text2G', 1, |
||
3494 | 'text2B', 0 |
||
3495 | ); |
||
3496 | else |
||
3497 | cat:AddLine( |
||
3498 | 'text', L"enable", |
||
3499 | 'textR', 1, |
||
3500 | 'textG', 1, |
||
3501 | 'textB', 0, |
||
3502 | 'text2', "Disabled", |
||
3503 | 'text2R', 1, |
||
3504 | 'text2G', 0, |
||
3505 | 'text2B', 0 |
||
3506 | ); |
||
3507 | end |
||
3508 | |||
3509 | if (TitanAutoBuffStates.Debug) then |
||
3510 | cat:AddLine( |
||
3511 | 'text', L"debug", |
||
3512 | 'textR', 1, |
||
3513 | 'textG', 1, |
||
3514 | 'textB', 0, |
||
3515 | 'text2', "Enabled", |
||
3516 | 'text2R', 0, |
||
3517 | 'text2G', 1, |
||
3518 | 'text2B', 0 |
||
3519 | ); |
||
3520 | else |
||
3521 | cat:AddLine( |
||
3522 | 'text', L"debug", |
||
3523 | 'textR', 1, |
||
3524 | 'textG', 1, |
||
3525 | 'textB', 0, |
||
3526 | 'text2', "Disabled", |
||
3527 | 'text2R', 1, |
||
3528 | 'text2G', 0, |
||
3529 | 'text2B', 0 |
||
3530 | ); |
||
3531 | end |
||
3532 | |||
3533 | if (vClass == string.lower(AUTOBUFF_CLASS_WARLOCK) or vClass == string.lower(AUTOBUFF_CLASS_SHAMAN)) then |
||
3534 | if (TitanAutoBuffStates.Water) then |
||
3535 | cat:AddLine( |
||
3536 | 'text', L"water", |
||
3537 | 'textR', 1, |
||
3538 | 'textG', 1, |
||
3539 | 'textB', 0, |
||
3540 | 'text2', "Enabled", |
||
3541 | 'text2R', 0, |
||
3542 | 'text2G', 1, |
||
3543 | 'text2B', 0 |
||
3544 | ); |
||
3545 | else |
||
3546 | cat:AddLine( |
||
3547 | 'text', L"water", |
||
3548 | 'textR', 1, |
||
3549 | 'textG', 1, |
||
3550 | 'textB', 0, |
||
3551 | 'text2', "Disabled", |
||
3552 | 'text2R', 1, |
||
3553 | 'text2G', 0, |
||
3554 | 'text2B', 0 |
||
3555 | ); |
||
3556 | end |
||
3557 | end |
||
3558 | |||
3559 | if (vClass == string.lower(AUTOBUFF_CLASS_WARLOCK) or vClass == string.lower(AUTOBUFF_CLASS_PRIEST)) then |
||
3560 | if (TitanAutoBuffStates.Tap) then |
||
3561 | cat:AddLine( |
||
3562 | 'text', L"tap", |
||
3563 | 'textR', 1, |
||
3564 | 'textG', 1, |
||
3565 | 'textB', 0, |
||
3566 | 'text2', "Enabled", |
||
3567 | 'text2R', 0, |
||
3568 | 'text2G', 1, |
||
3569 | 'text2B', 0 |
||
3570 | ); |
||
3571 | else |
||
3572 | cat:AddLine( |
||
3573 | 'text', L"tap", |
||
3574 | 'textR', 1, |
||
3575 | 'textG', 1, |
||
3576 | 'textB', 0, |
||
3577 | 'text2', "Disabled", |
||
3578 | 'text2R', 1, |
||
3579 | 'text2G', 0, |
||
3580 | 'text2B', 0 |
||
3581 | ); |
||
3582 | end |
||
3583 | end |
||
3584 | |||
3585 | if (vClass == string.lower(AUTOBUFF_CLASS_WARLOCK)) then |
||
3586 | if (TitanAutoBuffStates.Scaled) then |
||
3587 | cat:AddLine( |
||
3588 | 'text', L"scaled", |
||
3589 | 'textR', 1, |
||
3590 | 'textG', 1, |
||
3591 | 'textB', 0, |
||
3592 | 'text2', "Enabled", |
||
3593 | 'text2R', 0, |
||
3594 | 'text2G', 1, |
||
3595 | 'text2B', 0 |
||
3596 | ); |
||
3597 | else |
||
3598 | cat:AddLine( |
||
3599 | 'text', L"scaled", |
||
3600 | 'textR', 1, |
||
3601 | 'textG', 1, |
||
3602 | 'textB', 0, |
||
3603 | 'text2', "Disabled", |
||
3604 | 'text2R', 1, |
||
3605 | 'text2G', 0, |
||
3606 | 'text2B', 0 |
||
3607 | ); |
||
3608 | end |
||
3609 | end |
||
3610 | |||
3611 | if (vClass == string.lower(AUTOBUFF_CLASS_PRIEST)) then |
||
3612 | if (TitanAutoBuffStates.Inner) then |
||
3613 | cat:AddLine( |
||
3614 | 'text', TITAN_AUTOBUFF_INNER, |
||
3615 | 'textR', 1, |
||
3616 | 'textG', 1, |
||
3617 | 'textB', 0, |
||
3618 | 'text2', "Enabled", |
||
3619 | 'text2R', 0, |
||
3620 | 'text2G', 1, |
||
3621 | 'text2B', 0 |
||
3622 | ); |
||
3623 | else |
||
3624 | cat:AddLine( |
||
3625 | 'text', TITAN_AUTOBUFF_INNER, |
||
3626 | 'textR', 1, |
||
3627 | 'textG', 1, |
||
3628 | 'textB', 0, |
||
3629 | 'text2', "Disabled", |
||
3630 | 'text2R', 1, |
||
3631 | 'text2G', 0, |
||
3632 | 'text2B', 0 |
||
3633 | ); |
||
3634 | end |
||
3635 | end |
||
3636 | |||
3637 | cat:AddLine("text", ""); |
||
3638 | |||
3639 | Tablet:SetHint(L"tablethint"); |
||
3640 | end |
||
3641 | |||
3642 | function AutoBuffFu:OnMenuRequest(value) |
||
3643 | Dewdrop:AddLine( |
||
3644 | "text", TITAN_AUTOBUFF_ENABLE, |
||
3645 | "arg1", self, |
||
3646 | "func", AutoBuffToggle, |
||
3647 | "checked", TitanAutoBuffStates.Enabled |
||
3648 | ); |
||
3649 | Dewdrop:AddLine( |
||
3650 | "text", "" |
||
3651 | ); |
||
3652 | if (vClass == string.lower(AUTOBUFF_CLASS_WARLOCK) or vClass == string.lower(AUTOBUFF_CLASS_SHAMAN)) then |
||
3653 | Dewdrop:AddLine( |
||
3654 | "text", TITAN_AUTOBUFF_WATER, |
||
3655 | "arg1", self, |
||
3656 | "func", AutoBuffWaterToggle, |
||
3657 | "checked", TitanAutoBuffStates.Water |
||
3658 | ); |
||
3659 | end |
||
3660 | if (vClass == string.lower(AUTOBUFF_CLASS_WARLOCK) or vClass == string.lower(AUTOBUFF_CLASS_PRIEST)) then |
||
3661 | Dewdrop:AddLine( |
||
3662 | "text", TITAN_AUTOBUFF_TAP, |
||
3663 | "arg1", self, |
||
3664 | "func", AutoBuffTapToggle, |
||
3665 | "checked", TitanAutoBuffStates.Tap |
||
3666 | ); |
||
3667 | end |
||
3668 | if (vClass == string.lower(AUTOBUFF_CLASS_WARLOCK)) then |
||
3669 | Dewdrop:AddLine( |
||
3670 | "text", TITAN_AUTOBUFF_SCALED, |
||
3671 | "arg1", self, |
||
3672 | "func", AutoBuffScaledToggle, |
||
3673 | "checked", TitanAutoBuffStates.Scaled |
||
3674 | ); |
||
3675 | end |
||
3676 | if (vClass == string.lower(AUTOBUFF_CLASS_PRIEST)) then |
||
3677 | Dewdrop:AddLine( |
||
3678 | "text", TITAN_AUTOBUFF_INNER, |
||
3679 | "arg1", self, |
||
3680 | "func", AutoBuffInnerToggle, |
||
3681 | "checked", TitanAutoBuffStates.Inner |
||
3682 | ); |
||
3683 | end |
||
3684 | Dewdrop:AddLine( |
||
3685 | "text", "" |
||
3686 | ); |
||
3687 | Dewdrop:AddLine( |
||
3688 | "text", TITAN_AUTOBUFF_BUTTONSHOW, |
||
3689 | "arg1", self, |
||
3690 | "func", AutoBuff_HideButton, |
||
3691 | "checked", TitanAutoBuffStates.Button |
||
3692 | ); |
||
3693 | Dewdrop:AddLine( |
||
3694 | "text", TITAN_AUTOBUFF_BUTTONRESET, |
||
3695 | "arg1", self, |
||
3696 | "func", AutoBuff_ResetButton, |
||
3697 | "checked", nil |
||
3698 | ); |
||
3699 | Dewdrop:AddLine( |
||
3700 | "text", "" |
||
3701 | ); |
||
3702 | Dewdrop:AddLine( |
||
3703 | "text", TITAN_AUTOBUFF_DEBUG, |
||
3704 | "arg1", self, |
||
3705 | "func", AutoBuffDebug, |
||
3706 | "checked", TitanAutoBuffStates.Debug |
||
3707 | ); |
||
3708 | |||
3709 | Dewdrop:AddLine("text", ""); |
||
3710 | end |
||
3711 | |||
3712 | function AutoBuffFu:OnClick() -- Only reacts on "LeftButton" |
||
3713 | AutoBuffOptionsButton_OnClick("LeftButton"); |
||
3714 | end |
||
3715 | |||
3716 | end -- End prevention code wrap |
||
3717 | |||
3718 | -- Class declarations |
||
3719 | -- Utility class provides print (to the chat box) and echo (displays over your character's head). |
||
3720 | -- Instantiate it and use the colon syntax. |
||
3721 | -- Color is an optional argument. You can either use one of 7 named colors |
||
3722 | -- "red", "green", "blue", "yellow", "cyan", "magenta", "white" or |
||
3723 | -- a table with the r, g, b values. |
||
3724 | -- IE foo:Print("some text", {r = 1.0, g=1.0, b=.5}) |
||
3725 | |||
3726 | -- if there is an existing Utility Class version of equal or greater version, don't declare. |
||
3727 | if not Utility_Class or (not Utility_Class.version) or (Utility_Class.version < 1.01) then |
||
3728 | Utility_Class = {}; |
||
3729 | Utility_Class.version = 1.01 |
||
3730 | function Utility_Class:New () |
||
3731 | local o = {} -- create object |
||
3732 | setmetatable(o, self) |
||
3733 | self.__index = self |
||
3734 | return o |
||
3735 | end |
||
3736 | |||
3737 | function Utility_Class:Print(msg, color) |
||
3738 | local text; |
||
3739 | local r, g, b; |
||
3740 | if msg == nil then return; end |
||
3741 | if color == nil then color = "white"; end |
||
3742 | r, g, b = self.GetColor(color); |
||
3743 | |||
3744 | if( DEFAULT_CHAT_FRAME ) then |
||
3745 | DEFAULT_CHAT_FRAME:AddMessage(msg,r,g,b); |
||
3746 | end |
||
3747 | |||
3748 | end |
||
3749 | |||
3750 | function Utility_Class:Echo(msg, color) |
||
3751 | local text; |
||
3752 | local r, g, b; |
||
3753 | if msg == nil then return; end |
||
3754 | if color == nil then color = "white"; end |
||
3755 | r, g, b = self.GetColor(color); |
||
3756 | |||
3757 | UIErrorsFrame:AddMessage(msg, r, g, b, 1.0, UIERRORS_HOLD_TIME); |
||
3758 | |||
3759 | end |
||
3760 | |||
3761 | function Utility_Class:GetColor(color) |
||
3762 | if color == nil then color = self; end |
||
3763 | if color == nil then return 0, 0, 0 end |
||
3764 | |||
3765 | if type(color) == "string" then |
||
3766 | color = Utility_Class.ColorList[string.lower(color)]; |
||
3767 | end |
||
3768 | |||
3769 | if type(color) == "table" then |
||
3770 | if color.r == nil then color.r = 0.0 end |
||
3771 | if color.g == nil then color.g = 0.0 end |
||
3772 | if color.b == nil then color.g = 0.0 end |
||
3773 | else |
||
3774 | return 0, 0, 0 |
||
3775 | end |
||
3776 | |||
3777 | if color.r < 0 then color.r = 0.0 end |
||
3778 | if color.g < 0 then color.g = 0.0 end |
||
3779 | if color.b < 0 then color.g = 0.0 end |
||
3780 | |||
3781 | if color.r > 1 then color.r = 1.0 end |
||
3782 | if color.g > 1 then color.g = 1.0 end |
||
3783 | if color.b > 1 then color.g = 1.0 end |
||
3784 | |||
3785 | return color.r, color.g, color.b |
||
3786 | |||
3787 | end |
||
3788 | |||
3789 | Utility_Class.ColorList = {} |
||
3790 | Utility_Class.ColorList["red"] = { r = 1.0, g = 0.0, b = 0.0 } |
||
3791 | Utility_Class.ColorList["green"] = { r = 0.0, g = 1.0, b = 0.0 } |
||
3792 | Utility_Class.ColorList["blue"] = { r = 0.0, g = 0.0, b = 1.0 } |
||
3793 | Utility_Class.ColorList["white"] = { r = 1.0, g = 1.0, b = 1.0 } |
||
3794 | Utility_Class.ColorList["magenta"] = { r = 1.0, g = 0.0, b = 1.0 } |
||
3795 | Utility_Class.ColorList["yellow"] = { r = 1.0, g = 1.0, b = 0.0 } |
||
3796 | Utility_Class.ColorList["cyan"] = { r = 0.0, g = 1.0, b = 1.0 } |
||
3797 | Utility_Class.ColorList["orange"] = { r = 1.0, g = 0.6, b = 0.0 } |
||
3798 | end |