fix(Core): Update packet hook signatures to const WorldPacket& (#366)
Co-authored-by: blinkysc <blinkysc@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -976,7 +976,7 @@ public:
|
|||||||
SERVERHOOK_CAN_PACKET_RECEIVE
|
SERVERHOOK_CAN_PACKET_RECEIVE
|
||||||
}) { }
|
}) { }
|
||||||
|
|
||||||
bool CanPacketSend(WorldSession* session, WorldPacket& packet) override
|
bool CanPacketSend(WorldSession* session, WorldPacket const& packet) override
|
||||||
{
|
{
|
||||||
if (!sALE->OnPacketSend(session, packet))
|
if (!sALE->OnPacketSend(session, packet))
|
||||||
return false;
|
return false;
|
||||||
@@ -984,7 +984,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CanPacketReceive(WorldSession* session, WorldPacket& packet) override
|
bool CanPacketReceive(WorldSession* session, WorldPacket const& packet) override
|
||||||
{
|
{
|
||||||
if (!sALE->OnPacketReceive(session, packet))
|
if (!sALE->OnPacketReceive(session, packet))
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -451,9 +451,9 @@ public:
|
|||||||
bool OnPacketSend(WorldSession* session, const WorldPacket& packet);
|
bool OnPacketSend(WorldSession* session, const WorldPacket& packet);
|
||||||
void OnPacketSendAny(Player* player, const WorldPacket& packet, bool& result);
|
void OnPacketSendAny(Player* player, const WorldPacket& packet, bool& result);
|
||||||
void OnPacketSendOne(Player* player, const WorldPacket& packet, bool& result);
|
void OnPacketSendOne(Player* player, const WorldPacket& packet, bool& result);
|
||||||
bool OnPacketReceive(WorldSession* session, WorldPacket& packet);
|
bool OnPacketReceive(WorldSession* session, WorldPacket const& packet);
|
||||||
void OnPacketReceiveAny(Player* player, WorldPacket& packet, bool& result);
|
void OnPacketReceiveAny(Player* player, WorldPacket const& packet, bool& result);
|
||||||
void OnPacketReceiveOne(Player* player, WorldPacket& packet, bool& result);
|
void OnPacketReceiveOne(Player* player, WorldPacket const& packet, bool& result);
|
||||||
|
|
||||||
/* Player */
|
/* Player */
|
||||||
void OnPlayerEnterCombat(Player* pPlayer, Unit* pEnemy);
|
void OnPlayerEnterCombat(Player* pPlayer, Unit* pEnemy);
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ void ALE::OnPacketSendOne(Player* player, const WorldPacket& packet, bool& resul
|
|||||||
CleanUpStack(2);
|
CleanUpStack(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ALE::OnPacketReceive(WorldSession* session, WorldPacket& packet)
|
bool ALE::OnPacketReceive(WorldSession* session, WorldPacket const& packet)
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
Player* player = NULL;
|
Player* player = NULL;
|
||||||
@@ -90,7 +90,7 @@ bool ALE::OnPacketReceive(WorldSession* session, WorldPacket& packet)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ALE::OnPacketReceiveAny(Player* player, WorldPacket& packet, bool& result)
|
void ALE::OnPacketReceiveAny(Player* player, WorldPacket const& packet, bool& result)
|
||||||
{
|
{
|
||||||
START_HOOK_SERVER(SERVER_EVENT_ON_PACKET_RECEIVE);
|
START_HOOK_SERVER(SERVER_EVENT_ON_PACKET_RECEIVE);
|
||||||
Push(new WorldPacket(packet));
|
Push(new WorldPacket(packet));
|
||||||
@@ -99,22 +99,18 @@ void ALE::OnPacketReceiveAny(Player* player, WorldPacket& packet, bool& result)
|
|||||||
|
|
||||||
while (n > 0)
|
while (n > 0)
|
||||||
{
|
{
|
||||||
int r = CallOneFunction(n--, 2, 2);
|
int r = CallOneFunction(n--, 2, 1);
|
||||||
|
|
||||||
if (lua_isboolean(L, r + 0) && !lua_toboolean(L, r + 0))
|
if (lua_isboolean(L, r + 0) && !lua_toboolean(L, r + 0))
|
||||||
result = false;
|
result = false;
|
||||||
|
|
||||||
if (lua_isuserdata(L, r + 1))
|
lua_pop(L, 1);
|
||||||
if (WorldPacket* data = CHECKOBJ<WorldPacket>(L, r + 1, false))
|
|
||||||
packet = *data;
|
|
||||||
|
|
||||||
lua_pop(L, 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CleanUpStack(2);
|
CleanUpStack(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ALE::OnPacketReceiveOne(Player* player, WorldPacket& packet, bool& result)
|
void ALE::OnPacketReceiveOne(Player* player, WorldPacket const& packet, bool& result)
|
||||||
{
|
{
|
||||||
START_HOOK_PACKET(PACKET_EVENT_ON_PACKET_RECEIVE, packet.GetOpcode());
|
START_HOOK_PACKET(PACKET_EVENT_ON_PACKET_RECEIVE, packet.GetOpcode());
|
||||||
Push(new WorldPacket(packet));
|
Push(new WorldPacket(packet));
|
||||||
@@ -123,16 +119,12 @@ void ALE::OnPacketReceiveOne(Player* player, WorldPacket& packet, bool& result)
|
|||||||
|
|
||||||
while (n > 0)
|
while (n > 0)
|
||||||
{
|
{
|
||||||
int r = CallOneFunction(n--, 2, 2);
|
int r = CallOneFunction(n--, 2, 1);
|
||||||
|
|
||||||
if (lua_isboolean(L, r + 0) && !lua_toboolean(L, r + 0))
|
if (lua_isboolean(L, r + 0) && !lua_toboolean(L, r + 0))
|
||||||
result = false;
|
result = false;
|
||||||
|
|
||||||
if (lua_isuserdata(L, r + 1))
|
lua_pop(L, 1);
|
||||||
if (WorldPacket* data = CHECKOBJ<WorldPacket>(L, r + 1, false))
|
|
||||||
packet = *data;
|
|
||||||
|
|
||||||
lua_pop(L, 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CleanUpStack(2);
|
CleanUpStack(2);
|
||||||
|
|||||||
Reference in New Issue
Block a user