forked from Celther-FFXI/GearSwap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPLD.lua
598 lines (502 loc) · 24.8 KB
/
PLD.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
586
587
588
589
590
591
592
593
594
595
596
597
598
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- __________.__ ________ __ .__.__ __ __ .__ .__ _____.__.__
-- \______ | | ____ _____ ______ ____ \______ \ ____ ____ _____/ |_ ____ __| _|___/ |_ _/ |_| |__ |__| ______ _/ ____|__| | ____
-- | ___| | _/ __ \\__ \ / ____/ __ \ | | \ / _ \ / \ / _ \ __\ _/ __ \ / __ || \ __\ \ __| | \| |/ ___/ \ __\| | | _/ __ \
-- | | | |_\ ___/ / __ \_\___ \\ ___/ | ` ( <_> ) | | ( <_> | | \ ___// /_/ || || | | | | 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['Aftermath: Lv.3'] = buffactive['Aftermath: Lv.3'] or false
state.Buff.Sentinel = buffactive.Sentinel or false
state.Buff.Cover = buffactive.Cover or false
state.Stance = M{['description']='Stance','Hasso','Seigan','None'}
state.CurrentStep = M{['description']='Current Step', 'Box Step', 'Quickstep'}
state.AutoEmblem = M(true, 'Auto Emblem')
state.AutoCover = M(false, 'Auto Cover')
state.AutoMajesty = M(true, 'Auto Majesty')
autows = 'Savage Blade'
autofood = 'Miso Ramen'
update_melee_groups()
init_job_states({"Capacity","AutoRuneMode","AutoTrustMode","AutoTankMode","AutoWSMode","AutoShadowMode","AutoFoodMode","AutoNukeMode","AutoStunMode","AutoDefenseMode"},{"AutoBuffMode","AutoSambaMode","Weapons","OffenseMode","WeaponskillMode","Stance","IdleMode","Passive","RuneElement","PhysicalDefenseMode","MagicalDefenseMode","ResistDefenseMode","CastingMode","TreasureMode",})
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)
if spell.type == 'WeaponSkill' then
local available_ws = S(windower.ffxi.get_abilities().weapon_skills)
-- WS 172 is Flash Nova, meaning a Spear is equipped.
if available_ws:contains(172) then
if spell.english == "Chant du Cygne" then
send_command('@input /ws "True Strike" '..spell.target.raw)
cancel_spell()
eventArgs.cancel = true
elseif spell.english == "Savage Blade" then
send_command('@input /ws "Realmrazer" '..spell.target.raw)
cancel_spell()
eventArgs.cancel = true
elseif spell.english == "Sanguine Blade" then
send_command('@input /ws "Flash Nova" '..spell.target.raw)
cancel_spell()
eventArgs.cancel = true
end
end
end
end
function job_pretarget(spell, spellMap, eventArgs)
end
function job_precast(spell, spellMap, eventArgs)
if spell.english == 'Flash' then
local abil_recasts = windower.ffxi.get_ability_recasts()
local spell_recasts = windower.ffxi.get_spell_recasts()
if abil_recasts[80] < latency and not silent_check_amnesia() and spell_recasts[112] < spell_latency and state.AutoEmblem.value then
eventArgs.cancel = true
windower.chat.input('/ja "Divine Emblem" <me>')
windower.chat.input:schedule(1,'/ma "Flash" '..spell.target.raw..'')
end
end
end
function job_post_precast(spell, spellMap, eventArgs)
if spell.type == 'WeaponSkill' then
local WSset = standardize_set(get_precast_set(spell, spellMap))
local wsacc = check_ws_acc()
if (WSset.ear1 == "Moonshade Earring" or WSset.ear2 == "Moonshade Earring") then
-- Replace Moonshade Earring if we're at cap TP
if get_effective_player_tp(spell, WSset) > 3200 then
if wsacc:contains('Acc') and not buffactive['Sneak Attack'] and sets.AccMaxTP then
local AccMaxTPset = standardize_set(sets.AccMaxTP)
if (AccMaxTPset.ear1:startswith("Lugra Earring") or AccMaxTPset.ear2:startswith("Lugra Earring")) and not classes.DuskToDawn and sets.AccDayMaxTPWSEars then
equip(sets.AccDayMaxTPWSEars[spell.english] or sets.AccDayMaxTPWSEars)
else
equip(sets.AccMaxTP[spell.english] or sets.AccMaxTP)
end
elseif sets.MaxTP then
local MaxTPset = standardize_set(sets.MaxTP)
if (MaxTPset.ear1:startswith("Lugra Earring") or MaxTPset.ear2:startswith("Lugra Earring")) and not classes.DuskToDawn and sets.DayMaxTPWSEars then
equip(sets.DayMaxTPWSEars[spell.english] or sets.DayMaxTPWSEars)
else
equip(sets.MaxTP[spell.english] or sets.MaxTP)
end
else
end
else
if wsacc:contains('Acc') and not buffactive['Sneak Attack'] and (WSset.ear1:startswith("Lugra Earring") or WSset.ear2:startswith("Lugra Earring")) and not classes.DuskToDawn and sets.AccDayWSEars then
equip(sets.AccDayWSEars[spell.english] or sets.AccDayWSEars)
elseif (WSset.ear1:startswith("Lugra Earring") or WSset.ear2:startswith("Lugra Earring")) and not classes.DuskToDawn and sets.DayWSEars then
equip(sets.DayWSEars[spell.english] or sets.DayWSEars)
end
end
elseif (WSset.ear1:startswith("Lugra Earring") or WSset.ear2:startswith("Lugra Earring")) and not classes.DuskToDawn then
if wsacc:contains('Acc') and not buffactive['Sneak Attack'] and sets.AccDayWSEars then
equip(sets.AccDayWSEars[spell.english] or sets.AccDayWSEars)
elseif sets.DayWSEars then
equip(sets.DayWSEars[spell.english] or sets.DayWSEars)
end
end
end
end
function job_post_midcast(spell, spellMap, eventArgs)
end
function job_aftercast(spell, spellMap, eventArgs)
-- Lock feet after using Mana Wall.
if not spell.interrupted then
if spell.english:lower():contains('step') then
state.CurrentStep:cycle()
end
end
end
function job_buff_change(buff, gain)
update_melee_groups()
end
-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks for non-casting events.
-------------------------------------------------------------------------------------------------------------------
-- Handle notifications of general user state change.
function job_state_change(stateField, newValue, oldValue)
classes.CustomDefenseGroups:clear()
classes.CustomDefenseGroups:append(state.ExtraDefenseMode.current)
classes.CustomMeleeGroups:clear()
classes.CustomMeleeGroups:append(state.ExtraDefenseMode.current)
end
-------------------------------------------------------------------------------------------------------------------
-- User code that supplements standard library decisions.
-------------------------------------------------------------------------------------------------------------------
-- Allow jobs to override this code
function job_self_command(commandArgs, eventArgs)
if commandArgs[1] == 'RuneElement' then
send_command('input /ja "'..state.RuneElement.value..'" <me>')
elseif commandArgs[1] == 'SubJobEnmity' then
if player.target.type ~= "MONSTER" then
add_to_chat(123,'Abort: You are not targeting a monster.')
return
elseif player.sub_job == 'RUN' then
local abil_recasts = windower.ffxi.get_ability_recasts()
if abil_recasts[24] < latency then
send_command('input /ja "Swordplay" <me>')
end
elseif player.sub_job == 'BLU' and not moving then
local spell_recasts = windower.ffxi.get_spell_recasts()
if spell_recasts[584] < spell_latency then
windower.chat.input('/ma "Sheep Song" <t>')
elseif spell_recasts[598] < spell_latency then
windower.chat.input('/ma "Soporific" <t>')
elseif spell_recasts[605] < spell_latency then
windower.chat.input('/ma "Geist Wall" <t>')
elseif spell_recasts[575] < spell_latency then
windower.chat.input('/ma "Jettatura" <t>')
elseif spell_recasts[537] < spell_latency then
windower.chat.input('/ma "Stinking Gas" <t>')
elseif spell_recasts[592] < spell_latency then
windower.chat.input('/ma "Blank Gaze" <t>')
elseif not check_auto_tank_ws() then
if not state.AutoTankMode.value then add_to_chat(123,'All Enmity Blue Magic on cooldown.') end
end
elseif player.sub_job == 'DRK' then
local abil_recasts = windower.ffxi.get_ability_recasts()
local spell_recasts = windower.ffxi.get_spell_recasts()
if (state.HybridMode.value ~= 'Normal' or state.DefenseMode.value ~= 'None') and buffactive['Souleater'] then
send_command('cancel souleater')
end
if (state.HybridMode.value ~= 'Normal' or state.DefenseMode.value ~= 'None') and buffactive['Last Resort'] then
send_command('cancel last resort')
end
if spell_recasts[252] < spell_latency and not silent_check_silence() then
windower.chat.input('/ma "Stun" <t>')
elseif abil_recasts[85] < latency then
windower.chat.input('/ja "Souleater" <me>')
elseif abil_recasts[87] < latency then
windower.chat.input('/ja "Last Resort" <me>')
elseif abil_recasts[86] < latency then
windower.chat.input('/ja "Arcane Circle" <me>')
elseif not check_auto_tank_ws() then
if not state.AutoTankMode.value then add_to_chat(123,'All Enmity Dark Knight abillities on cooldown.') end
end
elseif player.sub_job == 'WAR' then
local abil_recasts = windower.ffxi.get_ability_recasts()
if state.HybridMode.value:contains('DD') then
if buffactive['Defender'] then send_command('cancel defender') end
elseif state.HybridMode.value ~= 'Normal' and not state.HybridMode.value:contains('DD') then
if buffactive['Berserk'] then send_command('cancel berserk') end
end
if abil_recasts[5] < latency then
send_command('input /ja "Provoke" <t>')
elseif abil_recasts[2] < latency then
send_command('input /ja "Warcry" <me>')
elseif abil_recasts[3] < latency then
send_command('input /ja "Defender" <me>')
elseif abil_recasts[4] < latency then
send_command('input /ja "Aggressor" <me>')
elseif abil_recasts[1] < latency then
send_command('input /ja "Berserk" <me>')
elseif not check_auto_tank_ws() then
if not state.AutoTankMode.value then add_to_chat(123,'All Enmity Warrior Job Abilities on cooldown.') end
end
elseif player.sub_job == 'DNC' then
local abil_recasts = windower.ffxi.get_ability_recasts()
local under3FMs = not buffactive['Finishing Move 3'] and not buffactive['Finishing Move 4'] and not buffactive['Finishing Move 5']
if under3FMs then
if abil_recasts[220] < latency then
send_command('@input /ja "'..state.CurrentStep.value..'" <t>')
return
end
elseif abil_recasts[221] < latency then
send_command('input /ja "Animated Flourish" <t>')
return
elseif abil_recasts[220] < latency and not buffactive['Finishing Move 5'] then
send_command('@input /ja "'..state.CurrentStep.value..'" <t>')
return
elseif not check_auto_tank_ws() then
if not state.AutoTankMode.value then add_to_chat(123,'Dancer job abilities not needed.') end
end
end
end
end
-- Called by the 'update' self-command, for common needs.
-- Set eventArgs.handled to true if we don't want automatic equipping of gear.
function job_update(cmdParams, eventArgs)
update_defense_mode()
update_melee_groups()
if state.RuneElement.value == 'Ignis' then
RuneResist = "Ice"
RuneDamage = 'Fire'
elseif state.RuneElement.value == 'Gelus' then
RuneResist = "Wind"
RuneDamage = 'Ice'
elseif state.RuneElement.value == 'Flabra' then
RuneResist = "Earth"
RuneDamage = 'Wind'
elseif state.RuneElement.value == 'Tellus' then
RuneResist = "Lightning"
RuneDamage = 'Earth'
elseif state.RuneElement.value == 'Sulpor' then
RuneResist = "Water"
RuneDamage = 'Lightning'
elseif state.RuneElement.value == 'Unda' then
RuneResist = "Fire"
RuneDamage = 'Water'
elseif state.RuneElement.value == 'Lux' then
RuneResist = "Darkness"
RuneDamage = 'Light'
elseif state.RuneElement.value == 'Tenebrae' then
RuneResist = "Light"
RuneDamage = 'Darkness'
end
if player.sub_job ~= 'SAM' and state.Stance.value ~= "None" then
state.Stance:set("None")
end
end
-- Modify the default idle set after it was constructed.
function job_customize_idle_set(idleSet)
if state.IdleMode.value == 'Normal' or state.IdleMode.value:contains('Sphere') then
if player.mpp < 51 and sets.latent_refresh then
idleSet = set_combine(idleSet, sets.latent_refresh)
end
if player.hpp < 71 then
idleSet = set_combine(idleSet, sets.latent_regen)
end
end
return idleSet
end
-- Modify the default melee set after it was constructed.
function job_customize_melee_set(meleeSet)
if state.ExtraDefenseMode.value ~= 'None' then
meleeSet = set_combine(meleeSet, sets[state.ExtraDefenseMode.value])
end
return meleeSet
end
function job_customize_defense_set(defenseSet)
if state.ExtraDefenseMode.value ~= 'None' then
defenseSet = set_combine(defenseSet, sets[state.ExtraDefenseMode.value])
end
return defenseSet
end
function display_current_job_state(eventArgs)
local msg = 'Melee'
if state.CombatForm.has_value then
msg = msg .. ' (' .. state.CombatForm.value .. ')'
end
msg = msg .. ': '
msg = msg .. state.OffenseMode.value
if state.HybridMode.value ~= 'Normal' then
msg = msg .. '/' .. state.HybridMode.value
end
msg = msg .. ', WS: ' .. state.WeaponskillMode.value
if state.DefenseMode.value ~= 'None' then
msg = msg .. ', Defense: ' .. state.DefenseMode.value .. ' (' .. state[state.DefenseMode.value .. 'DefenseMode'].value .. ')'
end
if state.ExtraDefenseMode.value ~= 'None' then
msg = msg .. ', Extra: ' .. state.ExtraDefenseMode.value
end
if state.Kiting.value == true then
msg = msg .. ', Kiting'
end
if state.PCTargetMode.value ~= 'default' then
msg = msg .. ', Target PC: '..state.PCTargetMode.value
end
if state.SelectNPCTargets.value == true then
msg = msg .. ', Target NPCs'
end
if state.AutoDefenseMode.value == true then
msg = msg .. ', Auto Defense: On'
end
add_to_chat(122, msg)
eventArgs.handled = true
end
-------------------------------------------------------------------------------------------------------------------
-- Utility functions specific to this job.
-------------------------------------------------------------------------------------------------------------------
function update_defense_mode()
if player.equipment.main == 'Kheshig Blade' and not classes.CustomDefenseGroups:contains('Kheshig Blade') then
classes.CustomDefenseGroups:append('Kheshig Blade')
end
if player.sub_job == 'NIN' or player.sub_job == 'DNC' then
if player.equipment.sub and not player.equipment.sub:contains('Shield') and
player.equipment.sub ~= 'Aegis' and player.equipment.sub ~= 'Ochain' and player.equipment.sub ~= 'Svalinn' and player.equipment.sub ~= 'Priwen' then
state.CombatForm:set('DW')
else
state.CombatForm:reset()
end
end
end
function job_tick()
if check_majesty() then return true end
if check_hasso() then return true end
if check_buff() then return true end
if check_buffup() then return true end
if state.AutoTankMode.value and player.in_combat and player.target.type == "MONSTER" and not moving then
if check_flash() then return true
else
windower.send_command('gs c SubJobEnmity')
tickdelay = os.clock() + 1
return true
end
end
return false
end
function check_flash()
local spell_recasts = windower.ffxi.get_spell_recasts()
if spell_recasts[112] < spell_latency then
send_command('input /ma "Flash" <t>')
tickdelay = os.clock() + 2
return true
else
return false
end
end
function update_melee_groups()
if player.equipment.main then
classes.CustomMeleeGroups:clear()
if player.equipment.main == "Burtgang" and state.Buff['Aftermath: Lv.3'] then
classes.CustomMeleeGroups:append('AM')
end
end
end
function check_majesty()
if state.AutoMajesty.value and player.in_combat and not buffactive.Majesty and not silent_check_amnesia() then
local abil_recasts = windower.ffxi.get_ability_recasts()
if abil_recasts[150] < latency then
windower.chat.input('/ja "Majesty" <me>')
tickdelay = os.clock() + 1.1
return true
else
return false
end
end
return false
end
function check_cover(Protectee)
if state.AutoCover.value and not midaction() and Protectee.hpp < 85 and math.sqrt(Protectee.distance) < 10 and windower.ffxi.get_ability_recasts()[76] < latency then
windower.chat.input('/ja Cover '..Protectee.name..'')
end
end
function check_hasso()
if player.sub_job == 'SAM' and not state.Buff['SJ Restriction'] and not (state.Stance.value == 'None' or state.Buff.Hasso or state.Buff.Seigan) and player.status == 'Engaged' and not silent_check_amnesia() then
local abil_recasts = windower.ffxi.get_ability_recasts()
if state.Stance.value == 'Hasso' and abil_recasts[138] < latency then
windower.chat.input('/ja "Hasso" <me>')
tickdelay = os.clock() + 1.1
return true
elseif state.Stance.value == 'Seigan' and abil_recasts[139] < latency then
windower.chat.input('/ja "Seigan" <me>')
tickdelay = os.clock() + 1.1
return true
else
return false
end
end
return false
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] < 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
if player.in_combat then
local abil_recasts = windower.ffxi.get_ability_recasts()
if not buffactive['Majesty'] and abil_recasts[150] < latency then
windower.chat.input('/ja "Majesty" <me>')
tickdelay = os.clock() + 1.1
return true
else
return false
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 = {
{Name='Crusade',Buff='Enmity Boost',SpellID=476,When='Always'},
{Name='Reprisal',Buff='Reprisal',SpellID=97,When='Always'},
{Name='Phalanx',Buff='Phalanx',SpellID=106,When='Always'},
},
Default = {
{Name='Crusade',Buff='Enmity Boost',SpellID=476,Reapply=false},
{Name='Reprisal',Buff='Reprisal',SpellID=97,Reapply=false},
{Name='Haste',Buff='Haste',SpellID=57,Reapply=false},
{Name='Refresh',Buff='Refresh',SpellID=109,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',Buff='Regen',SpellID=108,Reapply=false},
{Name='Phalanx',Buff='Phalanx',SpellID=106,Reapply=false},
},
}