-
Notifications
You must be signed in to change notification settings - Fork 13
/
OutTownSelect.cpp
71 lines (60 loc) · 1.31 KB
/
OutTownSelect.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
#include "stdafx.h"
#ifdef MODULE_OUTTOWNSELECT
int __fastcall OutTownSelectPatch(UnitAny *pUnit) {
if ( tOutTownSelect.isOn==0 && fPlayerInTown==FALSE )return -1;
if (CheckUnitSelect(pUnit)) return 1;
return -1;
}
void __declspec(naked) OutTownSelectPatch_ASM1() {
__asm {
shr eax, 0x15
and eax, 1
jnz donothing
mov ecx, ebp
call OutTownSelectPatch;
cmp al, 0xFF
jz quitcode
add dword ptr [esp], 0xA2 // adjust return address
mov [esp+4+0x34], eax // save return result
pop eax // return address to eax
push esi // push esi and edi because the return address skips these two instructions
push edi
jmp eax
donothing:
ret
quitcode:
xor eax, eax
ret
}
}
//技能点击玩家会跑过去,这里修正
BOOL __stdcall CheckOutTownSelected( UnitAny *pUnit )
{
if ( tOutTownSelect.isOn ==0 ) return FALSE;
if ( fPlayerInTown ) return FALSE;
if ( pUnit ){
if ( pUnit->dwUnitType == UNITNO_PLAYER ) return TRUE;
if ( pUnit->dwUnitType==UNITNO_MONSTER && D2GetMonsterOwner(pUnit->dwUnitId)!= (DWORD)-1 ) return TRUE;
}
return FALSE;
}
void __declspec(naked) OutTownSelectPatch_ASM2()
{
__asm {
// ebx pUnit
jnz orgcontinue
//check
push esi
push edi
push ebx
call CheckOutTownSelected;
test eax, eax
pop edi
pop esi
jnz orgcontinue
add dword ptr [esp], 0xA2
orgcontinue:
ret
}
}
#endif