diff --git a/src/map/lua/lua_baseentity.cpp b/src/map/lua/lua_baseentity.cpp index 725c4160e19..17432abaeac 100644 --- a/src/map/lua/lua_baseentity.cpp +++ b/src/map/lua/lua_baseentity.cpp @@ -10839,6 +10839,39 @@ bool CLuaBaseEntity::hasEnteredBattlefield() return CBattlefield::hasPlayerEntered(PChar); } +/************************************************************************ + * Function: sendTimerPacket() + * Purpose : sends the packet to enable a timer with durations in seconds + * Example : player:sendTimerPacket(60 * 15) + * Notes : + ************************************************************************/ + +void CLuaBaseEntity::sendTimerPacket(uint32 seconds) +{ + if (m_PBaseEntity->objtype != TYPE_PC) + { + ShowWarning("CLuaBaseEntity::sendTimerPacket() was called on non CCharEntity!"); + return; + } + charutils::SendTimerPacket(static_cast(m_PBaseEntity), seconds); +} + +/************************************************************************ + * Function: sendClearTimerPacket() + * Purpose : sends the packet to clear an existing timer + * Example : player:sendClearTimerPacket() + * Notes : + ************************************************************************/ +void CLuaBaseEntity::sendClearTimerPacket() +{ + if (m_PBaseEntity->objtype != TYPE_PC) + { + ShowWarning("CLuaBaseEntity::sendClearTimerPacket() was called on non CCharEntity!"); + return; + } + charutils::SendClearTimerPacket(static_cast(m_PBaseEntity)); +} + /************************************************************************ * Function: isAlive() * Purpose : Returns true if an Entity is alive @@ -17334,6 +17367,8 @@ void CLuaBaseEntity::Register() SOL_REGISTER("isInDynamis", CLuaBaseEntity::isInDynamis); SOL_REGISTER("setEnteredBattlefield", CLuaBaseEntity::setEnteredBattlefield); SOL_REGISTER("hasEnteredBattlefield", CLuaBaseEntity::hasEnteredBattlefield); + SOL_REGISTER("sendTimerPacket", CLuaBaseEntity::sendTimerPacket); + SOL_REGISTER("sendClearTimerPacket", CLuaBaseEntity::sendClearTimerPacket); // Battle Utilities SOL_REGISTER("isAlive", CLuaBaseEntity::isAlive); diff --git a/src/map/lua/lua_baseentity.h b/src/map/lua/lua_baseentity.h index d59d807ac82..bba583a83d8 100644 --- a/src/map/lua/lua_baseentity.h +++ b/src/map/lua/lua_baseentity.h @@ -547,6 +547,8 @@ class CLuaBaseEntity bool isInDynamis(); void setEnteredBattlefield(bool entered); bool hasEnteredBattlefield(); + void sendTimerPacket(uint32 seconds); + void sendClearTimerPacket(); // Battle Utilities bool isAlive();