-
Notifications
You must be signed in to change notification settings - Fork 449
Expand file tree
/
Copy pathfields.lua
More file actions
4085 lines (3637 loc) · 231 KB
/
fields.lua
File metadata and controls
4085 lines (3637 loc) · 231 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
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--[[
A collection of detailed packet field information.
]]
require('pack')
require('functions')
require('strings')
require('maths')
require('lists')
require('sets')
local bit = require('bit')
local fields = {}
fields.outgoing = {}
fields.incoming = {}
local func = {
incoming = {},
outgoing = {},
}
-- String decoding definitions
local ls_enc = {
charset = T('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ':split()):update({
[0] = '`',
[60] = 0:char(),
[63] = 0:char(),
}),
bits = 6,
terminator = function(str)
return (#str % 4 == 2 and 60 or 63):binary()
end
}
local sign_enc = {
charset = T('0123456798ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz{':split()):update({
[0] = 0:char(),
}),
bits = 6,
}
-- Function definitions. Used to display packet field information.
local res = require('resources')
local function s(val, from, to)
from = from - 1
to = to
return bit.band(bit.rshift(val, from), 2^(to - from) - 1)
end
local function id(val)
local mob = windower.ffxi.get_mob_by_id(val)
return mob and mob.name or '-'
end
local function index(val)
local mob = windower.ffxi.get_mob_by_index(val)
return mob and mob.name or '-'
end
local function ip(val)
return '%d.%d.%d.%d':format('I':pack(val):unpack('CCCC'))
end
local function gil(val)
return tostring(val):reverse():chunks(3):concat(','):reverse() .. ' G'
end
local function bool(val)
return val ~= 0
end
local function invbool(val)
return val == 0
end
local function div(denom, val)
return val/denom
end
local function add(amount, val)
return val + amount
end
local function sub(amount, val)
return val - amount
end
local time
local utime
do
local now = os.time()
local h, m = (os.difftime(now, os.time(os.date('!*t', now))) / 3600):modf()
local timezone = '%+.2d:%.2d':format(h, 60 * m)
local fn = function(ts)
return os.date('%Y-%m-%dT%H:%M:%S' .. timezone, ts)
end
time = function(ts)
return fn(os.time() - ts)
end
utime = function(ts)
return fn(ts)
end
bufftime = function(ts)
return fn(1009810800 + (ts / 60) + 0x100000000 / 60 * 10) -- increment last number every 2.27 years
end
end
local time_ms = time .. function(val) return val/1000 end
local dir = function()
local dir_sets = L{'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW', 'N', 'NNE', 'NE', 'ENE', 'E'}
return function(val)
return dir_sets[((val + 8)/16):floor() + 1]
end
end()
local function cap(max, val)
return '%.1f':format(100*val/max)..'%'
end
local function zone(val)
return res.zones[val] and res.zones[val].name or '- (Unknown zone ID: %d)':format(val)
end
local function item(val)
return val ~= 0 and res.items[val] and res.items[val].name or '-'
end
local function server(val)
return res.servers[val].name
end
local function weather(val)
return res.weather[val].name
end
local function buff(val)
return val ~= 0xFF and res.buffs[val].name or '-'
end
local function chat(val)
return res.chat[val].name
end
local function skill(val)
return res.skills[val].name
end
local function title(val)
return res.titles[val].name
end
local function job(val)
return res.jobs[val].name
end
local function emote(val)
return '/' .. res.emotes[val].command
end
local function bag(val)
return res.bags[val] and res.bags[val].name or 'Unknown'
end
local function race(val)
return res.races[val].name
end
local function slot(val)
return res.slots[val].name
end
local function statuses(val)
return res.statuses[val] and res.statuses[val].name or 'Unknown'
end
local function srank(val)
return res.synth_ranks[val].name
end
local function arecast(val)
return res.ability_recasts[val].name
end
local function inv(bag, val)
if val == 0 or not res.bags[bag] then
return '-'
end
return item(windower.ffxi.get_items(bag, val).id)
end
local function invp(index, val, data)
return inv(data[index + 1]:byte(), val)
end
local function hex(fill, val)
return val:hex():zfill(2*fill):chunks(2):reverse():concat(' ')
end
local function bin(fill, val)
return type(val) == 'string' and val:binary(' ') or val:binary():zfill(8*fill):chunks(8):reverse():concat(' ')
end
--[[
Custom types
]]
local types = {}
local enums = {
['synth'] = {
[0] = 'Success',
[1] = 'Fail',
[2] = 'Fail, interrupted',
[3] = 'Cancel, invalid recipe',
[4] = 'Cancel',
[5] = 'Fail, crystal lost',
[6] = 'Cancel, skill too low',
[7] = 'Cancel, rare',
},
['logout'] = {
[1] = '/loguot',
[2] = '/pol',
[3] = '/shutdown',
},
['zone'] = {
[1] = 'Logout',
[2] = 'Teleport',
[3] = 'Zone line',
},
[0x038] = {
deru = 'Appear',
kesu = 'Disappear',
},
['itemstat'] = {
[0x00] = 'None',
[0x05] = 'Equipped',
[0x0F] = 'Synthing',
[0x13] = 'Active linkshell',
[0x19] = 'Bazaaring',
},
['ws track'] = {
[1] = 'Update',
[2] = 'Reset (zone)',
[3] = 'Reset (new scan)',
},
['ws mob'] = {
[0] = 'Other',
[1] = 'Friendly',
[2] = 'Enemy',
},
['ws mark'] = {
[1] = 'Start',
[2] = 'End',
},
['bazaar'] = {
[0] = 'Open',
[1] = 'Close',
},
['try'] = {
[0] = 'Succeeded',
[1] = 'Failed',
},
}
local e = function(t, val)
return enums[t][val] or 'Unknown value for \'%s\': %s':format(t, tostring(val))
end
--[[
Outgoing packets
]]
-- Zone In 1
-- Likely triggers specific incoming packets.
-- Does not trigger any packets when randomly injected.
fields.outgoing[0x00C] = L{
{ctype='int', label='_unknown1'}, -- 04 Always 00s?
{ctype='int', label='_unknown2'}, -- 04 Always 00s?
}
-- Client Leave
-- Last packet sent when zoning. Disconnects from the zone server.
fields.outgoing[0x00D] = L{
{ctype='unsigned char', label='_unknown1'}, -- 04 Always 00?
{ctype='unsigned char', label='_unknown2'}, -- 05 Always 00?
{ctype='unsigned char', label='_unknown3'}, -- 06 Always 00?
{ctype='unsigned char', label='_unknown4'}, -- 07 Always 00?
}
-- Zone In 2
-- Likely triggers specific incoming packets.
-- Does not trigger any packets when randomly injected.
fields.outgoing[0x00F] = L{
{ctype='data[32]', label='_unknown1'}, -- 04 Always 00s?
}
-- Zone In 3
-- Likely triggers specific incoming packets.
-- Does not trigger any packets when randomly injected.
fields.outgoing[0x011] = L{
{ctype='int', label='_unknown1'}, -- 04 Always 02 00 00 00?
}
-- Standard Client
fields.outgoing[0x015] = L{
{ctype='float', label='X'}, -- 04
{ctype='float', label='Z'}, -- 08
{ctype='float', label='Y'}, -- 0C
{ctype='unsigned short', label='_junk1'}, -- 10
{ctype='unsigned short', label='Run Count'}, -- 12 Counter that indicates how long you've been running?
{ctype='unsigned char', label='Rotation', fn=dir}, -- 14
{ctype='unsigned char', label='_flags1'}, -- 15 Bit 0x04 indicates that maintenance mode is activated
{ctype='unsigned short', label='Target Index', fn=index}, -- 16
{ctype='unsigned int', label='Timestamp', fn=time_ms}, -- 18 Milliseconds
{ctype='unsigned int', label='_unknown3'}, -- 1C
}
-- Update Request
fields.outgoing[0x016] = L{
{ctype='unsigned short', label='Target Index', fn=index}, -- 04
{ctype='unsigned short', label='_junk1'}, -- 06
}
-- NPC Race Error
fields.outgoing[0x017] = L{
{ctype='unsigned short', label='NPC Index', fn=index}, -- 04
{ctype='unsigned short', label='_unknown1'}, -- 06
{ctype='unsigned int', label='NPC ID', fn=id}, -- 08
{ctype='data[6]', label='_unknown2'}, -- 0C
{ctype='unsigned char', label='Reported NPC type'}, -- 12
{ctype='unsigned char', label='_unknown3'}, -- 13
}
enums['action'] = {
[0x00] = 'NPC Interaction',
[0x02] = 'Engage monster',
[0x03] = 'Magic cast',
[0x04] = 'Disengage',
[0x05] = 'Call for Help',
[0x07] = 'Weaponskill usage',
[0x09] = 'Job ability usage',
[0x0C] = 'Assist',
[0x0D] = 'Reraise dialogue',
[0x0E] = 'Cast Fishing Rod',
[0x0F] = 'Switch target',
[0x10] = 'Ranged attack',
[0x11] = 'Chocobo dig',
[0x12] = 'Dismount Chocobo',
[0x13] = 'Tractor Dialogue',
[0x14] = 'Zoning/Appear', -- I think, the resource for this is ambiguous.
[0x19] = 'Monsterskill',
[0x1A] = 'Mount',
}
-- Action
fields.outgoing[0x01A] = L{
{ctype='unsigned int', label='Target', fn=id}, -- 04
{ctype='unsigned short', label='Target Index', fn=index}, -- 08
{ctype='unsigned short', label='Category', fn=e+{'action'}}, -- 0A
{ctype='unsigned short', label='Param'}, -- 0C
{ctype='unsigned short', label='_unknown1', const=0}, -- 0E
{ctype='float', label='X Offset'}, -- 10 -- non-zero values only observed for geo spells cast using a repositioned subtarget
{ctype='float', label='Z Offset'}, -- 14
{ctype='float', label='Y Offset'}, -- 18
}
-- /volunteer
fields.outgoing[0x01E] = L{
{ctype='char*', label='Target Name'}, -- 04 null terminated string. Length of name to the nearest 4 bytes.
}
-- Drop Item
fields.outgoing[0x028] = L{
{ctype='unsigned int', label='Count'}, -- 04
{ctype='unsigned char', label='Bag', fn=bag}, -- 08
{ctype='unsigned char', label='Inventory Index', fn=invp+{0x08}}, -- 09
{ctype='unsigned short', label='_junk1'}, -- 0A
}
-- Move Item
fields.outgoing[0x029] = L{
{ctype='unsigned int', label='Count'}, -- 04
{ctype='unsigned char', label='Bag', fn=bag}, -- 08
{ctype='unsigned char', label='Target Bag', fn=bag}, -- 09
{ctype='unsigned char', label='Current Index', fn=invp+{0x08}}, -- 0A
{ctype='unsigned char', label='Target Index'}, -- 0B This byte is 0x52 when moving items between bags. It takes other values when manually sorting.
}
-- Translate
-- German and French translations appear to no longer be supported.
fields.outgoing[0x02B] = L{
{ctype='unsigned char', label='Starting Language'}, -- 04 0 == JP, 1 == EN
{ctype='unsigned char', label='Ending Language'}, -- 05 0 == JP, 1 == EN
{ctype='unsigned short', label='_unknown1', const=0x0000}, -- 06
{ctype='char[64]', label='Phrase'}, -- 08 Quotation marks are removed. Phrase is truncated at 64 characters.
}
-- Trade request
fields.outgoing[0x032] = L{
{ctype='unsigned int', label='Target', fn=id}, -- 04
{ctype='unsigned short', label='Target Index', fn=index}, -- 08
{ctype='data[2]', label='_junk1'} -- 0A
}
enums[0x033] = {
[0] = 'Accept trade',
[1] = 'Cancel trade',
[2] = 'Confirm trade',
}
-- Trade confirm
-- Sent when accepting, confirming or canceling a trade
fields.outgoing[0x033] = L{
{ctype='unsigned int', label='Type', fn=e+{0x033}}, -- 04
{ctype='unsigned int', label='Trade Count'} -- 08 Necessary to set if you are receiving items, comes from incoming packet 0x023
}
-- Trade offer
fields.outgoing[0x034] = L{
{ctype='unsigned int', label='Count'}, -- 04
{ctype='unsigned short', label='Item', fn=item}, -- 08
{ctype='unsigned char', label='Inventory Index', fn=inv+{0}}, -- 0A
{ctype='unsigned char', label='Slot'}, -- 0F
}
-- Menu Item
fields.outgoing[0x036] = L{
-- Item order is Gil -> top row left-to-right -> bottom row left-to-right, but
-- they slide up and fill empty slots
{ctype='unsigned int', label='Target', fn=id}, -- 04
{ctype='unsigned int[9]', label='Item Count'}, -- 08
{ctype='unsigned int', label='_unknown1'}, -- 2C
{ctype='unsigned char[9]', label='Item Index', fn=inv+{0}}, -- 30 Gil has an Inventory Index of 0
{ctype='unsigned char', label='_unknown2'}, -- 39
{ctype='unsigned short', label='Target Index', fn=index}, -- 3A
{ctype='unsigned char', label='Number of Items'}, -- 3C
}
-- Use Item
fields.outgoing[0x037] = L{
{ctype='unsigned int', label='Player', fn=id}, -- 04
{ctype='unsigned int', label='_unknown1'}, -- 08 00 00 00 00 observed
{ctype='unsigned short', label='Player Index', fn=index}, -- 0C
{ctype='unsigned char', label='Slot', fn=inv+{0}}, -- 0E
{ctype='unsigned char', label='_unknown2'}, -- 0F Takes values
{ctype='unsigned char', label='Bag', fn=bag}, -- 10
{ctype='data[3]', label='_unknown3'} -- 11
}
-- Sort Item
fields.outgoing[0x03A] = L{
{ctype='unsigned char', label='Bag', fn=bag}, -- 04
{ctype='unsigned char', label='_unknown1'}, -- 05
{ctype='unsigned short', label='_unknown2'}, -- 06
}
-- Blacklist (add/delete)
fields.outgoing[0x03D] = L{
{ctype='int', label='_unknown1'}, -- 04 Looks like a player ID, but does not match the sender or the receiver.
{ctype='char[16]', label='Name'}, -- 08 Character name
{ctype='bool', label='Add/Remove'}, -- 18 0 = add, 1 = remove
{ctype='data[3]', label='_unknown2'}, -- 19 Values observed on adding but not deleting.
}
-- Lot item
fields.outgoing[0x041] = L{
{ctype='unsigned char', label='Slot'}, -- 04
}
-- Pass item
fields.outgoing[0x042] = L{
{ctype='unsigned char', label='Slot'}, -- 04
}
-- Servmes
-- First 4 bytes resemble the first 4 bytes of the incoming servmessage packet
fields.outgoing[0x04B] = L{
{ctype='unsigned char', label='_unknown1'}, -- 04 Always 1?
{ctype='unsigned char', label='_unknown2'}, -- 05 Can be 1 or 0
{ctype='unsigned char', label='_unknown3'}, -- 06 Always 1?
{ctype='unsigned char', label='_unknown4'}, -- 07 Always 2?
{ctype='data[12]', label='_unknown5'}, -- 08 All 00s
{ctype='unsigned int', label='_unknown5'}, -- 14 EC 00 00 00 observed. May be junk.
}
-- Delivery Box
fields.outgoing[0x04D] = L{
{ctype='unsigned char', label='Type'}, -- 04
--
-- Removing an item from the d-box sends type 0x08
-- It then responds to the server's 0x4B (id=0x08) with a 0x0A type packet.
-- Their assignment is the same, as far as I can see.
{ctype='unsigned char', label='_unknown1'}, -- 05 01 observed
{ctype='unsigned char', label='Slot'}, -- 06
{ctype='data[5]', label='_unknown2'}, -- 07 FF FF FF FF FF observed
{ctype='data[20]', label='_unknown3'}, -- 0C All 00 observed
}
enums['ah otype'] = {
[0x04] = 'Sell item request',
[0x05] = 'Check sales',
[0x0A] = 'Open AH menu',
[0x0B] = 'Sell item confirmation',
[0x0C] = 'Stop sale',
[0x0D] = 'Sale status confirmation',
[0x0E] = 'Place bid',
[0x10] = 'Item sold',
}
func.outgoing[0x04E] = {}
func.outgoing[0x04E].base = L{
{ctype='unsigned char', label='Type', fn=e+{'ah otype'}}, -- 04
}
-- Sent when putting an item up for auction (request)
func.outgoing[0x04E][0x04] = L{
{ctype='data[3]', label='_unknown1'}, -- 05
{ctype='unsigned int', label='Price', fn=gil}, -- 08
{ctype='unsigned short', label='Inventory Index', fn=inv+{0}}, -- 0C
{ctype='unsigned short', label='Item', fn=item}, -- 0E
{ctype='unsigned char', label='Stack', fn=invbool}, -- 10
{ctype='char*', label='_junk'}, -- 11
}
-- Sent when checking your sale status
func.outgoing[0x04E][0x05] = L{
{ctype='char*', label='_junk'}, -- 05
}
-- Sent when initially opening the AH menu
func.outgoing[0x04E][0x0A] = L{
{ctype='unsigned char', label='_unknown1', const=0xFF}, -- 05
{ctype='char*', label='_junk'}, -- 06
}
-- Sent when putting an item up for auction (confirmation)
func.outgoing[0x04E][0x0B] = L{
{ctype='unsigned char', label='Slot'}, -- 05
{ctype='data[2]', label='_unknown1'}, -- 06
{ctype='unsigned int', label='Price', fn=gil}, -- 08
{ctype='unsigned short', label='Inventory Index', fn=inv+{0}}, -- 0C
{ctype='unsigned short', label='_unknown2'}, -- 0E
{ctype='unsigned char', label='Stack', fn=invbool}, -- 10
{ctype='char*', label='_junk'}, -- 11
}
-- Sent when stopping an item from sale
func.outgoing[0x04E][0x0C] = L{
{ctype='unsigned char', label='Slot'}, -- 05
{ctype='char*', label='_junk'}, -- 06
}
-- Sent after receiving the sale status list for each item
func.outgoing[0x04E][0x0D] = L{
{ctype='unsigned char', label='Slot'}, -- 05
{ctype='char*', label='_junk'}, -- 06
}
-- Sent when bidding on an item
func.outgoing[0x04E][0x0E] = L{
{ctype='unsigned char', label='Slot'}, -- 05
{ctype='unsigned short', label='_unknown3'}, -- 06
{ctype='unsigned int', label='Price', fn=gil}, -- 08
{ctype='unsigned short', label='Item', fn=item}, -- 0C
{ctype='unsigned short', label='_unknown4'}, -- 0E
{ctype='bool', label='Stack', fn=invbool}, -- 10
{ctype='char*', label='_junk'}, -- 11
}
-- Sent when taking a sold item from the list
func.outgoing[0x04E][0x10] = L{
{ctype='unsigned char', label='Slot'}, -- 05
{ctype='char*', label='_junk'}, -- 06
}
-- Auction Interaction
fields.outgoing[0x04E] = function(data, type)
type = type or data and data:byte(5)
return func.outgoing[0x04E].base + (func.outgoing[0x04E][type] or L{})
end
-- Equip
fields.outgoing[0x050] = L{
{ctype='unsigned char', label='Item Index', fn=invp+{0x06}}, -- 04
{ctype='unsigned char', label='Equip Slot', fn=slot}, -- 05
{ctype='unsigned char', label='Bag', fn=bag}, -- 06
{ctype='data[1]', label='_junk1'} -- 07
}
types.equipset = L{
{ctype='unsigned char', label='Inventory Index', fn=invp+{0x0A}}, -- 00
{ctype='unsigned char', label='Equipment Slot', fn=slot}, -- 01
{ctype='unsigned char', label='Bag', fn=bag}, -- 02
{ctype='unsigned char', label='_padding1'}, -- 03
}
func.outgoing[0x051] = {}
func.outgoing[0x051].base = L{
{ctype='unsigned char', label='Count'}, -- 04
{ctype='unsigned char[3]', label='_unknown1'}, -- 05 Same as _unknown1 in outgoing 0x052
}
-- Equipset
fields.outgoing[0x051] = function(data, count)
count = count or data:byte(5)
return func.outgoing[0x051].base + L{
-- Only the number given in Count will be properly populated, the rest is junk
{ref=types.equipset, count=count}, -- 08
{ctype='data[%u]':format((16 - count) * 4), label='_junk1'}, -- 08 + 4 * count
}
end
types.equipset_build = L{
{ctype='boolbit', label='Active'}, -- 00
{ctype='bit', label='_unknown1'}, -- 00
{ctype='bit[6]', label='Bag', fn=bag}, -- 00
{ctype='unsigned char', label='Inventory Index'}, -- 01
{ctype='unsigned short', label='Item', fn=item}, -- 02
}
-- Equipset Build
fields.outgoing[0x052] = L{
-- First 8 bytes are for the newly changed item
{ctype='unsigned char', label='New Equipment Slot', fn=slot}, -- 04
{ctype='unsigned char[3]', label='_unknown1'}, -- 05
{ref=types.equipset_build, count=1}, -- 08
-- The next 16 are the entire current equipset, excluding the newly changed item
{ref=types.equipset_build, lookup={res.slots, 0x00}, count=0x10}, -- 0C
}
types.lockstyleset = L{
{ctype='unsigned char', label='Inventory Index'}, -- 00
{ctype='unsigned char', label='Equipment Slot', fn=slot}, -- 01
{ctype='unsigned char', label='Bag', fn=bag}, -- 02
{ctype='unsigned char', label='_unknown2', const=0x00}, -- 03
{ctype='unsigned short', label='Item', fn=item}, -- 04
{ctype='unsigned short', label='_unknown3', const=0x0000}, -- 06
}
-- lockstyleset
fields.outgoing[0x053] = L{
-- First 4 bytes are a header for the set
{ctype='unsigned char', label='Count'}, -- 04
{ctype='unsigned char', label='Type'}, -- 05 0 = "Stop locking style", 1 = "Continue locking style", 3 = "Lock style in this way". Might be flags?
{ctype='unsigned short', label='_unknown1', const=0x0000}, -- 06
{ref=types.lockstyleset, count=16}, -- 08
}
-- End Synth
-- This packet is sent after receiving a result when synthesizing.
fields.outgoing[0x059] = L{
{ctype='unsigned int', label='_unknown1'}, -- 04 Often 00 00 00 00, but 01 00 00 00 observed.
{ctype='data[8]', label='_junk1'} -- 08 Often 00 00 00 00, likely junk from a non-zero'd buffer.
}
-- Conquest
fields.outgoing[0x05A] = L{
}
-- Dialogue options
fields.outgoing[0x05B] = L{
{ctype='unsigned int', label='Target', fn=id}, -- 04
{ctype='unsigned int', label='Option Index'}, -- 08
{ctype='unsigned short', label='Target Index', fn=index}, -- 0C
{ctype='bool', label='Automated Message'}, -- 0E 1 if continuing the current menu, 0 if ending
{ctype='unsigned char', label='_padding'}, -- 0F Upper bits of a Mode short including the previous bool
{ctype='unsigned short', label='Zone', fn=zone}, -- 10
{ctype='unsigned short', label='Menu ID'}, -- 12
}
-- Warp Request
fields.outgoing[0x05C] = L{
{ctype='float', label='X'}, -- 04
{ctype='float', label='Z'}, -- 08
{ctype='float', label='Y'}, -- 0C
{ctype='unsigned int', label='Target ID', fn=id}, -- 10 NPC that you are requesting a warp from
{ctype='unsigned int', label='Option Index'}, -- 14
{ctype='unsigned short', label='Zone'}, -- 18
{ctype='unsigned short', label='Menu ID'}, -- 1A
{ctype='unsigned short', label='Target Index', fn=index}, -- 1C
{ctype='unsigned char', label='Mode', const=1}, -- 1E
{ctype='unsigned char', label='Rotation'}, -- 1F
}
-- Outgoing emote
fields.outgoing[0x05D] = L{
{ctype='unsigned int', label='Target ID', fn=id}, -- 04
{ctype='unsigned short', label='Target Index', fn=index}, -- 08
{ctype='unsigned char', label='Emote', fn=emote}, -- 0A
{ctype='unsigned char', label='Type'}, -- 0B 2 for motion, 0 otherwise
{ctype='unsigned int', label='_unknown1', const=0}, -- 0C
}
-- Zone request
-- Sent when crossing a zone line.
fields.outgoing[0x05E] = L{
{ctype='unsigned int', label='Zone Line'}, -- 04 This seems to be a fourCC consisting of the following chars:
-- 'z' (apparently constant)
-- Region-specific char ('6' for Jeuno, '3' for Qufim, etc.)
-- Zone-specific char ('u' for Port Jeuno, 't' for Lower Jeuno, 's' for Upper Jeuno, etc.)
-- Zone line identifier ('4' for Port Jeuno > Qufim Island, '2' for Port Jeuno > Lower Jeuno, etc.)
{ctype='data[12]', label='_unknown1', const=''}, -- 08
{ctype='unsigned short', label='_unknown2', const=0}, -- 14
{ctype='unsigned char', label='MH Door Menu', fn=e+{'mh door menus'}}, -- 16 should always contain the "MH Door Menu" byte of the last `incoming 0x00A`
{ctype='unsigned char', label='Type'}, -- 17 should be 0 except for when using mog house door, when it is a menu value:
-- 0="Whence I came", 1=first_option, 2=second_option, 3and-so-on, 125=mh_first_floor, 126=mh_second_floor, 127=mog_garden
}
-- Equipment Screen, also observed when zoning
fields.outgoing[0x061] = L{
{ctype='data[4]', label='_unknown1'}, -- 04 Always zero?
}
-- Digging Finished
-- This packet alone is responsible for generating the digging result, meaning that anyone that can inject
-- this packet is capable of digging with 0 delay.
fields.outgoing[0x063] = L{
{ctype='unsigned int', label='Player', fn=id}, -- 04
{ctype='unsigned int', label='_unknown1'}, -- 08
{ctype='unsigned short', label='Player Index', fn=index}, -- 0C
{ctype='unsigned char', label='Action?'}, -- 0E Changing it to anything other than 0x11 causes the packet to fail
{ctype='unsigned char', label='_junk1'}, -- 0F Likely junk. Has no effect on anything notable.
}
--"New" Key Item examination packet
fields.outgoing[0x064] = L{
{ctype='unsigned int', label='Player', fn=id}, -- 04
{ctype='data[0x40]', label='flags'}, -- 08 These correspond to a particular section of the 0x55 incoming packet
{ctype='unsigned int', label='_unknown1'}, -- 48 This field somehow denotes which half-0x55-packet the flags corresponds to
}
-- Party invite
fields.outgoing[0x06E] = L{
{ctype='unsigned int', label='Target', fn=id}, -- 04 This is so weird. The client only knows IDs from searching for people or running into them. So if neither has happened, the manual invite will fail, as the ID cannot be retrieved.
{ctype='unsigned short', label='Target Index', fn=index}, -- 08 00 if target not in zone
{ctype='unsigned char', label='Alliance'}, -- 0A 05 for alliance, 00 for party or if invalid alliance target (the client somehow knows..)
{ctype='unsigned char', label='_const1', const=0x041}, -- 0B
}
-- Party leaving
fields.outgoing[0x06F] = L{
{ctype='unsigned char', label='Alliance'}, -- 04 05 for alliance, 00 for party
{ctype='data[3]', label='_junk1'} -- 05
}
-- Party breakup
fields.outgoing[0x070] = L{
{ctype='unsigned char', label='Alliance'}, -- 04 02 for alliance, 00 for party
{ctype='data[3]', label='_junk1'} -- 05
}
-- Kick
fields.outgoing[0x071] = L{
{ctype='data[6]', label='_unknown1'}, -- 04
{ctype='unsigned char', label='Kick Type'}, -- 0A 0 for party, 1 for linkshell, 2 for alliance (maybe)
{ctype='unsigned char', label='_unknown2'}, -- 0B
{ctype='data[16]', label='Member Name'} -- 0C Null terminated string
}
-- Party invite response
fields.outgoing[0x074] = L{
{ctype='bool', label='Join', fn=bool}, -- 04
{ctype='data[3]', label='_junk1'} -- 05
}
--[[ -- Unnamed 0x76
-- Observed when zoning (sometimes). Probably triggers some information to be sent (perhaps about linkshells?)
fields.outgoing[0x076] = L{
{ctype='unsigned char', label='flag'}, -- 04 Only 01 observed
{ctype='data[3]', label='_junk1'}, -- 05 Only 00 00 00 observed.
}]]
-- Change Permissions
fields.outgoing[0x077] = L{
{ctype='char[16]', label='Target Name'}, -- 04 Name of the person to give leader to
{ctype='unsigned char', label='Party Type'}, -- 14 00 = party, 01 = linkshell, 02 = alliance
{ctype='unsigned short', label='Permissions'}, -- 15 01 for alliance leader, 00 for party leader, 03 for linkshell "to sack", 02 for linkshell "to pearl"
{ctype='unsigned short', label='_unknown1'}, -- 16
}
-- Party list request (4 byte packet)
fields.outgoing[0x078] = L{
}
-- Guild NPC Buy
-- Sent when buying an item from a guild NPC
fields.outgoing[0x082] = L{
{ctype='unsigned short', label='Item', fn=item}, -- 08
{ctype='unsigned char', label='_unknown1', const=0x00}, -- 0A
{ctype='unsigned char', label='Count'}, -- 0B Number you are buying
}
-- NPC Buy Item
-- Sent when buying an item from a generic NPC vendor
fields.outgoing[0x083] = L{
{ctype='unsigned int', label='Count'}, -- 04
{ctype='unsigned short', label='_unknown2'}, -- 08 Redirection Index? When buying from a guild helper, this was the index of the real guild NPC.
{ctype='unsigned char', label='Shop Slot'}, -- 0A The same index sent in incoming packet 0x03C
{ctype='unsigned char', label='_unknown3'}, -- 0B Always 0? Possibly padding
{ctype='unsigned int', label='_unknown4'}, -- 0C Always 0?
}
-- NPC Sell price query
-- Sent when trying to sell an item to an NPC
-- Clicking on the item the first time will determine the price
-- Also sent automatically when finalizing a sale, immediately preceeding packet 0x085
fields.outgoing[0x084] = L{
{ctype='unsigned int', label='Count'}, -- 04
{ctype='unsigned short', label='Item', fn=item}, -- 08
{ctype='unsigned char', label='Inventory Index', fn=inv+{0}}, -- 09 Inventory index of the same item
{ctype='unsigned char', label='_unknown3'}, -- 0A Always 0? Likely padding
}
-- NPC Sell confirm
-- Sent when confirming a sell of an item to an NPC
fields.outgoing[0x085] = L{
{ctype='unsigned int', label='_unknown1', const=1}, -- 04 Always 1? Possibly a type
}
-- Synth
fields.outgoing[0x096] = L{
{ctype='unsigned char', label='_unknown1'}, -- 04 Crystal ID? Earth = 0x02, Wind-break = 0x19?, Wind no-break = 0x2D?
{ctype='unsigned char', label='_unknown2'}, -- 05
{ctype='unsigned short', label='Crystal', fn=item}, -- 06
{ctype='unsigned char', label='Crystal Index', fn=inv+{0}}, -- 08
{ctype='unsigned char', label='Ingredient count'}, -- 09
{ctype='unsigned short[8]', label='Ingredient', fn=item}, -- 0A
{ctype='unsigned char[8]', label='Ingredient Index', fn=inv+{0}}, -- 1A
{ctype='unsigned short', label='_junk1'}, -- 22
}
-- /nominate or /proposal
fields.outgoing[0x0A0] = L{
{ctype='unsigned char', label='Packet Type'}, -- 04 Not typical mapping. 0=Open poll (say), 1 = Open poll (party), 3 = conclude poll
-- Just padding if the poll is being concluded.
{ctype='char*', label='Proposal'}, -- 05 Proposal exactly as written. Space delimited with quotes and all. Null terminated.
}
-- /vote
fields.outgoing[0x0A1] = L{
{ctype='unsigned char', label='Option'}, -- 04 Voting option
{ctype='char*', label='Character Name'}, -- 05 Character name. Null terminated.
}
-- /random
fields.outgoing[0x0A2] = L{
{ctype='int', label='_unknown1'}, -- 04 No clear purpose
}
-- Guild Buy Item
-- Sent when buying an item from a guild NPC
fields.outgoing[0x0AA] = L{
{ctype='unsigned short', label='Item', fn=item}, -- 04
{ctype='unsigned char', label='_unknown1', const=0x00}, -- 06
{ctype='unsigned char', label='Count'}, -- 07 Number you are buying
}
-- Get Guild Inv List
-- It's unclear how the server figures out which guild you're asking about, but this triggers 0x83 Incoming.
fields.outgoing[0x0AB] = L{
}
-- Guild Sell Item
-- Sent when selling an item to a guild NPC
fields.outgoing[0x0AC] = L{
{ctype='unsigned short', label='Item', fn=item}, -- 04
{ctype='unsigned char', label='_unknown1'}, -- 06
{ctype='unsigned char', label='Count'}, -- 07 Number you are selling
}
-- Get Guild Sale List
-- It's unclear how the server figures out which guild you're asking about, but this triggers 0x85 Incoming.
fields.outgoing[0x0AD] = L{
}
-- Speech
fields.outgoing[0x0B5] = L{
{ctype='unsigned char', label='Mode', fn=chat}, -- 04
{ctype='unsigned char', label='GM', fn=bool}, -- 05
{ctype='char*', label='Message'}, -- 06
}
-- Tell
fields.outgoing[0x0B6] = L{
{ctype='unsigned short', label='_unknown1', const=0x0003}, -- 04 03 00 for a normal tell -- Varying this did nothing.
{ctype='char[15]', label='Target Name'}, -- 06
{ctype='char*', label='Message'}, -- 15
}
-- Merit Point Increase
fields.outgoing[0x0BE] = L{
{ctype='unsigned char', label='_unknown1', const=0x03}, -- 04 No idea what it is, but it's always 0x03 for me
{ctype='unsigned char', label='Flag'}, -- 05 1 when you're increasing a merit point. 0 when you're decreasing it.
{ctype='unsigned short', label='Merit Point'}, -- 06 No known mapping, but unique to each merit point. Could be an int.
{ctype='unsigned int', label='_unknown2', const=0x00000000}, -- 08
}
-- Job Point Increase
fields.outgoing[0x0BF] = L{
{ctype='bit[5]', label='Type'}, -- 04
{ctype='bit[11]', label='Job', fn=job}, -- 04
{ctype='unsigned short', label='_junk1', const=0x0000}, -- 06 No values seen so far
}
-- Job Point Menu
-- This packet has no content bytes
fields.outgoing[0x0C0] = L{
}
-- /makelinkshell
fields.outgoing[0x0C3] = L{
{ctype='unsigned char', label='_unknown1'}, -- 04
{ctype='unsigned char', label='Linkshell Number'}, -- 05
{ctype='data[2]', label='_junk1'} -- 05
}
-- Equip Linkshell
fields.outgoing[0x0C4] = L{
{ctype='unsigned short', label='_unknown1'}, -- 04 0x00 0x0F for me
{ctype='unsigned char', label='Inventory Slot ID'}, -- 06 Inventory Slot that holds the linkshell
{ctype='unsigned char', label='Linkshell Number'}, -- 07 Inventory Slot that holds the linkshell
{ctype='data[16]', label='String of unclear purpose'} -- 08 Probably going to be used in the future system somehow. Currently "dummy"..string.char(0,0,0).."%s %s "..string.char(0,1)
}
-- Open Mog
fields.outgoing[0x0CB] = L{
{ctype='unsigned char', label='type'}, -- 04 1 = open mog, 2 = close mog
{ctype='data[3]', label='_junk1'} -- 05
}
-- Party Marker Request
fields.outgoing[0x0D2] = L{
{ctype='unsigned short', label='Zone', fn=zone}, -- 04
{ctype='unsigned short', label='_junk1'} -- 06
}
-- Open Help Submenu
fields.outgoing[0x0D4] = L{
{ctype='unsigned int', label='Number of Opens'}, -- 04 Number of times you've opened the submenu.
}
-- Check
fields.outgoing[0x0DD] = L{
{ctype='unsigned int', label='Target', fn=id}, -- 04
{ctype='unsigned short', label='Target Index', fn=index}, -- 08
{ctype='unsigned short', label='_unknown1'}, -- 0A
{ctype='unsigned char', label='Check Type'}, -- 0C 00 = Normal /check, 01 = /checkname, 02 = /checkparam
{ctype='data[3]', label='_junk1'} -- 0D
}
-- Search Comment
fields.outgoing[0x0E0] = L{
{ctype='char[40]', label='Line 1'}, -- 04 Spaces (0x20) fill out any empty characters.
{ctype='char[40]', label='Line 2'}, -- 2C Spaces (0x20) fill out any empty characters.
{ctype='char[40]', label='Line 3'}, -- 54 Spaces (0x20) fill out any empty characters.
{ctype='data[4]', label='_unknown1'}, -- 7C 20 20 20 00 observed.
{ctype='data[24]', label='_unknown2'}, -- 80 Likely contains information about the flags.
}
-- Get LS Message
fields.outgoing[0x0E1] = L{
{ctype='data[136]', label='_unknown1', const=0x0}, -- 04
}
-- Set LS Message
fields.outgoing[0x0E2] = L{
{ctype='unsigned int', label='_unknown1', const=0x00000040}, -- 04
{ctype='unsigned int', label='_unknown2'}, -- 08 Usually 0, but sometimes contains some junk
{ctype='char[128]', label='Message'} -- 0C
}
-- Logout
fields.outgoing[0x0E7] = L{
{ctype='unsigned char', label='_unknown1'}, -- 04 Observed to be 00
{ctype='unsigned char', label='_unknown2'}, -- 05 Observed to be 00
{ctype='unsigned char', label='Logout Type', fn=e+{'logout'}}, -- 06 /logout = 01, /pol == 02 (removed), /shutdown = 03
{ctype='unsigned char', label='_unknown3'}, -- 07 Observed to be 00
}
-- Toggle Heal
fields.outgoing[0x0E8] = L{
{ctype='unsigned char', label='Movement'}, -- 04 02 if caused by movement
{ctype='unsigned char', label='_unknown2'}, -- 05 00 observed
{ctype='unsigned char', label='_unknown3'}, -- 06 00 observed
{ctype='unsigned char', label='_unknown4'}, -- 07 00 observed
}
-- Sit
fields.outgoing[0x0EA] = L{
{ctype='unsigned char', label='Movement'}, -- 04