forked from jewalky/srvmgr
-
Notifications
You must be signed in to change notification settings - Fork 5
/
spell_duration_fix.cpp
55 lines (54 loc) · 1.31 KB
/
spell_duration_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
void __declspec(naked) fix_spell_duration_overflow_0053973E()
{ // 0053973E
__asm
{
cmp eax, 0xFFFF
jle short ret_point
mov eax, 0xFFFF
ret_point:
// restore overridden code begin
mov edx, [ebp-0xC]
mov [edx+10h], ax
// restore overridden code
// jump back
mov edx, 0x00539745
jmp edx
}
}
// FUNCTIONS BELOW ARE DIFFERENT
void __declspec(naked) fix_spell_duration_overflow()
{ // 0053BFA1
__asm
{
cmp eax, 0xFFFF
jle short ret_point
mov eax, 0xFFFF
ret_point:
mov edx, [ebp-0x44]
mov [edx+0x42], ax
pop eax
inc eax
push eax
ret
}
}
//using spells parameter Duration from DATA.BIN instead of constant coding
void __declspec(naked) fix_StoneCurseDurationCalculation()
{ // 005396D9, 0053C32E
__asm
{
cmp dword ptr [esp],0x05396D9+6
jne call2
call1:
mov edx, [ebp-0x0C]
jmp calc
call2: //cmp dword ptr [esp],0x053C32E+6
mov edx, [ebp-0x02FC]
calc:
mov edx, [edx+4]
mov edx, [edx+0x0C]
mov edx, [edx+0x0E*4]
imul edx
ret
}
}