forked from igroglaz/srvmgr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common_new.cpp
1474 lines (1286 loc) · 23.8 KB
/
common_new.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 "srvmgr_new.h"
#include "config_new.h"
#include "lib\utils.hpp"
#include "srvmgrdef.h"
#include "zxmgr.h"
#include "cheat_codes_new.h"
#include "player_info.h"
#include "srvmgr.h"
void __declspec(naked) imp_ServerStarted()
{
__asm
{
mov edx, [ebp-0xB0]
mov [ebp-0x70], edx
mov [ebp-0x04], 0xFFFFFFFF
mov eax, [ebp-0x70]
mov ebx, 0x006CDB24
mov [ebx], eax
call OnInitializeServer
mov [ebp-0x30], 0
mov edx, 0x004F0A23
jmp edx
}
}
void __declspec(naked) imp_LoadedMap()
{
__asm
{
call OnInitializeMap
mov edx, 0x004F19EE
jmp edx
}
}
void __declspec(naked) imp_LoadingMap()
{
__asm
{
push ebp
mov ebp, esp
push 0xFFFFFFFF
push 0x006008B3
mov eax, fs:[0]
push eax
mov fs:[0], esp
sub esp, 0x11C
push ebx
push esi
mov [ebp-0xE4], ecx
mov [ebp-0x04], 0
call OnPreInitializeMap
mov edx, 0x004F149E
jmp edx
}
}
void __declspec(naked) imp_MapLoadError()
{
__asm
{
push ecx
mov esi, esp
mov [ebp-0x54], esp
push [ebp-0x18]
push [ebp+0x08]
call OnInitializeMapError
add esp, 8
mov edx, 0x0059BA2A
jmp edx
}
}
void __declspec(naked) imp_ServerClosed()
{
__asm
{
call OnServerClosed
mov edx, 0x004F2FE1
jmp edx
}
}
void __declspec(naked) imp_ShopError()
{
__asm
{
call OnShopError
mov edx, 0x0054DBBA
jmp edx
}
}
void __declspec(naked) imp_ServerTic()
{
__asm
{
push ebp
mov ebp, esp
sub esp, 0xBC
push esi
mov [ebp-0xBC], ecx
call OnServerTic
mov edx, 0x004FBB89
jmp edx
}
}
void __declspec(naked) imp_LocalMessageBox()
{
__asm
{
push ebp
mov ebp, esp
push [ebp+0x08]
call OnLocalMessageBox
add esp, 4
mov esp, ebp
pop ebp
retn 0x0C
}
}
void OnMapClosedRejected(const char* name, const char* login)
{
Printf("Player %s login %s has been rejected (Map closed)\n", name, login);
}
void __declspec(naked) imp_MapClosed()
{
__asm
{
mov edx, [ebp-0x30]
mov eax, [edx+0x14]
and eax, GMF_ANY
cmp eax, GMF_ANY
jz mc_allow2
test [Config::ServerFlags], SVF_CLOSED
jz mc_allow
push [ebp+0x14]
push [ebp+0x10]
call OnMapClosedRejected
add esp, 8
mov [ebp-0x2B0], 1
mov edx, 0x004FF418
jmp edx
mc_allow:
mov eax, 0x006D1648
cmp [eax], 0
mov edx, 0x004FE2D7
jmp edx
mc_allow2:
mov edx, 0x004FE950
jmp edx
}
}
void OnServerChatMessage(char* what)
{
CharToOemA(what, what);
Printf("<server>: %s", what);
if(what[0] != '#') zxmgr::SendMessage(NULL, "<server>: %s", what);
else RunCommand(NULL, NULL, what, 0xFFFFFFFF, true);
}
void __declspec(naked) imp_ServerChat()
{
__asm
{
push [ebp-0x10]
call OnServerChatMessage
add esp, 4
mov edx, 0x00494FDF
jmp edx
}
}
void __declspec(naked) imp_PIadd()
{
__asm
{
mov eax, [ebp+0x08]
test eax, eax
jz pia_skip
movzx ebx, word ptr [eax+4]
cmp ebx, 0x10
jb pia_skip
cmp ebx, 0x20
ja pia_skip
push eax
call PI_Create
add esp, 4
pia_skip:
mov esp, ebp
pop ebp
retn 0x0004
}
}
void __declspec(naked) imp_PIdel()
{
__asm
{
mov eax, [ebp-0x10]
test eax, eax
jz pid_skip
push eax
call PI_Delete
add esp, 4
pid_skip:
push ecx
mov esi, esp
mov [ebp-0x40], esp
mov edx, 0x0053543F
jmp edx
}
}
bool CheckShield(byte* player)
{
Player* pi = PI_Get(player);
if(!pi) return false;
if(!pi->Casted)
{
pi->Casted = true;
return true;
}
return false;
}
void LogShield(const char* name)
{
Printf("Warning: player %s tried to use shield bug!", name);
}
void __declspec(naked) imp_CheckShield()
{
__asm
{
mov eax, [ebp-0xFC]
test eax, eax
jz cs_skip_cast
mov ecx, [eax+0x38]
test byte ptr [ecx+0x4C], 8
jz cs_skip_cast
push eax
call CheckShield
add esp, 4
test al, al
jz cs_skip_cast_log
// cast shield&resists&invis
mov edx, 0x00506A6C
jmp edx
cs_skip_cast:
mov edx, 0x005070EC
jmp edx
cs_skip_cast_log:
mov eax, [ebp-0xFC]
push [eax+0x18]
call LogShield
add esp, 4
jmp cs_skip_cast
}
}
void ReturnFailProc(byte* unit)
{
if(!unit) return;
byte* player = *(byte**)(unit + 0x14);
if(!player) return;
if(unit != *(byte**)(player + 0x38)) return; // only for main character
Player* pi = PI_Get(player);
if(!pi) return;
pi->ShouldReturn = true;
pi->LastReturn = GetTickCount();
Printf("Warning: unit of player %s couldn't return to map.", *(const char**)(player + 0x18));
}
void __declspec(naked) imp_ReturnFail()
{
__asm
{
push [ebp-0x08]
call ReturnFailProc
add esp, 4
xor eax, eax
mov esp, ebp
pop ebp
retn
}
}
uint32_t _stdcall OnCast(byte* cptr)
{
if(!cptr) return 0;
byte* pptr = *(byte**)(cptr + 0x14);
if(!pptr || *(uint32_t*)(pptr + 0x2C)) return 0;
uint32_t rights = *(uint32_t*)(pptr + 0x14);
if((rights & 0x3F000000) != 0x3F000000) return 0;
uint32_t ac_data = *(uint32_t*)(cptr + 0x1C4);
uint8_t action = *(uint8_t*)(ac_data + 0x08);
uint8_t action_2 = *(uint8_t*)(ac_data + 0x09);
if(action != 8 && action != 9) return 0; // unit cast, point cast
return 1;
}
void __declspec(naked) imp_OnCast1()
{
__asm
{
push esi
push [ebp+0x08]
call OnCast
pop esi
cmp eax, 0
jz oc1_continue_normal
mov eax, 1
pop esi
mov esp, ebp
pop ebp
retn 0x000C
oc1_continue_normal:
mov ax, [ebp+0x0C]
push eax
mov ecx, [ebp+0x08]
mov ecx, [ecx+0x10]
mov edx, 0x0058AADE
call edx
mov edx, 0x0058FF26
jmp edx
}
}
void __declspec(naked) imp_OnCast2()
{
__asm
{
push [ebp+0x08]
call OnCast
cmp eax, 0
jz oc2_continue_normal
jmp loc_58FFAC
oc2_continue_normal:
mov ecx, [ebp-0x04]
and ecx, 0xFF
mov edx, [ebp+0x10]
and edx, 0xFF
cmp ecx, edx
jg loc_58FFCE
loc_58FFAC:
mov ebx, 0x0058FFAC
jmp ebx
loc_58FFCE:
mov ebx, 0x0058FFCE
jmp ebx
}
}
void __declspec(naked) imp_OnCast3()
{
__asm
{
push esi
push [ebp+0x08]
call OnCast
pop esi
cmp eax, 0
jz oc3_continue_normal
mov eax, 1
pop esi
mov esp, ebp
pop ebp
retn 0x000C
oc3_continue_normal:
push [ebp+0x0C]
push [ebp+0x08]
mov ecx, [ebp-0x04]
mov edx, 0x0059190D
call edx
mov edx, 0x0058FEB8
jmp edx
}
}
void __declspec(naked) imp_OnCast4()
{
__asm
{
push [ebp+0x08]
call OnCast
cmp eax, 0
jz oc4_continue_normal
jmp loc_5902EE
oc4_continue_normal:
mov edx, [ebp-0x08]
and edx, 0xFF
mov eax, [ebp+0x10]
and eax, 0xFF
cmp edx, eax
jg loc_590303
loc_5902EE:
mov ebx, 0x005902EE
jmp ebx
loc_590303:
mov ebx, 0x00590303
jmp ebx
}
}
void __declspec(naked) imp_Experience1()
{
__asm
{
cmp ecx, MAX_SKILL
jle loc_530D55
mov ecx, MAX_SKILL
mov [ebp-0x38], ecx
jmp loc_530D66
loc_530D55:
mov [ebp-0x38], ecx
loc_530D66:
mov edx, 0x00530D66
jmp edx
}
}
void __declspec(naked) imp_Experience2()
{
__asm
{
cmp ecx, MAX_SKILL
jge loc_530CC6
mov edx, 0x00530AF3
jmp edx
loc_530CC6:
mov edx, 0x00530CC6
jmp edx
}
}
void __declspec(naked) imp_Experience3()
{
__asm
{
cmp ecx, MAX_SKILL
jge loc_530AB2
mov edx, 0x00530921
jmp edx
loc_530AB2:
mov edx, 0x00530AB2
jmp edx
}
}
void __declspec(naked) imp_Experience4()
{
__asm
{
add edx, [ebp-0x24]
cmp edx, MAX_SKILL
jle loc_52CD41
mov edx, MAX_SKILL
mov [ebp-0x158], edx
mov edx, 0x0052CD5B
jmp edx
loc_52CD41:
mov edx, 0x0052CD41
jmp edx
}
}
void __declspec(naked) imp_Experience5()
{
__asm
{
cmp eax, MAX_SKILL
jle loc_531C63
mov eax, MAX_SKILL
mov [ebp-0x88], eax
jmp loc_531C77
loc_531C63:
mov [ebp-0x88], eax
loc_531C77:
cmp [ebp-0x88], 0
jge loc_531C8C
mov [ebp-0x8C], 0
jmp loc_531CCB
loc_531C8C:
mov [ebp-0x8C], eax
loc_531CCB:
mov edx, [ebp-0x1C]
mov eax, [ebp-0x28]
mov cx, [ebp-0x8C]
mov [eax+edx*2+0xA8], cx
mov edx, 0x00531C31
jmp edx
}
}
void __declspec(naked) imp_Experience6()
{
__asm
{
movsx edx, word ptr [ecx+eax*2+0xA8]
cmp edx, MAX_SKILL
jle loc_531D1C
mov edx, MAX_SKILL
mov [ebp-0x94], edx
mov edx, 0x00531D30
jmp edx
loc_531D1C:
mov edx, 0x00531D1C
jmp edx
}
}
void __declspec(naked) imp_Experience7()
{
__asm
{
push MAX_SKILL
mov edx, 0x00530726
call edx
add esp, 4
mov [ebp-0x54], eax
mov [ebp-0x48], 1
mov edx, 0x005610FB
jmp edx
}
}
void FixExperience(void* t_ptr)
{
if(MAX_SKILL > 100) return;
unsigned long* exp = (unsigned long*)((char*)t_ptr + 0x20);
for(int i = 0; i < 5; i++)
if(exp[i] > 13779612) exp[i] = 13779612;
unsigned long* mny = (unsigned long*)((char*)t_ptr + 0x10);
if(*mny > 2147483647) *mny = 2147483647;
}
void __declspec(naked) imp_FixExperience()
{
__asm
{
push 0x34
push 0x006CDB40
mov edx, 0x004F5308
call edx
add esp, 8
cmp eax, [ebp-0x10]
jnz loc_4F68A7
push 0x006CDB40
call FixExperience
add esp, 4
mov edx, 0x004F689C
jmp edx
loc_4F68A7:
mov edx, 0x004F68A7
jmp edx
}
}
void _stdcall imp_FixMoney(unsigned long money, unsigned long flags)
{
byte* pthis;
__asm mov pthis, ecx;
if(!pthis) return;
uint32_t leftover = 0;
if(money > 0x7FFFFFFF)
{
leftover = money - 0x7FFFFFFF;
money = 0x7FFFFFFF;
}
unsigned long cur_money = *(unsigned long*)(pthis + 0x3C);
if(cur_money > 0x7FFFFFFF)
{
leftover += cur_money - 0x7FFFFFFF;
cur_money = 0x7FFFFFFF;
}
cur_money += money;
if(cur_money > 0x7FFFFFFF)
{
leftover += cur_money - 0x7FFFFFFF;
cur_money = 0x7FFFFFFF;
}
*(unsigned long*)(pthis + 0x3C) = cur_money;
if(leftover > 0x7FFFFFFF) leftover = 0x7FFFFFFF;
byte* unit = *(byte**)(pthis + 0x38);
if(unit && leftover)
{
uint32_t p_x = *(uint8_t*)(*(byte**)(unit + 0x10));
uint32_t p_y = *(uint8_t*)(*(byte**)(unit + 0x10) + 1);
zxmgr::CreateSack(NULL, p_x, p_y, leftover);
}
__asm
{
push [pthis]
push [flags]
push [cur_money]
push 0x67
mov ecx, 0x006C3A08
mov edx, 0x0051CEFB
call edx
}
}
void __declspec(naked) imp_LogIP()
{
__asm
{
push [ebp+0x08]
call LogIP
add esp, 4
mov edx, 0x004FF817
jmp edx
}
}
void _stdcall UseItems(byte* unit, byte* packet)
{
if(!(Config::ServerFlags & SVF_NOHEALING)) return;
uint8_t source = *(uint8_t*)(packet+0x0C);
uint8_t destination = *(uint8_t*)(packet+0x0D);
uint8_t order = *(uint16_t*)(packet+0x0E);
uint8_t count = *(uint16_t*)(packet+0x10);
if(source == 2 && destination == 1) // moving item onto character
{
// find the item player is trying to use
byte* pack = *(byte**)(unit + 0x7C);
if(!pack) return;
uint32_t index = 0;
byte* lp = *(byte**)(pack + 4);
while(lp)
{
byte* item = *(byte**)(lp + 8);
if(index == order)
{
std::string item_name = *(const char**)(*(byte**)(item + 0x3C) + 4);
if((item_name == "Potion Big Healing" ||
item_name == "Potion Medium Healing") && (Config::ServerFlags & SVF_NOHEALING))
{
*(uint8_t*)(packet+0x0D) = 0; // destination=source
*(uint8_t*)(packet+0x0C) = 0;
zxmgr::UpdateUnit(unit, NULL, 0xFFFFFFFF, 0xFFB, 0, 0);
}
break;
}
lp = *(byte**)(lp);
index++;
}
}
}
char aPotionBigHealing[] = "Potion Big Healing";
char aPotionMediumHealing[] = "Potion Medium Healing";
void _stdcall logOddShit(int16_t value, uint32_t from)
{
//zxmgr::SendMessage(NULL, "added %d -- %08x", value, from);
log_format("added %d -- %08X\n", value, from);
}
bool _stdcall testOkayEffect(byte* pthis, byte* unit, uint32_t unk)
{
uint8_t parmType = *(uint8_t*)(pthis+0x3C);
uint8_t parmWay = *(uint8_t*)(pthis+0x3D);
// "health" + "singleuse"
if(parmType == 6 && parmWay == 8 && (Config::ServerFlags & SVF_NOHEALING))
{
//zxmgr::SendMessage(NULL, "health disallowed");
return false;
}
return true;
}
// imp -> 53FA2B
void __declspec(naked) test_health()
{
__asm
{
push ebp
mov ebp, esp
sub esp, 0x08
mov [ebp-0x04], ecx
push [ebp+0x0C]
push [ebp+0x08]
push ecx
call testOkayEffect
and eax, 0xFF
test eax, eax
jz th_exit
push [ebp+0x0C]
push [ebp+0x08]
mov ecx, [ebp-0x04]
call original_53FA2B
th_exit:
mov esp, ebp
pop ebp
retn 0x0008
original_53FA2B:
push ebp
mov ebp, esp
push 0xFFFFFFFF
push 0x0060321E
mov eax, 0x0053FA35
jmp eax
}
}
// imp -> 505A0C
void __declspec(naked) imp_UseItems()
{
__asm
{
mov [ebp-0x50], 0
mov eax, [ebp-0x54]
mov dword ptr [eax+0x150], 0
mov ecx, [ebp-0x5C]
movzx edx, byte ptr [ecx+0x0C]
cmp edx, 2
jnz loc_505A85
mov eax, [ebp-0x54]
mov ecx, [eax+0x7C]
mov edx, [ecx+0x0C]
mov [ebp-0xB5C], edx
mov [ebp-0x48], edx
mov ecx, [ebp-0x5C]
movzx edx, word ptr [ecx+0x12]
push edx
mov eax, [ebp-0x5C]
movzx ecx, word ptr [eax+0x0E]
push ecx
mov edx, [ebp-0x54]
mov ecx, [edx+0x7C]
mov edx, 0x00552E42
call edx
mov [ebp-0x60], eax
cmp [ebp-0x60], 0
jz loc_505A80
// check if we should omit health potions
mov eax, [ebp-0x5C]
cmp byte ptr [eax+0x0C], 2
jnz loc_505A6B
cmp byte ptr [eax+0x0D], 1
jnz loc_505A6B
test [Config::ServerFlags], SVF_NOHEALING
jz loc_505A6B
/*mov eax, [ebp-0x60]
mov ebx, [eax+0x3C]
mov ebx, [ebx+4] // Item name string
push offset aPotionMediumHealing
push ebx
mov edx, 0x005BEDB0
call edx // strcmp
test eax, eax
jz ui_delete_item
mov eax, [ebp-0x60]
mov ebx, [eax+0x3C]
mov ebx, [ebx+4]
push offset aPotionBigHealing
push ebx
mov edx, 0x005BEDB0
call edx // strcmp
test eax, eax
jz ui_delete_item*/
/*mov eax, [ebp-0x60]
movzx ecx, word ptr [eax+0x40]
push ecx
call logOddShit*/
mov eax, [ebp-0x60] // item
movzx ecx, word ptr [eax+0x40] // id
cmp ecx, 0x0E47 // Potion Big Healing
jz ui_delete_item
cmp ecx, 0x0E46
jz ui_delete_item
loc_505A6B:
mov edx, 0x00505A6B
jmp edx
ui_delete_item:
mov ecx, [ebp-0x60]
mov edx, [ecx]
push 1
call [edx+4]
mov [ebp-0x60], 0
push 0
push 0
push 0
push 3
push 0
push [ebp-0x54] // update unit
mov ecx, 0x006C3A08
mov edx, 0x00519221
call edx
jmp loc_50864E
loc_505A80:
mov edx, 0x00505A80
jmp edx
loc_505A85:
mov edx, 0x00505A85
jmp edx
loc_50864E:
mov edx, 0x0050864E
jmp edx
}
}
// imp -> 54F041
void __declspec(naked) imp_CreateItemParameter()
{
__asm
{
push [ebp+0x24]
push eax
call CreateItemParameter
add esp, 8
mov ecx, [ebp-0x0C]
mov fs:[0], ecx
mov esp, ebp
pop ebp
retn
}
}
// imp -> 54EBC9
void __declspec(naked) imp_CreateItemParameterCall1()
{
__asm
{
push [ebp+0x08] // +24
push 0x64 // +20
mov edx, [ebp+0x08]
push [edx+0x1C] // +1C
push [ebp-0x10] // +18
push [ebp-0x18] // +14
push [ebp-0x14] // +10
push [ebp-0x1C] // +C
push [ebp-0x08] // +8
mov edx, 0x0054EDE9
call edx
add esp, 0x20
mov [ebp-0x04], eax
mov edx, 0x0054EBF1
jmp edx
}
}
// imp -> 54EC68
void __declspec(naked) imp_CreateItemParameterCall2()
{
__asm
{
push [ebp+0x08] // +24
push 0x64 // +20
mov edx, [ebp+0x08]
push [edx+0x1C] // +1C
push [ebp-0x10] // +18
push [ebp-0x18] // +14
push [ebp-0x14] // +10
push [ebp-0x1C] // +C
push [ebp-0x08] // +8
mov edx, 0x0054EDE9
call edx
add esp, 0x20
mov [ebp-0x04], eax
mov edx, 0x0054EC90
jmp edx
}
}
// imp -> 54ED35
void __declspec(naked) imp_CreateItemParameterCall3()
{
__asm
{
push [ebp+0x08] // +24
push 0x64 // +20
mov edx, [ebp+0x08]
push [edx+0x1C] // +1C
push [ebp-0x10] // +18
push [ebp-0x18] // +14
push [ebp-0x14] // +10
push [ebp-0x1C] // +C
push [ebp-0x08] // +8
mov edx, 0x0054EDE9
call edx
add esp, 0x20
mov [ebp-0x04], eax
mov edx, 0x0054ED5D
jmp edx
}
}
// íèâàëîâñêèé õàê äëÿ ïàóêîâ:
// Spider.5: damage: Administrator ZZYZX -> 131-131 -> Monsters;
// min.damage = (131 & 0x7F) * 15
// max.damage = 131 * 15
// real max.damage = min.damage+max.damage
// 45-2010
void DamagePhysical(byte* victim, byte* damage, byte* attacker, uint32_t return_addr)
{
*(uint16_t*)(attacker + 0xA6) = 2010;
const char* name_victim = "(unnamed)";
const char* name_attacker = "(unnamed)";
if(*(byte**)(victim + 0x14)) name_victim = *(const char**)(*(byte**)(victim + 0x14) + 0x18);
if(*(byte**)(attacker + 0x14)) name_attacker = *(const char**)(*(byte**)(attacker + 0x14) + 0x18);
zxmgr::SendMessage(NULL, "damage: %s -> %u-%u -> %s; return_addr = %08x", name_attacker, *(uint8_t*)(damage+0x0E), *(uint8_t*)(damage+0x0F), name_victim, return_addr);
log_format("damage: %s -> %u-%u; return_addr = %08x\n", name_attacker, *(uint8_t*)(damage+0x0E), *(uint8_t*)(damage+0x0F), name_victim, return_addr);
}
// imp -> 536B31
void __declspec(naked) imp_DamagePhysical()
{
__asm
{