forked from Kinematics/GearSwap-Jobs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PUP.lua
370 lines (279 loc) · 13.1 KB
/
PUP.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
-------------------------------------------------------------------------------------------------------------------
-- Initialization function that defines sets and variables to be used.
-------------------------------------------------------------------------------------------------------------------
-- IMPORTANT: Make sure to also get the Mote-Include.lua file (and its supplementary files) to go with this.
-- Initialization function for this job file.
function get_sets()
-- Load and initialize the include file.
include('Mote-Include.lua')
end
-- Setup vars that are user-independent.
function job_setup()
-- List of pet weaponskills to check for
petWeaponskills = S{"Slapstick", "Knockout", "Magic Mortar",
"Chimera Ripper", "String Clipper", "Cannibal Blade", "Bone Crusher", "String Shredder",
"Arcuballista", "Daze", "Armor Piercer", "Armor Shatterer"}
-- Map automaton heads to combat roles
petModes = {
['Harlequin Head'] = 'Melee',
['Sharpshot Head'] = 'Ranged',
['Valoredge Head'] = 'Tank',
['Stormwaker Head'] = 'Magic',
['Soulsoother Head'] = 'Heal',
['Spiritreaver Head'] = 'Nuke'
}
-- Subset of modes that use magic
magicPetModes = S{'Nuke','Heal','Magic'}
-- Var to track the current pet mode.
state.PetMode = 'Melee'
update_pet_mode()
end
-- Setup vars that are user-dependent. Can override this function in a sidecar file.
function user_setup()
-- Options: Override default values
options.OffenseModes = {'Normal', 'Acc'}
options.DefenseModes = {'Normal', 'DT'}
options.WeaponskillModes = {'Normal', 'Att', 'Mod'}
options.IdleModes = {'Normal'}
options.RestingModes = {'Normal'}
options.PhysicalDefenseModes = {'PDT', 'Evasion'}
options.MagicalDefenseModes = {'MDT'}
state.Defense.PhysicalMode = 'PDT'
-- Default maneuvers 1, 2, 3 and 4 for each pet mode.
defaultManeuvers = {
['Melee'] = {'Fire Maneuver', 'Thunder Maneuver', 'Wind Maneuver', 'Light Maneuver'},
['Ranged'] = {'Wind Maneuver', 'Fire Maneuver', 'Thunder Maneuver', 'Light Maneuver'},
['Tank'] = {'Earth Maneuver', 'Dark Maneuver', 'Light Maneuver', 'Wind Maneuver'},
['Magic'] = {'Ice Maneuver', 'Light Maneuver', 'Dark Maneuver', 'Earth Maneuver'},
['Heal'] = {'Light Maneuver', 'Dark Maneuver', 'Water Maneuver', 'Earth Maneuver'},
['Nuke'] = {'Ice Maneuver', 'Dark Maneuver', 'Light Maneuver', 'Earth Maneuver'}
}
select_default_macro_book()
end
-- Called when this job file is unloaded (eg: job change)
function file_unload()
if binds_on_unload then
binds_on_unload()
end
end
-- Define sets used by this job file.
function init_gear_sets()
-- Precast Sets
-- Fast cast sets for spells
sets.precast.FC = {head="Haruspex Hat",ear2="Loquacious Earring",hands="Thaumas Gloves"}
sets.precast.FC.Utsusemi = set_combine(sets.precast.FC, {neck="Magoraga Beads"})
-- Precast sets to enhance JAs
sets.precast.JA['Tactical Switch'] = {feet="Cirque Scarpe +2"}
sets.precast.JA['Repair'] = {feet="Foire Babouches"}
sets.precast.Maneuver = {neck="Buffoon's Collar",body="Cirque Farsetto +2",hands="Foire Dastanas"}
-- Waltz set (chr and vit)
sets.precast.Waltz = {
head="Whirlpool Mask",ear1="Roundel Earring",
body="Otronif Harness",hands="Otronif Gloves",ring1="Spiral Ring",
back="Iximulew Cape",legs="Nahtirah Trousers",feet="Thurandaut Boots +1"}
-- Don't need any special gear for Healing Waltz.
sets.precast.Waltz['Healing Waltz'] = {}
-- Weaponskill sets
-- Default set for any weaponskill that isn't any more specifically defined
sets.precast.WS = {
head="Whirlpool Mask",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
body="Manibozho Jerkin",hands="Otronif Gloves",ring1="Rajas Ring",ring2="Epona's Ring",
back="Pantin Cape",waist="Windbuffet Belt",legs="Manibozho Brais",feet="Manibozho Boots"}
-- Specific weaponskill sets. Uses the base set if an appropriate WSMod version isn't found.
sets.precast.WS['Stringing Pummel'] = set_combine(sets.precast.WS, {neck="Rancor Collar",ear1="Brutal Earring",ear2="Moonshade Earring",
ring1="Spiral Ring",waist="Soil Belt"})
sets.precast.WS['Stringing Pummel'].Mod = set_combine(sets.precast.WS['Stringing Pummel'], {legs="Nahtirah Trousers"})
sets.precast.WS['Victory Smite'] = set_combine(sets.precast.WS, {neck="Rancor Collar",ear1="Brutal Earring",ear2="Moonshade Earring",
waist="Thunder Belt"})
sets.precast.WS['Shijin Spiral'] = set_combine(sets.precast.WS, {neck="Light Gorget",waist="Light Belt"})
-- Midcast Sets
sets.midcast.FastRecast = {
head="Haruspex Hat",ear2="Loquacious Earring",
body="Otronif Harness",hands="Regimen Mittens",
waist="Twilight Belt",legs="Manibozho Brais",feet="Otronif Boots"}
-- Midcast sets for pet actions
sets.midcast.Pet.Cure = {legs="Foire Churidars"}
sets.midcast.Pet.Weaponskill = {head="Cirque Cappello +2", hands="Cirque Guanti +2", legs="Cirque Pantaloni +2"}
-- Sets to return to when not performing an action.
-- Resting sets
sets.resting = {head="Foire Taj",neck="Wiglen Gorget",
ring1="Sheltered Ring",ring2="Paguroidea Ring"}
-- Idle sets
sets.idle = {range="Eminent Animator",
head="Foire Taj",neck="Wiglen Gorget",ear1="Bladeborn Earring",ear2="Steelflash Earring",
body="Foire Tobe",hands="Regimen Mittens",ring1="Sheltered Ring",ring2="Paguroidea Ring",
back="Shadow Mantle",waist="Hurch'lan Sash",legs="Foire Churidars",feet="Hermes' Sandals"}
sets.idle.Town = set_combine(sets.idle, {main="Oatixur"})
-- Set for idle while pet is out (eg: pet regen gear)
sets.idle.Pet = sets.idle
-- Idle sets to wear while pet is engaged
sets.idle.Pet.Engaged = {
head="Foire Taj",neck="Wiglen Gorget",ear1="Bladeborn Earring",ear2="Cirque Earring",
body="Foire Tobe",hands="Regimen Mittens",ring1="Sheltered Ring",ring2="Paguroidea Ring",
back="Pantin Cape",waist="Hurch'lan Sash",legs="Foire Churidars",feet="Foire Babouches"}
sets.idle.Pet.Engaged.Ranged = set_combine(sets.idle.Pet.Engaged, {hands="Cirque Guanti +2",legs="Cirque Pantaloni +2"})
sets.idle.Pet.Engaged.Nuke = set_combine(sets.idle.Pet.Engaged, {legs="Cirque Pantaloni +2",feet="Cirque Scarpe +2"})
sets.idle.Pet.Engaged.Magic = set_combine(sets.idle.Pet.Engaged, {legs="Cirque Pantaloni +2",feet="Cirque Scarpe +2"})
-- Defense sets
sets.defense.Evasion = {
head="Whirlpool Mask",neck="Twilight Torque",
body="Otronif Harness",hands="Otronif Gloves",ring1="Beeline Ring",ring2="Dark Ring",
back="Ik Cape",waist="Hurch'lan Sash",legs="Nahtirah Trousers",feet="Otronif Boots"}
sets.defense.PDT = {
head="Whirlpool Mask",neck="Twilight Torque",
body="Otronif Harness",hands="Otronif Gloves",ring1="Beeline Ring",ring2="Dark Ring",
back="Shadow Mantle",waist="Hurch'lan Sash",legs="Nahtirah Trousers",feet="Otronif Boots"}
sets.defense.MDT = {
head="Whirlpool Mask",neck="Twilight Torque",
body="Otronif Harness",hands="Otronif Gloves",ring1="Dark Ring",ring2="Shadow Ring",
back="Tuilha Cape",waist="Hurch'lan Sash",legs="Nahtirah Trousers",feet="Otronif Boots"}
sets.Kiting = {feet="Hermes' Sandals"}
-- Engaged sets
-- Variations for TP weapon and (optional) offense/defense modes. Code will fall back on previous
-- sets if more refined versions aren't defined.
-- If you create a set with both offense and defense modes, the offense mode should be first.
-- EG: sets.engaged.Dagger.Accuracy.Evasion
-- Normal melee group
sets.engaged = {
head="Whirlpool Mask",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
body="Thaumas Coat",hands="Otronif Gloves",ring1="Rajas Ring",ring2="Epona's Ring",
back="Pantin Cape",waist="Windbuffet Belt",legs="Manibozho Brais",feet="Otronif Boots"}
sets.engaged.Acc = {
head="Whirlpool Mask",neck="Peacock Charm",ear1="Bladeborn Earring",ear2="Steelflash Earring",
body="Thaumas Coat",hands="Otronif Gloves",ring1="Rajas Ring",ring2="Epona's Ring",
back="Pantin Cape",waist="Hurch'lan Sash",legs="Manibozho Brais",feet="Otronif Boots"}
sets.engaged.DT = {
head="Whirlpool Mask",neck="Twilight Torque",ear1="Bladeborn Earring",ear2="Steelflash Earring",
body="Otronif Harness",hands="Regimen Mittens",ring1="Dark Ring",ring2="Epona's Ring",
back="Iximulew Cape",waist="Windbuffet Belt",legs="Manibozho Brais",feet="Otronif Boots"}
sets.engaged.Acc.DT = {
head="Whirlpool Mask",neck="Twilight Torque",ear1="Bladeborn Earring",ear2="Steelflash Earring",
body="Otronif Harness",hands="Regimen Mittens",ring1="Dark Ring",ring2="Beeline Ring",
back="Iximulew Cape",waist="Hurch'lan Sash",legs="Manibozho Brais",feet="Otronif Boots"}
end
-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks that are called to process player actions at specific points in time.
-------------------------------------------------------------------------------------------------------------------
-- Called when player is about to perform an action
function job_precast(spell, action, spellMap, eventArgs)
if spell.type == 'Waltz' then
refine_waltz(spell, action, spellMap, eventArgs)
end
end
-- Called when pet is about to perform an action
function job_pet_midcast(spell, action, spellMap, eventArgs)
if petWeaponskills:contains(spell.english) then
classes.CustomClass = "Weaponskill"
end
end
-------------------------------------------------------------------------------------------------------------------
-- General hooks for other game 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 buff == 'Wind Maneuver' then
handle_equipping_gear(player.status)
end
end
-- Called when a player gains or loses a pet.
-- pet == pet gained or lost
-- gain == true if the pet was gained, false if it was lost.
function job_pet_change(pet, gain)
update_pet_mode()
end
-- Called when the pet's status changes.
function job_pet_status_change(newStatus, oldStatus)
if newStatus == 'Engaged' then
display_pet_status()
end
end
-- Called when the player's subjob changes.
function sub_job_change(newSubjob, oldSubjob)
select_default_macro_book()
end
-------------------------------------------------------------------------------------------------------------------
-- User code that supplements self-commands.
-------------------------------------------------------------------------------------------------------------------
-- Called for custom player commands.
function job_self_command(cmdParams, eventArgs)
if cmdParams[1] == 'maneuver' then
if pet.isvalid then
local man = defaultManeuvers[state.PetMode]
if man and tonumber(cmdParams[2]) then
man = man[tonumber(cmdParams[2])]
end
if man then
send_command('input /pet "'..man..'" <me>')
end
else
add_to_chat(123,'No valid pet.')
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_pet_mode()
end
-- Set eventArgs.handled to true if we don't want the automatic display to be run.
function display_current_job_state(eventArgs)
local defenseString = ''
if state.Defense.Active then
local defMode = state.Defense.PhysicalMode
if state.Defense.Type == 'Magical' then
defMode = state.Defense.MagicalMode
end
defenseString = 'Defense: '..state.Defense.Type..' '..defMode..', '
end
add_to_chat(122,'Melee: '..state.OffenseMode..'/'..state.DefenseMode..', WS: '..state.WeaponskillMode..', '..defenseString..
'Kiting: '..on_off_names[state.Kiting])
display_pet_status()
eventArgs.handled = true
end
-------------------------------------------------------------------------------------------------------------------
-- Utility functions specific to this job.
-------------------------------------------------------------------------------------------------------------------
-- Get the pet mode value based on the equipped head of the automaton.
-- Returns nil if pet is not valid.
function get_pet_mode()
if pet.isvalid then
return petModes[pet.head]
end
end
-- Update state.PetMode, as well as functions that use it for set determination.
function update_pet_mode()
state.PetMode = get_pet_mode()
update_custom_groups()
end
-- Update custom groups based on the current pet.
function update_custom_groups()
classes.CustomIdleGroups:clear()
if pet.isvalid then
classes.CustomIdleGroups:append(state.PetMode)
end
end
-- Display current pet status.
function display_pet_status()
if pet.isvalid then
local petInfoString = pet.name..' ['..pet.head..']: '..tostring(pet.status)..' TP='..tostring(pet.tp)..' HP%='..tostring(pet.hpp)
if magicPetModes:contains(state.PetMode) then
petInfoString = petInfoString..' MP%='..tostring(pet.mpp)
end
add_to_chat(122,petInfoString)
end
end
-- Select default macro book on initial load or subjob change.
function select_default_macro_book()
-- Default macro set/book
if player.sub_job == 'DNC' then
set_macro_page(2, 9)
elseif player.sub_job == 'NIN' then
set_macro_page(3, 9)
elseif player.sub_job == 'THF' then
set_macro_page(4, 9)
else
set_macro_page(1, 9)
end
end