forked from Celther-FFXI/GearSwap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWHM.lua
585 lines (517 loc) · 26.2 KB
/
WHM.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- __________.__ ________ __ .__.__ __ __ .__ .__ _____.__.__
-- \______ | | ____ _____ ______ ____ \______ \ ____ ____ _____/ |_ ____ __| _|___/ |_ _/ |_| |__ |__| ______ _/ ____|__| | ____
-- | ___| | _/ __ \\__ \ / ____/ __ \ | | \ / _ \ / \ / _ \ __\ _/ __ \ / __ || \ __\ \ __| | \| |/ ___/ \ __\| | | _/ __ \
-- | | | |_\ ___/ / __ \_\___ \\ ___/ | ` ( <_> ) | | ( <_> | | \ ___// /_/ || || | | | | Y | |\___ \ | | | | |_\ ___/
-- |____| |____/\___ (____ /____ >\___ > /_______ /\____/ |___| /\____/|__| \___ \____ ||__||__| |__| |___| |__/____ > |__| |__|____/\___ > /\
-- \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/
--
-- Please do not edit this file! Please do not edit this file! Please do not edit this file!
--
-- Editing this file will cause you to be unable to use Github Desktop to update!
--
-- Any changes you wish to make in this file you should be able to make by overloading. That is Re-Defining the same variables or functions in another file, by copying and
-- pasting them to a file that is loaded after the original file, all of my library files, and then job files are loaded first.
-- The last files to load are the ones unique to you. User-Globals, Charactername-Globals, Charactername_Job_Gear, in that order, so these changes will take precedence.
--
-- You may wish to "hook" into existing functions, to add functionality without losing access to updates or fixes I make, for example, instead of copying and editing
-- status_change(), you can instead use the function user_status_change() in the same manner, which is called by status_change() if it exists, most of the important
-- gearswap functions work like this in my files, and if it's unique to a specific job, user_job_status_change() would be appropriate instead.
--
-- Variables and tables can be easily redefined just by defining them in one of the later loaded files: autofood = 'Miso Ramen' for example.
-- States can be redefined as well: state.HybridMode:options('Normal','PDT') though most of these are already redefined in the gear files for editing there.
-- Commands can be added easily with: user_self_command(commandArgs, eventArgs) or user_job_self_command(commandArgs, eventArgs)
--
-- If you're not sure where is appropriate to copy and paste variables, tables and functions to make changes or add them:
-- User-Globals.lua - This file loads with all characters, all jobs, so it's ideal for settings and rules you want to be the same no matter what.
-- Charactername-Globals.lua - This file loads with one character, all jobs, so it's ideal for gear settings that are usable on all jobs, but unique to this character.
-- Charactername_Job_Gear.lua- This file loads only on one character, one job, so it's ideal for things that are specific only to that job and character.
--
--
-- If you still need help, feel free to contact me on discord or ask in my chat for help: https://discord.gg/ug6xtvQ
-- !Please do NOT message me in game about anything third party related, though you're welcome to message me there and ask me to talk on another medium.
--
-- Please do not edit this file! Please do not edit this file! Please do not edit this file!
-- __________.__ ________ __ .__.__ __ __ .__ .__ _____.__.__
-- \______ | | ____ _____ ______ ____ \______ \ ____ ____ _____/ |_ ____ __| _|___/ |_ _/ |_| |__ |__| ______ _/ ____|__| | ____
-- | ___| | _/ __ \\__ \ / ____/ __ \ | | \ / _ \ / \ / _ \ __\ _/ __ \ / __ || \ __\ \ __| | \| |/ ___/ \ __\| | | _/ __ \
-- | | | |_\ ___/ / __ \_\___ \\ ___/ | ` ( <_> ) | | ( <_> | | \ ___// /_/ || || | | | | Y | |\___ \ | | | | |_\ ___/
-- |____| |____/\___ (____ /____ >\___ > /_______ /\____/ |___| /\____/|__| \___ \____ ||__||__| |__| |___| |__/____ > |__| |__|____/\___ > /\
-- \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Setup functions for this job. Generally should not be modified.
-------------------------------------------------------------------------------------------------------------------
-- Initialization function for this job file.
function get_sets()
-- Load and initialize the include file.
include('Sel-Include.lua')
end
-- Setup vars that are user-independent. state.Buff vars initialized here will automatically be tracked.
function job_setup()
state.Buff['Afflatus Solace'] = buffactive['Afflatus Solace'] or false
state.Buff['Afflatus Misery'] = buffactive['Afflatus Misery'] or false
state.Buff['Divine Caress'] = buffactive['Divine Caress'] or false
state.AutoCaress = M(true, 'Auto Caress Mode')
state.Gambanteinn = M(false, 'Gambanteinn Cursna Mode')
state.BlockLowDevotion = M(true, 'Block Low Devotion')
autows = 'Mystic Boon'
autofood = 'Miso Ramen'
state.ElementalMode = M{['description'] = 'Elemental Mode','Light','Dark','Fire','Ice','Wind','Earth','Lightning','Water',}
init_job_states({"Capacity","AutoRuneMode","AutoTrustMode","AutoNukeMode","AutoWSMode","AutoShadowMode","AutoFoodMode","AutoStunMode","AutoDefenseMode"},{"AutoBuffMode","Weapons","OffenseMode","WeaponskillMode","IdleMode","Passive","RuneElement","ElementalMode","CastingMode","TreasureMode",})
function handle_smartcure(cmdParams)
if cmdParams[2] then
if tonumber(cmdParams[2]) then
cureTarget = windower.ffxi.get_mob_by_id(tonumber(cmdParams[2]))
else
cureTarget = table.concat(cmdParams, ' ', 2)
cureTarget = get_closest_mob_by_name(cureTarget)
if not cureTarget.name then cureTarget = player.target end
if not cureTarget.name then cureTarget = player end
end
elseif player.target.type == "SELF" or player.target.type == 'MONSTER' or player.target.type == 'NONE' then
cureTarget = player
else
cureTarget = player.target
end
if cureTarget.status == 2 or cureTarget.status == 3 then
windower.chat.input('/ma "Arise" '..cureTarget..'')
return
end
local missingHP
local spell_recasts = windower.ffxi.get_spell_recasts()
if cureTarget.type == 'MONSTER' then
if silent_can_use(4) and spell_recasts[4] < spell_latency then
windower.chat.input('/ma "Cure IV" '..cureTarget.id..'')
elseif spell_recasts[3] < spell_latency then
windower.chat.input('/ma "Cure III" '..cureTarget.id..'')
elseif spell_recasts[2] < spell_latency then
windower.chat.input('/ma "Cure II" '..cureTarget.id..'')
else
add_to_chat(123,'Abort: Appropriate cures are on cooldown.')
end
elseif cureTarget.in_alliance then
cureTarget.hp = find_player_in_alliance(cureTarget.name).hp
local est_max_hp = cureTarget.hp / (cureTarget.hpp/100)
missingHP = math.floor(est_max_hp - cureTarget.hp)
else
local est_current_hp = 1800 * (cureTarget.hpp/100)
missingHP = math.floor(1800 - est_current_hp)
end
if missingHP < 250 then
if spell_recasts[1] < spell_latency then
windower.chat.input('/ma "Cure" '..cureTarget.id..'')
elseif spell_recasts[2] < spell_latency then
windower.chat.input('/ma "Cure II" '..cureTarget.id..'')
else
add_to_chat(123,'Abort: Appropriate cures are on cooldown.')
end
elseif missingHP < 400 then
if spell_recasts[2] < spell_latency then
windower.chat.input('/ma "Cure II" '..cureTarget.id..'')
elseif spell_recasts[3] < spell_latency then
windower.chat.input('/ma "Cure III" '..cureTarget.id..'')
elseif spell_recasts[1] < spell_latency then
windower.chat.input('/ma "Cure" '..cureTarget.id..'')
else
add_to_chat(123,'Abort: Appropriate cures are on cooldown.')
end
elseif missingHP < 900 then
if spell_recasts[3] < spell_latency then
windower.chat.input('/ma "Cure III" '..cureTarget.id..'')
elseif spell_recasts[4] < spell_latency then
windower.chat.input('/ma "Cure IV" '..cureTarget.id..'')
elseif spell_recasts[5] < spell_latency then
windower.chat.input('/ma "Cure V" '..cureTarget.id..'')
else
add_to_chat(123,'Abort: Appropriate cures are on cooldown.')
end
elseif missingHP < 1400 then
if spell_recasts[5] < spell_latency then
windower.chat.input('/ma "Cure V" '..cureTarget.id..'')
elseif spell_recasts[4] < spell_latency then
windower.chat.input('/ma "Cure IV" '..cureTarget.id..'')
elseif spell_recasts[6] < spell_latency then
windower.chat.input('/ma "Cure VI" '..cureTarget.id..'')
elseif spell_recasts[3] < spell_latency then
windower.chat.input('/ma "Cure III" '..cureTarget.id..'')
else
add_to_chat(123,'Abort: Appropriate cures are on cooldown.')
end
else
if spell_recasts[6] < spell_latency then
windower.chat.input('/ma "Cure VI" '..cureTarget.id..'')
elseif spell_recasts[5] < spell_latency then
windower.chat.input('/ma "Cure V" '..cureTarget.id..'')
elseif spell_recasts[4] < spell_latency then
windower.chat.input('/ma "Cure IV" '..cureTarget.id..'')
elseif spell_recasts[3] < spell_latency then
windower.chat.input('/ma "Cure III" '..cureTarget.id..'')
else
add_to_chat(123,'Abort: Appropriate cures are on cooldown.')
end
end
end
end
-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks for standard casting events.
-------------------------------------------------------------------------------------------------------------------
-- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
-- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
function job_filtered_action(spell, eventArgs)
end
function job_pretarget(spell, spellMap, eventArgs)
end
function job_precast(spell, spellMap, eventArgs)
if spell.action_type == 'Magic' then
if spellMap == 'Cure' or spellMap == 'Curaga' then
gear.default.obi_waist = gear.obi_cure_waist
gear.default.obi_back = gear.obi_cure_back
elseif spell.english == 'Holy II' then
gear.default.obi_waist = gear.obi_high_nuke_waist
elseif spell.english == 'Holy' or (spell.skill == 'Elemental Magic' and default_spell_map ~= 'ElementalEnfeeble') then
gear.default.obi_waist = gear.obi_nuke_waist
gear.default.obi_back = gear.obi_nuke_back
elseif spellMap == 'StatusRemoval' and not (spell.english == "Erase" or spell.english == "Esuna" or spell.english == "Sacrifice") then
local abil_recasts = windower.ffxi.get_ability_recasts()
if abil_recasts[32] < latency and not silent_check_amnesia() and state.AutoCaress.value then
eventArgs.cancel = true
windower.chat.input('/ja "Divine Caress" <me>')
windower.chat.input:schedule(1,'/ma "'..spell.english..'" '..spell.target.raw..'')
return
end
end
elseif spell.type == 'JobAbility' then
local abil_recasts = windower.ffxi.get_ability_recasts()
if spell.english == 'Devotion' and state.BlockLowDevotion.value and abil_recasts[28] < latency and player.hpp < 50 then
eventArgs.cancel = true
add_to_chat(123,'Abort: Blocking Devotion under 50% HP to prevent inefficient use.')
end
end
if state.CastingMode.value == 'Proc' then
classes.CustomClass = 'Proc'
end
end
function job_post_precast(spell, spellMap, eventArgs)
if spell.type == 'WeaponSkill' then
local WSset = standardize_set(get_precast_set(spell, spellMap))
if (WSset.ear1 == "Moonshade Earring" or WSset.ear2 == "Moonshade Earring") then
-- Replace Moonshade Earring if we're at cap TP
if sets.MaxTP and get_effective_player_tp(spell, WSset) > 3200 then
equip(sets.MaxTP[spell.english] or sets.MaxTP)
end
end
end
end
function job_post_midcast(spell, spellMap, eventArgs)
-- Apply Divine Caress boosting items as highest priority over other gear, if applicable.
if spellMap == 'StatusRemoval' then
if state.Buff['Divine Caress'] then
equip(sets.buff['Divine Caress'])
end
if spell.english == 'Cursna' then
if (player.sub_job == 'NIN' or player.sub_job == 'DNC') and sets.midcast.DWCursna then
equip(sets.midcast.DWCursna)
elseif state.Gambanteinn.value and item_available('Gambanteinn') then
equip({main="Gambanteinn"})
end
end
elseif spellMap == 'BarElement' then
if (state.Buff['Light Arts'] or state.Buff['Addendum: White']) and sets.midcast.BarElement and sets.midcast.BarElement.LightArts then
equip(sets.midcast.BarElement.LightArts)
end
elseif spell.skill == 'Elemental Magic' and default_spell_map ~= 'ElementalEnfeeble' and spell.english ~= 'Impact' then
if state.MagicBurstMode.value ~= 'Off' then equip(sets.MagicBurst) end
if spell.element == world.weather_element or spell.element == world.day_element then
if state.CastingMode.value == 'Fodder' then
if spell.element == world.day_element then
if item_available('Zodiac Ring') then
sets.ZodiacRing = {ring2="Zodiac Ring"}
equip(sets.ZodiacRing)
end
end
end
end
if spell.element and sets.element[spell.element] then
equip(sets.element[spell.element])
end
end
end
function job_aftercast(spell, spellMap, eventArgs)
if not spell.interrupted then
if state.UseCustomTimers.value and spell.english == 'Sleep' or spell.english == 'Sleepga' then
send_command('@timers c "'..spell.english..' ['..spell.target.name..']" 60 down spells/00220.png')
elseif spell.skill == 'Elemental Magic' and state.MagicBurstMode.value == 'Single' then
state.MagicBurstMode:reset()
if state.DisplayMode.value then update_job_states() end
end
end
end
-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks for non-casting events.
-------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------
-- User code that supplements standard library decisions.
-------------------------------------------------------------------------------------------------------------------
-- Custom spell mapping.
function job_get_spell_map(spell, default_spell_map)
if spell.action_type == 'Magic' then
if default_spell_map == 'Curaga' then
if world.weather_element == 'Light' then
return 'LightWeatherCuraga'
elseif world.day_element == 'Light' then
return 'LightDayCuraga'
end
elseif default_spell_map == 'Cure' then
if state.Weapons.value ~= 'None' then
if state.Buff['Afflatus Solace'] then
if world.weather_element == 'Light' then
return '"MeleeLightWeatherCureSolace'
elseif world.day_element == 'Light' then
return 'MeleeLightDayCureSolace'
else
return "MeleeCureSolace"
end
elseif world.weather_element == 'Light' then
return 'MeleeLightWeatherCure'
elseif world.day_element == 'Light' then
return 'MeleeLightDayCure'
else
return 'MeleeCure'
end
elseif state.Buff['Afflatus Solace'] then
if world.weather_element == 'Light' then
return 'LightWeatherCureSolace'
elseif world.day_element == 'Light' then
return 'LightDayCureSolace'
else
return "CureSolace"
end
elseif world.weather_element == 'Light' then
return 'LightWeatherCure'
elseif world.day_element == 'Light' then
return 'LightDayCure'
end
elseif spell.skill == "Enfeebling Magic" then
if spell.english:startswith('Dia') then
return "Dia"
elseif spell.type == "WhiteMagic" or spell.english:startswith('Frazzle') or spell.english:startswith('Distract') then
return 'MndEnfeebles'
else
return 'IntEnfeebles'
end
end
end
end
function job_customize_idle_set(idleSet)
if buffactive['Sublimation: Activated'] then
if (state.IdleMode.value == 'Normal' or state.IdleMode.value:contains('Sphere')) and sets.buff.Sublimation then
idleSet = set_combine(idleSet, sets.buff.Sublimation)
elseif state.IdleMode.value:contains('DT') and sets.buff.DTSublimation then
idleSet = set_combine(idleSet, sets.buff.DTSublimation)
end
end
if state.IdleMode.value == 'Normal' or state.IdleMode.value:contains('Sphere') then
if player.mpp < 51 then
if sets.latent_refresh then
idleSet = set_combine(idleSet, sets.latent_refresh)
end
if (state.Weapons.value == 'None' or state.UnlockWeapons.value) and idleSet.main then
local main_table = get_item_table(idleSet.main)
if main_table and main_table.skill == 12 and sets.latent_refresh_grip then
idleSet = set_combine(idleSet, sets.latent_refresh_grip)
end
if player.tp > 10 and sets.TPEat then
idleSet = set_combine(idleSet, sets.TPEat)
end
end
end
end
return idleSet
end
-- Called by the 'update' self-command.
function job_update(cmdParams, eventArgs)
if cmdParams[1] == 'user' then check_arts() end
end
-- Function to display the current relevant user state when doing an update.
function display_current_job_state(eventArgs)
display_current_caster_state()
eventArgs.handled = true
end
-- Allow jobs to override this code
function job_self_command(commandArgs, eventArgs)
if commandArgs[1]:lower() == 'smartcure' then
handle_smartcure(commandArgs)
eventArgs.handled = true
elseif commandArgs[1]:lower() == 'elemental' then
handle_elemental(commandArgs)
eventArgs.handled = true
end
end
function job_tick()
if check_arts() then return true end
if check_buff() then return true end
if check_buffup() then return true end
return false
end
function check_arts()
if buffup ~= '' or (not data.areas.cities:contains(world.area) and ((state.AutoArts.value and player.in_combat) or state.AutoBuffMode.value ~= 'Off')) then
local abil_recasts = windower.ffxi.get_ability_recasts()
if abil_recasts[29] < latency and not state.Buff['Afflatus Solace'] and not state.Buff['Afflatus Misery'] then
send_command('@input /ja "Afflatus Solace" <me>')
tickdelay = os.clock() + 1
return true
elseif player.sub_job == 'SCH' and not (state.Buff['SJ Restriction'] or arts_active()) and abil_recasts[228] < latency then
send_command('@input /ja "Light Arts" <me>')
tickdelay = os.clock() + 1
return true
end
end
return false
end
function handle_elemental(cmdParams)
-- cmdParams[1] == 'elemental'
-- cmdParams[2] == ability to use
if not cmdParams[2] then
add_to_chat(123,'Error: No elemental command given.')
return
end
local command = cmdParams[2]:lower()
if command == 'spikes' then
windower.chat.input('/ma "'..data.elements.spikes_of[state.ElementalMode.value]..' Spikes" <me>')
return
elseif command == 'enspell' then
windower.chat.input('/ma "En'..data.elements.enspell_of[state.ElementalMode.value]..'" <me>')
return
--Leave out target, let shortcuts auto-determine it.
elseif command == 'weather' then
if player.sub_job == 'RDM' then
windower.chat.input('/ma "Phalanx" <me>')
else
local spell_recasts = windower.ffxi.get_spell_recasts()
if (player.target.type == 'SELF' or not player.target.in_party) and buffactive[data.elements.storm_of[state.ElementalMode.value]] and not buffactive['Klimaform'] and spell_recasts[287] < spell_latency then
windower.chat.input('/ma "Klimaform" <me>')
else
windower.chat.input('/ma "'..data.elements.storm_of[state.ElementalMode.value]..'"')
end
end
return
end
local target = '<t>'
if cmdParams[3] then
if tonumber(cmdParams[3]) then
target = tonumber(cmdParams[3])
else
target = table.concat(cmdParams, ' ', 3)
target = get_closest_mob_id_by_name(target) or '<t>'
end
end
if command == 'nuke' or command == 'smallnuke' then
local spell_recasts = windower.ffxi.get_spell_recasts()
if command == 'nuke' and state.ElementalMode.value == 'Light' then
local tiers = {'Holy II','Holy','Banish III','Banish II','Banish'}
for k in ipairs(tiers) do
if spell_recasts[get_spell_table_by_name(tiers[k]).id] < spell_latency and actual_cost(get_spell_table_by_name(tiers[k])) < player.mp then
windower.chat.input('/ma "'..tiers[k]..'" '..target..'')
return
end
end
else
local tiers = {' II',''}
for k in ipairs(tiers) do
if spell_recasts[get_spell_table_by_name(data.elements.nuke_of[state.ElementalMode.value]..''..tiers[k]..'').id] < spell_latency and actual_cost(get_spell_table_by_name(data.elements.nuke_of[state.ElementalMode.value]..''..tiers[k]..'')) < player.mp then
windower.chat.input('/ma "'..data.elements.nuke_of[state.ElementalMode.value]..''..tiers[k]..'" '..target..'')
return
end
end
end
add_to_chat(123,'Abort: All '..data.elements.nuke_of[state.ElementalMode.value]..' nukes on cooldown or or not enough MP.')
elseif command:contains('tier') then
local spell_recasts = windower.ffxi.get_spell_recasts()
local tierlist = {['tier1']='',['tier2']=' II',['tier3']=' III',['tier4']=' IV',['tier5']=' V',['tier6']=' VI'}
windower.chat.input('/ma "'..data.elements.nuke_of[state.ElementalMode.value]..tierlist[command]..'" '..target..'')
elseif command == 'ara' then
windower.chat.input('/ma "'..data.elements.nukera_of[state.ElementalMode.value]..'ra" '..target..'')
elseif command == 'aga' then
windower.chat.input('/ma "'..data.elements.nukega_of[state.ElementalMode.value]..'ga" '..target..'')
elseif command == 'helix' then
windower.chat.input('/ma "'..data.elements.helix_of[state.ElementalMode.value]..'helix" '..target..'')
elseif command == 'enfeeble' then
windower.chat.input('/ma "'..data.elements.elemental_enfeeble_of[state.ElementalMode.value]..'" '..target..'')
elseif command == 'bardsong' then
windower.chat.input('/ma "'..data.elements.threnody_of[state.ElementalMode.value]..' Threnody" '..target..'')
else
add_to_chat(123,'Unrecognized elemental command.')
end
end
function check_buff()
if state.AutoBuffMode.value ~= 'Off' and not data.areas.cities:contains(world.area) then
local spell_recasts = windower.ffxi.get_spell_recasts()
for i in pairs(buff_spell_lists[state.AutoBuffMode.Value]) do
if not buffactive[buff_spell_lists[state.AutoBuffMode.Value][i].Buff] and (buff_spell_lists[state.AutoBuffMode.Value][i].When == 'Always' or (buff_spell_lists[state.AutoBuffMode.Value][i].When == 'Combat' and (player.in_combat or being_attacked)) or (buff_spell_lists[state.AutoBuffMode.Value][i].When == 'Engaged' and player.status == 'Engaged') or (buff_spell_lists[state.AutoBuffMode.Value][i].When == 'Idle' and player.status == 'Idle') or (buff_spell_lists[state.AutoBuffMode.Value][i].When == 'OutOfCombat' and not (player.in_combat or being_attacked))) and spell_recasts[buff_spell_lists[state.AutoBuffMode.Value][i].SpellID] < spell_latency and silent_can_use(buff_spell_lists[state.AutoBuffMode.Value][i].SpellID) then
windower.chat.input('/ma "'..buff_spell_lists[state.AutoBuffMode.Value][i].Name..'" <me>')
tickdelay = os.clock() + 2
return true
end
end
else
return false
end
end
function check_buffup()
if buffup ~= '' then
local needsbuff = false
for i in pairs(buff_spell_lists[buffup]) do
if not buffactive[buff_spell_lists[buffup][i].Buff] and silent_can_use(buff_spell_lists[buffup][i].SpellID) then
needsbuff = true
break
end
end
if not needsbuff then
add_to_chat(217, 'All '..buffup..' buffs are up!')
buffup = ''
return false
end
local spell_recasts = windower.ffxi.get_spell_recasts()
for i in pairs(buff_spell_lists[buffup]) do
if not buffactive[buff_spell_lists[buffup][i].Buff] and silent_can_use(buff_spell_lists[buffup][i].SpellID) and spell_recasts[buff_spell_lists[buffup][i].SpellID] < spell_latency then
windower.chat.input('/ma "'..buff_spell_lists[buffup][i].Name..'" <me>')
tickdelay = os.clock() + 2
return true
end
end
return false
else
return false
end
end
buff_spell_lists = {
Auto = {--Options for When are: Always, Engaged, Idle, OutOfCombat, Combat
{Name='Reraise IV', Buff='Reraise', SpellID=848, When='Always'},
{Name='Haste', Buff='Haste', SpellID=57, When='Always'},
{Name='Aurorastorm', Buff='Aurorastorm', SpellID=119, When='Always'},
{Name='Refresh', Buff='Refresh', SpellID=109, When='Always'},
{Name='Stoneskin', Buff='Stoneskin', SpellID=54, When='Always'},
},
Default = {
{Name='Reraise IV', Buff='Reraise', SpellID=848, Reapply=false},
{Name='Haste', Buff='Haste', SpellID=57, Reapply=false},
{Name='Aquaveil', Buff='Aquaveil', SpellID=55, Reapply=false},
{Name='Stoneskin', Buff='Stoneskin', SpellID=54, Reapply=false},
{Name='Blink', Buff='Blink', SpellID=53, Reapply=false},
{Name='Regen IV', Buff='Regen', SpellID=477, Reapply=false},
{Name='Phalanx', Buff='Phalanx', SpellID=106, Reapply=false},
{Name='Boost-MND', Buff='MND Boost', SpellID=484, Reapply=false},
{Name='Shellra V', Buff='Shell', SpellID=134, Reapply=false},
{Name='Protectra V', Buff='Protect', SpellID=129, Reapply=false},
{Name='Barthundra', Buff='Barthunder', SpellID=70, Reapply=false},
{Name='Barparalyzra', Buff='Barparalyze', SpellID=88, Reapply=false},
},
Melee = {
{Name='Reraise IV', Buff='Reraise', SpellID=848, Reapply=false},
{Name='Haste', Buff='Haste', SpellID=57, Reapply=false},
{Name='Boost-STR', Buff='STR Boost', SpellID=479, Reapply=false},
{Name='Shellra V', Buff='Shell', SpellID=134, Reapply=false},
{Name='Protectra V', Buff='Protect', SpellID=129, Reapply=false},
{Name='Auspice', Buff='Auspice', SpellID=96, Reapply=false},
},
}