-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwt_doer.lua
More file actions
363 lines (335 loc) · 13.7 KB
/
Copy pathwt_doer.lua
File metadata and controls
363 lines (335 loc) · 13.7 KB
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
require 'utils'
require 'path_helpers'
require 'inventory_buddy'
local fixed_members = { "Graha", "Yshtola" } -- allrounder + DPS
local support_fill = "Krile" -- if youre support add another DPS Graha fills the other support role
local dps_fill = "Thancred" -- if youre dps add tank and Graha fills healer
local duty_blacklist = {}
function reset_blacklist()
duty_blacklist = {
--447, -- Limitless Blue, doesnt touch the hookshots, should work now with the path
577, -- P1T6 ex, no module support, falls off the platform
--720, -- emanation ex, no module support, sometimes works, depends if the vril mech is used too fast
748, -- Phantom train, gets caught by the ghosties and gets stuck
}
end
function do_wt(gearset)
reset_blacklist()
if gearset ~= nil then
equip_gearset(gearset)
end
if not Player.Bingo.HasWeeklyBingoJournal or Player.Bingo.IsWeeklyBingoExpired then
get_wt()
end
while wt_count() < 9 do
if not wt_duty() then
log("No Possible Duties", "Failed to find a duty to fill out wt bingo", wt_count(), 'of 9 done')
return false
end
end
log("WT Bingo completed", wt_count(), "of 9 done")
RunVislandRoute(
"H4sIAAAAAAAACu1SyW7bMBD9leKdGYNyEjjmrVAWuIVdJ3HhLOiBqSYWAZHjiqMUgaF/Dygri5trTkF54czDzJs3ywYz6wkGP0OwnoovF9wIQeGs5mbd4atkUQGFU+YCRitMbWhs1ZkLW69IzqyUVE+EfAcu7eOaXZAIc7vBnKMTxwFmgyuYvWw8OBqNR3qocA0zzLKBVriB0YNM7x+ODg/GrcINB5ocwxyMjhQubOGaCDNOL0VP+YE8BYEZKsytlPcuFDBSN6QwCUK1/S1LJ+WPxKF3sb5j7KL/qNSpzHX/d+J0qxBL/vuc5DhEmHtbxTc1O4JM4cSz0HNtId+bX7uI3jlvKMpb+5L+bMfLdz18KbzOORS9Mq3w3VVVzk1qXSt023rtJy+t5Oy9TcNIQNK7tE5ehSbvlOtd0gQunKdp3HFPFu+H0SpM4ry0Qdi/kKYNwISmqhRmREWcbhVu97E9DhdWi8c1pSUmihkX9JKfnG98B6Nb9ZH3Mvx/K/knvpVf7RMEuPS/vwQAAA==",
"Going to Khloe")
return true
end
function log_wt()
log("---- WT Info ----")
for i = 0, 15 do
local cell = Player.Bingo:GetWeeklyBingoTaskStatus(i)
local duty = Player.Bingo:GetWeeklyBingoOrderDataRow(i)
log("Wt item", i + 1, duty.Type, wt_item_name(duty), "Level:", extract_level(duty), duty.RowId, cell)
local instance = wt_pick_duty(duty)
if instance == nil then
log("Not supported")
else
local instance_id = instance.TerritoryType.RowId
local type, unsync = wt_duty_type(instance)
if duty_executable(instance) then
log("Using:", type, unsync, '-', instance.Name, '-', instance_id, '-',
IPC.AutoDuty.ContentHasPath(instance_id))
end
end
end
log("Completed:", wt_count(), "of 9")
end
function get_wt()
RunVislandRoute(
"H4sIAAAAAAAACu1SyW7bMBD9leKdGYNyEjjmrVAWuIVdJ3HhLOiBqSYWAZHjiqMUgaF/Dygri5trTkF54czDzJs3ywYz6wkGP0OwnoovF9wIQeGs5mbd4atkUQGFU+YCRitMbWhs1ZkLW69IzqyUVE+EfAcu7eOaXZAIc7vBnKMTxwFmgyuYvWw8OBqNR3qocA0zzLKBVriB0YNM7x+ODg/GrcINB5ocwxyMjhQubOGaCDNOL0VP+YE8BYEZKsytlPcuFDBSN6QwCUK1/S1LJ+WPxKF3sb5j7KL/qNSpzHX/d+J0qxBL/vuc5DhEmHtbxTc1O4JM4cSz0HNtId+bX7uI3jlvKMpb+5L+bMfLdz18KbzOORS9Mq3w3VVVzk1qXSt023rtJy+t5Oy9TcNIQNK7tE5ehSbvlOtd0gQunKdp3HFPFu+H0SpM4ry0Qdi/kKYNwISmqhRmREWcbhVu97E9DhdWi8c1pSUmihkX9JKfnG98B6Nb9ZH3Mvx/K/knvpVf7RMEuPS/vwQAAA==",
"Going to Khloe")
if Player.Bingo.HasWeeklyBingoJournal and not Player.Bingo.IsWeeklyBingoExpired then
error("AlreadyHaveWT",
"Weekly Bingo Journal already exists and is not expired, turn in first")
end
repeat
local entity = get_closest_entity("Khloe Aliapoh", true)
entity:SetAsTarget()
entity:Interact()
wait(.1)
CheckTimeout(2, ti, "Talking to Khloe Aliapoh didnt work")
wait(.1)
until IsAddonReady("Talk") or IsAddonReady("SelectString")
while wait_any_addons("SelectString", "Talk") == "Talk" do
close_talk("SelectString")
wait(0.1)
end
SelectInList("Receive a new journal from Khloe.", "SelectString")
local ti = ResetTimeout()
repeat
CheckTimeout(10, ti, "Waiting for Weekly Bingo Journal to be received")
close_talk()
wait(.1)
until not is_busy() and Player.Bingo.HasWeeklyBingoJournal
end
function wt_duty()
for i = 0, 15 do
local cell = Player.Bingo:GetWeeklyBingoTaskStatus(i)
if cell ~= WeeklyBingoTaskStatus.Open then
log_(LEVEL_DEBUG, _text, "Bingo cell", i, "not available", cell)
else
local duty = Player.Bingo:GetWeeklyBingoOrderDataRow(i)
local content = wt_pick_duty(duty)
if content == nil then
log_(LEVEL_INFO, _text, "Bingo cell", i, "not supported type", duty.Data, '-', wt_item_name(duty))
else
-- try to do the duty
local instance_id = content.TerritoryType.RowId
local type, unsync = wt_duty_type(content)
if duty_executable(content) then
log_(LEVEL_INFO, _text, "Using:", type, unsync, '-', content.Name, '-', instance_id, '-',
IPC.AutoDuty.ContentHasPath(instance_id))
run_content(type, unsync, instance_id, wt_count)
return true
else
log_(LEVEL_INFO, _text, "Bingo cell", i, "not executable", duty.Data, '-', wt_item_name(duty))
end
end
end
end
return false
end
function run_content(type, unsync, instance_id, validate)
for_wt = default(for_wt, true)
local pre_validation = validate()
local s = os.clock()
repeat
IPC.AutoDuty.Stop()
InstancedContent.LeaveCurrentContent()
if os.clock() - s > 60 then
log_(LEVEL_ERROR, _text, "Failed to queue instance", instance_id, "blacklisting it.")
table.insert(duty_blacklist, instance_id)
return
end
setup_content(type, unsync)
IPC.AutoDuty.Run(instance_id, 1, false)
local c = os.clock()
repeat
wait(1)
until Svc.ClientState.TerritoryType == instance_id or os.clock() - c > 15
until Svc.ClientState.TerritoryType == instance_id
repeat
wait(1)
until IPC.AutoDuty.IsStopped()
if validate() == pre_validation then
log_(LEVEL_DEBUG, _text, "Duty failed? Still in instance?", Svc.ClientState.TerritoryType, instance_id)
table.insert(duty_blacklist, instance_id)
if Svc.ClientState.TerritoryType == instance_id then
InstancedContent.LeaveCurrentContent()
end
wait_ready()
end
end
function setup_content(type, unsync)
IPC.AutoDuty.SetConfig("autoDutyModeEnum", "Looping")
IPC.AutoDuty.SetConfig("leveling", "None")
if type == "Dungeons" and unsync then
IPC.AutoDuty.SetConfig("dutyModeEnum", "Regular")
IPC.AutoDuty.SetConfig("Unsynced", "True")
elseif type == "Dungeons" and not unsync then
IPC.AutoDuty.SetConfig("Unsynced", "False")
IPC.AutoDuty.SetConfig("dutyModeEnum", "Trust")
local command = String[4]
command[0] = "set"
command[1] = fixed_members[1]
command[2] = fixed_members[2]
if Player.Job.IsDPS then
command[3] = dps_fill
else
command[3] = support_fill
end
log_(LEVEL_INFO, _text, "Setting trust members to")
log_(LEVEL_INFO, _array, command)
IPC.AutoDuty.SetConfig("SelectedTrustMembers", command)
elseif type == "Raids" and unsync then
IPC.AutoDuty.SetConfig("dutyModeEnum", "Raid")
IPC.AutoDuty.SetConfig("Unsynced", "True")
elseif type == "Trials" and unsync then
IPC.AutoDuty.SetConfig("dutyModeEnum", "Trial")
IPC.AutoDuty.SetConfig("Unsynced", "True")
else
error("NotImplemented", "Duty type", type, unsync, "not configured")
end
end
function duty_executable(content)
local instance_id = content.TerritoryType.RowId
local type, unsync = wt_duty_type(content)
if not unsync and type ~= "Dungeons" then
log_(LEVEL_DEBUG, _text, "Not supported", content.Name, "type", type, "must be unsynced but allow undersized is",
unsync)
return false
elseif type == "Trials" and content.ClassJobLevelRequired > 70 then
log_(LEVEL_DEBUG, _text, "Not supported", content.Name, "type", type, "dont work well above level 70 but needs",
content.ClassJobLevelRequired)
return false
elseif not IPC.AutoDuty.ContentHasPath(instance_id) then
log_(LEVEL_DEBUG, _text, "Not supported", content.Name, "- No autoduty path")
return false
elseif list_contains(duty_blacklist, instance_id) then
log_(LEVEL_INFO, _text, "Blacklisted duty,", content.Name, '-', instance_id, "has been blacklisted")
return false
end
return true
end
function get_duty_row(duty_id)
local duty = Excel.GetRow("InstanceContent", duty_id)
if duty == nil then
return error("InvalidDuty", "no duty with ID", duty_id)
end
return duty.ContentFinderCondition
end
function get_content_row(content_id)
local duty = Excel.GetRow("TerritoryType", content_id)
if duty == nil then
return error("InvalidDuty", "no duty with territory ID", content_id)
end
return duty.ContentFinderCondition
end
function wt_pick_high_level_duty(level)
if level == 50 then
--return get_content_row(350) --Haukke Manor Hard, not stable, runs into walls in candle hall
return get_content_row(387) --Sastasha Hard
elseif level == 70 then
return get_content_row(742) --Hell's Lid
elseif level == 90 then
--return get_content_row(973) --The Dead Ends, not stable, first boss has mechanic requiring 2 players
--return get_content_row(976) --Smileton, no bossmod support
return get_content_row(1070) --The Fell Court of Troia
elseif level == 100 then
return get_content_row(1266) --The Underkeep
end
error("NotImplemented", "High level duty Lv.", level, "is not implemented")
end
function wt_pick_leveling_duty(level)
if level == 1 then
return get_content_row(1040) -- Haukke Manor
elseif level == 51 then
return get_content_row(434) -- Dusk Vigil
elseif level == 81 then
return get_content_row(952) -- Tower of Zot
end
error("NotImplemented", "Leveling duty Lv.", level, "is not implemented")
end
function extract_level(duty)
local name = wt_item_name(duty)
local s, e = name:find("Lv%. %d+")
if s == nil then
return nil
end
-- skip the "Lv. "
s = s + 4
return tonumber(name:sub(s, e))
end
local UNSUPPORTED_RAID_IDS = {
26, 27, 28, 29, 30, -- Alliance raids by expansion
23, 24, -- Eden
31, 32, 33, 37, -- Pandora
34, 35, 38, 36 -- AAC
}
function raid_id_to_duty(raid_id)
if list_contains(UNSUPPORTED_RAID_IDS, raid_id) then
return nil
elseif raid_id == 2 then
-- Binding Coil of Bahamut
return get_content_row(242) -- Turn 2
elseif raid_id == 4 then
-- Final Coil of Bahamut
return get_content_row(195) -- Turn 3
elseif raid_id == 5 then
-- Alexander: The Father
return get_content_row(442) -- Fist of the Father
elseif raid_id == 6 then
-- Alexander: The Son
return get_content_row(520) -- Fist of the Son
elseif raid_id == 7 then
-- Alexander: The Creator
return get_content_row(580) -- Eyes of the Creator
elseif raid_id == 8 then
-- Deltascape
return get_content_row(693) -- V3
elseif raid_id == 9 then
-- Sigmascape
--return get_content_row(748) -- Phantom Train
return get_content_row(750) -- TV guy
elseif raid_id == 10 then
-- Alphascape
return get_content_row(798) -- Chaos!
elseif raid_id == 25 then
-- Edens Promise
return get_content_row(943) -- Litany
end
error("NotImplemented", "Raid", raid_id, "is not implemented")
end
-- I dont think they use most of these anymore, so just crash and implement it when they come up.
function wt_pick_duty(duty)
if duty.Type == 0 then
-- Specicfic duty, Data == duty_id
return get_duty_row(duty.Data)
elseif duty.Type == 1 then
-- X0 dungeons, Data == X0
return wt_pick_high_level_duty(extract_level(duty))
elseif duty.Type == 2 then
-- X1-X9 dungeons, Data == X9
error("NotImplemented")
elseif duty.Type == 3 then
-- Special (PvP, treasure, etc.)
return nil
elseif duty.Type == 4 then
-- Normal/Alliance raids, Data == Specific raid index
return raid_id_to_duty(duty.Data)
elseif duty.Type == 5 then
-- X1-Y9 Leveling dungeons, Data == Y9
return wt_pick_leveling_duty(extract_level(duty))
elseif duty.Type == 6 then
-- X0,Y0 High level dungeons, Data == Y0
return wt_pick_high_level_duty(extract_level(duty))
elseif duty.Type == 7 then
-- X0-Y0 Trials, Data == Y0
error("NotImplemented")
elseif duty.Type == 8 then
-- X0-Y0 Alliance Raids, Data == Y0
error("NotImplemented")
elseif duty.Type == 9 then
-- X0-Y0 Normal Raids, Data == Y0
error("NotImplemented")
end
end
function wt_item_name(duty)
if duty.Type == 0 then
return get_duty_row(duty.Data).Name
else
return duty.Text.Description
end
end
function wt_duty_type(content_instance)
return content_instance.ContentType.Name, content_instance.AllowUndersized
end
function wt_count()
local count = 0
for i = 0, 15 do
local cell = Player.Bingo:GetWeeklyBingoTaskStatus(i)
if cell == WeeklyBingoTaskStatus.Claimable or cell == WeeklyBingoTaskStatus.Claimed then
count = count + 1
end
end
return count
end