How to use GetStatus

07/24/2021 13:04 wfwf321#16
Quote:
Originally Posted by _asm View Post
here is a much simpler approach without hassling with inline assembler, function pointers or addresses (except for the hook :p) in the first place:
1. hook a function that is periodically called from within the mainthread of metin2 (OnUpdate, OnRender, etc.). go for OnUpdate since you probably want to run your cheat in the background.
2. use the python c api to retrieve the GetStatus function like so (untested code):

Code:
// import the player module first
#ifdef GAMEFORGE
    player_module_ = PyImport_ImportModule("playerm2g2");
#else
    player_module_ = PyImport_ImportModule("player");
#endif

long GetStatus(std::uint32_t type)
{
    auto* args = PyTuple_New(1);
    PyTuple_SetItem(args, 0, PyInt_FromLong(type));

    auto* fun = PyObject_Call(
        PyObject_GetAttrString(player_module_, "GetStatus"), args, nullptr);

    auto const res = PyInt_AsLong(fun);

    Py_DECREF(fun);
    Py_XDECREF(args);

    return res;
}
Refer to [Only registered and activated users can see links. Click Here To Register...] for the documentation.

3. now call all of the metin2 game functions from within the mainthread hook (OnUpdate). if you disregard this - like many other poorly written cheats - you will encounter many runtime errors. this is due to the fact that metin2 is not thread-safe by itself and you need to ensure that all external function calls that yield to game functions are only executed from within the same thread in which the gameloop is running.

4. ???
5. profit.
Hey, do u think this would work on servers with statically linked python?
07/31/2021 19:19 sad666#17
Quote:
Originally Posted by wfwf321 View Post
Hey, do u think this would work on servers with statically linked python?
it won't work but you can find the python functions manually using signature.

Also try call virtual GetStatus function from CPythonPlayer vtable. If im not wrong all functions access this function there.
08/02/2021 22:45 macnn50#18
Quote:
Originally Posted by sad666 View Post
it won't work but you can find the python functions manually using signature.

Also try call virtual GetStatus function from CPythonPlayer vtable. If im not wrong all functions access this function there.
How can I tell if a mob is a boss? do you know
08/03/2021 22:37 sad666#19
Quote:
Originally Posted by macnn50 View Post
How can I tell if a mob is a boss? do you know
check GetGradeByVID function