forked from Celther-FFXI/GearSwap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGEO.lua
747 lines (656 loc) · 38 KB
/
GEO.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
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- __________.__ ________ __ .__.__ __ __ .__ .__ _____.__.__
-- \______ | | ____ _____ ______ ____ \______ \ ____ ____ _____/ |_ ____ __| _|___/ |_ _/ |_| |__ |__| ______ _/ ____|__| | ____
-- | ___| | _/ __ \\__ \ / ____/ __ \ | | \ / _ \ / \ / _ \ __\ _/ __ \ / __ || \ __\ \ __| | \| |/ ___/ \ __\| | | _/ __ \
-- | | | |_\ ___/ / __ \_\___ \\ ___/ | ` ( <_> ) | | ( <_> | | \ ___// /_/ || || | | | | 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.Entrust = buffactive.Entrust or false
state.Buff['Blaze of Glory'] = buffactive['Blaze of Glory'] or false
LowTierNukes = S{'Stone', 'Water', 'Aero', 'Fire', 'Blizzard', 'Thunder',
'Stone II', 'Water II', 'Aero II', 'Fire II', 'Blizzard II', 'Thunder II',
'Stonega', 'Waterga', 'Aeroga', 'Firaga', 'Blizzaga', 'Thundaga'}
state.RecoverMode = M('35%', '60%', 'Always', 'Never')
autows = 'Realmrazer'
autofood = 'Miso Ramen'
autoindi = 'Torpor'
autoentrust = 'Fury'
autoentrustee = '<p1>'
autogeo = 'Frailty'
last_indi = nil
last_geo = nil
blazelocked = false
used_ecliptic = false
state.ShowDistance = M(true, 'Show Geomancy Buff/Debuff distance')
state.AutoEntrust = M(false, 'AutoEntrust Mode')
state.CombatEntrustOnly = M(true, 'Combat Entrust Only Mode')
state.AutoGeoAbilities = M(true, 'Use Geo Abilities Automatically')
indi_timer = ''
indi_duration = 180
init_job_states({"Capacity","AutoRuneMode","AutoTrustMode","AutoNukeMode","AutoWSMode","AutoShadowMode","AutoFoodMode","AutoStunMode","AutoDefenseMode"},{"AutoBuffMode","Weapons","OffenseMode","WeaponskillMode","IdleMode","Passive","RuneElement","RecoverMode","ElementalMode","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)
end
function job_filter_precast(spell, spellMap, eventArgs)
if spell.english:startswith('Geo-') and pet.isvalid then
eventArgs.cancel = true
windower.chat.input('/ja "Full Circle" <me>')
windower.chat.input:schedule(1.3,'/ma "'..spell.english..'" '..spell.target.raw..'')
end
end
function job_pretarget(spell, spellMap, eventArgs)
if spell.type == 'Geomancy' then
if spell.english:startswith('Indi') then
if state.Buff.Entrust then
if spell.target.type == 'SELF' then
add_to_chat(204, 'Entrust active - You can\'t entrust yourself.')
eventArgs.cancel = true
end
elseif spell.target.type ~= 'SELF' then
if state.AutoEntrust.value and ((spell.target.type == 'PLAYER' and not spell.target.charmed) or (spell.target.type == 'NPC')) and spell.target.in_party then
local spell_recasts = windower.ffxi.get_spell_recasts()
local abil_recasts = windower.ffxi.get_ability_recasts()
eventArgs.cancel = true
if spell_recasts[spell.recast_id] > 1.5 then
add_to_chat(123,'Abort: ['..spell.english..'] waiting on recast. ('..seconds_to_clock(spell_recasts[spell.recast_id]/60)..')')
elseif abil_recasts[93] > 0 then
add_to_chat(123,'Abort: [Entrust] waiting on recast. ('..seconds_to_clock(abil_recasts[93])..')')
else
send_command('@input /ja "Entrust" <me>; wait 1.1; input /ma "'..spell.name..'" '..spell.target.name)
end
elseif spell.target.raw == '<t>' then
change_target('<me>')
end
end
elseif spell.english:startswith('Geo') then
if set.contains(spell.targets, 'Enemy') then
if ((spell.target.type == 'PLAYER' and not spell.target.charmed) or (spell.target.type == 'NPC' and spell.target.in_party)) then
eventArgs.cancel = true
end
elseif not ((spell.target.type == 'PLAYER' and not spell.target.charmed and spell.target.in_party) or (spell.target.type == 'NPC' and spell.target.in_party) or (spell.target.raw == '<stpt>' or spell.target.raw == '<stal>' or spell.target.raw == '<st>')) then
change_target('<me>')
end
end
end
end
-- 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_precast(spell, spellMap, eventArgs)
if spell.action_type == 'Magic' then
if spellMap == 'Cure' or spellMap == 'Curaga' then
gear.default.obi_back = gear.obi_cure_back
gear.default.obi_waist = gear.obi_cure_waist
elseif spell.skill == 'Elemental Magic' then
if LowTierNukes:contains(spell.english) or spell.english:endswith('helix') then
gear.default.obi_back = gear.obi_low_nuke_back
gear.default.obi_waist = gear.obi_low_nuke_waist
else
gear.default.obi_back = gear.obi_high_nuke_back
gear.default.obi_waist = gear.obi_high_nuke_waist
end
end
if state.CastingMode.value == 'Proc' then
classes.CustomClass = 'Proc'
end
elseif buffactive.Bolster and (spell.english == 'Blaze of Glory' or spell.english == 'Ecliptic Attrition') then
eventArgs.cancel = true
add_to_chat(123,'Abort: Bolster maxes the strength of bubbles.')
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)
if spell.skill == 'Elemental Magic' and default_spell_map ~= 'ElementalEnfeeble' and spell.english ~= 'Impact' then
if state.MagicBurstMode.value ~= 'Off' then
if state.CastingMode.value:contains('Resistant') and sets.ResistantMagicBurst then
equip(sets.ResistantMagicBurst)
else
equip(sets.MagicBurst)
end
end
if spell.element == world.weather_element or spell.element == world.day_element then
if state.CastingMode.value == 'Fodder' then
-- if item_available('Twilight Cape') and not LowTierNukes:contains(spell.english) and not state.Capacity.value then
-- sets.TwilightCape = {back="Twilight Cape"}
-- equip(sets.TwilightCape)
-- end
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
if state.RecoverMode.value ~= 'Never' and (state.RecoverMode.value == 'Always' or tonumber(state.RecoverMode.value:sub(1, -2)) > player.mpp) then
if state.MagicBurstMode.value ~= 'Off' then
if state.CastingMode.value:contains('Resistant') and sets.ResistantRecoverBurst then
equip(sets.ResistantRecoverBurst)
elseif sets.RecoverBurst then
equip(sets.RecoverBurst)
elseif sets.RecoverMP then
equip(sets.RecoverMP)
end
elseif sets.RecoverMP then
equip(sets.RecoverMP)
end
end
elseif spell.skill == 'Geomancy' then
if spell.english:startswith('Geo-') then
if state.Buff['Blaze of Glory'] and sets.buff['Blaze of Glory'] then
equip(sets.buff['Blaze of Glory'])
disable('head')
blazelocked = true
end
elseif state.Buff.Entrust and spell.english:startswith('Indi-') then
if sets.midcast.Geomancy.main == 'Idris' and item_available('Solstice') then
equip({main="Solstice"})
end
end
end
end
function job_aftercast(spell, spellMap, eventArgs)
if not spell.interrupted then
if spell.english:startswith('Indi-') then
if spell.target.type == 'SELF' then
last_indi = string.sub(spell.english,6)
end
if not classes.CustomIdleGroups:contains('Indi') then
classes.CustomIdleGroups:append('Indi')
end
if state.UseCustomTimers.value then
send_command('@timers d "'..spell.target.name..': '..indi_timer..'"')
indi_timer = spell.english
send_command('@timers c "'..spell.target.name..': '..indi_timer..'" '..indi_duration..' down spells/00136.png')
end
elseif spell.english:startswith('Geo-') or spell.english == "Mending Halation" or spell.english == "Radial Arcana" then
eventArgs.handled = true
if spell.english:startswith('Geo-') then
last_geo = string.sub(spell.english,5)
end
elseif 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 state.UseCustomTimers.value and spell.english == 'Sleep II' or spell.english == 'Sleepga II' then
send_command('@timers c "'..spell.english..' ['..spell.target.name..']" 90 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
if not player.indi then
classes.CustomIdleGroups:clear()
end
end
-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks for non-casting events.
-------------------------------------------------------------------------------------------------------------------
-- Called when a player gains or loses a buff.
-- buff == buff gained or lost
-- gain == true if the buff was gained, false if it was lost.
function job_buff_change(buff, gain)
if player.indi and not classes.CustomIdleGroups:contains('Indi') then
classes.CustomIdleGroups:append('Indi')
if not midaction () then handle_equipping_gear(player.status) end
elseif classes.CustomIdleGroups:contains('Indi') and not player.indi then
classes.CustomIdleGroups:clear()
if not midaction () then handle_equipping_gear(player.status) end
end
end
-------------------------------------------------------------------------------------------------------------------
-- User code that supplements standard library decisions.
-------------------------------------------------------------------------------------------------------------------
function job_get_spell_map(spell, default_spell_map)
if default_spell_map == 'Cure' or default_spell_map == 'Curaga' then
if 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
elseif spell.skill == 'Geomancy' then
if spell.english:startswith('Indi') then
return 'Indi'
end
elseif spell.skill == 'Elemental Magic' then
if default_spell_map == 'ElementalEnfeeble' or spell.english:contains('helix') then
return
elseif LowTierNukes:contains(spell.english) then
return 'LowTierNuke'
else
return 'HighTierNuke'
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)
classes.CustomIdleGroups:clear()
if player.indi then
classes.CustomIdleGroups:append('Indi')
end
end
-- Function that watches pet gain and loss.
function job_pet_change(pet, gain)
if not gain then
used_ecliptic = false
end
if blazelocked then
enable('head')
blazelocked = false
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
function job_self_command(commandArgs, eventArgs)
local lowerCommand = commandArgs[1]:lower()
if lowerCommand == 'autoindi' and commandArgs[2] then
autoindi = commandArgs[2]:ucfirst()
add_to_chat(122,'Your Auto Indi- spell is set to '..autoindi..'.')
if state.DisplayMode.value then update_job_states() end
elseif lowerCommand == 'autogeo' and commandArgs[2] then
autogeo = commandArgs[2]:ucfirst()
add_to_chat(122,'Your Auto Geo- spell is set to '..autogeo..'.')
if state.DisplayMode.value then update_job_states() end
elseif lowerCommand == 'autoentrust' and commandArgs[2] then
autoentrust = commandArgs[2]:ucfirst()
add_to_chat(122,'Your Auto Entrust Indi- spell is set to '..autoentrust..'.')
if state.DisplayMode.value then update_job_states() end
elseif lowerCommand:contains('trustee') and commandArgs[2] then
autoentrustee = commandArgs[2]:ucfirst()
add_to_chat(122,'Your Auto Entrustee target is set to '..autoentrustee..'.')
if state.DisplayMode.value then update_job_states() end
elseif lowerCommand == 'elemental' then
handle_elemental(commandArgs)
eventArgs.handled = true
end
end
-- Handling Elemental spells within Gearswap.
-- Format: gs c elemental <nuke, helix, skillchain1, skillchain2, weather>
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' then
local spell_recasts = windower.ffxi.get_spell_recasts()
if state.ElementalMode.value == 'Light' then
if spell_recasts[29] < spell_latency and actual_cost(get_spell_table_by_name('Banish II')) < player.mp then
windower.chat.input('/ma "Banish II" '..target..'')
elseif spell_recasts[28] < spell_latency and actual_cost(get_spell_table_by_name('Banish')) < player.mp then
windower.chat.input('/ma "Banish" '..target..'')
else
add_to_chat(123,'Abort: Banishes on cooldown or not enough MP.')
end
else
if player.job_points[(res.jobs[player.main_job_id].ens):lower()].jp_spent > 99 and spell_recasts[get_spell_table_by_name(data.elements.nuke_of[state.ElementalMode.value]..' V').id] < spell_latency and actual_cost(get_spell_table_by_name(data.elements.nuke_of[state.ElementalMode.value]..' V')) < player.mp then
windower.chat.input('/ma "'..data.elements.nuke_of[state.ElementalMode.value]..' V" '..target..'')
else
local tiers = {' IV',' III',' 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
add_to_chat(123,'Abort: All '..data.elements.nuke_of[state.ElementalMode.value]..' nukes on cooldown or or not enough MP.')
end
end
elseif command == 'ninjutsu' then
windower.chat.input('/ma "'..data.elements.ninjutsu_nuke_of[state.ElementalMode.value]..': Ni" '..target..'')
elseif command == 'smallnuke' then
local spell_recasts = windower.ffxi.get_spell_recasts()
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
add_to_chat(123,'Abort: All '..data.elements.nuke_of[state.ElementalMode.value]..' nukes on cooldown or or not enough MP.')
elseif command:startswith('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:startswith('ara') then
local spell_recasts = windower.ffxi.get_spell_recasts()
local tierkey = {'ara3','ara2','ara1'}
local tierlist = {['ara3']='ra III',['ara2']='ra II',['ara1']='ra'}
if command == 'ara' then
for i in ipairs(tierkey) do
if spell_recasts[get_spell_table_by_name(data.elements.nukera_of[state.ElementalMode.value]..''..tierlist[tierkey[i]]..'').id] < spell_latency and actual_cost(get_spell_table_by_name(data.elements.nukera_of[state.ElementalMode.value]..''..tierlist[tierkey[i]]..'')) < player.mp then
windower.chat.input('/ma "'..data.elements.nukera_of[state.ElementalMode.value]..''..tierlist[tierkey[i]]..'" '..target..'')
return
end
end
else
windower.chat.input('/ma "'..data.elements.nukera_of[state.ElementalMode.value]..tierlist[command]..'" '..target..'')
end
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 job_tick()
if check_geo() then return true end
if check_buff() then return true end
if check_buffup() then return true end
return false
end
function check_geo()
if state.AutoBuffMode.value ~= 'Off' and not data.areas.cities:contains(world.area) then
if not pet.isvalid then
used_ecliptic = false
end
local abil_recasts = windower.ffxi.get_ability_recasts()
if autoindi ~= 'None' and ((not player.indi) or last_indi ~= autoindi) then
windower.chat.input('/ma "Indi-'..autoindi..'" <me>')
tickdelay = os.clock() + 2.1
return true
elseif autoentrust ~= 'None' and abil_recasts[93] < latency and (player.in_combat or state.CombatEntrustOnly.value == false) then
send_command('@input /ja "Entrust" <me>; wait 1.1; input /ma "Indi-'..autoentrust..'" '..autoentrustee)
tickdelay = os.clock() + 3.5
return true
elseif pet.isvalid then
local pet = windower.ffxi.get_mob_by_target("pet")
if pet.distance:sqrt() > 50 then --If pet is greater than detectable.
windower.chat.input('/ja "Full Circle" <me>')
tickdelay = os.clock() + 1.1
return true
elseif state.AutoGeoAbilities.value and abil_recasts[244] < latency and not used_ecliptic and not buffactive.Bolster then
windower.chat.input('/ja "Ecliptic Attrition" <me>;')
used_ecliptic = true
return true
else
return false
end
elseif autogeo ~= 'None' and (windower.ffxi.get_mob_by_target('bt') or data.spells.geo_buffs:contains(autogeo)) then
if player.in_combat and state.AutoGeoAbilities.value and abil_recasts[247] < latency and not buffactive.Bolster then
windower.chat.input('/ja "Blaze of Glory" <me>;')
tickdelay = os.clock() + 1.1
return true
else
windower.chat.input('/ma "Geo-'..autogeo..'" <bt>')
tickdelay = os.clock() + 3.1
return true
end
end
end
return false
end
--Luopan Distance Tracking
debuff_list = S{'Gravity','Paralysis','Slow','Languor','Vex','Torpor','Slip','Malaise','Fade','Frailty','Wilt','Poison'}
ignore_list = S{'SlipperySilas','HareFamiliar','SheepFamiliar','FlowerpotBill','TigerFamiliar','FlytrapFamiliar','LizardFamiliar','MayflyFamiliar','EftFamiliar','BeetleFamiliar','AntlionFamiliar','CrabFamiliar','MiteFamiliar','KeenearedSteffi','LullabyMelodia','FlowerpotBen','SaberSiravarde','FunguarFamiliar','ShellbusterOrob','ColdbloodComo','CourierCarrie','Homunculus','VoraciousAudrey','AmbusherAllie','PanzerGalahad','LifedrinkerLars','ChopsueyChucky','AmigoSabotender','NurseryNazuna','CraftyClyvonne','PrestoJulio','SwiftSieghard','MailbusterCetas','AudaciousAnna','TurbidToloi','LuckyLulush','DipperYuly','FlowerpotMerle','DapperMac','DiscreetLouise','FatsoFargann','FaithfulFalcorr','BugeyedBroncha','BloodclawShasra','GorefangHobs','GooeyGerard','CrudeRaphie','DroopyDortwin','SunburstMalfik','WarlikePatrick','ScissorlegXerin','RhymingShizuna','AttentiveIbuki','AmiableRoche','HeraldHenry','BrainyWaluis','SuspiciousAlice','HeadbreakerKen','RedolentCandi','CaringKiyomaro','HurlerPercival','AnklebiterJedd','BlackbeardRandy','FleetReinhard','GenerousArthur','ThreestarLynn','BraveHeroGlenn','SharpwitHermes','AlluringHoney','CursedAnnabelle','SwoopingZhivago','BouncingBertha','MosquitoFamilia','Ifrit','Shiva','Garuda','Fenrir','Carbuncle','Ramuh','Leviathan','CaitSith','Diabolos','Titan','Atomos','WaterSpirit','FireSpirit','EarthSpirit','ThunderSpirit','AirSpirit','LightSpirit','DarkSpirit','IceSpirit', 'Azure','Cerulean','Rygor','Firewing','Delphyne','Ember','Rover','Max','Buster','Duke','Oscar','Maggie','Jessie','Lady','Hien','Raiden','Lumiere','Eisenzahn','Pfeil','Wuffi','George','Donryu','Qiqiru','Karav-Marav','Oboro','Darug Borug','Mikan','Vhiki','Sasavi','Tatang','Nanaja','Khocha','Nanaja','Khocha','Dino','Chomper','Huffy','Pouncer','Fido','Lucy','Jake','Rocky','Rex','Rusty','Himmelskralle','Gizmo','Spike','Sylvester','Milo','Tom','Toby','Felix','Komet','Bo','Molly','Unryu','Daisy','Baron','Ginger','Muffin','Lumineux','Quatrevents','Toryu','Tataba','Etoilazuree','Grisnuage','Belorage','Centonnerre','Nouvellune','Missy','Amedeo','Tranchevent','Soufflefeu','Etoile','Tonnerre','Nuage','Foudre','Hyuh','Orage','Lune','Astre','Waffenzahn','Soleil','Courageux','Koffla-Paffla','Venteuse','Lunaire','Tora','Celeste','Galja-Mogalja','Gaboh','Vhyun','Orageuse','Stellaire','Solaire','Wirbelwind','Blutkralle','Bogen','Junker','Flink','Knirps','Bodo','Soryu','Wanaro','Totona','Levian-Movian','Kagero','Joseph','Paparaz','Coco','Ringo','Nonomi','Teter','Gigima','Gogodavi','Rurumo','Tupah','Jyubih','Majha','Luron','Drille','Tournefoux','Chafouin','Plaisantin','Loustic','Histrion','Bobeche','Bougrion','Rouleteau','Allouette','Serenade','Ficelette','Tocadie','Caprice','Foucade','Capillotte','Quenotte','Pacotille','Comedie','Kagekiyo','Toraoh','Genta','Kintoki','Koumei','Pamama','Lobo','Tsukushi','Oniwaka','Kenbishi','Hannya','Mashira','Nadeshiko','E100','Koume','X-32','Poppo','Asuka','Sakura','Tao','Mao','Gadget','Marion','Widget','Quirk','Sprocket','Cogette','Lecter','Coppelia','Sparky','Clank','Calcobrena','Crackle','Ricochet','Josette','Fritz','Skippy','Pino','Mandarin','Jackstraw','Guignol','Moppet','Nutcracker','Erwin','Otto','Gustav','Muffin','Xaver','Toni','Ina','Gerda','Petra','Verena','Rosi','Schatzi','Warashi','Klingel','Clochette','Campanello','Kaiserin','Principessa','Butler','Graf','Caro','Cara','Mademoiselle','Herzog','Tramp','V-1000','Hikozaemon','Nine','Acht','Quattro','Zero','Dreizehn','Seize','Fukusuke','Mataemon','Kansuke','Polichinelle','Tobisuke','Sasuke','Shijimi','Chobi','Aurelie','Magalie','Aurore','Caroline','Andrea','Machinette','Clarine','Armelle','Reinette','Dorlote','Turlupin','Klaxon','Bambino','Potiron','Fustige','Amidon','Machin','Bidulon','Tandem','Prestidige','Purute-Porute','Bito-Rabito','Cocoa','Totomo','Centurion','A7V','Scipio','Sentinel','Pioneer','Seneschal','Ginjin','Amagatsu','Dolly','Fantoccini','Joe','Kikizaru','Whippet','Punchinello','Charlie','Midge','Petrouchka','Schneider','Ushabti','Noel','Yajirobe','Hina','Nora','Shoki','Kobina','Kokeshi','Mame','Bishop','Marvin','Dora','Data','Robin','Robby','Porlo-Moperlo','Paroko-Puronko','Pipima','Gagaja','Mobil','Donzel','Archer','Shooter','Stephen','Mk.IV','Conjurer','Footman','Tokotoko','Sancho','Sarumaro','Picket','Mushroom','Shantotto','Naji','Kupipi','Excenmille','Ayame','NanaaMihgo','Curilla','Volker','Ajido-Marujido','Trion','Zeid','Lion','Tenzen','MihliAliapoh','Valaineral','Joachim','NajaSalaheem','Prishe','Ulmia','ShikareeZ','Cherukiki','IronEater','Gessho','Gadalar','Rainemard','Ingrid','LehkoHabhoka','Nashmeira','Zazarg','Ovjang','Mnejing','Sakura','Luzaf','Najelith','Aldo','Moogle','Fablinix','Maat','D.Shantotto','StarSibyl','Karaha-Baruha','Cid','Gilgamesh','Areuhat','SemihLafihna','Elivira','Noillurie','LhuMhakaracca','FerreousCoffin','Lilisette','Mumor','UkaTotlihn','Klara','RomaaMihgo','KuyinHathdenna','Rahal','Koru-Moru','Pieuje','InvincibleShld','Apururu','JakohWahcondalo','Flaviria','Babban','Abenzio','Rughadjeen','Kukki-Chebukki','Margret','Chacharoon','LheLhangavo','Arciela','Mayakov','Qultada','Adelheid','Amchuchu','Brygid','Mildaurion','Halver','Rongelouts','Leonoyne','Maximilian','Kayeel-Payeel','Robel-Akbel','Kupofried','Selh\'teus','Yoran-Oran','Sylvie','Abquhbah','Balamor','August','Rosulatia','Teodor','Ullegore','Makki-Chebukki','KingOfHearts','Morimar','Darrcuiln','ArkHM','ArkEV','ArkMR','ArkTT','ArkGK','Iroha','Ygnas','Excenmille','Ayame','Maat','Aldo','NajaSalaheem','Lion','Zeid'}
luopantxt = {}
luopantxt.pos = {}
luopantxt.pos.x = -200
luopantxt.pos.y = 175
luopantxt.text = {}
luopantxt.text.font = 'Arial'
luopantxt.text.size = 12
luopantxt.flags = {}
luopantxt.flags.right = true
luopan = texts.new('${value}', luopantxt)
luopan:bold(true)
luopan:bg_alpha(0)--128
luopan:stroke_width(2)
luopan:stroke_transparency(192)
bt_color = '\\cs(230,118,116)'
windower.raw_register_event('prerender', function()
local s = windower.ffxi.get_mob_by_target('me')
if windower.ffxi.get_mob_by_target('pet') then
myluopan = windower.ffxi.get_mob_by_target('pet')
else
myluopan = nil
end
local luopan_txtbox = ''
local indi_count = 0
local geo_count = 0
local battle_target = windower.ffxi.get_mob_by_target('bt') or false
if myluopan and last_geo then
luopan_txtbox = luopan_txtbox..' \\cs(0,255,0)Geo-'..last_geo..':\\cs(255,255,255)\n'
for i,v in pairs(windower.ffxi.get_mob_array()) do
local DistanceBetween = ((myluopan.x - v.x)*(myluopan.x-v.x) + (myluopan.y-v.y)*(myluopan.y-v.y)):sqrt()
if DistanceBetween < (6 + v.model_size) and not (v.status == 2 or v.status == 3) and v.name and v.name ~= '' and v.name ~= "Luopan" and v.valid_target and v.model_size > 0 then
if debuff_list:contains(last_geo) then
if v.is_npc and not (v.in_party or ignore_list:contains(v.name)) then
if battle_target and battle_target.id == v.id then
luopan_txtbox = luopan_txtbox..' '..bt_color..v.name.." "..string.format("%.2f",DistanceBetween).."\\cs(255,255,255)\n"
else
luopan_txtbox = luopan_txtbox..' '..v.name.." "..string.format("%.2f",DistanceBetween).."\n"
end
geo_count = geo_count + 1
end
else
if v.in_party then
luopan_txtbox = luopan_txtbox..' '..v.name.." "..string.format("%.2f",DistanceBetween).."\n"
geo_count = geo_count + 1
end
end
end
end
end
if buffactive['Colure Active'] and last_indi then
if myluopan then
luopan_txtbox = luopan_txtbox..'\n'
end
luopan_txtbox = luopan_txtbox..' \\cs(0,255,0)Indi-'..last_indi..':\\cs(255,255,255)\n'
for i,v in pairs(windower.ffxi.get_mob_array()) do
local DistanceBetween = ((s.x - v.x)*(s.x-v.x) + (s.y-v.y)*(s.y-v.y)):sqrt()
if DistanceBetween < (6 + v.model_size) and (v.status == 1 or v.status == 0) and v.name and v.name ~= '' and v.name ~= "Luopan" and v.name ~= s.name and v.valid_target and v.model_size > 0 then
if debuff_list:contains(last_indi) then
if v.is_npc and not (v.in_party or ignore_list:contains(v.name)) then
if battle_target and battle_target.id == v.id then
luopan_txtbox = luopan_txtbox..' '..bt_color..v.name.." "..string.format("%.2f",DistanceBetween).."\\cs(255,255,255)\n"
else
luopan_txtbox = luopan_txtbox..' '..v.name.." "..string.format("%.2f",DistanceBetween).."\n"
end
indi_count = indi_count + 1
end
else
if v.in_party then
luopan_txtbox = luopan_txtbox..' '..v.name.." "..string.format("%.2f",DistanceBetween).."\n"
indi_count = indi_count + 1
end
end
end
end
end
luopan.value = luopan_txtbox
if state.ShowDistance and state.ShowDistance.value and ((myluopan and geo_count ~= 0) or (buffactive['Colure Active'] and indi_count ~= 0)) then
luopan:visible(true)
else
luopan:visible(false)
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 = {
{Name='Haste', Buff='Haste', SpellID=57, When='Always'},
{Name='Refresh', Buff='Refresh', SpellID=109, When='Always'},
{Name='Stoneskin', Buff='Stoneskin', SpellID=54, When='Always'},
},
Default = {
{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},
},
}