-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMap Gatherer.lua
More file actions
315 lines (271 loc) · 10.4 KB
/
Copy pathMap Gatherer.lua
File metadata and controls
315 lines (271 loc) · 10.4 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
--[=====[
[[SND Metadata]]
author: 'pot0to (https://ko-fi.com/pot0to) || Updated by: Minnu'
version: 2.0.0
description: Short script to enable GBR and gather a map. Allows for multi-character gathering but will have to be manually edited to support.
plugin_dependencies:
- Gatherbuddy Reborn (And its dependencies)
configs:
MapName:
description: The name of the map to be gathered (MUST MATCH THE MAP SET IN GBR)
type: list
choices: ["Timeworn Leather Map", "Timeworn Goatskin Map", "Timeworn Toadskin Map", "Timeworn Boarskin Map", "Timeworn Peisteskin Map", "Timeworn Archaeoskin Map", "Timeworn Wyvernskin Map", "Timeworn Dragonskin Map", "Timeworn Gaganaskin Map", "Timeworn Gazelleskin Map", "Timeworn Gliderskin Map", "Timeworn Zonureskin Map", "Timeworn Saigaskin Map", "Timeworn Kumbhiraskin Map", "Timeworn Ophiotauroskin Map", "Timeworn Loboskin Map", "Timeworn Br'aaxskin Map", "Timeworn Gargantuaskin Map"]
is_choice: true
required: true
[[End Metadata]]
--]=====]
--[[
********************************************************************************
* Map Gathering *
********************************************************************************
Created by: pot0to (https://ko-fi.com/pot0to)
Gathers a map, relogs as the next character in the list, mails them all to your
"friend", rinse and repeat. You will need to install Gather Buddy Reborn and add
your desired map to the auto gather list. This plugin only kicks off the gather
list and waits for the map to drop in your inventory, then stops the gathering
and relogs as the next character.
********************************************************************************
* Version *
* 0.1.2 *
********************************************************************************
0.1.2 Fixed state change between character swap and ready
0.1.1 Added code to support Delivery Moogle at Radz-at-Han (/tp radz)
0.1.0 Added ability to mail
0.0.10 Moved command to close gathering menu
0.0.9 Added checks to stop pathing and close gathering menus when ready to
switch characters
0.0.8 Added ability to search entire timers list for map allowances, added
other maps
********************************************************************************
* Required Plugins *
********************************************************************************
1. Vnavmesh
2. Gather Buddy Reborn - Create an autogather list with your desired map
3. Autoretainer
]]
--#region Settings
--[[
********************************************************************************
* Settings *
********************************************************************************
]]
yield("/xlenableplugin Gatherbuddy Reborn")
yield("/wait 5")
MapName = GetConfig("MapName") -- must match the map on your GBR list
Multimode = false
Characters =
{
{ characterName="John Doe", worldName="Excalibur" },
{ characterName="Jane Doe", worldName="Excalibur" }
}
Mail = false
RecipientName = "John Doe"
MailboxName = "Moogle Letter Box" -- options: Moogle Letter Box, Regal Letter Box, Delivery Moogle
MailboxTeleportCommand = "/li auto" -- if you don't have a private home or fc, then "/tp radz" + Delivery Moogle will work
--#endregion Settings
--[[
********************************************************************************
* Code: Don't touch this unless you know what you're doing *
********************************************************************************
]]
TimewornMapIds = {
-- ARR Maps
{itemId=6688, itemName="Timeworn Leather Map"},
{itemId=6689, itemName="Timeworn Goatskin Map"},
{itemId=6690, itemName="Timeworn Toadskin Map"},
{itemId=6691, itemName="Timeworn Boarskin Map"},
{itemId=6692, itemName="Timeworn Peisteskin Map"},
-- Heavensward Maps
{itemId=12241, itemName="Timeworn Archaeoskin Map"},
{itemId=12242, itemName="Timeworn Wyvernskin Map"},
{itemId=12243, itemName="Timeworn Dragonskin Map"},
-- Stormblood Maps
{itemId=17835, itemName="Timeworn Gaganaskin Map"},
{itemId=17836, itemName="Timeworn Gazelleskin Map"},
-- Shadowbringers Maps
{itemId=26744, itemName="Timeworn Gliderskin Map"},
{itemId=26745, itemName="Timeworn Zonureskin Map"},
-- Endwalker Maps
{itemId=36611, itemName="Timeworn Saigaskin Map"},
{itemId=36612, itemName="Timeworn Kumbhiraskin Map"},
{itemId=39591, itemName="Timeworn Ophiotauroskin Map"},
-- Dawntrail Maps
{itemId=43556, itemName="Timeworn Loboskin Map"},
{itemId=43557, itemName="Timeworn Br'aaxskin Map"}
{itemId=46185, itemName="Timeworn Gargantuaskin Map"}
}
function GetMapInfo()
for _, mapInfo in ipairs(TimewornMapIds) do
if mapInfo.itemName == MapName then
return mapInfo
end
end
end
function HasMapAllowance()
if not Addons.GetAddon("ContentsInfo").Ready then
yield("/timers")
yield ("/wait 1")
end
for i = 41000, 41015 do
local timerName = Addons.GetAddon("ContentsInfo"):GetNode(1, 4, i, 6, 7).Text
if timerName == nil then
else
if timerName == "Next Map Allowance" then
yield("/echo Map Allowance is available!")
return Addons.GetAddon("ContentsInfo"):GetNode(1, 4, i, 6, 8).Text == "Available Now"
end
end
end
yield("/echo No record found...")
return false
end
function Gather()
yield("/echo gathering")
if IPC.Lifestream.IsBusy() then
return
end
if Inventory.GetItemCount(MapInfo.itemId) > 0 then
yield("/echo Acquired map.")
State = CharacterState.ready
return
end
yield("/echo gathering")
if not GBRAutoOn then
yield("/gbr auto on")
GBRAutoOn = true
end
yield("/wait 10")
end
--[[
function MailMap()
if IPC.Lifestream.IsBusy() then
return
end
yield("/echo mailing")
if Inventory.GetItemCount(MapInfo.itemId) == 0 then
if Addons.GetAddon("LetterList").Ready then
yield("/callback LetterList true -1")
end
State = CharacterState.ready
return
end
if Addons.GetAddon("SelectYesno").Ready then
yield("/callback SelectYesno true 0")
return
end
if Addons.GetAddon("LetterEditor").Ready then
if MapAttached then
--local dateString = os.date("%B %d, %Y", os.time(os.date("*t")))
yield('/callback LetterEditor true 0 0 "'..RecipientName..'" "sending you a map" 0 0')
return
end
-- search through every inventory slot until you find the map
for inventoryPage=0,4 do
for inventorySlot=0,34 do
if (GetItemIdInSlot(inventoryPage, inventorySlot) == MapInfo.itemId) then
yield("/callback LetterEditor true 3 0 "..inventoryPage.." "..inventorySlot.." 0 0")
MapAttached = true
return
end
end
end
yield("/echo Could not find "..MapInfo.itemName.." in inventory.")
State = CharacterState.ready
return
end
if IsAddonVisible("LetterList") then
yield("/callback LetterList true 1 0 0 0") -- click "New"
return
end
yield("/target "..MailboxName)
if HasTarget() and GetTargetName() == MailboxName then
if GetDistanceToTarget() > 5 then
PathfindAndMoveTo(GetTargetRawXPos(), GetTargetRawYPos(), GetTargetRawZPos(), false)
repeat
yield("/wait 1")
until GetDistanceToTarget() <= 5
yield("/vnav stop")
end
yield("/interact")
return
else
yield(MailboxTeleportCommand)
return
end
end
--]]
function SwapCharacters()
yield("/echo swapping")
if GBRAutoOn then
yield("/gbr auto off")
GBRAutoOn = false
end
yield("/echo swapping characters")
yield("/ays multi d")
yield("/ays disable")
for i=1, #Characters do
if Characters[i].visited == nil then
Characters[i].visited = true
local nextCharacterName = Characters[i].characterName.."@"..Characters[i].worldName
yield("/echo "..nextCharacterName)
if Entity.Player.Name ~= nextCharacterName then
yield("/ays relog "..nextCharacterName)
-- yield("/wait 3")
repeat
yield("/wait 1")
until Entity.Player.Name == nextCharacterName
-- yield("/waitaddon _ActionBar <maxwait.600><wait.5>")
yield("/waitaddon _ActionBar")
State = CharacterState.ready
end
return
end
end
Multimode = false
end
function Ready()
yield("/echo ready")
if Addons.GetAddon("Gathering").Ready then
yield("/callback Gathering true -1")
return
end
if Player.IsBusy then -- wait for player to be available
return
end
if Inventory.GetItemCount(MapInfo.itemId) > 0 then
yield("/echo You already have a map in Inventory...")
--[[if Mail and RecipientName ~= GetCharacterName(false) then
MapAttached = false
State = CharacterState.mailing
end
--]]
elseif not HasMapAllowance() then
yield("Do I get here?")
if Multimode then
State = CharacterState.swapping
end
else
yield("/echo Let's go gathering!")
State = CharacterState.gathering
end
end
CharacterState =
{
ready = Ready,
gathering = Gather,
--mailing = MailMap,
swapping = SwapCharacters
}
yield("/at y")
GBRAutoOn = false
MapInfo = GetMapInfo()
State = CharacterState.ready
if MapInfo == nil then
yield("/echo Cannot find item # for "..MapName)
else
repeat
State()
yield("/wait 1")
until not Multimode and (not HasMapAllowance() or (Inventory.GetItemCount(MapInfo.itemId) > 0 and not Mail))
yield("/xldisableplugin Gatherbuddy Reborn")
end