#include <Windows.h>
using namespace std;
DWORD dwOldProtect;
#define jmp(frm, to) (int)(((int)to - (int)frm) - 5)
void MakePageWritable(unsigned long ulAddress, unsigned long ulSize)
{
MEMORY_BASIC_INFORMATION* mbi = new MEMORY_BASIC_INFORMATION;
VirtualQuery((void*)ulAddress, mbi, ulSize);
if (mbi->Protect != PAGE_EXECUTE_READWRITE)
{
unsigned long* ulProtect = new unsigned long;
VirtualProtect((void*)ulAddress, ulSize, PAGE_EXECUTE_READWRITE, ulProtect);
delete ulProtect;
}
delete mbi;
}
void WriteMemory(unsigned long ulAddress, unsigned long ulAmount, ...)
{
va_list va;
va_start(va, ulAmount);
MakePageWritable(ulAddress, ulAmount);
for (unsigned long ulIndex = 0; ulIndex < ulAmount; ulIndex++)
{
*(unsigned char*)(ulAddress + ulIndex) = va_arg(va, unsigned char);
}
va_end(va);
}
void Jump(unsigned long ulAddress, void* Function, unsigned Nops)
{
VirtualProtect((void*)ulAddress, Nops + 5, PAGE_EXECUTE_READWRITE, &dwOldProtect);
*(unsigned char*)ulAddress = 0xE9;
*(unsigned long*)(ulAddress + 1) = jmp(ulAddress, Function);
memset((void*)(ulAddress + 5), 0x90, Nops);
VirtualProtect((void*)ulAddress, Nops + 5, dwOldProtect, &dwOldProtect);
}
DWORD AggroAddy = 0x01607B90;
DWORD AggroAddyRet = AggroAddy+6; //aggroaddy+6
void __declspec(naked) Aggro()
{
__asm //dont forget to make everything 0x to be hex
{
mov eax, [0x01E1ABD4] //Char Base
mov eax, [eax]
lea eax, [eax + 04]
mov[ecx + 0x3F8], eax
push ebp
mov ebp, esp
and esp, -0x40
jmp dword ptr[AggroAddyRet]//go to l
}
}
/*[ENABLE]
//v161.2
alloc(Aggro,128)
Aggro:
mov eax,[01E1ABD4] //Char Base
lea eax,[eax+04]
mov [ecx+3F8],eax //Look at bytes and rev the last set
push ebp
mov ebp,esp
and esp,-40
jmp 01607B90+6
01607B90: //55 8B EC 83 E4 ?? 6A ?? 68 ?? ?? ?? ?? 64 A1 ?? ?? ?? ?? 50 83 EC ?? 53 56 57 A1 ?? ?? ?? ?? 33 C4 50 8D 44 24 ?? 64 A3 ?? ?? ?? ?? 8B F1 8B 4D ?? 8B 06
jmp Aggro
nop
[DISABLE]
01607B90:
push ebp
mov ebp,esp
and esp,-40
dealloc(Aggro)*/
/*
// MapleStory.exe+1207B90 - E9 4B BB A6 6B
//
// jmp 6DBF36E0
*/
void Agg(bool on)
{
if (on){
//MakePageWritable(AggroAddy,6);
Jump(AggroAddy, Aggro, 1);
//WriteMemory(AggroAddy, 6, 0xE9, 0x4B, 0xBB, 0xA6, 0x6B, 0x90);
}
else{
WriteMemory(AggroAddy,6, 0x55, 0x8B, 0xEC, 0x83, 0xE4, 0xC0);
}
}