forked from igroglaz/srvmgr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cheat_codes.cpp
2052 lines (1947 loc) · 92.9 KB
/
cheat_codes.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
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
#include "syslib.h"
#include <math.h>
#include <string>
#include <vector>
#include <sstream>
#include "srvmgr.h"
char akickme[] = "#kickme";
char aDisc[] = "#disconnect ";
char ainfo[] = "#info ";
char aMode[] = "#set mode";
char aown[] = "#own ";
char aownfor[] = "#own_for ";
char * _stdcall get_player_info(char *char_name, char *login_name, bool connected, unsigned char *unit)
{
static char buf[2000];
unsigned int st[4];
unsigned int sum = 0;
const unsigned int maxSum = 0x8C;
for (int i = 0; i < 4; ++i)
{
st[i] = *(unsigned short *)(unit + 0x84 + i * 2) - *(unsigned char *)(unit + 0xD4 + i);
if (st[i] > 0x2B)
{
sum = maxSum + 1;
}
else
{
sum += static_cast<unsigned int>(0.349*pow(1.15, double(st[i] - 1)) + 0.5);
}
}
_snprintf(buf, sizeof(buf) - 1, "character: \"%s\", login: \"%s\", %sCONNECTED, [%d,%d,%d,%d]%s",
char_name,
login_name,
connected ? "" : "DIS", st[0], st[1], st[2], st[3], sum > maxSum ? "" : " -> n00b");
return buf;
}
void parse_space_delimited(const std::string &str, std::vector<std::string> &vs)
{
vs.clear();
char quote = 0;
std::string part;
for (unsigned int i = 0; i < str.size(); ++i)
{
if (quote)
{
if (str[i] == quote)
quote = 0;
else
{
if (str[i] == '\\')
if (++i >= str.size())
throw std::runtime_error("Invalid arguments");
part += str[i];
}
}
else
{
if (std::string("\"'`").find(str[i]) != std::string::npos)
quote = str[i]; // start quoting
else if (str[i] != ' ')
{
if (str[i] == '\\')
if (++i >= str.size())
throw std::runtime_error("Invalid arguments");
part += str[i];
}
else if (!part.empty())
{
vs.push_back(part);
part.clear();
}
}
}
if (!part.empty())
{
vs.push_back(part);
part.clear();
}
}
#pragma warning (disable: 4731)
void __stdcall own_units(void *from, void *to)
{
__asm
{
mov eax, dword ptr [from]
mov ecx, dword ptr [to]
push ebp
mov ebp, esp
sub esp, 0x10
mov [ebp-4], eax
mov [ebp-8], ecx
mov eax, 0x6CDB3C
mov eax, [eax]
add eax, 4
mov edx, [eax+4]
mov [ebp-0x0C], edx
l_own_u_loop:
mov edx, [ebp-0x0C]
test edx, edx
jz l_own_u_exit
mov eax, [edx]
mov ecx, [edx+8]
mov [ebp-0x0C], eax
test ecx, ecx
jz l_own_u_exit
mov eax, [ecx + 0x14]
cmp eax, [ebp - 4] // если это юнит жертвы
jnz l_own_u_loop
cmp ecx, [eax + 0x38] // проверка на главного персонажа - его не овнить
jz l_own_u_loop
mov eax, [ebp - 8]
push eax
push ecx
mov ecx, 0x642C2C
mov ecx, [ecx]
mov ecx, [ecx+0x7C]
mov edx, 0x4FB4CA
call edx
jmp l_own_u_loop
l_own_u_exit:
mov esp, ebp
pop ebp
}
}
#pragma warning (default: 4731)
void __stdcall handle_own_for(char *cmd, void *player)
{
try
{
std::vector<std::string> args;
parse_space_delimited(cmd + strlen(aownfor), args);
if (args.size() != 2) throw std::runtime_error("Invalid arguments");
void *from = get_player_by_name(args[0].c_str());
void *to = get_player_by_name(args[1].c_str());
if (!from)
{
std::ostringstream ss;
ss << "Invalid arguments : no such player - " << args[0];
throw std::runtime_error(ss.str().c_str());
}
if (!to)
{
std::ostringstream ss;
ss << "Invalid arguments : no such player - " << args[1];
throw std::runtime_error(ss.str().c_str());
}
own_units(from, to);
}
catch (std::runtime_error &e)
{
send_to_player(player, e.what());
send_to_player(player, "Usage: #own_for <player-from> <player-to>");
}
}
//char print_ecx[] = "ecx = 0x%.8X\n";
//void _stdcall print_stack(void *ebp)
//{
// for (int i = 0; i < 10; ++i)
// {
// void *ret = *(((void**)ebp)+1);
// if ((unsigned int)ret < 0x400000 || (unsigned int)ret > 0x600000) break;
// ebp = *(void**)ebp;
// log_format("--> 0x%.8X\n", (unsigned int)ret);
// }
//}
#include "cheat_codes_new.h"
#include "srvmgrdef.h"
//void RunCommand(byte* _this, byte* player, const char* command, uint32_t rights, bool console);
#pragma warning (disable: 4102)
#pragma warning (disable: 4733)
void _declspec(naked) cheat_codes(void) {
__asm
{
push ebp
mov ebp, esp
push 0
mov ebx, 0
mov eax, [ebp+0x08]
test eax, eax
jz sk_rights
mov edx, [eax+0x14]
and edx, GMF_ANY
cmp edx, GMF_ANY
jnz sk_rights
mov ebx, [eax+0x14]
and ebx, 0x00FFFFFF
sk_rights:
push ebx
push [ebp+0x0C]
push [ebp+0x08]
push ecx
call RunCommand
add esp, 0x14
mov esp, ebp
pop ebp
retn 0x0008
}
}
#pragma warning (default: 4733)
#pragma warning (default: 4102)
void cheat_codes_unsafe(void);
void __stdcall cheat_say(const char *nick, const char *command)
{
_asm
{
sub esp, 4
mov ecx, esp
push dword ptr [command]
mov edx, 0x005DD8F8 // CString::CString()
call edx
mov eax, [eax]
push eax
push dword ptr [nick] // name (arg_0)
call get_player_by_name // get player by name
test eax, eax
jz cs_skip
push eax
call cheat_codes_unsafe
jmp cs_cont
cs_skip:
pop eax
cs_cont:
add esp, 4
}
}
void __stdcall cheat_codes_2(byte* player, const char* command)
{
byte* cstring = NULL;
__asm
{
push [command]
lea ecx, [cstring]
mov edx, 0x005DD8F8 // CString::CString()
call edx
push [eax]
push [player]
call cheat_codes_unsafe
}
}
#pragma warning (disable: 4102)
#pragma warning (disable: 4733)
void _declspec(naked) cheat_codes_unsafe(void)
{
__asm {/////00502D0B
push ebp
mov ebp, esp
push 0FFFFFFFFh
push 0x00601776 // Microsoft VisualC 2-6/net runtime
mov eax, fs:0
push eax
mov fs:0, esp
sub esp, 2B0h
mov ecx, 0x642C2C
mov ecx, dword ptr [ecx]
mov [ebp-0x01DC], ecx
mov dword ptr [ebp-0x04], 0
mov ecx, [ebp+8]
xor edx, edx
mov dx, [ecx+4]
push edx
mov ecx, 0x6C3A08
mov edx, 0x518544
call edx
mov [ebp-0x010], eax
jmp lu_ready /// могут все игроки
lu_afterready:
jmp lu_test // только админы
lu_test: // CODE XREF: sub_502D0B+53j
jmp lu_kick
lu_afterkick:
jmp lu_kickme
lu_afterkickme:
jmp lu_locate
lu_afterlocate: // CODE XREF: sub_502D0B+15Dj
jmp lu_create
lu_aftercreate: // CODE XREF: sub_502D0B+6ACj
jmp lu_modify
lu_aftermodify: // CODE XREF: sub_502D0B+9EBj
jmp lu_summon
lu_aftersummon: // CODE XREF: sub_502D0B+FAFj
jmp lu_killall
lu_afterkillall: // CODE XREF: sub_502D0B+1163j
jmp lu_kill
lu_afterkill: // CODE XREF: sub_502D0B+14D0j
jmp lu_pickupall
lu_afterpickupall: // CODE XREF: sub_502D0B+160Ej
jmp lu_showmap
lu_aftershowmap: // CODE XREF: sub_502D0B+1AA7j
jmp lu_hidemap
lu_afterhidemap: // CODE XREF: sub_502D0B+1B3Fj
jmp lu_info
lu_afterinfo: // CODE XREF: sub_502D0B+1B3Fj
jmp lu_entermode
lu_afterenter_mode:
jmp lu_own
lu_afterown:
jmp lu_own_for
lu_afterown_for:
// jmp lu_summon_for
lu_aftersummon_for:
jmp locu_5049B2
lu_ready:
mov ecx, 0x63B124
push ecx // "#ready"
lea ecx, [ebp+0Ch]
mov edx, 0x5DA123
call edx
test eax, eax
jnz locu_5031EF
mov ecx, 0x06D1648
cmp dword ptr [ecx], 2
jnz locu_5031EF
mov ecx, 0x06CDB24
mov ecx, dword ptr [ecx]
mov edx, 0x53636E
call edx
test eax, eax
jnz locu_5031EF
mov edx, [ebp+8]
cmp dword ptr [edx+0A6Ch], 0
jnz locu_5031EF
mov eax, [ebp+8]
mov dword ptr [eax+0A6Ch], 1
push 0
mov ecx, 0x6C3A08
mov edx, 0x51D6B4
call edx
mov ecx, 0x06CDB24
mov ecx, dword ptr [ecx]
mov edx, 0x53636E
call edx
test eax, eax
jz locu_5031EF
push 0
push 0
push 0Ah
mov ecx, 0x6C3A08
mov edx, 0x51CE86
call edx
mov ecx, [ebp-1DCh]
mov edx, 0x4F8F86
call edx
push 0
push 0
mov ecx, [ebp-1DCh]
mov edx, 0x4F8FBF
call edx
push 0
push 1
mov ecx, [ebp-1DCh]
mov edx, 0x4F8FBF
call edx
locu_5031EF:
jmp lu_afterready
////////////////
lu_kick: // CODE XREF: sub_502D0B+290j
push 0x63B0BC // "#kick "
lea ecx, [ebp+0Ch]
mov edx, 0x5DA123
call edx
test eax, eax
jnz lu_afterkick
push 6
lea edx, [ebp-90h]
push edx
lea ecx, [ebp+0Ch]
mov edx, 0x5D9F0C
call edx
mov [ebp-1E0h], eax
mov [ebp-1E4h], eax
mov byte ptr [ebp-4], 1
push eax
lea ecx, [ebp+0Ch]
mov edx, 0x5DD9D1
call edx
mov byte ptr [ebp-4], 0
lea ecx, [ebp-90h]
mov edx, 0x5DD88A
call edx
lea ecx, [ebp+0Ch]
mov edx, 0x5DA55C
call edx
push ecx
mov ecx, esp
mov [ebp-94h], esp
lea edx, [ebp+0Ch]
push edx
mov edx, 0x5DD74F
call edx
mov [ebp-1E8h], eax
mov ecx, 0x06CDB24
mov ecx, [ecx]
mov edx, 0x535D39
call edx
push eax
// mov edx, 0x502DE5
call kick_char
jmp locu_502E54
locu_502E54: // CODE XREF: sub_502D0B+D8j
jmp locu_5049B2
///////////////
lu_kickme: // CODE XREF: sub_502D0B+290j
push offset akickme
lea ecx, [ebp+0Ch]
mov edx, 0x5DA123
call edx
test eax, eax
jnz lu_afterkickme
mov eax, [ebp+8]
push eax
// mov edx, 0x502DE5
call kick_char
jmp locu_5049B2
//////////////////////////////////////////////
lu_locate: // CODE XREF: sub_502D0B+29Dj
push 0x63B0C4 // "#locate "
lea ecx, [ebp+0x0C]
mov edx, 0x5DA123
call edx
test eax, eax
jnz lu_afterlocate
push 8
lea edx, [ebp-0x098]
push edx
lea ecx, [ebp+0x0C]
mov edx, 0x5D9F0C
call edx
mov [ebp-0x01EC], eax
mov eax, [ebp-0x01EC]
mov [ebp-0x01F0], eax
mov byte ptr [ebp-0x04], 2
mov ecx, [ebp-0x01F0]
push ecx
lea ecx, [ebp+0x0C]
mov edx, 0x5DD9D1
call edx
mov byte ptr [ebp-0x04], 0
lea ecx, [ebp-0x098]
mov edx, 0x5DD88A
call edx
lea ecx, [ebp+0x0C]
mov edx, 0x5DA55C
call edx
push ecx
mov ecx, esp
mov [ebp-0x09C], esp
lea edx, [ebp+0x0C]
push edx
mov edx, 0x5DD74F
call edx
mov [ebp-0x01F4], eax
mov ecx, 0x06CDB24
mov ecx, [ecx]
mov edx, 0x535D39
call edx
mov [ebp-0x018], eax
cmp [ebp-0x018], 0
jz locu_502F7F
mov eax, [ebp-0x018]
cmp dword ptr [eax+2Ch], 0
jnz locu_502F7F
// mov ecx, [ebp-0x018]
// xor edx, edx
// mov dx, [ecx+4]
// push edx
// mov ecx, 0x6C3A08
// mov edx, 0x518544
// call edx
// mov [ebp-0x010], eax ////////// проверка на вылет
// cmp dword ptr [ebp-0x010], 0
// jz locu_502F7F
lea ecx, [ebp-0x01C]
mov edx, 0x5DD73F
call edx
mov byte ptr [ebp-0x04], 3
mov eax, [ebp-0x018]
mov ecx, [eax+38h]
mov ecx, [ecx+10h]
mov edx, 0x58AB00
call edx
and eax, 0FFh
push eax
mov edx, [ebp-0x018]
mov eax, [edx+38h]
mov ecx, [eax+10h]
mov edx, 0x58AAF0
call edx
and eax, 0FFh
push eax
mov ecx, [ebp-0x018]
mov edx, [ecx+18h]
push edx
push 0x63B0D0 // "%s (%d,%d)"
lea eax, [ebp-0x01C]
push eax
mov edx, 0x5DA3E8
call edx
add esp, 14h
mov ecx, [ebp+0x08]
push ecx
lea edx, [ebp-0x01C]
push edx
mov ecx, 0x6C3A08
mov edx, 0x51CD89
call edx
mov byte ptr [ebp-0x04], 0
lea ecx, [ebp-0x01C]
mov edx, 0x5DD88A
call edx
locu_502F7F: // CODE XREF: sub_502D0B+1DAj
// sub_502D0B+1E7j ...
jmp locu_5049B2
//////////////////////////
lu_create: // CODE XREF: sub_502D0B+2ACj
push 0x63B148 // "#create "
lea ecx, [ebp+0x0C]
mov edx, 0x5DA123
call edx
test eax, eax
jnz lu_aftercreate
jmp locu_503424
locu_503424: // CODE XREF: sub_502D0B+6C7j
push 8
lea eax, [ebp-0x0B4]
push eax
lea ecx, [ebp+0x0C]
mov edx, 0x5D9F0C
call edx
mov [ebp-0x0224], eax
mov ecx, [ebp-0x0224]
mov [ebp-0x0228], ecx
mov byte ptr [ebp-0x04], 8
mov edx, [ebp-0x0228]
push edx
lea ecx, [ebp+0x0C]
mov edx, 0x5DD9D1
call edx
mov byte ptr [ebp-0x04], 0
lea ecx, [ebp-0x0B4]
mov edx, 0x5DD88A
call edx
lea ecx, [ebp+0x0C]
mov edx, 0x5DA55C
call edx
mov eax, [ebp+0x08]
mov ecx, [eax+38h]
xor edx, edx
mov dl, [ecx+13Ch]
test edx, edx
jle locu_5034D3
jmp locu_5034BF
locu_5034BF: // CODE XREF: sub_502D0B+79Cj
mov [ebp-0x04], 0FFFFFFFFh
lea ecx, [ebp+0x0C]
mov edx, 0x5DD88A
call edx
jmp locu_5049C1
// ---------------------------------------------------------------------------
locu_5034D3: // CODE XREF: sub_502D0B+776j
lea edx, [ebp+0x0C]
push edx
mov edx, 0x5049D1
call edx
add esp, 4
mov [ebp-0x030], eax
push 0x63B154 // "Gold"
mov eax, [ebp+0x0C]
push eax // char *
mov edx, 0x5C0AB0
call edx
add esp, 8
mov [ebp-0x010C], eax
cmp dword ptr [ebp-0x010C], 0
jnz locu_503560
push 0
mov ecx, [ebp-0x030]
push ecx
mov ecx, [ebp+0x08]
mov edx, 0x534AC1
call edx
jmp locu_50354C
locu_50354C: // CODE XREF: sub_502D0B+829j
mov [ebp-0x04], 0FFFFFFFFh
lea ecx, [ebp+0x0C]
mov edx, 0x5DD88A
call edx
jmp locu_5049C1
// ---------------------------------------------------------------------------
locu_503560: // CODE XREF: sub_502D0B+7F5j
lea ecx, [ebp+0x0C]
push ecx
mov ecx, 0x6D0668
mov edx, 0x510502
call edx
mov [ebp-0x034], eax
cmp dword ptr [ebp-0x034], 0
jz locu_5036A4
mov ecx, [ebp-0x034]
mov edx, 0x548F6A
call edx
test eax, eax
jnz locu_50361E
mov edx, [ebp-0x034]
mov [ebp-0x0BC], edx
mov eax, [ebp-0x0BC]
mov [ebp-0x0B8], eax
cmp dword ptr [ebp-0x0B8], 0
jz locu_5035C4
push 1
mov ecx, [ebp-0x0B8]
mov edx, [ecx]
mov ecx, [ebp-0x0B8]
call dword ptr [edx+4]
mov [ebp-0x0234], eax
jmp locu_5035CE
// ---------------------------------------------------------------------------
locu_5035C4: // CODE XREF: sub_502D0B+89Cj
mov dword ptr [ebp-0x0234], 0
locu_5035CE: // CODE XREF: sub_502D0B+8B7j
jmp locu_50360A
locu_50360A: // CODE XREF: sub_502D0B+8E7j
mov [ebp-0x04], 0FFFFFFFFh
lea ecx, [ebp+0x0C]
mov edx, 0x5DD88A
call edx
jmp locu_5049C1
// ---------------------------------------------------------------------------
locu_50361E: // CODE XREF: sub_502D0B+87Aj
mov edx, [ebp-0x034]
mov ax, word ptr [ebp-0x030]
mov [edx+42h], ax
mov ecx, [ebp-0x034]
push ecx
mov edx, [ebp+0x08]
mov eax, [edx+38h]
mov ecx, [eax+7Ch]
mov edx, 0x551FA3
call edx
push 0
mov ecx, [ebp+0x08]
mov ecx, [ecx+38h]
mov edx, 0x52A790
call edx
push 0
push 0
push 0FFBh
push 0FFFFFFFFh
mov edx, [ebp+0x08]
push edx
mov eax, [ebp+0x08]
mov ecx, [eax+38h]
push ecx
mov ecx, 0x6C3A08
mov edx, 0x519221
call edx
jmp locu_5036A4
locu_5036A4: // CODE XREF: sub_502D0B+981j
jmp locu_5036E2
locu_5036E2: // CODE XREF: sub_502D0B:locu_5036A4j
// sub_502D0B+9BFj
jmp locu_5049B2
///////////////////////////////////////////////////
lu_modify: // CODE XREF: sub_502D0B+2BBj
push 0x63B15C // "#modify "
lea ecx, [ebp+0x0C]
mov edx, 0x5DA123
call edx
test eax, eax
jnz lu_aftermodify
push 8
lea eax, [ebp-0x0C0]
push eax
lea ecx, [ebp+0x0C]
mov edx, 0x5D9F0C
call edx
mov [ebp-0x0244], eax
mov ecx, [ebp-0x0244]
mov [ebp-0x0248], ecx
mov byte ptr [ebp-0x04], 9
mov edx, [ebp-0x0248]
push edx
lea ecx, [ebp+0x0C]
mov edx, 0x5DD9D1
call edx
mov byte ptr [ebp-0x04], 0
lea ecx, [ebp-0x0C0]
mov edx, 0x5DD88A
call edx
lea ecx, [ebp+0x0C]
mov edx, 0x5DA55C
call edx
mov dword ptr [ebp-0x038], 0
push 0x63B168 // "self"
lea ecx, [ebp+0x0C]
mov edx, 0x5DA123
call edx
test eax, eax
jnz locu_5037C6
push 0x63B170 // "self"
mov edx, 0x5BFCE0
call edx
add esp, 4
push eax
lea eax, [ebp-0x0C4]
push eax
lea ecx, [ebp+0x0C]
mov edx, 0x5D9F0C
call edx
mov [ebp-0x024C], eax
mov ecx, [ebp-0x024C]
mov [ebp-0x0250], ecx
mov byte ptr [ebp-0x04], 0Ah
mov edx, [ebp-0x0250]
push edx
lea ecx, [ebp+0x0C]
mov edx, 0x5DD9D1
call edx
mov byte ptr [ebp-0x04], 0
lea ecx, [ebp-0x0C4]
mov edx, 0x5DD88A
call edx
lea ecx, [ebp+0x0C]
mov edx, 0x5DA55C
call edx
mov dword ptr [ebp-0x038], 1
jmp locu_50384D
// ---------------------------------------------------------------------------
locu_5037C6: // CODE XREF: sub_502D0B+A54j
push 0x63B178 // "army"
lea ecx, [ebp+0x0C]
mov edx, 0x5DA123
call edx
test eax, eax
jnz locu_503839
push 0x63B180 // "army"
mov edx, 0x5BFCE0
call edx
add esp, 4
push eax
lea eax, [ebp-0x0C8]
push eax
lea ecx, [ebp+0x0C]
mov edx, 0x5D9F0C
call edx
mov [ebp-0x0254], eax
mov ecx, [ebp-0x0254]
mov [ebp-0x0258], ecx
mov byte ptr [ebp-0x04], 0Bh
mov edx, [ebp-0x0258]
push edx
lea ecx, [ebp+0x0C]
mov edx, 0x5DD9D1
call edx
mov byte ptr [ebp-0x04], 0
lea ecx, [ebp-0x0C8]
mov edx, 0x5DD88A
call edx
lea ecx, [ebp+0x0C]
mov edx, 0x5DA55C
call edx
mov dword ptr [ebp-0x038], 2
jmp locu_50384D
// ---------------------------------------------------------------------------
locu_503839: // CODE XREF: sub_502D0B+ACAj
mov [ebp-0x04], 0FFFFFFFFh
lea ecx, [ebp+0x0C]
mov edx, 0x5DD88A
call edx
jmp locu_5049C1
// ---------------------------------------------------------------------------
locu_50384D: // CODE XREF: sub_502D0B+AB6j
// sub_502D0B+B2Cj
push 0x63B188 // "+god"
lea ecx, [ebp+0x0C]
mov edx, 0x5DA123
call edx
test eax, eax
jnz locu_5039E3
cmp dword ptr [ebp-0x038], 1
jnz locu_503899
mov eax, [ebp+0x08]
mov ecx, [eax+38h]
mov edx, 0x537251
call edx
push 0
push 0
push 0FFBh
push 0A31FFFFFh
push 0
mov ecx, [ebp+0x08]
mov edx, [ecx+38h]
push edx
mov ecx, 0x6C3A08
mov edx, 0x519221
call edx
jmp locu_5039C8
// ---------------------------------------------------------------------------
locu_503899: // CODE XREF: sub_502D0B+B5Bj
cmp dword ptr [ebp-0x038], 2
jnz locu_5039C8
mov eax, [ebp+0x08]
cmp dword ptr [eax+24h], 0
jz locu_5038BD
mov ecx, [ebp+0x08]
mov edx, [ecx+24h]
add edx, 4
mov [ebp-0x0124], edx
jmp locu_5038C7
// ---------------------------------------------------------------------------
locu_5038BD: // CODE XREF: sub_502D0B+B9Fj
mov dword ptr [ebp-0x0124], 0
locu_5038C7: // CODE XREF: sub_502D0B+BB0j
mov eax, [ebp-0x0124]
mov [ebp-0x044], eax
mov ecx, [ebp-0x044]
mov edx, [ecx+4]
mov [ebp-0x0110], edx
mov eax, [ebp-0x0110]
mov [ebp-0x040], eax
cmp dword ptr [ebp-0x040], 0
jz locu_503935
lea ecx, [ebp-0x040]
mov [ebp-0x011C], ecx
mov edx, [ebp-0x044]
mov [ebp-0x0118], edx
mov eax, [ebp-0x011C]
mov ecx, [eax]
mov [ebp-0x0114], ecx
mov edx, [ebp-0x011C]
mov eax, [ebp-0x0114]
mov ecx, [eax]
mov [edx], ecx
mov edx, [ebp-0x0114]
mov eax, [edx+8]
mov [ebp-0x0120], eax
mov ecx, [ebp-0x0120]
mov [ebp-0x03C], ecx
jmp locu_50393C
// ---------------------------------------------------------------------------
locu_503935: // CODE XREF: sub_502D0B+BDEj
mov dword ptr [ebp-0x03C], 0
locu_50393C: // CODE XREF: sub_502D0B+C28j
// sub_502D0B:locu_5039C3j
cmp dword ptr [ebp-0x03C], 0
jz locu_5039C8
mov ecx, [ebp-0x03C]
mov edx, 0x537251
call edx
push 0
push 0
push 0FFBh
push 0A31FFFFFh
push 0
mov edx, [ebp-0x03C]
push edx
mov ecx, 0x6C3A08
mov edx, 0x519221
call edx
cmp dword ptr [ebp-0x040], 0
jz locu_5039BC
lea eax, [ebp-0x040]
mov [ebp-0x0130], eax
mov ecx, [ebp-0x044]
mov [ebp-0x012C], ecx
mov edx, [ebp-0x0130]
mov eax, [edx]
mov [ebp-0x0128], eax
mov ecx, [ebp-0x0130]
mov edx, [ebp-0x0128]
mov eax, [edx]
mov [ecx], eax
mov ecx, [ebp-0x0128]
mov edx, [ecx+8]
mov [ebp-0x0134], edx
mov eax, [ebp-0x0134]
mov [ebp-0x03C], eax
jmp locu_5039C3
// ---------------------------------------------------------------------------
locu_5039BC: // CODE XREF: sub_502D0B+C65j
mov dword ptr [ebp-0x03C], 0
locu_5039C3: // CODE XREF: sub_502D0B+CAFj
jmp locu_50393C
// ---------------------------------------------------------------------------
locu_5039C8: // CODE XREF: sub_502D0B+B89j
// sub_502D0B+B92j ...
// push 0
// mov ecx, [ebp+0x08]
// movsx edx, word ptr [ecx+4]
// push edx
// push 7
// mov ecx, 0x6C3A08 ///// ОТПРАВКА СООБЩЕНИЯ ИГРОК РЕШИЛ ИГРАТЬ НЕЧЕСТНО
// mov edx, 0x51CE86
// call edx
jmp locu_503C85
// ---------------------------------------------------------------------------
locu_5039E3: // CODE XREF: sub_502D0B+B51j
push 0x63B190 // "+spell "
lea ecx, [ebp+0x0C]
mov edx, 0x5DA123
call edx
test eax, eax
jnz locu_503B5B
push 0x63B198 // "+spell "
mov edx, 0x5BFCE0
call edx
add esp, 4
push eax
lea eax, [ebp-0x0CC]
push eax
lea ecx, [ebp+0x0C]
mov edx, 0x5D9F0C
call edx
mov [ebp-0x025C], eax
mov ecx, [ebp-0x025C]
mov [ebp-0x0260], ecx
mov byte ptr [ebp-0x04], 0Ch
mov edx, [ebp-0x0260]
push edx
lea ecx, [ebp+0x0C]
mov edx, 0x5DD9D1
call edx
mov byte ptr [ebp-0x04], 0
lea ecx, [ebp-0x0CC]
mov edx, 0x5DD88A
call edx
lea ecx, [ebp+0x0C]
mov edx, 0x5DA55C
call edx
cmp dword ptr [ebp-0x038], 1
jnz locu_503B56
mov eax, [ebp+0x08]
mov ecx, [eax+38h]
mov [ebp-0x048], ecx
mov edx, [ebp-0x048]
cmp dword ptr [edx+140h], 0
jnz locu_503A84
mov [ebp-0x04], 0FFFFFFFFh
lea ecx, [ebp+0x0C]
mov edx, 0x5DD88A
call edx
jmp locu_5049C1
// ---------------------------------------------------------------------------
locu_503A84: // CODE XREF: sub_502D0B+D63j
mov eax, [ebp+0x0C]
push eax // char *
mov edx, 0x5BF920
call edx
add esp, 4
mov [ebp-0x04C], eax
cmp dword ptr [ebp-0x04C], 0
jle locu_503B1D
mov ecx, 0x06D074C
mov ecx, [ecx]
mov [ebp-0x0138], ecx
mov edx, [ebp-0x04C]
cmp edx, [ebp-0x0138]
jge locu_503B1D
push 14h
mov edx, 0x5DDF54