diff --git a/GlobalMethods.h b/GlobalMethods.h index 215cae1..85edc89 100644 --- a/GlobalMethods.h +++ b/GlobalMethods.h @@ -1880,13 +1880,8 @@ namespace LuaGlobalFunctions switch (banMode) { case BAN_ACCOUNT: -#ifdef CATA if (!Utf8ToUpperOnlyLatin(nameOrIP)) return 0; -#else - if (!AccountMgr::normalizeString(nameOrIP)) - return 0; -#endif break; case BAN_CHARACTER: if (!normalizePlayerName(nameOrIP)) diff --git a/LuaEngine.h b/LuaEngine.h index f9531d8..b7dcbfc 100644 --- a/LuaEngine.h +++ b/LuaEngine.h @@ -402,9 +402,9 @@ public: void OnSpawn(GameObject* gameobject); /* Packet */ - bool OnPacketSend(WorldSession* session, WorldPacket& packet); - void OnPacketSendAny(Player* player, WorldPacket& packet, bool& result); - void OnPacketSendOne(Player* player, WorldPacket& packet, bool& result); + bool OnPacketSend(WorldSession* session, const WorldPacket& packet); + void OnPacketSendAny(Player* player, const WorldPacket& packet, bool& result); + void OnPacketSendOne(Player* player, const WorldPacket& packet, bool& result); bool OnPacketReceive(WorldSession* session, WorldPacket& packet); void OnPacketReceiveAny(Player* player, WorldPacket& packet, bool& result); void OnPacketReceiveOne(Player* player, WorldPacket& packet, bool& result); diff --git a/PacketHooks.cpp b/PacketHooks.cpp index edaecb6..4d086f6 100644 --- a/PacketHooks.cpp +++ b/PacketHooks.cpp @@ -29,7 +29,7 @@ using namespace Hooks; return;\ LOCK_ELUNA -bool Eluna::OnPacketSend(WorldSession* session, WorldPacket& packet) +bool Eluna::OnPacketSend(WorldSession* session, const WorldPacket& packet) { bool result = true; Player* player = NULL; @@ -39,7 +39,7 @@ bool Eluna::OnPacketSend(WorldSession* session, WorldPacket& packet) OnPacketSendOne(player, packet, result); return result; } -void Eluna::OnPacketSendAny(Player* player, WorldPacket& packet, bool& result) +void Eluna::OnPacketSendAny(Player* player, const WorldPacket& packet, bool& result) { START_HOOK_SERVER(SERVER_EVENT_ON_PACKET_SEND); Push(new WorldPacket(packet)); @@ -48,22 +48,18 @@ void Eluna::OnPacketSendAny(Player* player, WorldPacket& packet, bool& result) 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)) result = false; - if (lua_isuserdata(L, r + 1)) - if (WorldPacket* data = CHECKOBJ(L, r + 1, false)) - packet = *data; - - lua_pop(L, 2); + lua_pop(L, 1); } CleanUpStack(2); } -void Eluna::OnPacketSendOne(Player* player, WorldPacket& packet, bool& result) +void Eluna::OnPacketSendOne(Player* player, const WorldPacket& packet, bool& result) { START_HOOK_PACKET(PACKET_EVENT_ON_PACKET_SEND, packet.GetOpcode()); Push(new WorldPacket(packet)); @@ -72,16 +68,12 @@ void Eluna::OnPacketSendOne(Player* player, WorldPacket& packet, bool& result) 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)) result = false; - if (lua_isuserdata(L, r + 1)) - if (WorldPacket* data = CHECKOBJ(L, r + 1, false)) - packet = *data; - - lua_pop(L, 2); + lua_pop(L, 1); } CleanUpStack(2);