mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 19:44:54 +02:00
bot traceback, moveup function, chat setting default ongamestart
This commit is contained in:
@@ -521,6 +521,15 @@ void Game::move(const ThingPtr& thing, const Position& toPos, int count)
|
||||
m_protocolGame->sendMove(thing->getPosition(), thing->getId(), thing->getStackpos(), toPos, count);
|
||||
}
|
||||
|
||||
void Game::moveToParentContainer(const ThingPtr& thing, int count)
|
||||
{
|
||||
if(!canPerformGameAction() || !thing || count <= 0)
|
||||
return;
|
||||
|
||||
Position position = thing->getPosition();
|
||||
move(thing, Position(position.x, position.y, 254), count);
|
||||
}
|
||||
|
||||
void Game::rotate(const ThingPtr& thing)
|
||||
{
|
||||
if(!canPerformGameAction() || !thing)
|
||||
@@ -927,7 +936,7 @@ bool Game::checkBotProtection()
|
||||
// accepts calls comming from a stacktrace containing only C++ functions,
|
||||
// if the stacktrace contains a lua function, then only accept if the engine is processing an input event
|
||||
if(g_lua.isInCppCallback() && !g_ui.isOnInputEvent()) {
|
||||
logError("caught a lua call to a bot protected game function, the call was canceled");
|
||||
logError(g_lua.traceback("caught a lua call to a bot protected game function, the call was canceled"));
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
@@ -132,6 +132,7 @@ public:
|
||||
// item related
|
||||
void look(const ThingPtr& thing);
|
||||
void move(const ThingPtr &thing, const Position& toPos, int count);
|
||||
void moveToParentContainer(const ThingPtr& thing, int count);
|
||||
void rotate(const ThingPtr& thing);
|
||||
void use(const ThingPtr& thing);
|
||||
void useWith(const ItemPtr& fromThing, const ThingPtr& toThing);
|
||||
|
@@ -89,6 +89,7 @@ void OTClient::registerLuaFunctions()
|
||||
g_lua.bindClassStaticFunction("g_game", "stop", std::bind(&Game::stop, &g_game));
|
||||
g_lua.bindClassStaticFunction("g_game", "look", std::bind(&Game::look, &g_game, std::placeholders::_1));
|
||||
g_lua.bindClassStaticFunction("g_game", "move", std::bind(&Game::move, &g_game, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||
g_lua.bindClassStaticFunction("g_game", "moveToParentContainer", std::bind(&Game::moveToParentContainer, &g_game, std::placeholders::_1, std::placeholders::_2));
|
||||
g_lua.bindClassStaticFunction("g_game", "rotate", std::bind(&Game::rotate, &g_game, std::placeholders::_1));
|
||||
g_lua.bindClassStaticFunction("g_game", "use", std::bind(&Game::use, &g_game, std::placeholders::_1));
|
||||
g_lua.bindClassStaticFunction("g_game", "useWith", std::bind(&Game::useWith, &g_game, std::placeholders::_1, std::placeholders::_2));
|
||||
|
Reference in New Issue
Block a user