-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpathlog.lua
More file actions
734 lines (602 loc) · 25.8 KB
/
pathlog.lua
File metadata and controls
734 lines (602 loc) · 25.8 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
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
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
_addon.name = 'pathlog'
_addon.author = 'Duke'
_addon.version = '2.1'
_addon.commands = {'pathlog', 'pl'}
resources = require('resources')
config = require('config')
packets = require('packets')
files = require('files')
require('strings')
require('tables')
defaults = {}
defaults.messageColor = 219
defaults.logPath = false
defaults.mode = 'target'
defaults.filter = 'rot'
defaults.TimestampFormat = '-- %H:%M:%S'
defaults.logRot = false
defaults.AddTimestamp = true
defaults.pauseLegs = true
defaults.tableEachPoint = false
defaults.defineCoordinates = false
defaults.all = false
defaults.cumulativeDiff = 5
defaults.xDiff = 3
defaults.yDiff = 0.5
defaults.zDiff = 3
defaults.rotDiff = 0
defaults.timeDiff = 4
settings = config.load(defaults)
local pathlog = {}
local commands = {}
pathlog.trackList = T{}
pathlog.ghostLog = T{}
pathlog.logFiles = T{}
local logType =
{
fromPacket = 1,
firstPoint = 2,
lastPoint = 3,
closeBracket = 4,
}
-- Windower Events --
--------------------------------------------
-- Update variables on load, login, and logout.
windower.register_event('load', 'login', 'logout', function()
pathlog.logged_in = windower.ffxi.get_info().logged_in
pathlog.zone = pathlog.logged_in and resources.zones[windower.ffxi.get_info().zone].name
pathlog.player = pathlog.logged_in and windower.ffxi.get_player()
end)
-- Parse incoming packets for mob/npc position data.
windower.register_event('incoming chunk', function(id, data, modified, injected, blocked)
if not settings.logPath or not id == 0x0E or not pathlog.logged_in then return end
local packet = packets.parse('incoming', data)
local npc = {}
npc.index = packet['Index']
npc.id = packet['NPC']
npc.look = packet['look']
npc.polutils = packet['polutils_name']
if pathlog.willScan(npc.look, npc.polutils) and npc.id then
walkCount = packet['Walk Count'] -- not currently in use
npc.x = packet['X']
npc.y = packet['Z'] -- Windower has Z and Y axis swapped
npc.z = packet['Y']
npc.rot = packet['Rotation']
npc.time = os.time()
if settings.mode == 'target' then
local target = windower.ffxi.get_mob_by_target('t')
if target and target.id == npc.id and pathlog.shouldLogPoint(npc.id, npc.x, npc.y, npc.z, npc.rot, npc.time) then
pathlog.logToFile(logType.fromPacket, npc.id, npc.x, npc.y, npc.z, npc.rot, npc.time)
end
elseif settings.mode == 'list' and #pathlog.trackList > 0 and pathlog.trackList:contains(npc.id) then
local target = windower.ffxi.get_mob_by_id(npc.id)
if target and pathlog.shouldLogPoint(npc.id, npc.x, npc.y, npc.z, npc.rot, npc.time) then
pathlog.logToFile(logType.fromPacket, npc.id, npc.x, npc.y, npc.z, npc.rot, npc.time)
end
end
end
end)
-- Parse outgoing packets for player position data.
windower.register_event('outgoing chunk', function(id, data, modified, injected, blocked)
if settings.logPath and settings.mode == 'target' and id == 0x015 and pathlog.targetIndex == pathlog.player.index and pathlog.logged_in then
local packet = packets.parse('outgoing', data)
local char = {}
char.x = packet['X']
char.y = packet['Z'] -- Windower has Z and Y axis swapped
char.z = packet['Y']
char.rot = packet['Rotation']
char.time = os.time()
if pathlog.shouldLogPoint(pathlog.player.id, char.x, char.y, char.z, char.rot, char.time) then
pathlog.logToFile(logType.fromPacket, pathlog.player.id, char.x, char.y, char.z, char.rot, char.time)
end
end
end)
-- Update target index variable; In target mode, append last received point and close bracket leg, open new leg.
windower.register_event('target change', function(index)
if pathlog.logged_in then
pathlog.targetIndex = index
end
if settings.logPath and settings.mode == 'target' and #pathlog.ghostLog > 0 and pathlog.logged_in then
local ghostLog = pathlog.ghostLog
for entry = #ghostLog, 1, -1 do
local id = tonumber(ghostLog[entry][1])
pathlog.closeLeg(id)
break
end
end
end)
-- Update zone variable; Clear track list and ghost log.
windower.register_event('zone change', function(new)
pathlog.zone = resources.zones[new].name
pathlog.trackList:clear()
pathlog.ghostLog:clear()
end)
-- Handle commands.
windower.register_event('addon command', function(command, ...)
command = command and command:lower()
if commands[command] then
commands[command](L{...})
else
commands.help()
end
end)
-- Logging functions --
--------------------------------------------
-- Log to file by type.
function pathlog.logToFile(type, id, x, y, z, rot, time)
local logFile = pathlog.getFilePath(id)
if not logFile then return end
if type == logType.closeBracket then
logFile:append(string.format('},\n'))
return
end
local timestamp = settings.AddTimestamp and os.date(settings.TimestampFormat, time) or ''
local openBracket, closeBracket, defineX, defineY, defineZ, defineRot = pathlog.formatLogOutput()
local fx, fy, fz, frot = pathlog.formatCoords(x, y, z, rot)
local logRot = settings.logRot and frot or ''
if type == logType.fromPacket then
logFile:append(string.format(' %s%s%s, %s%s, %s%s,%s%s%s %s\n', openBracket, defineX, fx, defineY, fy, defineZ, fz, defineRot, logRot, closeBracket, timestamp))
elseif type == logType.firstPoint then
logFile:append(string.format('{\n %s%s%s, %s%s, %s%s,%s%s%s %s\n', openBracket, defineX, fx, defineY, fy, defineZ, fz, defineRot, logRot, closeBracket, timestamp))
elseif type == logType.lastPoint then
logFile:append(string.format(' %s%s%s, %s%s, %s%s,%s%s%s %s\n},\n', openBracket, defineX, fx, defineY, fy, defineZ, fz, defineRot, logRot, closeBracket, timestamp))
end
end
-- Checks if incoming point should be logged and returns true or false.
-- Handles the ghost log, comparing the last logged point, last received point, and the incoming point.
-- Handles the first point of a leg, last point of a leg, and close bracket of a leg.
function pathlog.shouldLogPoint(id, x, y, z, rot, time)
local lastLoggedX, lastLoggedY, lastLoggedZ, lastLoggedRot, lastLoggedTime = pathlog.getLastLoggedPosByID(id)
local lastX, lastY, lastZ, lastRot, lastTime = pathlog.getLastPosByID(id)
local logFile = pathlog.getFilePath(id)
if x == 0 and y == 0 and z == 0 then
return false
end
if not (lastLoggedX and lastLoggedY and lastLoggedZ and lastLoggedRot) then
pathlog.ghostLog:append(string.format(id..','..x..','..y..','..z..','..rot..','..time):split(','))
pathlog.ghostLog:append(string.format(id..','..x..','..y..','..z..','..rot..','..time):split(','))
pathlog.logToFile(logType.firstPoint, id, x, y, z, rot, time)
return false
end
local xDiff = tonumber(string.format('%.3f', math.abs(lastLoggedX - x)))
local yDiff = tonumber(string.format('%.3f', math.abs(lastLoggedY - y)))
local zDiff = tonumber(string.format('%.3f', math.abs(lastLoggedZ - z)))
local cumulativeDiff = xDiff + yDiff + zDiff
local rotDiff = math.abs(lastLoggedRot - rot)
local timeDiff = math.abs(lastTime - time)
if timeDiff >= settings.timeDiff and settings.pauseLegs and settings.mode == 'list' and #pathlog.ghostLog > 0 then
pathlog.closeLeg(id)
pathlog.logToFile(logType.firstPoint, id, x, y, z, rot, time)
for entry = #pathlog.ghostLog, 1, -1 do
if id == tonumber(pathlog.ghostLog[entry][1]) then
pathlog.ghostLog:delete(pathlog.ghostLog[entry])
end
end
pathlog.ghostLog:append(string.format(id..','..x..','..y..','..z..','..rot..','..time):split(','))
pathlog.ghostLog:append(string.format(id..','..x..','..y..','..z..','..rot..','..time):split(','))
return false
end
if settings.all then
return true
end
if settings.filter == 'rot' and #pathlog.ghostLog > 0 and (yDiff >= settings.yDiff or rotDiff > settings.rotDiff) then
for entry = #pathlog.ghostLog, 1, -1 do
if id == tonumber(pathlog.ghostLog[entry][1]) then
pathlog.ghostLog:delete(pathlog.ghostLog[entry])
end
end
pathlog.ghostLog:append(string.format(id..','..x..','..y..','..z..','..rot..','..time):split(','))
pathlog.ghostLog:append(string.format(id..','..x..','..y..','..z..','..rot..','..time):split(','))
return true
elseif settings.filter == 'xyz' and #pathlog.ghostLog > 0 and (cumulativeDiff >= settings.cumulativeDiff or xDiff >= settings.xDiff or yDiff >= settings.yDiff or zDiff >= settings.zDiff) then
for entry = #pathlog.ghostLog, 1, -1 do
if id == tonumber(pathlog.ghostLog[entry][1]) then
pathlog.ghostLog:delete(pathlog.ghostLog[entry])
end
end
pathlog.ghostLog:append(string.format(id..','..x..','..y..','..z..','..rot..','..time):split(','))
pathlog.ghostLog:append(string.format(id..','..x..','..y..','..z..','..rot..','..time):split(','))
return true
end
if #pathlog.ghostLog > 0 then
for entry = #pathlog.ghostLog, 1, -1 do
if id == tonumber(pathlog.ghostLog[entry][1]) then
pathlog.ghostLog:delete(pathlog.ghostLog[entry])
break
end
end
pathlog.ghostLog:append(string.format(id..','..x..','..y..','..z..','..rot..','..time):split(','))
return false
end
end
-- Handle command to log a single point to player file, append comment to end.
function pathlog.logPointWithComment(comment)
local target = windower.ffxi.get_mob_by_target('me')
if target then
local logFile = pathlog.getFilePath(target.id)
local timestamp = settings.AddTimestamp and os.date(settings.TimestampFormat, os.time()) or ''
local openBracket, closeBracket, defineX, defineY, defineZ, defineRot = pathlog.formatLogOutput()
local rot = pathlog.headingToByteRotation(target.heading)
local fx, fy, fz, frot = pathlog.formatCoords(target.x, target.y, target.z, rot)
local logRot = settings.logRot and frot or ''
if not comment then
comment = ''
else
comment = table.sconcat(comment)
end
logFile:append(string.format('%s%s%s, %s%s, %s%s,%s%s%s %s -- %s\n', openBracket, defineX, fx, defineY, fy, defineZ, fz, defineRot, logRot, closeBracket, timestamp, comment))
end
end
-- Compare last logged point to last received point, if they are very similar, close the leg with a close bracket, otherwise log the last point and close leg. Remove entries from ghostLog.
function pathlog.closeLeg(id)
local lastLoggedX, lastLoggedY, lastLoggedZ, lastLoggedRot, lastLoggedTime = pathlog.getLastLoggedPosByID(id)
local lastX, lastY, lastZ, lastRot, lastTime = pathlog.getLastPosByID(id)
local ghostLog = pathlog.ghostLog
if #ghostLog <= 0 or not (lastLoggedX and lastLoggedY and lastLoggedZ and lastLoggedRot and lastLoggedTime) or not (lastX and lastY and lastZ and lastRot and lastTime) then
return
end
local loggedLastDiffX = math.abs(lastLoggedX - lastX)
local loggedLastDiffY = math.abs(lastLoggedY - lastY)
local loggedLastDiffZ = math.abs(lastLoggedZ - lastZ)
local loggedLastDiffRot = math.abs(lastLoggedRot - lastRot)
if (loggedLastDiffX and loggedLastDiffY and loggedLastDiffZ and loggedLastDiffRot) < 1 then
pathlog.logToFile(logType.closeBracket, id)
else
pathlog.logToFile(logType.lastPoint, id, lastX, lastY, lastZ, lastRot, lastTime)
end
for entry = #ghostLog, 1, -1 do
if id == tonumber(ghostLog[entry][1]) then
ghostLog:delete(ghostLog[entry])
end
end
end
-- Helper functions --
--------------------------------------------
-- Pad coordinates to align in logs.
pathlog.padCoords = function(coord, isY, isRot)
local padding = 8
if isY then
padding = padding - 1
end
if isRot then
padding = padding - 3
end
return string.rep(' ', padding - #coord) .. coord
end
-- Format coordinates to string with padding.
function pathlog.formatCoords(x, y, z, rot)
local fx = pathlog.padCoords(string.format('%.3f', x))
local fy = pathlog.padCoords(string.format('%.3f', y), true)
local fz = pathlog.padCoords(string.format('%.3f', z))
local frot = pathlog.padCoords(string.format('%i,', rot), false, true)
return fx, fy, fz, frot
end
-- Format log output based on settings.
function pathlog.formatLogOutput()
local openBracket = settings.tableEachPoint and '{ ' or ''
local closeBracket = settings.tableEachPoint and ' },' or ''
local defineX = settings.defineCoordinates and 'x = ' or ''
local defineY = settings.defineCoordinates and 'y = ' or ''
local defineZ = settings.defineCoordinates and 'z = ' or ''
local defineRot = settings.defineCoordinates and settings.logRot and ' rot =' or ''
return openBracket, closeBracket, defineX, defineY, defineZ, defineRot
end
-- Get file path by id.
function pathlog.getFilePath(id)
local playerName = pathlog.player.name
local zone = pathlog.zone
local logFiles = pathlog.logFiles
if not logFiles[id] then
if id == pathlog.player.id then
logFiles[id] = files.new('data/pathlogs/'..playerName..'/'..zone..'/'..playerName..'.log')
else
local target = windower.ffxi.get_mob_by_id(id)
if target then
logFiles[id] = files.new('data/pathlogs/'..playerName..'/'..zone..'/'..target.name..'/'..id..'.log')
end
end
end
if logFiles[id] and not logFiles[id]:exists() then
logFiles[id]:create()
end
return logFiles[id]
end
-- Returns the last logged position in ghost logs by id.
function pathlog.getLastLoggedPosByID(id)
local ghostLog = pathlog.ghostLog
if #ghostLog <= 0 then return end
for entry = 1, #ghostLog do
if ghostLog[entry][1] == tostring(id) then
return tonumber(ghostLog[entry][2]), tonumber(ghostLog[entry][3]), tonumber(ghostLog[entry][4]), tonumber(ghostLog[entry][5]), tonumber(ghostLog[entry][6])
end
end
end
-- Returns the last received position in ghost logs by id.
function pathlog.getLastPosByID(id)
local ghostLog = pathlog.ghostLog
if #ghostLog <= 0 then return end
for entry = #ghostLog, 1, -1 do
if ghostLog[entry][1] == tostring(id) then
return tonumber(ghostLog[entry][2]), tonumber(ghostLog[entry][3]), tonumber(ghostLog[entry][4]), tonumber(ghostLog[entry][5]), tonumber(ghostLog[entry][6])
end
end
end
-- Convert heading to byte rotation. Thank you Zach (Captain)
function pathlog.headingToByteRotation(oldHeading)
local newHeading = oldHeading
if newHeading < 0 then
newHeading = (math.pi * 2) - (newHeading * -1)
end
return math.round((newHeading / (math.pi * 2)) * 256)
end
-- Returns true if an entity will scan. Thank you Wiggo (npcl)
function pathlog.willScan(look, polutils)
if look == '00003400' or polutils == 'NPC' then
return false
end
return true
end
commands.start = function()
local target = windower.ffxi.get_mob_by_target('t')
if target then
pathlog.targetIndex = target.index
end
settings.logPath = true
windower.add_to_chat(settings.messageColor, 'Path logging ON')
end
commands.st = function()
return commands.start()
end
commands.stop = function()
local ghostLog = pathlog.ghostLog
local trackList = pathlog.trackList
if settings.mode == 'list' then
for entry = 1, #trackList do
local id = tonumber(trackList[entry])
pathlog.closeLeg(id)
end
elseif settings.mode == 'target' and #ghostLog > 0 then
for entry = #ghostLog, 1, -1 do
local id = tonumber(ghostLog[entry][1])
pathlog.closeLeg(id)
break
end
end
settings.logPath = false
windower.add_to_chat(settings.messageColor, 'Path logging OFF')
end
commands.sp = function()
return commands.stop()
end
commands.mode = function(args)
local newMode = args:remove(1)
if newMode == 't' then
newMode = 'target'
elseif newMode == 'l' then
newMode = 'list'
end
if newMode == 'target' or newMode == 'list' then
settings.mode = newMode
windower.add_to_chat(settings.messageColor, 'Pathlog mode: '..settings.mode)
else
commands.help()
end
settings:save()
end
commands.m = function(args)
return commands.mode(args)
end
commands.filter = function(args)
local newFilter = args:remove(1)
if newFilter == 'r' then
newFilter = 'rot'
end
if newFilter == 'xyz' or newFilter == 'rot' then
settings.filter = newFilter
windower.add_to_chat(settings.messageColor, 'Pathlog filter: '..settings.filter)
else
commands.help()
end
settings:save()
end
commands.f = function(args)
return commands.filter(args)
end
commands.list = function(args)
local option = args:remove(1)
local id = tonumber(args:concat(' '))
local target = windower.ffxi.get_mob_by_target('t')
local player = windower.ffxi.get_mob_by_target('me')
if option == 'show' or option == 's' then
local trackList = pathlog.trackList
if #trackList > 0 then
windower.add_to_chat(settings.messageColor, 'Pathlog Tracklist:')
for entry = 1, #trackList do
windower.add_to_chat(settings.messageColor, ''..trackList[entry])
end
else
windower.add_to_chat(settings.messageColor, 'Pathlog Tracklist is Empty')
end
return
end
if id then -- Look for explicitly desired ID first
if type(id) ~= 'number' or id == player.id then -- Make sure its a not players id number
commands.help()
return
end
elseif not id then -- Look for cursor target next
if target then
if target.name == player.name or target.index == player.index then
windower.add_to_chat(settings.messageColor, 'Cannot target player in list mode. Switch to target mode to log player path')
else
id = target.id
end
end
else
commands.help()
return
end
if option == 'add' or option == 'a' then
if id and not pathlog.trackList:contains(id) then
pathlog.trackList:append(id)
windower.add_to_chat(settings.messageColor, 'Added '..id.. ' to tracking list. ')
else
windower.add_to_chat(settings.messageColor, 'Must provivde an ID or target an entity to add to tracking list.')
end
elseif option == 'remove' or option == 'r' then
if id and pathlog.trackList:contains(id) then
if settings.logPath then -- if removing an id while logging, log the last point and remove entries from ghost log
pathlog.closeLeg(id)
end
pathlog.trackList:delete(id)
windower.add_to_chat(settings.messageColor, 'Removed '..id.. ' from tracking list. ')
else
windower.add_to_chat(settings.messageColor, 'Must provivde an ID or target an entity to remove from tracking list.')
end
elseif option == 'clear' or option == 'c' then
if not pathlog.trackList:empty() then
pathlog.trackList:clear()
windower.add_to_chat(settings.messageColor, 'Cleared tracking list! ')
else
windower.add_to_chat(settings.messageColor, 'Trackling list is empty.')
end
else
commands.help()
return
end
end
commands.l = function(args)
return commands.list(args)
end
commands.all = function()
if settings.all == true then
settings.all = false
windower.add_to_chat(settings.messageColor, 'Log all = FALSE')
elseif settings.all == false then
settings.all = true
windower.add_to_chat(settings.messageColor, 'Log all = TRUE')
end
settings:save()
end
commands.a = function()
return commands.all()
end
commands.diff = function(args)
local option = args:remove(1)
local value = tonumber(args:concat(' '))
if option == 'cumulative' or option == 'c' then
settings.cumulativeDiff = value
windower.add_to_chat(settings.messageColor, 'Cumulative Diff = '..settings.cumulativeDiff)
elseif option == 'x' then
settings.xDiff = value
windower.add_to_chat(settings.messageColor, 'x Diff = '..settings.xDiff)
elseif option == 'y' then
settings.yDiff = value
windower.add_to_chat(settings.messageColor, 'y Diff = '..settings.yDiff)
elseif option == 'z' then
settings.zDiff = value
windower.add_to_chat(settings.messageColor, 'z Diff = '..settings.zDiff)
elseif option == 'rot' then
settings.rotDiff = value
windower.add_to_chat(settings.messageColor, 'rot Diff = '..settings.rotDiff)
elseif option == 'time' or option == 't' then
settings.timeDiff = value
windower.add_to_chat(settings.messageColor, 'time Diff = '..settings.timeDiff)
else
windower.add_to_chat(settings.messageColor, 'Valid arguments are cumulative(c), x, y, z, or rot followed by a number')
return
end
settings:save()
end
commands.d = function(args)
return commands.diff(args)
end
commands.timestamp = function()
if settings.AddTimestamp == true then
settings.AddTimestamp = false
windower.add_to_chat(settings.messageColor, 'Add timestamp to logs = FALSE')
elseif settings.AddTimestamp == false then
settings.AddTimestamp = true
windower.add_to_chat(settings.messageColor, 'Add timestamp to logs = TRUE')
end
settings:save()
end
commands.ts = function()
return commands.timestamp()
end
commands.rot = function()
if settings.logRot == true then
settings.logRot = false
windower.add_to_chat(settings.messageColor, 'Add rot to logs = FALSE')
elseif settings.logRot == false then
settings.logRot = true
windower.add_to_chat(settings.messageColor, 'Add rot to logs = TRUE')
end
settings:save()
end
commands.r = function()
return commands.rot()
end
commands.tablepoints = function()
if settings.tableEachPoint == true then
settings.tableEachPoint = false
windower.add_to_chat(settings.messageColor, 'Table each point = FALSE')
elseif settings.tableEachPoint == false then
settings.tableEachPoint = true
windower.add_to_chat(settings.messageColor, 'Table each point = TRUE')
end
settings:save()
end
commands.tp = function()
return commands.tablepoints()
end
commands.definecoordinates = function()
if settings.defineCoordinates == true then
settings.defineCoordinates = false
windower.add_to_chat(settings.messageColor, 'Define coordinates = FALSE')
elseif settings.defineCoordinates == false then
settings.defineCoordinates = true
windower.add_to_chat(settings.messageColor, 'Define coordinates = TRUE')
end
settings:save()
end
commands.dc = function()
return commands.definecoordinates()
end
commands.pauselegs = function()
if settings.pauseLegs == true then
settings.pauseLegs = false
windower.add_to_chat(settings.messageColor, 'In list mode, divide pauses into path legs = FALSE')
elseif settings.pauseLegs == false then
settings.pauseLegs = true
windower.add_to_chat(settings.messageColor, 'In list mode, divide pauses into path legs = TRUE')
end
settings:save()
end
commands.pl = function()
return commands.pauselegs()
end
commands.point = function(args)
pathlog.logPointWithComment(args)
windower.add_to_chat(settings.messageColor, 'Point added to logs')
end
commands.p = function(args)
return commands.point(args)
end
commands.help = function()
windower.add_to_chat(settings.messageColor, 'pathlog (or //pl)')
windower.add_to_chat(settings.messageColor, '//pathlog start(st) - Begin logging targeted entity\'s path')
windower.add_to_chat(settings.messageColor, '//pathlog stop(sp) - Stop logging targeted entity\'s path')
windower.add_to_chat(settings.messageColor, '//pathlog mode(m) target(t)|list(l) - change tracking mode between cursor target and a set list (default target)')
windower.add_to_chat(settings.messageColor, '//pathlog filter(f) xyz|rot(r) - change filter between xyz diff and rot diff. Will always use 0.5 y diff (default rot)')
windower.add_to_chat(settings.messageColor, '//pathlog list(l) add(a)|remove(r)|show(s) ID - In list mode, add/remove ID|target to/from tracking list.')
windower.add_to_chat(settings.messageColor, '//pathlog all(a) - log all positions without difference filtering (default FALSE)')
windower.add_to_chat(settings.messageColor, '//pathlog diff(d) cumulative(c)|x|y|z|rot|time(t) (value) - set diffs required between points to log or split')
windower.add_to_chat(settings.messageColor, 'diff defaults: cumulative 4, x = 3, y = 0.5, z = 3, rot = 0, time = 4')
windower.add_to_chat(settings.messageColor, '//pathlog timestamp(ts) - toggle timestamp in log (default TRUE)')
windower.add_to_chat(settings.messageColor, '//pathlog rot(r) - toggle rot in log (default FALSE)')
windower.add_to_chat(settings.messageColor, '//pathlog tablepoints(tp) - toggle table each path point (default FALSE)')
windower.add_to_chat(settings.messageColor, '//pathlog definecoordinates(dc) - toggle define coordinates (x = #) (default FALSE)')
windower.add_to_chat(settings.messageColor, '//pathlog pauselegs(pl) - In list mode, auto divide mob/npc pauses into separate path legs (default TRUE)')
windower.add_to_chat(settings.messageColor, '//pathlog point(p) \'...\' - will add a point and anything typed after to a comment in the logs')
end