forked from jewalky/a2mgr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
administrat_fix.cpp
104 lines (94 loc) · 2.48 KB
/
administrat_fix.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
#include <cstring>
char* _stdcall GetFirstName(unsigned long dch)
{
char* longname = (char*)(*(unsigned long*)(dch + 0x14) + 0x14);
if(strstr(longname, "Administrator ") == longname) return "Administrator";
if(strstr(longname, "GameMaster ") == longname) return "GameMaster";
if(strstr(longname, "TournamentMaster ") == longname) return "TournamentMaster";
if(strstr(longname, "BalanceMaker ") == longname) return "BalanceMaker";
return "";
}
char* _stdcall GetSecondName(unsigned long dch)
{
int position = 0;
char* longname = (char*)(*(unsigned long*)(dch + 0x14) + 0x14);
if(strstr(longname, "Administrator ") == longname) position = 14;
else if(strstr(longname, "GameMaster ") == longname) position = 11;
else if(strstr(longname, "TournamentMaster ") == longname) position = 17;
else if(strstr(longname, "BalanceMaker ") == longname) position = 13;
return (longname + position);
}
bool _stdcall CheckNickname(unsigned long dunit)
{
char* longname = (char*)(*(unsigned long*)(dunit + 0x14) + 0x14);
if(*(char*)(dunit + 0xF8) != 0) return false;
if((strstr(longname, "Administrator ") == longname) ||
(strstr(longname, "GameMaster ") == longname) ||
(strstr(longname, "TournamentMaster ") == longname) ||
(strstr(longname, "BalanceMaker ") == longname)) return true;
return false;
}
// (+ 14) + 14 = nickname
void __declspec(naked) ADMINISTRAT()
{
__asm
{
push [ebp-0x58]
call CheckNickname
test eax, eax
jz def_proc
mov edx, [ebp-0x58]
mov eax, [edx+0x14]
mov ecx, [eax+0x0C]
shl ecx, 5
add ecx, 0x00629C90
push ecx
push 2
push [ebp-0x58]
call GetSecondName
push eax
mov eax, [ebp-0x1C]
sub eax, 0x0F
push eax
mov ecx, [ebp-0x18]
add ecx, [ebp-0x20]
sar ecx, 1
push ecx
mov edx, 0x0062A6C8
mov ecx, [edx]
mov edx, [ecx]
call dword ptr [edx+0x14]
mov edx, [ebp-0x58]
mov eax, [edx+0x14]
mov ecx, [eax+0x0C]
shl ecx, 5
add ecx, 0x00629C90
push ecx
push 2
push [ebp-0x58]
call GetFirstName
push eax
mov eax, [ebp-0x1C]
sub eax, 0x19
push eax
mov ecx, [ebp-0x18]
add ecx, [ebp-0x20]
sar ecx, 1
push ecx
mov edx, 0x0062A6C8
mov ecx, [edx]
mov edx, [ecx]
call dword ptr [edx+0x14]
mov edx, 0x0046B1BC
jmp edx
def_proc:
mov eax, [ebp-0x58]
mov ecx, [eax+0x14]
mov edx, [ecx+0x0C]
shl edx, 5
add edx, 0x00629C90
push edx
mov edx, 0x0046B191
jmp edx
}
}