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
|
#include <windows.h>
#define US_VERSION
#ifndef US_VERSION // JP version
#define DMG_PACKET_PROC 0x45FCC0
#define MONSTER_LIST1 0x8E96F0
#define MONSTER_LIST2 0x9D80E0
#define MONSTER_HP_OFFSET 0xAD64
#else // US version
#define DMG_PACKET_PROC 0x459620
#define MONSTER_LIST1 0x943C48
#define MONSTER_LIST2 0xA327C8
#define MONSTER_HP_OFFSET 0xAD6C
#endif
typedef int (__cdecl * DamagePacketFp)(int, int, int, int, int, int, int);
const DamagePacketFp meleeDamage = DMG_PACKET_PROC;
const DWORD* monsterList1 = MONSTER_LIST1;
const BYTE** monsterList2 = MONSTER_LIST2;
BOOL kill = FALSE;
DWORD CALLBACK ThreadProc(LPVOID lpParam)
{
DWORD mobID;
while (1) {
Sleep(100);
if (!kill)
continue;
for (mobID = 0; mobID < 0x1F4; mobID++) {
if (monsterList1[mobID] == 0)
continue;
if (*(DWORD*)(monsterList2[mobID]+MONSTER_HP_OFFSET) > 0) {
meleeDamage(1, 1, 1, 0, 0, mobID, 0);
break;
}
}
}
return 1;
}
DWORD CALLBACK HotkeyProc(LPVOID lpParam)
{
while (1) {
Sleep(300);
if (GetAsyncKeyState(VK_F5))
kill = !kill;
}
return 1;
}
BOOL CALLBACK _DllMainCRTStartup(HINSTANCE hInst, DWORD fdwReason, LPVOID lpvReserved)
{
if (fdwReason == DLL_PROCESS_ATTACH) {
if (!CreateThread(NULL, 0, &ThreadProc, NULL, 0, NULL))
return FALSE;
if (!CreateThread(NULL, 0, &HotkeyProc, NULL, 0, NULL))
return FALSE;
}
return TRUE;
}
|