forked from Celther-FFXI/GearSwap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWAR.lua
309 lines (272 loc) · 14.7 KB
/
WAR.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
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- __________.__ ________ __ .__.__ __ __ .__ .__ _____.__.__
-- \______ | | ____ _____ ______ ____ \______ \ ____ ____ _____/ |_ ____ __| _|___/ |_ _/ |_| |__ |__| ______ _/ ____|__| | ____
-- | ___| | _/ __ \\__ \ / ____/ __ \ | | \ / _ \ / \ / _ \ __\ _/ __ \ / __ || \ __\ \ __| | \| |/ ___/ \ __\| | | _/ __ \
-- | | | |_\ ___/ / __ \_\___ \\ ___/ | ` ( <_> ) | | ( <_> | | \ ___// /_/ || || | | | | 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.
function job_setup()
state.Buff['Brazen Rush'] = buffactive['Brazen Rush'] or false
state.Buff["Warrior's Charge"] = buffactive["Warrior's Charge"] or false
state.Buff['Mighty Strikes'] = buffactive['Mighty Strikes'] or false
state.Buff.Retaliation = buffactive['Retaliation'] or false
state.Buff.Restraint = buffactive['Restraint'] or false
state.Buff['Aftermath'] = buffactive['Aftermath'] or false
state.Buff['Aftermath: Lv.3'] = buffactive['Aftermath: Lv.3'] or false
state.Buff.Hasso = buffactive.Hasso or false
state.Buff.Seigan = buffactive.Seigan or false
state.Stance = M{['description']='Stance','Hasso','Seigan','None'}
autows = "Ukko's Fury"
autofood = 'Soy Ramen'
init_job_states({"Capacity","AutoRuneMode","AutoTrustMode","AutoWSMode","AutoShadowMode","AutoFoodMode","AutoStunMode","AutoDefenseMode",},{"AutoBuffMode","AutoSambaMode","Weapons","OffenseMode","WeaponskillMode","Stance","IdleMode","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)
if spell.type == 'WeaponSkill' then
local available_ws = S(windower.ffxi.get_abilities().weapon_skills)
-- WS 112 is Double Thrust, meaning a Spear is equipped.
if available_ws:contains(48) then
if spell.english == "Upheaval" then
windower.chat.input('/ws "Resolution" '..spell.target.raw)
cancel_spell()
eventArgs.cancel = true
elseif spell.english == "Ukko's Fury" then
send_command('@input /ws "Ground Strike" '..spell.target.raw)
cancel_spell()
eventArgs.cancel = true
end
end
end
end
function job_precast(spell, spellMap, eventArgs)
if spell.type == 'WeaponSkill' and state.AutoBuffMode.value ~= 'Off' then
local abil_recasts = windower.ffxi.get_ability_recasts()
if player.tp < 2250 and not buffactive['Blood Rage'] and abil_recasts[2] < latency then
eventArgs.cancel = true
windower.chat.input('/ja "Warcry" <me>')
windower.chat.input:schedule(1,'/ws "'..spell.english..'" '..spell.target.raw..'')
tickdelay = os.clock() + 1.25
return
elseif state.Buff['SJ Restriction'] then
return
elseif player.sub_job == 'SAM' 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 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
end
end
-- Modify the default melee set after it was constructed.
function job_customize_melee_set(meleeSet)
if not state.OffenseMode.value:contains('Acc') and state.HybridMode.value == 'Normal' and buffactive['Retaliation'] then
meleeSet = set_combine(meleeSet, sets.buff.Retaliation)
end
if not state.OffenseMode.value:contains('Acc') and state.HybridMode.value == 'Normal' and buffactive['Restraint'] then
meleeSet = set_combine(meleeSet, sets.buff.Restraint)
end
return meleeSet
end
-- Run after the general precast() is done.
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
if wsacc:contains('Acc') and not buffactive['Sneak Attack'] then
if state.Buff.Charge and state.Buff['Mighty Strikes'] and sets.ACCWSMightyCharge then
equip(sets.ACCWSMightyCharge)
elseif state.Buff.Charge and sets.ACCWSCharge then
equip(sets.ACCWSCharge)
elseif state.Buff['Mighty Strikes'] and sets.ACCWSMighty then
equip(sets.AccWSMighty)
end
else
if state.Buff.Charge and state.Buff['Mighty Strikes'] and sets.WSMightyCharge then
equip(sets.WSMightyCharge)
elseif state.Buff.Charge and sets.WSCharge then
equip(sets.WSCharge)
elseif state.Buff['Mighty Strikes'] and sets.WSMighty then
equip(sets.WSMighty)
end
end
end
end
function job_tick()
if check_hasso() then return true end
if check_buff() then return true end
return false
end
-- Called by the 'update' self-command.
function job_update(cmdParams, eventArgs)
update_melee_groups()
if player.sub_job ~= 'SAM' and state.Stance.value ~= "None" then
state.Stance:set("None")
end
end
function job_aftercast(spell, spellMap, eventArgs)
if not spell.interrupted then
if spell.english == 'Warcry' then
lastwarcry = player.name
end
end
end
function job_buff_change(buff, gain)
if buff == 'Warcry' then
if gain and windower.ffxi.get_ability_recasts()[2] > 297 then
lastwarcry = player.name
else
lastwarcry = ''
end
end
update_melee_groups()
end
function update_melee_groups()
if player then
classes.CustomMeleeGroups:clear()
if data.areas.adoulin:contains(world.area) and buffactive.Ionis then
classes.CustomMeleeGroups:append('Adoulin')
end
if state.Buff['Brazen Rush'] or state.Buff["Warrior's Charge"] then
classes.CustomMeleeGroups:append('Charge')
end
if state.Buff['Mighty Strikes'] then
classes.CustomMeleeGroups:append('Mighty')
end
if (player.equipment.main == "Conqueror" and buffactive['Aftermath: Lv.3']) or ((player.equipment.main == "Bravura" or player.equipment.main == "Ragnarok") and state.Buff['Aftermath']) then
classes.CustomMeleeGroups:append('AM')
end
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 player.in_combat then
local abil_recasts = windower.ffxi.get_ability_recasts()
if not buffactive.Retaliation and abil_recasts[8] < latency then
windower.chat.input('/ja "Retaliation" <me>')
tickdelay = os.clock() + 1.1
return true
elseif not buffactive.Restraint and abil_recasts[9] < latency then
windower.chat.input('/ja "Restraint" <me>')
tickdelay = os.clock() + 1.1
return true
elseif not buffactive['Blood Rage'] and abil_recasts[11] < latency then
windower.chat.input('/ja "Blood Rage" <me>')
tickdelay = os.clock() + 1.1
return true
elseif not buffactive.Berserk and abil_recasts[1] < latency then
windower.chat.input('/ja "Berserk" <me>')
tickdelay = os.clock() + 1.1
return true
elseif 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
return false
end