forked from Celther-FFXI/GearSwap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDNC.lua
406 lines (332 loc) · 18 KB
/
DNC.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
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- __________.__ ________ __ .__.__ __ __ .__ .__ _____.__.__
-- \______ | | ____ _____ ______ ____ \______ \ ____ ____ _____/ |_ ____ __| _|___/ |_ _/ |_| |__ |__| ______ _/ ____|__| | ____
-- | ___| | _/ __ \\__ \ / ____/ __ \ | | \ / _ \ / \ / _ \ __\ _/ __ \ / __ || \ __\ \ __| | \| |/ ___/ \ __\| | | _/ __ \
-- | | | |_\ ___/ / __ \_\___ \\ ___/ | ` ( <_> ) | | ( <_> | | \ ___// /_/ || || | | | | 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.
-------------------------------------------------------------------------------------------------------------------
--[[
Custom commands:
gs c step
Uses the currently configured step on the target, with either <t> or <stnpc> depending on setting.
gs c step t
Uses the currently configured step on the target, but forces use of <t>.
Configuration commands:
gs c cycle mainstep
Cycles through the available steps to use as the primary step when using one of the above commands.
gs c cycle altstep
Cycles through the available steps to use for alternating with the configured main step.
gs c toggle usealtstep
Toggles whether or not to use an alternate step.
--]]
-- 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['Climactic Flourish'] = buffactive['Climactic Flourish'] or false
state.Buff['Building Flourish'] = buffactive['Building Flourish'] or false
state.Buff['Presto'] = buffactive['Presto'] or false
state.Buff['Contradance'] = buffactive['Contradance'] or false
state.Buff['Saber Dance'] = buffactive['Saber Dance'] or false
state.Buff['Fan Dance'] = buffactive['Fan Dance'] or false
state.Buff['Aftermath: Lv.3'] = buffactive['Aftermath: Lv.3'] or false
state.MainStep = M{['description']='Main Step', 'Box Step','Quickstep','Feather Step','Stutter Step'}
state.AltStep = M{['description']='Alt Step', 'Feather Step','Quickstep','Stutter Step','Box Step'}
state.UseAltStep = M(true, 'Use Alt Step')
state.CurrentStep = M{['description']='Current Step', 'Main', 'Alt'}
state.AutoPrestoMode = M(true, 'Auto Presto Mode')
state.DanceStance = M{['description']='Dance Stance','None','Saber Dance','Fan Dance'}
autows = "Rudra's Storm"
autofood = 'Soy Ramen'
function calculate_step_feet_reduction()
local tp_reduction = 0
if sets.precast.Step and sets.precast.Step.feet and standardize_set(sets.precast.Step).feet:startswith('Horos T. Shoes') then
if sets.precast.Step.feet:endswith('+2') then
tp_reduction = 10
elseif sets.precast.Step.feet:endswith('+3') then
tp_reduction = 20
end
end
return tp_reduction
end
step_feet_reduction = calculate_step_feet_reduction()
update_melee_groups()
init_job_states({"Capacity","AutoRuneMode","AutoTrustMode","AutoWSMode","AutoShadowMode","AutoFoodMode","AutoStunMode","AutoDefenseMode",},{"AutoBuffMode","AutoSambaMode","Weapons","OffenseMode","WeaponskillMode","IdleMode","DanceStance","Passive","RuneElement","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_precast(spell, spellMap, eventArgs)
if spell.type == 'WeaponSkill' and state.AutoBuffMode.value ~= 'Off' and player.tp > (999 + step_cost()) then
local abil_recasts = windower.ffxi.get_ability_recasts()
if under3FMs() and abil_recasts[220] < latency and (abil_recasts[236] < latency or state.Buff['Presto']) and player.status == 'Engaged' then
eventArgs.cancel = true
windower.send_command('gs c step')
windower.chat.input:schedule(2.3,'/ws "'..spell.english..'" '..spell.target.raw..'')
tickdelay = os.clock() + 4.3
return
elseif not under3FMs() and not state.Buff['Building Flourish'] and abil_recasts[226] < latency then
eventArgs.cancel = true
windower.chat.input('/ja "Climactic Flourish" <me>')
windower.chat.input:schedule(1,'/ws "'..spell.english..'" '..spell.target.raw..'')
tickdelay = os.clock() + 1.25
return
elseif not under3FMs() and not state.Buff['Climactic Flourish'] and abil_recasts[222] < latency then
eventArgs.cancel = true
windower.chat.input('/ja "Building Flourish" <me>')
windower.chat.input:schedule(1,'/ws "'..spell.english..'" '..spell.target.raw..'')
tickdelay = os.clock() + 1.25
return
elseif player.sub_job == 'SAM' and not state.Buff['SJ Restriction'] and player.tp > 1850 and abil_recasts[140] < latency then
eventArgs.cancel = true
windower.chat.input('/ja "Sekkanoki" <me>')
windower.chat.input:schedule(1,'/ws "'..spell.english..'" '..spell.target.raw..'')
tickdelay = os.clock() + 1.25
return
elseif player.sub_job == 'SAM' and not state.Buff['SJ Restriction'] and abil_recasts[134] < latency then
eventArgs.cancel = true
windower.chat.input('/ja "Meditate" <me>')
windower.chat.input:schedule(1,'/ws "'..spell.english..'" '..spell.target.raw..'')
tickdelay = os.clock() + 1.25
return
end
elseif spell.type == 'Step' and player.main_job_level >= 77 and state.AutoPrestoMode.value and player.tp > 99 and player.status == 'Engaged' and under3FMs() then
local abil_recasts = windower.ffxi.get_ability_recasts()
if abil_recasts[236] < latency and abil_recasts[220] < latency then
eventArgs.cancel = true
windower.chat.input('/ja "Presto" <me>')
windower.chat.input:schedule(1.1,'/ja "'..spell.english..'" '..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
equip(sets.AccMaxTP[spell.english] or sets.AccMaxTP)
elseif sets.MaxTP then
equip(sets.MaxTP[spell.english] or sets.MaxTP)
else
end
end
end
--[[
if state.Buff['Building Flourish'] and sets.buff['Building Flourish'] then
equip(sets.buff['Building Flourish'])
end
]]
if state.Buff['Climactic Flourish'] and sets.buff['Climactic Flourish'] then
equip(sets.buff['Climactic Flourish'])
end
end
end
-- Return true if we handled the aftercast work. Otherwise it will fall back
-- to the general aftercast() code in Mote-Include.
function job_aftercast(spell, spellMap, eventArgs)
-- Lock feet after using Mana Wall.
if not spell.interrupted then
if spell.type == 'WeaponSkill' and state.Buff['Climactic Flourish'] and not under3FMs() and player.tp < 999 then
local abil_recasts = windower.ffxi.get_ability_recasts()
if abil_recasts[222] < latency then
windower.chat.input:schedule(1.5,'/ja "Reverse Flourish" <me>')
end
elseif state.UseAltStep.value and spell.english == state[state.CurrentStep.current..'Step'].current then
state.CurrentStep:cycle()
end
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)
update_melee_groups()
end
-------------------------------------------------------------------------------------------------------------------
-- User code that supplements standard library decisions.
-------------------------------------------------------------------------------------------------------------------
-- Called by the default 'update' self-command.
function job_update(cmdParams, eventArgs)
update_melee_groups()
end
function job_customize_idle_set(idleSet)
return idleSet
end
function job_customize_melee_set(meleeSet)
if state.DefenseMode.value ~= 'None' then
if state.Buff['Saber Dance'] then
meleeSet = set_combine(meleeSet, sets.buff['Saber Dance'])
end
if state.Buff['Climactic Flourish'] then
meleeSet = set_combine(meleeSet, sets.buff['Climactic Flourish'])
end
end
return meleeSet
end
-- Function to display the current relevant user state when doing an update.
-- Set eventArgs.handled to true if display was handled, and you don't want the default info shown.
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.Kiting.value then
msg = msg .. ', Kiting'
end
msg = msg .. ', ['..state.MainStep.current
if state.UseAltStep.value == true then
msg = msg .. '/'..state.AltStep.current
end
msg = msg .. ']'
if state.SelectStepTarget.value == true then
steps = steps..' (Targetted)'
end
add_to_chat(122, msg)
eventArgs.handled = true
end
-------------------------------------------------------------------------------------------------------------------
-- User self-commands.
-------------------------------------------------------------------------------------------------------------------
-- Called for custom player commands.
function job_self_command(commandArgs, eventArgs)
if commandArgs[1] == 'step' then
local doStep = ''
if state.UseAltStep.value == true then
doStep = state[state.CurrentStep.current..'Step'].current
else
doStep = state.MainStep.current
end
send_command('@input /ja "'..doStep..'" <t>')
end
end
function job_tick()
if check_dance() then return true end
if check_buff() then return true end
return false
end
-------------------------------------------------------------------------------------------------------------------
-- Utility functions specific to this job.
-------------------------------------------------------------------------------------------------------------------
function update_melee_groups()
classes.CustomMeleeGroups:clear()
if state.Buff['Saber Dance'] then
classes.CustomMeleeGroups:append('Saber')
end
if player.equipment.main and player.equipment.main == "Terpsichore" and state.Buff['Aftermath: Lv.3'] then
classes.CustomMeleeGroups:append('AM')
end
end
function under3FMs()
if not buffactive['Finishing Move 3'] and not buffactive['Finishing Move 4'] and not buffactive['Finishing Move 5'] and not buffactive['Finishing Move (6+)'] then
return true
else
return false
end
end
function check_buff()
if state.AutoBuffMode.value ~= 'Off' then
local abil_recasts = windower.ffxi.get_ability_recasts()
if not buffactive['Finishing Move 1'] and not buffactive['Finishing Move 2'] and not buffactive['Finishing Move 3'] and not buffactive['Finishing Move 4'] and not buffactive['Finishing Move 5'] and not buffactive['Finishing Move (6+)'] and abil_recasts[223] < latency then
windower.chat.input('/ja "No Foot Rise" <me>')
tickdelay = os.clock() + 1.1
return true
end
if player.in_combat and not state.Buff['SJ Restriction'] then
if player.sub_job == 'WAR' and not buffactive.Berserk and abil_recasts[1] < latency then
windower.chat.input('/ja "Berserk" <me>')
tickdelay = os.clock() + 1.1
return true
elseif player.sub_job == 'WAR' and not buffactive.Aggressor and abil_recasts[4] < latency then
windower.chat.input('/ja "Aggressor" <me>')
tickdelay = os.clock() + 1.1
return true
else
return false
end
end
end
return false
end
function check_dance()
if state.DanceStance.value ~= 'None' and not (state.Buff['Saber Dance'] or state.Buff['Fan Dance']) and player.in_combat then
local abil_recasts = windower.ffxi.get_ability_recasts()
if state.DanceStance.value == 'Saber Dance' and abil_recasts[219] < latency then
windower.chat.input('/ja "Saber Dance" <me>')
tickdelay = os.clock() + 1.1
return true
elseif state.DanceStance.value == 'Fan Dance' and abil_recasts[224] < latency then
windower.chat.input('/ja "Fan Dance" <me>')
tickdelay = os.clock() + 1.1
return true
else
return false
end
end
return false
end
function step_cost()
local cost = 100
if player.equipment.main == 'Setan Kober' then cost = cost - 40 end
if player.equipment.sub == 'Setan Kober' then cost = cost - 40 end
if state.DefenseMode.value == 'None' then cost = cost - step_feet_reduction end
return cost
end