Yo,
I've been trying to use the clients A* path finding algorithm, I've located the function and it works pretty neat.
However, after a random amount of function calls I get a deadlock.
I've created function prototypes accordingly to what you can see in the OllyDbg screenshot.
Code:
// Get player XYZ
typedef void _GetPlayerXYZ(int* pOutX, int* pOutY, int* pOutZ);
// UnknownA is pushed in as '1' at client call.
// UnknownB is pushed in as '0' at client call.
typedef int _FindAStarPath(int StartX, int StartY, int StartZ, int GotoX, int GotoY, int GotoZ, BOOL UnknownA, int* pOutTilesToGo, int* pUnknown, BOOL UnknownB, int* X, int* Y, int *Z);
// The last three arguments is not pushed to the stack before the functionc all, I assume they're kept from the GetPlayerXYZ call as they're still a part of the parameters according to the stack window in Olly.
// Will return 1 if a path if found.
// I'm not pushing in the clients NumberOfTiles to go, instead I've set up my own variable which is passed as 'pOutTilesToGo' as I don't want modify the clients data.
// all I want is to use the function for checking if a target is accessible.
// The FindAStarPath() is called once within the client and it's called from what I call PlayerGoToPos(), this function is called when you mapclick or click on the screen. The client will search for a path and if one is found, it will start moving.
// This function works as expected and you can make your character walk really far as the client will recalculate an A* path whenever you've walked X <> 7 or Y <> 5 as it seems to calculate a path only for what's visible on the screen.
// Thus it knows where you start from and where you want to go, it will calculate a path along the way.
typedef int _PlayerGotoPos(int GotoX, int GotoY, int GotoZ, BOOL UnknownA, BOOL UnknownB);
// In order for the above function to work, you must also call;
typedef void _StartWalking(void);
// Otherwise your character will move one square and freeze, you can stop the freeze by rightclicking on a tile. But calling the above function is how the client continues after a path is found.
// I've tried with changing the calling convention from standard __cdecl to __stdcall, but __stdcall gives me ESP failures.
Any inputs on why this deadlocks occurs is greatly appreciated.
Best regards.
EDIT:
int *pUnknown is the direction in wich to start walking.
UP = 3
DOWN = 7
LEFT = 5
RIGHT = 1
EDIT2:
UnknownA is likely to be "ForceDiagonal"
UnknownB is likely to be "MustReach"