So many releases lately. I thought it was time to make a contribution as well.
A couple of years ago, Bakabug released KalHack11. I don't think he likes to be reminded on the way he wrote code back then, but even so... his code has been the base of many sources till today.
Basically his method to get the height in KalHack11 was:
While working with this, I found out it was kinda buggy. My knowledge of asm is.... well, to be honost, I have no knowledge about asm at all xD. So I tried to figure out what this Something function did and succeeded.
So.. here it is: Height calculation :P
Few hours of work for this little code :D
Remarks:
This function does not work inside a dungeon and on emok.. It will return 0 there.
Other thing is, it also returns 0 if the 3D map isn't loaded in your kalclient! (when you walk with packets, you can get outside the area where the client has loaded the landscape for and that will cause this Height function to fail)
If anyone has a suggestion on how to force the client to load the 3D map/landscape, feel free to post here or send me a PM ;)
My thanks go to Bakabug for his help :)
A couple of years ago, Bakabug released KalHack11. I don't think he likes to be reminded on the way he wrote code back then, but even so... his code has been the base of many sources till today.
Basically his method to get the height in KalHack11 was:
PHP Code:
DWORD OrigHeight = SearchPattern("55 8B EC 81 EC 94 00 00 00 D9 45 08 D8 35 ? ? ? ? D9 5D 08",0x00400000,0x007FFFFF);
DWORD MyHeightBack = OrigHeight + 9;
float Naked MyHeightDetour(DWORD x,DWORD y,...)
{
__asm
{
push ebp
mov ebp, esp
sub esp, 94h
jmp MyHeightBack
}
}
DWORD Naked Something(DWORD some,DWORD some2,...)
{
_asm
{
push ebp
mov ebp, esp
push ecx
fild [ebp+0x08]
mov eax, [ebp+0x0C]
shl eax, 0Dh
mov [ebp-0x04], eax
fisub [ebp-0x04]
mov esp, ebp
pop ebp
fstp [ebp-0x04]
mov eax,[ebp-0x04]
retn
}
}
int Height(int X, int Y)
{
return (int)MyHeightDetour(Something(X,0x20),Something(Y,0x20))*10;
}
While working with this, I found out it was kinda buggy. My knowledge of asm is.... well, to be honost, I have no knowledge about asm at all xD. So I tried to figure out what this Something function did and succeeded.
So.. here it is: Height calculation :P
PHP Code:
DWORD pHeight = SearchPattern("55 8B EC 81 EC 94 00 00 00 D9 45 08 D8 35 x x x x D9 5D 08",0x00400000,0x007FFFFF);
typedef float (__cdecl * oHeight)(float X, float Y);
int Height(int X, int Y)
{
return (int)(((oHeight)pHeight)(X-262144,Y-262144)*10);
}
Remarks:
This function does not work inside a dungeon and on emok.. It will return 0 there.
Other thing is, it also returns 0 if the 3D map isn't loaded in your kalclient! (when you walk with packets, you can get outside the area where the client has loaded the landscape for and that will cause this Height function to fail)
If anyone has a suggestion on how to force the client to load the 3D map/landscape, feel free to post here or send me a PM ;)
My thanks go to Bakabug for his help :)