mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
Game.useOnCreature lua api
This commit is contained in:
@@ -274,6 +274,14 @@ void Game::useHotkey(int itemId, const ThingPtr& toThing)
|
||||
m_protocolGame->sendUseItemEx(Position(0xFFFF, 0, 0), itemId, 0, toThing->getPos(), toThing->getId(), getThingStackpos(toThing));
|
||||
}
|
||||
|
||||
void Game::useOnCreature(const ThingPtr& thing, const CreaturePtr& creature)
|
||||
{
|
||||
if(!m_online || !thing || !checkBotProtection())
|
||||
return;
|
||||
|
||||
m_protocolGame->sendUseOnCreature(thing->getPos(), thing->getId(), getThingStackpos(thing), creature->getId());
|
||||
}
|
||||
|
||||
void Game::attack(const CreaturePtr& creature)
|
||||
{
|
||||
if(!m_online || !creature || !checkBotProtection())
|
||||
|
@@ -65,6 +65,7 @@ public:
|
||||
void use(const ThingPtr& thing);
|
||||
void useWith(const ThingPtr& fromThing, const ThingPtr& toThing);
|
||||
void useHotkey(int itemId, const ThingPtr& toThing);
|
||||
void useOnCreature(const ThingPtr& thing, const CreaturePtr& creature);
|
||||
|
||||
// attack/follow related
|
||||
void attack(const CreaturePtr& creature);
|
||||
|
@@ -198,6 +198,7 @@ void OTClient::registerLuaFunctions()
|
||||
g_lua.bindClassStaticFunction<Game>("use", std::bind(&Game::use, &g_game, _1));
|
||||
g_lua.bindClassStaticFunction<Game>("useWith", std::bind(&Game::useWith, &g_game, _1, _2));
|
||||
g_lua.bindClassStaticFunction<Game>("useHotkey", std::bind(&Game::useHotkey, &g_game, _1, _2));
|
||||
g_lua.bindClassStaticFunction<Game>("useOnCreature", std::bind(&Game::useOnCreature, &g_game, _1, _2));
|
||||
g_lua.bindClassStaticFunction<Game>("walk", std::bind(&Game::walk, &g_game, _1));
|
||||
g_lua.bindClassStaticFunction<Game>("forceWalk", std::bind(&Game::forceWalk, &g_game, _1));
|
||||
g_lua.bindClassStaticFunction<Game>("attack", std::bind(&Game::attack, &g_game, _1));
|
||||
|
@@ -66,7 +66,7 @@ public:
|
||||
void sendRejectTrade();
|
||||
void sendUseItem(const Position& position, int itemId, int stackpos, int index);
|
||||
void sendUseItemEx(const Position& fromPos, int fromThingId, int fromStackpos, const Position& toPos, int toThingId, int toStackpos);
|
||||
void sendUseItemCreature(const Position& pos, int thingId, int stackpos, uint creatureId);
|
||||
void sendUseOnCreature(const Position& pos, int thingId, int stackpos, uint creatureId);
|
||||
void sendRotateItem(const Position& pos, int thingId, int stackpos);
|
||||
void sendCloseContainer(int containerId);
|
||||
void sendUpContainer(int containerId);
|
||||
|
@@ -275,7 +275,7 @@ void ProtocolGame::sendUseItemEx(const Position& fromPos, int fromThingId, int f
|
||||
send(oMsg);
|
||||
}
|
||||
|
||||
void ProtocolGame::sendUseItemCreature(const Position& pos, int thingId, int stackpos, uint creatureId)
|
||||
void ProtocolGame::sendUseOnCreature(const Position& pos, int thingId, int stackpos, uint creatureId)
|
||||
{
|
||||
OutputMessage oMsg;
|
||||
oMsg.addU8(Proto::ClientUseOnCreature);
|
||||
|
Reference in New Issue
Block a user