This repository has been archived by the owner on Feb 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Auth.cpp
876 lines (861 loc) · 45.5 KB
/
Auth.cpp
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
/******************************************************************************
* This file is part of plNetLog. *
* *
* plNetLog is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* plNetLog is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with plNetLog. If not, see <http://www.gnu.org/licenses/>. *
******************************************************************************/
#include "Auth.h"
static const unsigned __int64 kNodeIdx = (1ull << 0);
static const unsigned __int64 kCreateTime = (1ull << 1);
static const unsigned __int64 kModifyTime = (1ull << 2);
static const unsigned __int64 kCreateAgeName = (1ull << 3);
static const unsigned __int64 kCreateAgeUuid = (1ull << 4);
static const unsigned __int64 kCreatorUuid = (1ull << 5);
static const unsigned __int64 kCreatorIdx = (1ull << 6);
static const unsigned __int64 kNodeType = (1ull << 7);
static const unsigned __int64 kInt32_1 = (1ull << 8);
static const unsigned __int64 kInt32_2 = (1ull << 9);
static const unsigned __int64 kInt32_3 = (1ull << 10);
static const unsigned __int64 kInt32_4 = (1ull << 11);
static const unsigned __int64 kUint32_1 = (1ull << 12);
static const unsigned __int64 kUint32_2 = (1ull << 13);
static const unsigned __int64 kUint32_3 = (1ull << 14);
static const unsigned __int64 kUint32_4 = (1ull << 15);
static const unsigned __int64 kUuid_1 = (1ull << 16);
static const unsigned __int64 kUuid_2 = (1ull << 17);
static const unsigned __int64 kUuid_3 = (1ull << 18);
static const unsigned __int64 kUuid_4 = (1ull << 19);
static const unsigned __int64 kString64_1 = (1ull << 20);
static const unsigned __int64 kString64_2 = (1ull << 21);
static const unsigned __int64 kString64_3 = (1ull << 22);
static const unsigned __int64 kString64_4 = (1ull << 23);
static const unsigned __int64 kString64_5 = (1ull << 24);
static const unsigned __int64 kString64_6 = (1ull << 25);
static const unsigned __int64 kIString64_1 = (1ull << 26);
static const unsigned __int64 kIString64_2 = (1ull << 27);
static const unsigned __int64 kText_1 = (1ull << 28);
static const unsigned __int64 kText_2 = (1ull << 29);
static const unsigned __int64 kBlob_1 = (1ull << 30);
static const unsigned __int64 kBlob_2 = (1ull << 31);
static const QString s_nodeTypeNames[] = {
"Invalid", "VNodeMgrLow", "Player", "Age", "GameServer", "Admin",
"VaultServer", "CCR", "<8>", "<9>", "<10>", "<11>", "<12>", "<13>",
"<14>", "<15>", "<16>", "<17>", "<18>", "<19>", "<20>",
"VNodeMgrHigh", "Folder", "PlayerInfo", "System", "Image", "TextNote",
"SDL", "AgeLink", "Chronicle", "PlayerInfoList", "UNUSED (31)",
"Marker", "AgeInfo", "AgeInfoList", "MarkerList"
};
static QString readNodeString(ChunkBuffer& buffer)
{
unsigned length = buffer.read<unsigned>() / sizeof(unsigned short);
unsigned short* utf16 = new unsigned short[length];
buffer.chomp(utf16, length * sizeof(unsigned short));
QString str = QString::fromUtf16(utf16, length-1);
delete[] utf16;
return str;
}
static void Node_Factory(QTreeWidgetItem* parent, ChunkBuffer& buffer)
{
unsigned nodeSize = buffer.read<unsigned>();
if (nodeSize < sizeof(unsigned __int64))
return;
unsigned __int64 fields = buffer.read<unsigned __int64>();
if (fields >> 32)
OutputDebugStringA("[Node_Factory]\nInvalid bits in node field\n");
if (fields & kNodeIdx)
new QTreeWidgetItem(parent, QStringList()
<< QString("Node ID: %1").arg(buffer.read<unsigned>()));
if (fields & kCreateTime)
new QTreeWidgetItem(parent, QStringList()
<< QString("Create Time: %1").arg(buffer.read<unsigned>()));
if (fields & kModifyTime)
new QTreeWidgetItem(parent, QStringList()
<< QString("Modify Time: %1").arg(buffer.read<unsigned>()));
if (fields & kCreateAgeName)
new QTreeWidgetItem(parent, QStringList()
<< QString("Create Age Name: %1").arg(readNodeString(buffer)));
if (fields & kCreateAgeUuid)
new QTreeWidgetItem(parent, QStringList()
<< QString("Create Age UUID: %1").arg(buffer.readUuid()));
if (fields & kCreatorUuid)
new QTreeWidgetItem(parent, QStringList()
<< QString("Creator UUID: %1").arg(buffer.readUuid()));
if (fields & kCreatorIdx)
new QTreeWidgetItem(parent, QStringList()
<< QString("Modify Time: %1").arg(buffer.read<unsigned>()));
if (fields & kNodeType) {
unsigned type = buffer.read<unsigned>();
if (type < (sizeof(s_nodeTypeNames) / sizeof(s_nodeTypeNames[0]))) {
new QTreeWidgetItem(parent, QStringList()
<< QString("Node Type: %1").arg(s_nodeTypeNames[type]));
} else {
new QTreeWidgetItem(parent, QStringList()
<< QString("Node Type: %1").arg(type));
}
}
if (fields & kInt32_1)
new QTreeWidgetItem(parent, QStringList()
<< QString("Int32_1: %1").arg(buffer.read<int>()));
if (fields & kInt32_2)
new QTreeWidgetItem(parent, QStringList()
<< QString("Int32_2: %1").arg(buffer.read<int>()));
if (fields & kInt32_3)
new QTreeWidgetItem(parent, QStringList()
<< QString("Int32_3: %1").arg(buffer.read<int>()));
if (fields & kInt32_4)
new QTreeWidgetItem(parent, QStringList()
<< QString("Int32_4: %1").arg(buffer.read<int>()));
if (fields & kUint32_1)
new QTreeWidgetItem(parent, QStringList()
<< QString("UInt32_1: %1").arg(buffer.read<unsigned>()));
if (fields & kUint32_2)
new QTreeWidgetItem(parent, QStringList()
<< QString("UInt32_2: %1").arg(buffer.read<unsigned>()));
if (fields & kUint32_3)
new QTreeWidgetItem(parent, QStringList()
<< QString("UInt32_3: %1").arg(buffer.read<unsigned>()));
if (fields & kUint32_4)
new QTreeWidgetItem(parent, QStringList()
<< QString("UInt32_4: %1").arg(buffer.read<unsigned>()));
if (fields & kUuid_1)
new QTreeWidgetItem(parent, QStringList()
<< QString("Uuid_1: %1").arg(buffer.readUuid()));
if (fields & kUuid_2)
new QTreeWidgetItem(parent, QStringList()
<< QString("Uuid_2: %1").arg(buffer.readUuid()));
if (fields & kUuid_3)
new QTreeWidgetItem(parent, QStringList()
<< QString("Uuid_3: %1").arg(buffer.readUuid()));
if (fields & kUuid_4)
new QTreeWidgetItem(parent, QStringList()
<< QString("Uuid_4: %1").arg(buffer.readUuid()));
if (fields & kString64_1)
new QTreeWidgetItem(parent, QStringList()
<< QString("String64_1: %1").arg(readNodeString(buffer)));
if (fields & kString64_2)
new QTreeWidgetItem(parent, QStringList()
<< QString("String64_2: %1").arg(readNodeString(buffer)));
if (fields & kString64_3)
new QTreeWidgetItem(parent, QStringList()
<< QString("String64_3: %1").arg(readNodeString(buffer)));
if (fields & kString64_4)
new QTreeWidgetItem(parent, QStringList()
<< QString("String64_4: %1").arg(readNodeString(buffer)));
if (fields & kString64_5)
new QTreeWidgetItem(parent, QStringList()
<< QString("String64_5: %1").arg(readNodeString(buffer)));
if (fields & kString64_6)
new QTreeWidgetItem(parent, QStringList()
<< QString("String64_6: %1").arg(readNodeString(buffer)));
if (fields & kIString64_1)
new QTreeWidgetItem(parent, QStringList()
<< QString("IString64_1: %1").arg(readNodeString(buffer)));
if (fields & kIString64_2)
new QTreeWidgetItem(parent, QStringList()
<< QString("IString64_2: %1").arg(readNodeString(buffer)));
if (fields & kText_1)
new QTreeWidgetItem(parent, QStringList()
<< QString("Text_1: %1").arg(readNodeString(buffer)));
if (fields & kText_2)
new QTreeWidgetItem(parent, QStringList()
<< QString("Text_2: %1").arg(readNodeString(buffer)));
if (fields & kBlob_1) {
unsigned size = buffer.read<unsigned>();
new QTreeWidgetItem(parent, QStringList()
<< QString("Blob_1: %1 bytes").arg(size));
buffer.skip(size);
}
if (fields & kBlob_2) {
unsigned size = buffer.read<unsigned>();
new QTreeWidgetItem(parent, QStringList()
<< QString("Blob_2: %1 bytes").arg(size));
buffer.skip(size);
}
}
static void Score_Factory(QTreeWidgetItem* parent, ChunkBuffer& buffer)
{
QTreeWidgetItem* top = new QTreeWidgetItem(parent, QStringList()
<< QString("Score %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Owner: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Created Time: %1").arg(buffer.read<unsigned>()));
unsigned type = buffer.read<unsigned>();
switch (type) {
case 0:
new QTreeWidgetItem(top, QStringList() << "Game Type: Fixed");
break;
case 1:
new QTreeWidgetItem(top, QStringList() << "Game Type: Accumulative");
break;
case 2:
new QTreeWidgetItem(top, QStringList() << "Game Type: Accumulative (Allow Negative)");
break;
default:
QTreeWidgetItem* item = new QTreeWidgetItem(top, QStringList()
<< QString("Game Type: %1").arg(type));
item->setForeground(0, Qt::red);
break;
}
new QTreeWidgetItem(top, QStringList()
<< QString("Value: %1").arg(buffer.read<int>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Game Name: %1").arg(readNodeString(buffer)));
}
bool Auth_Factory(QTreeWidget* logger, QString timeFmt, int direction,
ChunkBuffer& buffer)
{
unsigned short msgId = buffer.read<unsigned short>();
if (direction == kCli2Srv) {
switch (msgId) {
case kCli2Auth_PingRequest:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 --> Cli2Auth_PingRequest").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Ping Time: %1 ms").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
size_t payloadSize = buffer.read<unsigned>();
if (payloadSize > 0) {
new QTreeWidgetItem(top, QStringList()
<< QString("Payload: %1 bytes").arg(payloadSize));
buffer.skip(payloadSize);
QFont bold = top->font(0);
bold.setBold(true);
top->setFont(0, bold);
}
break;
}
case kCli2Auth_ClientRegisterRequest:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 --> Cli2Auth_ClientRegisterRequest").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Build ID: %1").arg(buffer.read<unsigned>()));
break;
}
case kCli2Auth_AcctLoginRequest:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 --> Cli2Auth_AcctLoginRequest").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Challenge: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Account Name: %1").arg(buffer.readString()));
new QTreeWidgetItem(top, QStringList()
<< QString("Challenge Hash: %1").arg(buffer.readHex<20>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Auth Token: %1").arg(buffer.readString()));
new QTreeWidgetItem(top, QStringList()
<< QString("OS: %1").arg(buffer.readString()));
break;
}
case kCli2Auth_AcctSetPlayerRequest:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 --> Cli2Auth_AcctSetPlayerRequest").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Player ID: %1").arg(buffer.read<unsigned>()));
break;
}
case kCli2Auth_PlayerDeleteRequest:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 --> Cli2Auth_PlayerDeleteRequest").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Player ID: %1").arg(buffer.read<unsigned>()));
break;
}
case kCli2Auth_PlayerCreateRequest:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 --> Cli2Auth_PlayerCreateRequest").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Player Name: %1").arg(buffer.readString()));
new QTreeWidgetItem(top, QStringList()
<< QString("Avatar Shape: %1").arg(buffer.readString()));
new QTreeWidgetItem(top, QStringList()
<< QString("Friend Invite: %1").arg(buffer.readString()));
break;
}
case kCli2Auth_VaultNodeCreate:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 --> Cli2Auth_VaultNodeCreate").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
QTreeWidgetItem* node = new QTreeWidgetItem(top, QStringList() << "Node");
Node_Factory(node, buffer);
break;
}
case kCli2Auth_VaultNodeFetch:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 --> Cli2Auth_VaultNodeFetch").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Node ID: %1").arg(buffer.read<unsigned>()));
break;
}
case kCli2Auth_VaultNodeSave:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 --> Cli2Auth_VaultNodeSave").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Node ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Revision ID: %1").arg(buffer.readUuid()));
QTreeWidgetItem* node = new QTreeWidgetItem(top, QStringList() << "Node");
Node_Factory(node, buffer);
break;
}
case kCli2Auth_VaultNodeAdd:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 --> Cli2Auth_VaultNodeAdd").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Parent ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Child ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Owner ID: %1").arg(buffer.read<unsigned>()));
break;
}
case kCli2Auth_VaultNodeRemove:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 --> Cli2Auth_VaultNodeRemove").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Parent ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Child ID: %1").arg(buffer.read<unsigned>()));
break;
}
case kCli2Auth_VaultFetchNodeRefs:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 --> Cli2Auth_VaultFetchNodeRefs").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Node ID: %1").arg(buffer.read<unsigned>()));
break;
}
case kCli2Auth_VaultInitAgeRequest:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 --> Cli2Auth_VaultInitAgeRequest").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Age Instance ID: %1").arg(buffer.readUuid()));
new QTreeWidgetItem(top, QStringList()
<< QString("Parent Age Instance ID: %1").arg(buffer.readUuid()));
new QTreeWidgetItem(top, QStringList()
<< QString("Age Filename: %1").arg(buffer.readString()));
new QTreeWidgetItem(top, QStringList()
<< QString("Age Instance Name: %1").arg(buffer.readString()));
new QTreeWidgetItem(top, QStringList()
<< QString("Age User Name: %1").arg(buffer.readString()));
new QTreeWidgetItem(top, QStringList()
<< QString("Age Description: %1").arg(buffer.readString()));
new QTreeWidgetItem(top, QStringList()
<< QString("Age Sequence: %1").arg(buffer.read<int>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Age Language: %1").arg(buffer.read<int>()));
break;
}
case kCli2Auth_VaultNodeFind:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 --> Cli2Auth_VaultNodeFind").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
QTreeWidgetItem* node = new QTreeWidgetItem(top, QStringList() << "Template Node");
Node_Factory(node, buffer);
break;
}
case kCli2Auth_VaultSendNode:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 --> Cli2Auth_VaultSendNode").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Source Node ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Dest Player ID: %1").arg(buffer.read<unsigned>()));
break;
}
case kCli2Auth_AgeRequest:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 --> Cli2Auth_AgeRequest").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Age Name: %1").arg(buffer.readString()));
new QTreeWidgetItem(top, QStringList()
<< QString("Age UUID: %1").arg(buffer.readUuid()));
break;
}
case kCli2Auth_GetPublicAgeList:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 --> Cli2Auth_GetPublicAgeList").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Age Filename: %1").arg(buffer.readString()));
break;
}
case kCli2Auth_LogPythonTraceback:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 --> Cli2Auth_LogPythonTraceback").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList() << buffer.readString());
break;
}
case kCli2Auth_LogStackDump:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 --> Cli2Auth_LogStackDump").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList() << buffer.readString());
break;
}
case kCli2Auth_ScoreGetScores:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 --> Cli2Auth_ScoreGetScores").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Owner ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Game Name: %1").arg(buffer.readString()));
break;
}
default:
{
QTreeWidgetItem* item = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 --> Invalid Cli2Auth message (%2)").arg(timeFmt).arg(msgId));
QFont warnFont = item->font(0);
warnFont.setBold(true);
item->setFont(0, warnFont);
item->setForeground(0, Qt::red);
OutputDebugStringA(QString("Invalid Cli2Auth message (%1)\n").arg(msgId).toUtf8().data());
return false;
}
}
} else {
switch (msgId) {
case kAuth2Cli_PingReply:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 <-- Auth2Cli_PingReply").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Ping Time: %1 ms").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
size_t payloadSize = buffer.read<unsigned>();
if (payloadSize > 0) {
new QTreeWidgetItem(top, QStringList()
<< QString("Payload: %1 bytes").arg(payloadSize));
buffer.skip(payloadSize);
QFont bold = top->font(0);
bold.setBold(true);
top->setFont(0, bold);
}
break;
}
case kAuth2Cli_ServerAddr:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 <-- Auth2Cli_ServerAddr").arg(timeFmt));
top->setForeground(0, kColorAuth);
unsigned addr = buffer.read<unsigned>();
new QTreeWidgetItem(top, QStringList()
<< QString("Address: %1.%2.%3.%4").arg(addr & 0xFF)
.arg((addr >> 8) & 0xFF).arg((addr >> 16) & 0xFF)
.arg((addr >> 24) & 0xFF));
new QTreeWidgetItem(top, QStringList()
<< QString("Token: %1").arg(buffer.readUuid()));
break;
}
case kAuth2Cli_ClientRegisterReply:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 <-- Auth2Cli_ClientRegisterReply").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Challenge: %1").arg(buffer.read<unsigned>()));
break;
}
case kAuth2Cli_AcctLoginReply:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 <-- Auth2Cli_AcctLoginReply").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Result: %1").arg(buffer.readResultCode()));
new QTreeWidgetItem(top, QStringList()
<< QString("Account ID: %1").arg(buffer.readUuid()));
new QTreeWidgetItem(top, QStringList()
<< QString("Account Flags: 0x%1").arg(buffer.read<unsigned>(), 8, 16, QChar('0')));
new QTreeWidgetItem(top, QStringList()
<< QString("Billing Type: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Encryption Key: (0x%1, 0x%2, 0x%3, 0x%4)")
.arg(buffer.read<unsigned>(), 8, 16, QChar('0'))
.arg(buffer.read<unsigned>(), 8, 16, QChar('0'))
.arg(buffer.read<unsigned>(), 8, 16, QChar('0'))
.arg(buffer.read<unsigned>(), 8, 16, QChar('0')));
break;
}
case kAuth2Cli_AcctPlayerInfo:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 <-- Auth2Cli_AcctPlayerInfo").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Player ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Player Name: %1").arg(buffer.readString()));
new QTreeWidgetItem(top, QStringList()
<< QString("Avatar Shape: %1").arg(buffer.readString()));
new QTreeWidgetItem(top, QStringList()
<< QString("Explorer: %1").arg(buffer.read<unsigned>()));
break;
}
case kAuth2Cli_AcctSetPlayerReply:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 <-- Auth2Cli_AcctSetPlayerReply").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Result: %1").arg(buffer.readResultCode()));
break;
}
case kAuth2Cli_PlayerCreateReply:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 <-- Auth2Cli_PlayerCreateReply").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Result: %1").arg(buffer.readResultCode()));
new QTreeWidgetItem(top, QStringList()
<< QString("Player ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Explorer: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Player Name: %1").arg(buffer.readString()));
new QTreeWidgetItem(top, QStringList()
<< QString("Avatar Shape: %1").arg(buffer.readString()));
break;
}
case kAuth2Cli_PlayerDeleteReply:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 <-- Auth2Cli_PlayerDeleteReply").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Result: %1").arg(buffer.readResultCode()));
break;
}
case kAuth2Cli_VaultNodeCreated:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 <-- Auth2Cli_VaultNodeCreated").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Result: %1").arg(buffer.readResultCode()));
new QTreeWidgetItem(top, QStringList()
<< QString("Node ID: %1").arg(buffer.read<unsigned>()));
break;
}
case kAuth2Cli_VaultNodeFetched:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 <-- Auth2Cli_VaultNodeFetched").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Result: %1").arg(buffer.readResultCode()));
QTreeWidgetItem* node = new QTreeWidgetItem(top, QStringList() << "Node");
Node_Factory(node, buffer);
break;
}
case kAuth2Cli_VaultNodeChanged:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 <-- Auth2Cli_VaultNodeChanged").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Node ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Revision ID: %1").arg(buffer.readUuid()));
break;
}
case kAuth2Cli_VaultNodeAdded:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 <-- Auth2Cli_VaultNodeAdded").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Parent ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Child ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Owner ID: %1").arg(buffer.read<unsigned>()));
break;
}
case kAuth2Cli_VaultNodeRemoved:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 <-- Auth2Cli_VaultNodeRemoved").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Parent ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Child ID: %1").arg(buffer.read<unsigned>()));
break;
}
case kAuth2Cli_VaultNodeRefsFetched:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 <-- Auth2Cli_VaultNodeRefsFetched").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Result: %1").arg(buffer.readResultCode()));
unsigned count = buffer.read<unsigned>();
QTreeWidgetItem* refs = new QTreeWidgetItem(top, QStringList() << "Refs");
for (unsigned i=0; i<count; ++i) {
new QTreeWidgetItem(refs, QStringList()
<< QString("Parent: %1; Child: %2; Owner: %3; [%4]")
.arg(buffer.read<unsigned>())
.arg(buffer.read<unsigned>())
.arg(buffer.read<unsigned>())
.arg(buffer.read<bool>() ? "SEEN" : ""));
}
break;
}
case kAuth2Cli_VaultInitAgeReply:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 <-- Auth2Cli_VaultInitAgeReply").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Result: %1").arg(buffer.readResultCode()));
new QTreeWidgetItem(top, QStringList()
<< QString("Age Vault ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Age Info Vault ID: %1").arg(buffer.read<unsigned>()));
break;
}
case kAuth2Cli_VaultNodeFindReply:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 <-- Auth2Cli_VaultNodeFindReply").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Result: %1").arg(buffer.readResultCode()));
unsigned count = buffer.read<unsigned>();
QTreeWidgetItem* refs = new QTreeWidgetItem(top, QStringList() << "Nodes");
for (unsigned i=0; i<count; ++i) {
new QTreeWidgetItem(refs, QStringList()
<< QString("Node ID: %1").arg(buffer.read<unsigned>()));
}
break;
}
case kAuth2Cli_VaultSaveNodeReply:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 <-- Auth2Cli_VaultSaveNodeReply").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Result: %1").arg(buffer.readResultCode()));
break;
}
case kAuth2Cli_VaultAddNodeReply:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 <-- Auth2Cli_VaultAddNodeReply").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Result: %1").arg(buffer.readResultCode()));
break;
}
case kAuth2Cli_VaultRemoveNodeReply:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 <-- Auth2Cli_VaultRemoveNodeReply").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Result: %1").arg(buffer.readResultCode()));
break;
}
case kAuth2Cli_AgeReply:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 <-- Auth2Cli_AgeReply").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Result: %1").arg(buffer.readResultCode()));
new QTreeWidgetItem(top, QStringList()
<< QString("Age MCP: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Instance UUID: %1").arg(buffer.readUuid()));
new QTreeWidgetItem(top, QStringList()
<< QString("Vault ID: %1").arg(buffer.read<unsigned>()));
unsigned addr = buffer.read<unsigned>();
new QTreeWidgetItem(top, QStringList()
<< QString("Address: %1.%2.%3.%4").arg(addr & 0xFF)
.arg((addr >> 8) & 0xFF).arg((addr >> 16) & 0xFF)
.arg((addr >> 24) & 0xFF));
break;
}
case kAuth2Cli_PublicAgeList:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 <-- Auth2Cli_PublicAgeList").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Result: %1").arg(buffer.readResultCode()));
unsigned count = buffer.read<unsigned>();
QTreeWidgetItem* ages = new QTreeWidgetItem(top, QStringList() << "Ages");
for (unsigned i=0; i<count; ++i) {
unsigned short strbuf[1024];
QTreeWidgetItem* age = new QTreeWidgetItem(ages, QStringList()
<< QString("Age Instance %1").arg(buffer.readUuid()));
buffer.chomp(strbuf, 64 * sizeof(unsigned short));
strbuf[63] = 0;
new QTreeWidgetItem(age, QStringList()
<< QString("Age Filename: %1").arg(QString::fromUtf16(strbuf)));
buffer.chomp(strbuf, 64 * sizeof(unsigned short));
strbuf[63] = 0;
new QTreeWidgetItem(age, QStringList()
<< QString("Age Instance Name: %1").arg(QString::fromUtf16(strbuf)));
buffer.chomp(strbuf, 64 * sizeof(unsigned short));
strbuf[63] = 0;
new QTreeWidgetItem(age, QStringList()
<< QString("Age User Name: %1").arg(QString::fromUtf16(strbuf)));
buffer.chomp(strbuf, 1024 * sizeof(unsigned short));
strbuf[1023] = 0;
new QTreeWidgetItem(age, QStringList()
<< QString("Age Description: %1").arg(QString::fromUtf16(strbuf)));
new QTreeWidgetItem(age, QStringList()
<< QString("Age Sequence: %1").arg(buffer.read<int>()));
new QTreeWidgetItem(age, QStringList()
<< QString("Age Language: %1").arg(buffer.read<int>()));
new QTreeWidgetItem(age, QStringList()
<< QString("Population: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(age, QStringList()
<< QString("Current Population: %1").arg(buffer.read<unsigned>()));
}
break;
}
case kAuth2Cli_ScoreGetScoresReply:
{
QTreeWidgetItem* top = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 <-- Auth2Cli_ScoreGetScoresReply").arg(timeFmt));
top->setForeground(0, kColorAuth);
new QTreeWidgetItem(top, QStringList()
<< QString("Trans ID: %1").arg(buffer.read<unsigned>()));
new QTreeWidgetItem(top, QStringList()
<< QString("Result: %1").arg(buffer.readResultCode()));
unsigned scoreCount = buffer.read<unsigned>();
/*unsigned byteCount =*/ buffer.read<unsigned>();
QTreeWidgetItem* scores = new QTreeWidgetItem(top, QStringList() << "Scores");
for (unsigned i = 0; i < scoreCount; ++i)
Score_Factory(scores, buffer);
break;
}
default:
{
QTreeWidgetItem* item = new QTreeWidgetItem(logger, QStringList()
<< QString("%1 <-- Invalid Auth2Cli message (%2)").arg(timeFmt).arg(msgId));
QFont warnFont = item->font(0);
warnFont.setBold(true);
item->setFont(0, warnFont);
item->setForeground(0, Qt::red);
OutputDebugStringA(QString("Invalid Auth2Cli message (%1)\n").arg(msgId).toUtf8().data());
return false;
}
}
}
return true;
}