-
Member
Call LUA[Classic]
Hi, couple questions.
Firstly, I was wondering if anyone knew how to determine the unitType just from the entity object.
Secondly, I was wondering how to call a lua function. I found the lua function UnitGUID(Char*?); @ 0x10D3160. But I have no idea how to actually setup the function call.
Thanks.
-
Contributor
Both questions can be answered by simply searching.
-
Member
Originally Posted by
ejt
Both questions can be answered by simply searching.
Couldn't find with searching. Most were very old forum posts which said to parse the full GUID. But the entity list only uses the last part of it as an identifier.
I did find it in your post history though, so thanks.
Offset 0x20 from entity.
-
Member
inject dll into wow,
uintptr_t FrameScriptExecuteAddr= 0x32DD40; //classic 33728
static auto const luaDoString = reinterpret_cast<uintptr_t(__fastcall*)(const char*, const char*,int64_t)>((uintptr_t)GetModuleHandle(NULL) + FrameScriptExecuteAddr);
luaDoString("UnitGUID("target")", "helloworld", 0);
-
Post Thanks / Like - 1 Thanks
qewd (1 members gave Thanks to xbec for this useful post)
-
Originally Posted by
xbec
inject dll into wow,
uintptr_t FrameScriptExecuteAddr= 0x32DD40; //classic 33728
static auto const luaDoString = reinterpret_cast<uintptr_t(__fastcall*)(const char*, const char*,int64_t)>((uintptr_t)GetModuleHandle(NULL) + FrameScriptExecuteAddr);
luaDoString("UnitGUID("target")", "helloworld", 0);
A fantastic way to lose the account of yours and everyone who uses it.
-
Post Thanks / Like - 1 Thanks
aeo (1 members gave Thanks to Jadd for this useful post)
-
Member
Originally Posted by
Jadd
A fantastic way to lose the account of yours and everyone who uses it.
This is the easiest way to do it. Do you have a better way to share?
-
Member
Originally Posted by
Jadd
A fantastic way to lose the account of yours and everyone who uses it.
do you mean this is **detectable** by blizzard? even if call in Present hook.
-
Originally Posted by
airjqqq
do you mean this is **detectable** by blizzard? even if call in Present hook.
Yes, Blizzard has detected third-party use of this function on numerous occasions - the large majority of bots (especially rotation bots, which Blizzard *really* seem to hate) used it to easily interact with the huge API they provide so it's always been a big target.
Originally Posted by
xbec
This is the easiest way to do it. Do you have a better way to share?
I stay away from their Lua API entirely and avoided all those banwaves in the past. The "better way" would be to call the underlying functions directly, in a context that isn't easily distinguished from a regular call made by the game (spoofed stack trace, ROP, etc.)
-
Post Thanks / Like - 1 Thanks
GlittPrizes (1 members gave Thanks to Jadd for this useful post)
-
Member
Originally Posted by
Jadd
Yes, Blizzard has detected third-party use of this function on numerous occasions - the large majority of bots (especially rotation bots, which Blizzard *really* seem to hate) used it to easily interact with the huge API they provide so it's always been a big target.
I stay away from their Lua API entirely and avoided all those banwaves in the past. The "better way" would be to call the underlying functions directly, in a context that isn't easily distinguished from a regular call made by the game (spoofed stack trace, ROP, etc.)
great information. so do you use c# with clr injection or pure c++ injection or even not inject anything?
i am considering whether should i change my project from c# to c++ to avoid getting banned
Last edited by airjqqq; 04-04-2020 at 10:26 AM.
-
Contributor
Originally Posted by
qewd
Hi, couple questions.
Firstly, I was wondering if anyone knew how to determine the unitType just from the entity object.
Secondly, I was wondering how to call a lua function. I found the lua function UnitGUID(Char*?); @ 0x10D3160. But I have no idea how to actually setup the function call.
Thanks.
You can directly call the luaC api to call wow lua functions heres a simple example (note in actual implementation you will want to error check this)
Code:
lua_getglobal(luastate, "UnitGUID");
lua_pushstring(luastate, "player");
lua_call(luastate, 1, 1);
const char* result = lua_tostring(luastate, -1);
lua_pop(luastate, -1);
std::cout << result << "\n";
furthermore if you have about 12 hours to reverse the entire lua source api and rewrite the lua source code to match wows (like i did) you can use lua bindings like sol to call and retrieve functions extremely easily like so
Code:
sol::state_view l(*reinterpret_cast<lua_State**>(s_context));
const char* result = l["UnitGUID"]("player").get<const char*>();
further furthermore you can also make your own framescript execute so your not calling wows by calling lua_loadbuffer() lol, in short theres 100 different ways to do it i prefer to first attempt to call the c++ function that the lua calls and if that's to complex or the operation is done entirely in lua i will just directly use the luaC api
Last edited by Icesythe7; 04-04-2020 at 08:13 AM.
-
Post Thanks / Like - 1 Thanks
aeo (1 members gave Thanks to Icesythe7 for this useful post)
-
Sorry for the necro, but I'm looking into a safe(er) form of getting lua access. I was trying to do the generic present hook and call FramescriptExecute, but that looks to be easily detected. What I don't understand is the last post about rebuilding lua. Isn't Wow's implementation of 5.1 part of the executable, so how do you get it to interact with the reconstructed lua? Does it require extensive patching of the client?
If using WiNiFiX's lua unlocker was a hard no and zero, and just hooking Present with FramescriptExecute is a 3, what would an acceptable lua unlock method to attempt (asking for a friend)?
-
Contributor
probably a 6 or 7. There are many definitions of unlocked lua. Do you want to just call protected functions ? Do you want to make new functions and use them?
-
I think I just need the ability to call protected functions. Most of the stuff I would use for a custom function would likely be combat related, so I could just call a macro. I'm not sure why I'm having so much trouble just firing FramescriptExecute internally. I did it in the past when I was more fresh to this, but somehow can't retrace my progress. As others have mentioned though, that is probably asking for a ban since it's such a common lua workaround to call it in a Direct X hook. I guess I'm looking for the next best approach, something that is relatively safe and not overkill.
-
Member
Originally Posted by
Icesythe7
You can directly call the luaC api to call wow lua functions heres a simple example (note in actual implementation you will want to error check this)
Code:
lua_getglobal(luastate, "UnitGUID");
lua_pushstring(luastate, "player");
lua_call(luastate, 1, 1);
const char* result = lua_tostring(luastate, -1);
lua_pop(luastate, -1);
std::cout << result << "\n";
furthermore if you have about 12 hours to reverse the entire lua source api and rewrite the lua source code to match wows (like i did) you can use lua bindings like sol to call and retrieve functions extremely easily like so
Code:
sol::state_view l(*reinterpret_cast<lua_State**>(s_context));
const char* result = l["UnitGUID"]("player").get<const char*>();
further furthermore you can also make your own framescript execute so your not calling wows by calling lua_loadbuffer() lol, in short theres 100 different ways to do it i prefer to first attempt to call the c++ function that the lua calls and if that's to complex or the operation is done entirely in lua i will just directly use the luaC api
Is the luaStatus ** obtained from a certain address in the game or is it from the newtable(L) in the luac api?
I saw you mentioned an address in one of your responses
-
Contributor
the state/context is a global variable.