mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 13:16:23 +00:00
Big update.
This commit is contained in:
@@ -35,8 +35,8 @@ namespace WorldPackets
|
||||
virtual WorldPacket const* Write() = 0;
|
||||
virtual void Read() = 0;
|
||||
|
||||
WorldPacket const* GetRawPacket() const { return &_worldPacket; }
|
||||
size_t GetSize() const { return _worldPacket.size(); }
|
||||
[[nodiscard]] WorldPacket const* GetRawPacket() const { return &_worldPacket; }
|
||||
[[nodiscard]] size_t GetSize() const { return _worldPacket.size(); }
|
||||
|
||||
protected:
|
||||
WorldPacket _worldPacket;
|
||||
@@ -53,7 +53,7 @@ namespace WorldPackets
|
||||
WorldPacket&& Move() { return std::move(_worldPacket); }
|
||||
void ShrinkToFit() { _worldPacket.shrink_to_fit(); }
|
||||
|
||||
OpcodeServer GetOpcode() const { return OpcodeServer(_worldPacket.GetOpcode()); }
|
||||
[[nodiscard]] OpcodeServer GetOpcode() const { return OpcodeServer(_worldPacket.GetOpcode()); }
|
||||
};
|
||||
|
||||
class AC_GAME_API ClientPacket : public Packet
|
||||
@@ -64,7 +64,7 @@ namespace WorldPackets
|
||||
|
||||
WorldPacket const* Write() final;
|
||||
|
||||
OpcodeClient GetOpcode() const { return OpcodeClient(_worldPacket.GetOpcode()); }
|
||||
[[nodiscard]] OpcodeClient GetOpcode() const { return OpcodeClient(_worldPacket.GetOpcode()); }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -18,4 +18,16 @@
|
||||
#ifndef AllPackets_h__
|
||||
#define AllPackets_h__
|
||||
|
||||
#include "LFGPackets.h"
|
||||
#include "BankPackets.h"
|
||||
#include "CharacterPackets.h"
|
||||
#include "ChatPackets.h"
|
||||
#include "PetPackets.h"
|
||||
#include "CombatLogPackets.h"
|
||||
#include "CombatPackets.h"
|
||||
#include "GuildPackets.h"
|
||||
#include "MiscPackets.h"
|
||||
#include "TotemPackets.h"
|
||||
#include "WorldStatePackets.h"
|
||||
|
||||
#endif // AllPackets_h__
|
||||
|
||||
49
src/server/game/Server/Packets/BankPackets.cpp
Normal file
49
src/server/game/Server/Packets/BankPackets.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "BankPackets.h"
|
||||
|
||||
void WorldPackets::Bank::AutoBankItem::Read()
|
||||
{
|
||||
_worldPacket >> Bag;
|
||||
_worldPacket >> Slot;
|
||||
}
|
||||
|
||||
void WorldPackets::Bank::AutoStoreBankItem::Read()
|
||||
{
|
||||
_worldPacket >> Bag;
|
||||
_worldPacket >> Slot;
|
||||
}
|
||||
|
||||
void WorldPackets::Bank::BuyBankSlot::Read()
|
||||
{
|
||||
_worldPacket >> Banker;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Bank::BuyBankSlotResult::Write()
|
||||
{
|
||||
_worldPacket << uint32(Result);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Bank::ShowBank::Write()
|
||||
{
|
||||
_worldPacket << Banker;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
81
src/server/game/Server/Packets/BankPackets.h
Normal file
81
src/server/game/Server/Packets/BankPackets.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef BankPackets_h__
|
||||
#define BankPackets_h__
|
||||
|
||||
#include "ObjectGuid.h"
|
||||
#include "Packet.h"
|
||||
|
||||
namespace WorldPackets
|
||||
{
|
||||
namespace Bank
|
||||
{
|
||||
class AutoBankItem final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
AutoBankItem(WorldPacket&& packet) : ClientPacket(CMSG_AUTOBANK_ITEM, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
uint8 Bag = 0;
|
||||
uint8 Slot = 0;
|
||||
};
|
||||
|
||||
class AutoStoreBankItem final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
AutoStoreBankItem(WorldPacket&& packet) : ClientPacket(CMSG_AUTOSTORE_BANK_ITEM, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
uint8 Bag = 0;
|
||||
uint8 Slot = 0;
|
||||
};
|
||||
|
||||
class BuyBankSlot final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
BuyBankSlot(WorldPacket&& packet) : ClientPacket(CMSG_BUY_BANK_SLOT, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid Banker;
|
||||
};
|
||||
|
||||
class BuyBankSlotResult final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
BuyBankSlotResult() : ServerPacket(SMSG_BUY_BANK_SLOT_RESULT, 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 Result = 0;
|
||||
};
|
||||
|
||||
class ShowBank final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
ShowBank() : ServerPacket(SMSG_SHOW_BANK, 8) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
ObjectGuid Banker;
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif // BankPackets_h__
|
||||
49
src/server/game/Server/Packets/CharacterPackets.cpp
Normal file
49
src/server/game/Server/Packets/CharacterPackets.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "CharacterPackets.h"
|
||||
|
||||
void WorldPackets::Character::ShowingCloak::Read()
|
||||
{
|
||||
_worldPacket >> ShowCloak;
|
||||
}
|
||||
|
||||
void WorldPackets::Character::ShowingHelm::Read()
|
||||
{
|
||||
_worldPacket >> ShowHelm;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Character::LogoutResponse::Write()
|
||||
{
|
||||
_worldPacket << uint32(LogoutResult);
|
||||
_worldPacket << uint8(Instant);
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Character::PlayedTimeClient::Read()
|
||||
{
|
||||
_worldPacket >> TriggerScriptEvent;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Character::PlayedTime::Write()
|
||||
{
|
||||
_worldPacket << uint32(TotalTime);
|
||||
_worldPacket << uint32(LevelTime);
|
||||
_worldPacket << uint8(TriggerScriptEvent);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
122
src/server/game/Server/Packets/CharacterPackets.h
Normal file
122
src/server/game/Server/Packets/CharacterPackets.h
Normal file
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CharacterPackets_h__
|
||||
#define CharacterPackets_h__
|
||||
|
||||
#include "Packet.h"
|
||||
|
||||
namespace WorldPackets
|
||||
{
|
||||
namespace Character
|
||||
{
|
||||
class ShowingCloak final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
ShowingCloak(WorldPacket&& packet) : ClientPacket(CMSG_SHOWING_CLOAK, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
bool ShowCloak = false;
|
||||
};
|
||||
|
||||
class ShowingHelm final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
ShowingHelm(WorldPacket&& packet) : ClientPacket(CMSG_SHOWING_HELM, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
bool ShowHelm = false;
|
||||
};
|
||||
|
||||
class LogoutRequest final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
LogoutRequest(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
|
||||
|
||||
void Read() override { }
|
||||
};
|
||||
|
||||
class LogoutResponse final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
LogoutResponse() : ServerPacket(SMSG_LOGOUT_RESPONSE, 4 + 1) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 LogoutResult = 0;
|
||||
bool Instant = false;
|
||||
};
|
||||
|
||||
class LogoutComplete final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
LogoutComplete() : ServerPacket(SMSG_LOGOUT_COMPLETE, 0) { }
|
||||
|
||||
WorldPacket const* Write() override { return &_worldPacket; }
|
||||
};
|
||||
|
||||
class LogoutCancel final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
LogoutCancel(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
|
||||
|
||||
void Read() override { }
|
||||
};
|
||||
|
||||
class LogoutCancelAck final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
LogoutCancelAck() : ServerPacket(SMSG_LOGOUT_CANCEL_ACK, 0) { }
|
||||
|
||||
WorldPacket const* Write() override { return &_worldPacket; }
|
||||
};
|
||||
|
||||
class PlayerLogout final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
PlayerLogout(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
|
||||
|
||||
void Read() override { }
|
||||
};
|
||||
|
||||
class PlayedTimeClient final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
PlayedTimeClient(WorldPacket&& packet) : ClientPacket(CMSG_PLAYED_TIME, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
bool TriggerScriptEvent = false;
|
||||
};
|
||||
|
||||
class PlayedTime final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
PlayedTime() : ServerPacket(SMSG_PLAYED_TIME, 9) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 TotalTime = 0;
|
||||
uint32 LevelTime = 0;
|
||||
bool TriggerScriptEvent = false;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // CharacterPackets_h__
|
||||
39
src/server/game/Server/Packets/ChatPackets.cpp
Normal file
39
src/server/game/Server/Packets/ChatPackets.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ChatPackets.h"
|
||||
|
||||
WorldPacket const* WorldPackets::Chat::Emote::Write()
|
||||
{
|
||||
_worldPacket << EmoteID;
|
||||
_worldPacket << Guid;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Chat::EmoteClient::Read()
|
||||
{
|
||||
_worldPacket >> EmoteID;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Chat::ChatServerMessage::Write()
|
||||
{
|
||||
_worldPacket << int32(MessageID);
|
||||
_worldPacket << StringParam;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
62
src/server/game/Server/Packets/ChatPackets.h
Normal file
62
src/server/game/Server/Packets/ChatPackets.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef ChatPackets_h__
|
||||
#define ChatPackets_h__
|
||||
|
||||
#include "ObjectGuid.h"
|
||||
#include "Packet.h"
|
||||
|
||||
namespace WorldPackets
|
||||
{
|
||||
namespace Chat
|
||||
{
|
||||
class Emote final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
Emote() : ServerPacket(SMSG_EMOTE, 4 + 8) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 EmoteID = 0;
|
||||
ObjectGuid Guid;
|
||||
};
|
||||
|
||||
class EmoteClient final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
EmoteClient(WorldPacket&& packet) : ClientPacket(CMSG_EMOTE, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
uint32 EmoteID = 0;
|
||||
};
|
||||
|
||||
class ChatServerMessage final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
ChatServerMessage() : ServerPacket(SMSG_CHAT_SERVER_MESSAGE, 4 + 20) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
int32 MessageID = 0;
|
||||
std::string StringParam;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // ChatPackets_h__
|
||||
29
src/server/game/Server/Packets/CombatLogPackets.cpp
Normal file
29
src/server/game/Server/Packets/CombatLogPackets.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "CombatLogPackets.h"
|
||||
|
||||
WorldPacket const* WorldPackets::CombatLog::EnvironmentalDamageLog::Write()
|
||||
{
|
||||
_worldPacket << Victim;
|
||||
_worldPacket << uint8(Type);
|
||||
_worldPacket << uint32(Amount);
|
||||
_worldPacket << uint32(Resisted);
|
||||
_worldPacket << uint32(Absorbed);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
44
src/server/game/Server/Packets/CombatLogPackets.h
Normal file
44
src/server/game/Server/Packets/CombatLogPackets.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CombatLogPackets_h__
|
||||
#define CombatLogPackets_h__
|
||||
|
||||
#include "Packet.h"
|
||||
#include "Player.h"
|
||||
|
||||
namespace WorldPackets
|
||||
{
|
||||
namespace CombatLog
|
||||
{
|
||||
class EnvironmentalDamageLog final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
EnvironmentalDamageLog() : ServerPacket(SMSG_ENVIRONMENTAL_DAMAGE_LOG, 21) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
ObjectGuid Victim;
|
||||
EnviromentalDamage Type = DAMAGE_EXHAUSTED;
|
||||
uint32 Amount = 0;
|
||||
uint32 Resisted = 0;
|
||||
uint32 Absorbed = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // CombatLogPackets_h__
|
||||
23
src/server/game/Server/Packets/CombatPackets.cpp
Normal file
23
src/server/game/Server/Packets/CombatPackets.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "CombatPackets.h"
|
||||
|
||||
void WorldPackets::Combat::SetSheathed::Read()
|
||||
{
|
||||
_worldPacket >> CurrentSheathState;
|
||||
}
|
||||
40
src/server/game/Server/Packets/CombatPackets.h
Normal file
40
src/server/game/Server/Packets/CombatPackets.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CombatPackets_h__
|
||||
#define CombatPackets_h__
|
||||
|
||||
#include "Packet.h"
|
||||
#include "ObjectGuid.h"
|
||||
|
||||
namespace WorldPackets
|
||||
{
|
||||
namespace Combat
|
||||
{
|
||||
class SetSheathed final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
SetSheathed(WorldPacket&& packet) : ClientPacket(CMSG_SET_SHEATHED, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
uint32 CurrentSheathState = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // CombatPackets_h__
|
||||
458
src/server/game/Server/Packets/GuildPackets.cpp
Normal file
458
src/server/game/Server/Packets/GuildPackets.cpp
Normal file
@@ -0,0 +1,458 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "GuildPackets.h"
|
||||
|
||||
void WorldPackets::Guild::QueryGuildInfo::Read()
|
||||
{
|
||||
_worldPacket >> GuildId;
|
||||
}
|
||||
|
||||
WorldPackets::Guild::QueryGuildInfoResponse::QueryGuildInfoResponse()
|
||||
: ServerPacket(SMSG_GUILD_QUERY_RESPONSE) { }
|
||||
|
||||
WorldPacket const* WorldPackets::Guild::QueryGuildInfoResponse::Write()
|
||||
{
|
||||
_worldPacket << GuildId;
|
||||
_worldPacket << Info.GuildName;
|
||||
for (std::string const& rankName : Info.Ranks)
|
||||
_worldPacket << rankName;
|
||||
|
||||
_worldPacket << uint32(Info.EmblemStyle);
|
||||
_worldPacket << uint32(Info.EmblemColor);
|
||||
_worldPacket << uint32(Info.BorderStyle);
|
||||
_worldPacket << uint32(Info.BorderColor);
|
||||
_worldPacket << uint32(Info.BackgroundColor);
|
||||
_worldPacket << uint32(Info.RankCount);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Guild::GuildCreate::Read()
|
||||
{
|
||||
_worldPacket >> GuildName;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Guild::GuildInfoResponse::Write()
|
||||
{
|
||||
_worldPacket << GuildName;
|
||||
_worldPacket.AppendPackedTime(CreateDate);
|
||||
_worldPacket << int32(NumMembers);
|
||||
_worldPacket << int32(NumAccounts);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Guild::GuildRoster::Write()
|
||||
{
|
||||
_worldPacket << uint32(MemberData.size());
|
||||
_worldPacket << WelcomeText;
|
||||
_worldPacket << InfoText;
|
||||
_worldPacket << uint32(RankData.size());
|
||||
|
||||
for (GuildRankData const& rank : RankData)
|
||||
_worldPacket << rank;
|
||||
|
||||
for (GuildRosterMemberData const& member : MemberData)
|
||||
_worldPacket << member;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Guild::GuildUpdateMotdText::Read()
|
||||
{
|
||||
_worldPacket >> MotdText;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Guild::GuildCommandResult::Write()
|
||||
{
|
||||
_worldPacket << int32(Command);
|
||||
_worldPacket << Name;
|
||||
_worldPacket << int32(Result);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Guild::GuildInviteByName::Read()
|
||||
{
|
||||
_worldPacket >> Name;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Guild::GuildInvite::Write()
|
||||
{
|
||||
_worldPacket << InviterName;
|
||||
_worldPacket << GuildName;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Guild::GuildRosterMemberData const& rosterMemberData)
|
||||
{
|
||||
data << rosterMemberData.Guid;
|
||||
data << uint8(rosterMemberData.Status);
|
||||
data << rosterMemberData.Name;
|
||||
data << int32(rosterMemberData.RankID);
|
||||
data << uint8(rosterMemberData.Level);
|
||||
data << uint8(rosterMemberData.ClassID);
|
||||
data << uint8(rosterMemberData.Gender);
|
||||
data << int32(rosterMemberData.AreaID);
|
||||
if (!rosterMemberData.Status)
|
||||
data << float(rosterMemberData.LastSave);
|
||||
|
||||
data << rosterMemberData.Note;
|
||||
data << rosterMemberData.OfficerNote;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Guild::GuildEvent::Write()
|
||||
{
|
||||
_worldPacket << uint8(Type);
|
||||
_worldPacket << uint8(Params.size());
|
||||
for (std::string_view param : Params)
|
||||
_worldPacket << param;
|
||||
|
||||
switch (Type)
|
||||
{
|
||||
case GE_JOINED:
|
||||
case GE_LEFT:
|
||||
case GE_SIGNED_ON:
|
||||
case GE_SIGNED_OFF:
|
||||
_worldPacket << Guid;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Guild::GuildEventLogQueryResults::Write()
|
||||
{
|
||||
_worldPacket.reserve(1 + Entry.size() * sizeof(GuildEventEntry));
|
||||
|
||||
_worldPacket << uint8(Entry.size());
|
||||
|
||||
for (GuildEventEntry const& entry : Entry)
|
||||
{
|
||||
_worldPacket << uint8(entry.TransactionType);
|
||||
_worldPacket << entry.PlayerGUID;
|
||||
if (entry.TransactionType != GUILD_EVENT_LOG_JOIN_GUILD && entry.TransactionType != GUILD_EVENT_LOG_LEAVE_GUILD)
|
||||
_worldPacket << entry.OtherGUID;
|
||||
if (entry.TransactionType == GUILD_EVENT_LOG_PROMOTE_PLAYER || entry.TransactionType == GUILD_EVENT_LOG_DEMOTE_PLAYER)
|
||||
_worldPacket << uint8(entry.RankID);
|
||||
_worldPacket << uint32(entry.TransactionDate);
|
||||
}
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Guild::GuildPermissionsQueryResults::Write()
|
||||
{
|
||||
_worldPacket << uint32(RankID);
|
||||
_worldPacket << int32(Flags);
|
||||
_worldPacket << int32(WithdrawGoldLimit);
|
||||
_worldPacket << int8(NumTabs);
|
||||
|
||||
for (GuildRankTabPermissions const& tab : Tab)
|
||||
{
|
||||
_worldPacket << int32(tab.Flags);
|
||||
_worldPacket << int32(tab.WithdrawItemLimit);
|
||||
}
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Guild::GuildSetRankPermissions::Read()
|
||||
{
|
||||
_worldPacket >> RankID;
|
||||
_worldPacket >> Flags;
|
||||
_worldPacket >> RankName;
|
||||
_worldPacket >> WithdrawGoldLimit;
|
||||
|
||||
for (uint8 i = 0; i < GUILD_BANK_MAX_TABS; i++)
|
||||
{
|
||||
_worldPacket >> TabFlags[i];
|
||||
_worldPacket >> TabWithdrawItemLimit[i];
|
||||
}
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Guild::GuildRankData const& rankData)
|
||||
{
|
||||
data << uint32(rankData.Flags);
|
||||
data << uint32(rankData.WithdrawGoldLimit);
|
||||
|
||||
for (uint8 i = 0; i < GUILD_BANK_MAX_TABS; i++)
|
||||
{
|
||||
data << uint32(rankData.TabFlags[i]);
|
||||
data << uint32(rankData.TabWithdrawItemLimit[i]);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void WorldPackets::Guild::GuildAddRank::Read()
|
||||
{
|
||||
_worldPacket >> Name;
|
||||
}
|
||||
|
||||
void WorldPackets::Guild::GuildUpdateInfoText::Read()
|
||||
{
|
||||
_worldPacket >> InfoText;
|
||||
}
|
||||
|
||||
void WorldPackets::Guild::GuildSetMemberNote::Read()
|
||||
{
|
||||
_worldPacket >> NoteeName;
|
||||
_worldPacket >> Note;
|
||||
}
|
||||
|
||||
void WorldPackets::Guild::GuildDemoteMember::Read()
|
||||
{
|
||||
_worldPacket >> Demotee;
|
||||
}
|
||||
|
||||
void WorldPackets::Guild::GuildPromoteMember::Read()
|
||||
{
|
||||
_worldPacket >> Promotee;
|
||||
}
|
||||
|
||||
void WorldPackets::Guild::GuildOfficerRemoveMember::Read()
|
||||
{
|
||||
_worldPacket >> Removee;
|
||||
}
|
||||
|
||||
void WorldPackets::Guild::GuildBankActivate::Read()
|
||||
{
|
||||
_worldPacket >> Banker;
|
||||
_worldPacket >> FullUpdate;
|
||||
}
|
||||
|
||||
void WorldPackets::Guild::GuildBankBuyTab::Read()
|
||||
{
|
||||
_worldPacket >> Banker;
|
||||
_worldPacket >> BankTab;
|
||||
}
|
||||
|
||||
void WorldPackets::Guild::GuildBankUpdateTab::Read()
|
||||
{
|
||||
_worldPacket >> Banker;
|
||||
_worldPacket >> BankTab;
|
||||
_worldPacket >> Name;
|
||||
_worldPacket >> Icon;
|
||||
}
|
||||
|
||||
void WorldPackets::Guild::GuildBankDepositMoney::Read()
|
||||
{
|
||||
_worldPacket >> Banker;
|
||||
_worldPacket >> Money;
|
||||
}
|
||||
|
||||
void WorldPackets::Guild::GuildBankQueryTab::Read()
|
||||
{
|
||||
_worldPacket >> Banker;
|
||||
_worldPacket >> Tab;
|
||||
_worldPacket >> FullUpdate;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Guild::GuildBankRemainingWithdrawMoney::Write()
|
||||
{
|
||||
_worldPacket << RemainingWithdrawMoney;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Guild::GuildBankWithdrawMoney::Read()
|
||||
{
|
||||
_worldPacket >> Banker;
|
||||
_worldPacket >> Money;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Guild::GuildBankQueryResults::Write()
|
||||
{
|
||||
_worldPacket << uint64(Money);
|
||||
_worldPacket << uint8(Tab);
|
||||
_withdrawalsRemainingPos = _worldPacket.wpos();
|
||||
_worldPacket << int32(WithdrawalsRemaining);
|
||||
_worldPacket << uint8(FullUpdate);
|
||||
|
||||
if (!Tab && FullUpdate)
|
||||
{
|
||||
_worldPacket << uint8(TabInfo.size());
|
||||
for (GuildBankTabInfo const& tab : TabInfo)
|
||||
{
|
||||
_worldPacket << tab.Name;
|
||||
_worldPacket << tab.Icon;
|
||||
}
|
||||
}
|
||||
|
||||
_worldPacket << uint8(ItemInfo.size());
|
||||
for (GuildBankItemInfo const& item : ItemInfo)
|
||||
{
|
||||
_worldPacket << uint8(item.Slot);
|
||||
_worldPacket << uint32(item.ItemID);
|
||||
if (item.ItemID)
|
||||
{
|
||||
_worldPacket << int32(item.Flags);
|
||||
_worldPacket << int32(item.RandomPropertiesID);
|
||||
if (item.RandomPropertiesID)
|
||||
_worldPacket << int32(item.RandomPropertiesSeed);
|
||||
|
||||
_worldPacket << int32(item.Count);
|
||||
_worldPacket << int32(item.EnchantmentID);
|
||||
_worldPacket << uint8(item.Charges);
|
||||
_worldPacket << uint8(item.SocketEnchant.size());
|
||||
|
||||
for (GuildBankSocketEnchant const& socketEnchant : item.SocketEnchant)
|
||||
{
|
||||
_worldPacket << uint8(socketEnchant.SocketIndex);
|
||||
_worldPacket << int32(socketEnchant.SocketEnchantID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Guild::GuildBankQueryResults::SetWithdrawalsRemaining(int32 withdrawalsRemaining)
|
||||
{
|
||||
WithdrawalsRemaining = withdrawalsRemaining;
|
||||
_worldPacket.put<int32>(_withdrawalsRemainingPos, withdrawalsRemaining);
|
||||
}
|
||||
|
||||
void WorldPackets::Guild::GuildBankSwapItems::Read()
|
||||
{
|
||||
_worldPacket >> Banker;
|
||||
_worldPacket >> BankOnly;
|
||||
|
||||
if (BankOnly)
|
||||
{
|
||||
// dest
|
||||
_worldPacket >> BankTab;
|
||||
_worldPacket >> BankSlot;
|
||||
_worldPacket >> ItemID;
|
||||
|
||||
// src
|
||||
_worldPacket >> BankTab1;
|
||||
_worldPacket >> BankSlot1;
|
||||
_worldPacket >> ItemID1;
|
||||
|
||||
_worldPacket >> AutoStore;
|
||||
_worldPacket >> BankItemCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
_worldPacket >> BankTab;
|
||||
_worldPacket >> BankSlot;
|
||||
_worldPacket >> ItemID;
|
||||
|
||||
_worldPacket >> AutoStore;
|
||||
if (AutoStore)
|
||||
{
|
||||
_worldPacket >> BankItemCount;
|
||||
_worldPacket >> ToSlot;
|
||||
_worldPacket >> StackCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
_worldPacket >> ContainerSlot;
|
||||
_worldPacket >> ContainerItemSlot;
|
||||
_worldPacket >> ToSlot;
|
||||
_worldPacket >> StackCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WorldPackets::Guild::GuildBankLogQuery::Read()
|
||||
{
|
||||
_worldPacket >> Tab;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Guild::GuildBankLogQueryResults::Write()
|
||||
{
|
||||
_worldPacket << uint8(Tab);
|
||||
_worldPacket << uint8(Entry.size());
|
||||
|
||||
for (GuildBankLogEntry const& logEntry : Entry)
|
||||
{
|
||||
_worldPacket << int8(logEntry.EntryType);
|
||||
_worldPacket << logEntry.PlayerGUID;
|
||||
|
||||
switch (logEntry.EntryType)
|
||||
{
|
||||
case GUILD_BANK_LOG_DEPOSIT_ITEM:
|
||||
case GUILD_BANK_LOG_WITHDRAW_ITEM:
|
||||
_worldPacket << uint32(logEntry.ItemID);
|
||||
_worldPacket << uint32(logEntry.Count);
|
||||
break;
|
||||
case GUILD_BANK_LOG_MOVE_ITEM:
|
||||
case GUILD_BANK_LOG_MOVE_ITEM2:
|
||||
_worldPacket << uint32(logEntry.ItemID);
|
||||
_worldPacket << uint32(logEntry.Count);
|
||||
_worldPacket << uint8(logEntry.OtherTab);
|
||||
break;
|
||||
default:
|
||||
_worldPacket << uint32(logEntry.Money);
|
||||
break;
|
||||
}
|
||||
|
||||
_worldPacket << uint32(logEntry.TimeOffset);
|
||||
}
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Guild::GuildBankTextQuery::Read()
|
||||
{
|
||||
_worldPacket >> Tab;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Guild::GuildBankTextQueryResult::Write()
|
||||
{
|
||||
_worldPacket << uint8(Tab);
|
||||
_worldPacket << Text;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Guild::GuildBankSetTabText::Read()
|
||||
{
|
||||
_worldPacket >> Tab;
|
||||
_worldPacket >> TabText;
|
||||
}
|
||||
|
||||
void WorldPackets::Guild::GuildSetGuildMaster::Read()
|
||||
{
|
||||
_worldPacket >> NewMasterName;
|
||||
}
|
||||
|
||||
void WorldPackets::Guild::SaveGuildEmblem::Read()
|
||||
{
|
||||
_worldPacket >> Vendor;
|
||||
_worldPacket >> EStyle;
|
||||
_worldPacket >> EColor;
|
||||
_worldPacket >> BStyle;
|
||||
_worldPacket >> BColor;
|
||||
_worldPacket >> Bg;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Guild::PlayerSaveGuildEmblem::Write()
|
||||
{
|
||||
_worldPacket << int32(Error);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
628
src/server/game/Server/Packets/GuildPackets.h
Normal file
628
src/server/game/Server/Packets/GuildPackets.h
Normal file
@@ -0,0 +1,628 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef GuildPackets_h__
|
||||
#define GuildPackets_h__
|
||||
|
||||
#include "Guild.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "Packet.h"
|
||||
#include "PacketUtilities.h"
|
||||
#include <array>
|
||||
#include <boost/container/static_vector.hpp>
|
||||
|
||||
namespace WorldPackets
|
||||
{
|
||||
namespace Guild
|
||||
{
|
||||
class QueryGuildInfo final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
QueryGuildInfo(WorldPacket&& packet) : ClientPacket(CMSG_GUILD_QUERY, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
uint32 GuildId = 0;
|
||||
};
|
||||
|
||||
struct GuildInfo
|
||||
{
|
||||
std::string GuildName;
|
||||
|
||||
std::array<std::string, GUILD_RANKS_MAX_COUNT> Ranks;
|
||||
uint32 RankCount = 0;
|
||||
|
||||
uint32 EmblemStyle = 0;
|
||||
uint32 EmblemColor = 0;
|
||||
uint32 BorderStyle = 0;
|
||||
uint32 BorderColor = 0;
|
||||
uint32 BackgroundColor = 0;
|
||||
};
|
||||
|
||||
class QueryGuildInfoResponse final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
QueryGuildInfoResponse();
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 GuildId = 0;
|
||||
GuildInfo Info;
|
||||
};
|
||||
|
||||
class GuildCreate final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildCreate(WorldPacket&& packet) : ClientPacket(CMSG_GUILD_CREATE, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
std::string GuildName;
|
||||
};
|
||||
|
||||
class GuildGetInfo final : ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildGetInfo(WorldPacket&& packet) : ClientPacket(CMSG_GUILD_INFO, std::move(packet)) { }
|
||||
|
||||
void Read() override { }
|
||||
};
|
||||
|
||||
class GuildInfoResponse final : ServerPacket
|
||||
{
|
||||
public:
|
||||
GuildInfoResponse() : ServerPacket(SMSG_GUILD_INFO, 123) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
std::string GuildName;
|
||||
time_t CreateDate = time_t(0);
|
||||
int32 NumMembers = 0;
|
||||
int32 NumAccounts = 0;
|
||||
};
|
||||
|
||||
class GuildGetRoster final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildGetRoster(WorldPacket&& packet) : ClientPacket(CMSG_GUILD_ROSTER, std::move(packet)) { }
|
||||
|
||||
void Read() override { }
|
||||
};
|
||||
|
||||
struct GuildRosterMemberData
|
||||
{
|
||||
ObjectGuid Guid;
|
||||
int64 WeeklyXP = 0;
|
||||
int64 TotalXP = 0;
|
||||
int32 RankID = 0;
|
||||
int32 AreaID = 0;
|
||||
float LastSave = 0.0f;
|
||||
std::string Name;
|
||||
std::string Note;
|
||||
std::string OfficerNote;
|
||||
uint8 Status = 0;
|
||||
uint8 Level = 0;
|
||||
uint8 ClassID = 0;
|
||||
uint8 Gender = 0;
|
||||
};
|
||||
|
||||
struct GuildRankData
|
||||
{
|
||||
uint32 Flags = 0;
|
||||
uint32 WithdrawGoldLimit = 0;
|
||||
uint32 TabFlags[GUILD_BANK_MAX_TABS];
|
||||
uint32 TabWithdrawItemLimit[GUILD_BANK_MAX_TABS];
|
||||
};
|
||||
|
||||
class GuildRoster final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
GuildRoster() : ServerPacket(SMSG_GUILD_ROSTER, 4 + 4 + 4 + 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
std::vector<GuildRosterMemberData> MemberData;
|
||||
std::vector<GuildRankData> RankData;
|
||||
std::string WelcomeText;
|
||||
std::string InfoText;
|
||||
};
|
||||
|
||||
class GuildUpdateMotdText final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildUpdateMotdText(WorldPacket&& packet) : ClientPacket(CMSG_GUILD_MOTD, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
String<128, Strings::NoHyperlinks> MotdText;
|
||||
};
|
||||
|
||||
class GuildCommandResult final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
GuildCommandResult() : ServerPacket(SMSG_GUILD_COMMAND_RESULT, 9) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
std::string Name;
|
||||
int32 Result = 0;
|
||||
int32 Command = 0;
|
||||
};
|
||||
|
||||
class AcceptGuildInvite final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
AcceptGuildInvite(WorldPacket&& packet) : ClientPacket(CMSG_GUILD_ACCEPT, std::move(packet)) { }
|
||||
|
||||
void Read() override { }
|
||||
};
|
||||
|
||||
class GuildDeclineInvitation final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildDeclineInvitation(WorldPacket&& packet) : ClientPacket(CMSG_GUILD_DECLINE, std::move(packet)) { }
|
||||
|
||||
void Read() override { }
|
||||
};
|
||||
|
||||
class GuildInviteByName final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildInviteByName(WorldPacket&& packet) : ClientPacket(CMSG_GUILD_INVITE, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
String<48> Name;
|
||||
};
|
||||
|
||||
class GuildInvite final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
GuildInvite() : ServerPacket(SMSG_GUILD_INVITE, 144) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
std::string InviterName;
|
||||
std::string GuildName;
|
||||
};
|
||||
|
||||
class GuildEvent final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
GuildEvent() : ServerPacket(SMSG_GUILD_EVENT) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint8 Type = 0;
|
||||
boost::container::static_vector<std::string_view, 3> Params;
|
||||
ObjectGuid Guid;
|
||||
};
|
||||
|
||||
struct GuildEventEntry
|
||||
{
|
||||
ObjectGuid PlayerGUID;
|
||||
ObjectGuid OtherGUID;
|
||||
uint8 TransactionType = 0;
|
||||
uint8 RankID = 0;
|
||||
uint32 TransactionDate = 0;
|
||||
};
|
||||
|
||||
class GuildEventLogQuery final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildEventLogQuery(WorldPacket&& packet) : ClientPacket(MSG_GUILD_EVENT_LOG_QUERY, std::move(packet)) { }
|
||||
|
||||
void Read() override { }
|
||||
};
|
||||
|
||||
class GuildEventLogQueryResults final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
GuildEventLogQueryResults() : ServerPacket(MSG_GUILD_EVENT_LOG_QUERY, 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
std::vector<GuildEventEntry> Entry;
|
||||
};
|
||||
|
||||
class GuildPermissionsQuery final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildPermissionsQuery(WorldPacket&& packet) : ClientPacket(MSG_GUILD_PERMISSIONS, std::move(packet)) { }
|
||||
|
||||
void Read() override { }
|
||||
};
|
||||
|
||||
class GuildPermissionsQueryResults final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
struct GuildRankTabPermissions
|
||||
{
|
||||
int32 Flags = 0;
|
||||
int32 WithdrawItemLimit = 0;
|
||||
};
|
||||
|
||||
GuildPermissionsQueryResults() : ServerPacket(MSG_GUILD_PERMISSIONS, 20) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
int8 NumTabs = 0;
|
||||
int32 WithdrawGoldLimit = 0;
|
||||
int32 Flags = 0;
|
||||
uint32 RankID = 0;
|
||||
std::array<GuildRankTabPermissions, GUILD_BANK_MAX_TABS> Tab;
|
||||
};
|
||||
|
||||
class GuildSetRankPermissions final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildSetRankPermissions(WorldPacket&& packet) : ClientPacket(CMSG_GUILD_RANK, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
uint32 RankID = 0;
|
||||
uint32 WithdrawGoldLimit = 0;
|
||||
uint32 Flags = 0;
|
||||
uint32 TabFlags[GUILD_BANK_MAX_TABS];
|
||||
uint32 TabWithdrawItemLimit[GUILD_BANK_MAX_TABS];
|
||||
String<15, Strings::NoHyperlinks> RankName;
|
||||
};
|
||||
|
||||
class GuildAddRank final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildAddRank(WorldPacket&& packet) : ClientPacket(CMSG_GUILD_ADD_RANK, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
String<15, Strings::NoHyperlinks> Name;
|
||||
};
|
||||
|
||||
class GuildDeleteRank final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildDeleteRank(WorldPacket&& packet) : ClientPacket(CMSG_GUILD_DEL_RANK, std::move(packet)) { }
|
||||
|
||||
void Read() override { }
|
||||
};
|
||||
|
||||
class GuildUpdateInfoText final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildUpdateInfoText(WorldPacket&& packet) : ClientPacket(CMSG_GUILD_INFO_TEXT, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
String<500, Strings::NoHyperlinks> InfoText;
|
||||
};
|
||||
|
||||
class GuildSetMemberNote final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildSetMemberNote(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
std::string NoteeName;
|
||||
String<31, Strings::NoHyperlinks> Note;
|
||||
};
|
||||
|
||||
class GuildDelete final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildDelete(WorldPacket&& packet) : ClientPacket(CMSG_GUILD_DISBAND, std::move(packet)) { }
|
||||
|
||||
void Read() override { }
|
||||
};
|
||||
|
||||
class GuildDemoteMember final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildDemoteMember(WorldPacket&& packet) : ClientPacket(CMSG_GUILD_DEMOTE, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
std::string Demotee;
|
||||
};
|
||||
|
||||
class GuildPromoteMember final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildPromoteMember(WorldPacket&& packet) : ClientPacket(CMSG_GUILD_PROMOTE, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
std::string Promotee;
|
||||
};
|
||||
|
||||
class GuildOfficerRemoveMember : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildOfficerRemoveMember(WorldPacket&& packet) : ClientPacket(CMSG_GUILD_REMOVE, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
std::string Removee;
|
||||
};
|
||||
|
||||
class GuildLeave final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildLeave(WorldPacket&& packet) : ClientPacket(CMSG_GUILD_LEAVE, std::move(packet)) { }
|
||||
|
||||
void Read() override { }
|
||||
};
|
||||
|
||||
class GuildBankActivate final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildBankActivate(WorldPacket&& packet) : ClientPacket(CMSG_GUILD_BANKER_ACTIVATE, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid Banker;
|
||||
bool FullUpdate = false;
|
||||
};
|
||||
|
||||
class GuildBankBuyTab final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildBankBuyTab(WorldPacket&& packet) : ClientPacket(CMSG_GUILD_BANK_BUY_TAB, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid Banker;
|
||||
uint8 BankTab = 0;
|
||||
};
|
||||
|
||||
class GuildBankUpdateTab final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildBankUpdateTab(WorldPacket&& packet) : ClientPacket(CMSG_GUILD_BANK_UPDATE_TAB, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid Banker;
|
||||
uint8 BankTab = 0;
|
||||
String<16, Strings::NoHyperlinks> Name;
|
||||
String<100> Icon;
|
||||
};
|
||||
|
||||
class GuildBankDepositMoney final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildBankDepositMoney(WorldPacket&& packet) : ClientPacket(CMSG_GUILD_BANK_DEPOSIT_MONEY, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid Banker;
|
||||
uint32 Money = 0;
|
||||
};
|
||||
|
||||
class GuildBankQueryTab final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildBankQueryTab(WorldPacket&& packet) : ClientPacket(CMSG_GUILD_BANK_QUERY_TAB, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid Banker;
|
||||
uint8 Tab = 0;
|
||||
bool FullUpdate = false;
|
||||
};
|
||||
|
||||
class GuildBankRemainingWithdrawMoneyQuery final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildBankRemainingWithdrawMoneyQuery(WorldPacket&& packet) : ClientPacket(MSG_GUILD_BANK_MONEY_WITHDRAWN, std::move(packet)) { }
|
||||
|
||||
void Read() override { }
|
||||
};
|
||||
|
||||
class GuildBankRemainingWithdrawMoney final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
GuildBankRemainingWithdrawMoney() : ServerPacket(MSG_GUILD_BANK_MONEY_WITHDRAWN, 8) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
int32 RemainingWithdrawMoney = 0;
|
||||
};
|
||||
|
||||
class GuildBankWithdrawMoney final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildBankWithdrawMoney(WorldPacket&& packet) : ClientPacket(CMSG_GUILD_BANK_WITHDRAW_MONEY, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid Banker;
|
||||
uint32 Money = 0;
|
||||
};
|
||||
|
||||
struct GuildBankSocketEnchant
|
||||
{
|
||||
uint8 SocketIndex = 0;
|
||||
int32 SocketEnchantID = 0;
|
||||
};
|
||||
|
||||
struct GuildBankItemInfo
|
||||
{
|
||||
uint32 ItemID = 0;
|
||||
int32 RandomPropertiesSeed = 0;
|
||||
int32 RandomPropertiesID = 0;
|
||||
uint8 Slot = 0;
|
||||
int32 Count = 0;
|
||||
int32 EnchantmentID = 0;
|
||||
int32 Charges = 0;
|
||||
int32 Flags = 0;
|
||||
std::vector<GuildBankSocketEnchant> SocketEnchant;
|
||||
};
|
||||
|
||||
struct GuildBankTabInfo
|
||||
{
|
||||
std::string Name;
|
||||
std::string Icon;
|
||||
};
|
||||
|
||||
class GuildBankQueryResults final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
GuildBankQueryResults() : ServerPacket(SMSG_GUILD_BANK_LIST, 25) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
std::vector<GuildBankItemInfo> ItemInfo;
|
||||
std::vector<GuildBankTabInfo> TabInfo;
|
||||
int32 WithdrawalsRemaining = 0;
|
||||
uint8 Tab = 0;
|
||||
uint64 Money = 0;
|
||||
bool FullUpdate = false;
|
||||
|
||||
void SetWithdrawalsRemaining(int32 withdrawalsRemaining);
|
||||
|
||||
private:
|
||||
std::size_t _withdrawalsRemainingPos = 0;
|
||||
};
|
||||
|
||||
class GuildBankSwapItems final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildBankSwapItems(WorldPacket&& packet) : ClientPacket(CMSG_GUILD_BANK_SWAP_ITEMS, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid Banker;
|
||||
int32 StackCount = 0;
|
||||
int32 BankItemCount = 0;
|
||||
uint32 ItemID = 0;
|
||||
uint32 ItemID1 = 0;
|
||||
uint8 ToSlot = 0;
|
||||
uint8 BankSlot = 0;
|
||||
uint8 BankSlot1 = 0;
|
||||
uint8 BankTab = 0;
|
||||
uint8 BankTab1 = 0;
|
||||
uint8 ContainerSlot = 0;
|
||||
uint8 ContainerItemSlot = 0;
|
||||
bool AutoStore = false;
|
||||
bool BankOnly = false;
|
||||
};
|
||||
|
||||
class GuildBankLogQuery final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildBankLogQuery(WorldPacket&& packet) : ClientPacket(MSG_GUILD_BANK_LOG_QUERY, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
uint8 Tab = 0;
|
||||
};
|
||||
|
||||
struct GuildBankLogEntry
|
||||
{
|
||||
ObjectGuid PlayerGUID;
|
||||
uint32 TimeOffset = 0;
|
||||
int8 EntryType = 0;
|
||||
uint32 Money = 0;
|
||||
int32 ItemID = 0;
|
||||
int32 Count = 0;
|
||||
int8 OtherTab = 0;
|
||||
};
|
||||
|
||||
class GuildBankLogQueryResults final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
GuildBankLogQueryResults() : ServerPacket(MSG_GUILD_BANK_LOG_QUERY, 25) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint8 Tab = 0;
|
||||
std::vector<GuildBankLogEntry> Entry;
|
||||
};
|
||||
|
||||
class GuildBankTextQuery final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildBankTextQuery(WorldPacket&& packet) : ClientPacket(MSG_QUERY_GUILD_BANK_TEXT, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
uint8 Tab = 0;
|
||||
};
|
||||
|
||||
class GuildBankTextQueryResult : public ServerPacket
|
||||
{
|
||||
public:
|
||||
GuildBankTextQueryResult() : ServerPacket(MSG_QUERY_GUILD_BANK_TEXT, 4 + 2) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint8 Tab = 0;
|
||||
std::string Text;
|
||||
};
|
||||
|
||||
class GuildBankSetTabText final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildBankSetTabText(WorldPacket&& packet) : ClientPacket(CMSG_SET_GUILD_BANK_TEXT, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
uint8 Tab = 0;
|
||||
String<500, Strings::NoHyperlinks> TabText;
|
||||
};
|
||||
|
||||
class GuildSetGuildMaster final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
GuildSetGuildMaster(WorldPacket&& packet) : ClientPacket(CMSG_GUILD_LEADER, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
std::string NewMasterName;
|
||||
};
|
||||
|
||||
class SaveGuildEmblem final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
SaveGuildEmblem(WorldPacket&& packet) : ClientPacket(MSG_SAVE_GUILD_EMBLEM, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid Vendor;
|
||||
int32 BStyle = 0;
|
||||
int32 EStyle = 0;
|
||||
int32 BColor = 0;
|
||||
int32 EColor = 0;
|
||||
int32 Bg = 0;
|
||||
};
|
||||
|
||||
class PlayerSaveGuildEmblem final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
PlayerSaveGuildEmblem() : ServerPacket(MSG_SAVE_GUILD_EMBLEM, 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
int32 Error = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Guild::GuildRosterMemberData const& rosterMemberData);
|
||||
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Guild::GuildRankData const& rankData);
|
||||
|
||||
#endif // GuildPackets_h__
|
||||
34
src/server/game/Server/Packets/LFGPackets.cpp
Normal file
34
src/server/game/Server/Packets/LFGPackets.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "LFGPackets.h"
|
||||
|
||||
void WorldPackets::LFG::LFGJoin::Read()
|
||||
{
|
||||
_worldPacket >> Roles;
|
||||
_worldPacket >> NoPartialClear;
|
||||
_worldPacket >> Achievements;
|
||||
Slots.resize(_worldPacket.read<uint8>());
|
||||
for (uint32& slot : Slots)
|
||||
_worldPacket >> slot;
|
||||
|
||||
_worldPacket.read_skip<uint8>(); // Needs count, hardcoded to 3 in client
|
||||
for (uint8& needs : Needs)
|
||||
_worldPacket >> needs;
|
||||
|
||||
_worldPacket >> Comment;
|
||||
}
|
||||
50
src/server/game/Server/Packets/LFGPackets.h
Normal file
50
src/server/game/Server/Packets/LFGPackets.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LFGPackets_h__
|
||||
#define LFGPackets_h__
|
||||
|
||||
#include "Packet.h"
|
||||
#include "PacketUtilities.h"
|
||||
|
||||
namespace WorldPackets::LFG
|
||||
{
|
||||
class LFGJoin final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
LFGJoin(WorldPacket&& packet) : ClientPacket(CMSG_LFG_JOIN, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
uint32 Roles = 0;
|
||||
Array<uint32, 50> Slots;
|
||||
std::string Comment;
|
||||
bool NoPartialClear = false;
|
||||
bool Achievements = false;
|
||||
std::array<uint8, 3> Needs = { };
|
||||
};
|
||||
|
||||
class LFGLeave final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
LFGLeave(WorldPacket&& packet) : ClientPacket(CMSG_LFG_LEAVE, std::move(packet)) { }
|
||||
|
||||
void Read() override { };
|
||||
};
|
||||
}
|
||||
|
||||
#endif // LFGPackets_h__
|
||||
79
src/server/game/Server/Packets/MiscPackets.cpp
Normal file
79
src/server/game/Server/Packets/MiscPackets.cpp
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "MiscPackets.h"
|
||||
|
||||
WorldPackets::Misc::Weather::Weather() : ServerPacket(SMSG_WEATHER, 4 + 4 + 1) { }
|
||||
|
||||
WorldPackets::Misc::Weather::Weather(WeatherState weatherID, float intensity /*= 0.0f*/, bool abrupt /*= false*/)
|
||||
: ServerPacket(SMSG_WEATHER, 4 + 4 + 1), Abrupt(abrupt), Intensity(intensity), WeatherID(weatherID) { }
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::Weather::Write()
|
||||
{
|
||||
_worldPacket << uint32(WeatherID);
|
||||
_worldPacket << float(Intensity);
|
||||
_worldPacket << uint8(Abrupt);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::PlayMusic::Write()
|
||||
{
|
||||
_worldPacket << SoundKitID;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::PlayObjectSound::Write()
|
||||
{
|
||||
_worldPacket << SoundKitID;
|
||||
_worldPacket << SourceObjectGUID;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::Playsound::Write()
|
||||
{
|
||||
_worldPacket << SoundKitID;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Misc::RandomRollClient::Read()
|
||||
{
|
||||
_worldPacket >> Min;
|
||||
_worldPacket >> Max;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::RandomRoll::Write()
|
||||
{
|
||||
_worldPacket << uint32(Min);
|
||||
_worldPacket << uint32(Max);
|
||||
_worldPacket << uint32(Result);
|
||||
_worldPacket << Roller;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::CrossedInebriationThreshold::Write()
|
||||
{
|
||||
_worldPacket << Guid;
|
||||
_worldPacket << uint32(Threshold);
|
||||
_worldPacket << uint32(ItemID);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
118
src/server/game/Server/Packets/MiscPackets.h
Normal file
118
src/server/game/Server/Packets/MiscPackets.h
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MiscPackets_h__
|
||||
#define MiscPackets_h__
|
||||
|
||||
#include "Packet.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "Weather.h"
|
||||
|
||||
enum WeatherState : uint32;
|
||||
|
||||
namespace WorldPackets
|
||||
{
|
||||
namespace Misc
|
||||
{
|
||||
class AC_GAME_API Weather final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
Weather();
|
||||
Weather(WeatherState weatherID, float intensity = 0.0f, bool abrupt = false);
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
bool Abrupt = false;
|
||||
float Intensity = 0.0f;
|
||||
WeatherState WeatherID = WeatherState(0);
|
||||
};
|
||||
|
||||
class AC_GAME_API PlayMusic final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
PlayMusic() : ServerPacket(SMSG_PLAY_MUSIC, 4) { }
|
||||
PlayMusic(uint32 soundKitID) : ServerPacket(SMSG_PLAY_MUSIC, 4), SoundKitID(soundKitID) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 SoundKitID = 0;
|
||||
};
|
||||
|
||||
class AC_GAME_API PlayObjectSound final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
PlayObjectSound() : ServerPacket(SMSG_PLAY_OBJECT_SOUND, 4 + 8) { }
|
||||
PlayObjectSound(ObjectGuid const& sourceObjectGUID, uint32 soundKitID)
|
||||
: ServerPacket(SMSG_PLAY_OBJECT_SOUND, 4 + 8), SourceObjectGUID(sourceObjectGUID), SoundKitID(soundKitID) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
ObjectGuid SourceObjectGUID;
|
||||
uint32 SoundKitID = 0;
|
||||
|
||||
};
|
||||
|
||||
class AC_GAME_API Playsound final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
Playsound() : ServerPacket(SMSG_PLAY_SOUND, 4) { }
|
||||
Playsound(uint32 soundKitID) : ServerPacket(SMSG_PLAY_SOUND, 4), SoundKitID(soundKitID) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 SoundKitID = 0;
|
||||
};
|
||||
|
||||
class RandomRollClient final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
RandomRollClient(WorldPacket&& packet) : ClientPacket(MSG_RANDOM_ROLL, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
uint32 Min = 0;
|
||||
uint32 Max = 0;
|
||||
};
|
||||
|
||||
class RandomRoll final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
RandomRoll() : ServerPacket(MSG_RANDOM_ROLL, 4 + 4 + 4 + 8) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 Min = 0;
|
||||
uint32 Max = 0;
|
||||
uint32 Result = 0;
|
||||
ObjectGuid Roller;
|
||||
};
|
||||
|
||||
class CrossedInebriationThreshold final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
CrossedInebriationThreshold() : ServerPacket(SMSG_CROSSED_INEBRIATION_THRESHOLD, 8 + 4 + 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
ObjectGuid Guid;
|
||||
uint32 Threshold = 0;
|
||||
uint32 ItemID = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // MiscPackets_h__
|
||||
@@ -66,5 +66,5 @@ WorldPackets::PacketArrayMaxCapacityException::PacketArrayMaxCapacityException(s
|
||||
|
||||
void WorldPackets::CheckCompactArrayMaskOverflow(std::size_t index, std::size_t limit)
|
||||
{
|
||||
ASSERT(index < limit, "Attempted to insert " SZFMTD " values into CompactArray but it can only hold " SZFMTD, index, limit);
|
||||
ASSERT(index < limit, "Attempted to insert {} values into CompactArray but it can only hold {}", index, limit);
|
||||
}
|
||||
|
||||
52
src/server/game/Server/Packets/PetPackets.cpp
Normal file
52
src/server/game/Server/Packets/PetPackets.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "PetPackets.h"
|
||||
|
||||
void WorldPackets::Pet::DismissCritter::Read()
|
||||
{
|
||||
_worldPacket >> CritterGUID;
|
||||
}
|
||||
|
||||
void WorldPackets::Pet::PetAbandon::Read()
|
||||
{
|
||||
_worldPacket >> PetGUID;
|
||||
}
|
||||
|
||||
void WorldPackets::Pet::PetStopAttack::Read()
|
||||
{
|
||||
_worldPacket >> PetGUID;
|
||||
}
|
||||
|
||||
void WorldPackets::Pet::PetSpellAutocast::Read()
|
||||
{
|
||||
_worldPacket >> PetGUID;
|
||||
_worldPacket >> SpellID;
|
||||
_worldPacket >> AutocastEnabled;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Pet::PetLearnedSpell::Write()
|
||||
{
|
||||
_worldPacket << uint32(SpellID);
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Pet::PetUnlearnedSpell::Write()
|
||||
{
|
||||
_worldPacket << uint32(SpellID);
|
||||
return &_worldPacket;
|
||||
}
|
||||
100
src/server/game/Server/Packets/PetPackets.h
Normal file
100
src/server/game/Server/Packets/PetPackets.h
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PetPackets_h__
|
||||
#define PetPackets_h__
|
||||
|
||||
#include "Packet.h"
|
||||
#include "ObjectGuid.h"
|
||||
|
||||
namespace WorldPackets
|
||||
{
|
||||
namespace Pet
|
||||
{
|
||||
class DismissCritter final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
DismissCritter(WorldPacket&& packet) : ClientPacket(CMSG_DISMISS_CRITTER, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid CritterGUID;
|
||||
};
|
||||
|
||||
class PetAbandon final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
PetAbandon(WorldPacket&& packet) : ClientPacket(CMSG_PET_ABANDON, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid PetGUID;
|
||||
};
|
||||
|
||||
class PetStopAttack final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
PetStopAttack(WorldPacket&& packet) : ClientPacket(CMSG_PET_STOP_ATTACK, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid PetGUID;
|
||||
};
|
||||
|
||||
class PetSpellAutocast final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
PetSpellAutocast(WorldPacket&& packet) : ClientPacket(CMSG_PET_SPELL_AUTOCAST, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid PetGUID;
|
||||
uint32 SpellID = 0;
|
||||
bool AutocastEnabled = false;
|
||||
};
|
||||
|
||||
class PetLearnedSpell final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
PetLearnedSpell() : ServerPacket(SMSG_PET_LEARNED_SPELL, 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 SpellID = 0;
|
||||
};
|
||||
|
||||
class PetUnlearnedSpell final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
PetUnlearnedSpell() : ServerPacket(SMSG_PET_UNLEARNED_SPELL, 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 SpellID = 0;
|
||||
};
|
||||
|
||||
class RequestPetInfo final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
RequestPetInfo(WorldPacket&& packet) : ClientPacket(CMSG_REQUEST_PET_INFO, std::move(packet)) { }
|
||||
|
||||
void Read() override { }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // PetPackets_h__
|
||||
33
src/server/game/Server/Packets/TotemPackets.cpp
Normal file
33
src/server/game/Server/Packets/TotemPackets.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "TotemPackets.h"
|
||||
|
||||
void WorldPackets::Totem::TotemDestroyed::Read()
|
||||
{
|
||||
_worldPacket >> Slot;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Totem::TotemCreated::Write()
|
||||
{
|
||||
_worldPacket << Slot;
|
||||
_worldPacket << Totem;
|
||||
_worldPacket << Duration;
|
||||
_worldPacket << SpellID;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
54
src/server/game/Server/Packets/TotemPackets.h
Normal file
54
src/server/game/Server/Packets/TotemPackets.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TotemPackets_h__
|
||||
#define TotemPackets_h__
|
||||
|
||||
#include "ObjectGuid.h"
|
||||
#include "Packet.h"
|
||||
|
||||
namespace WorldPackets
|
||||
{
|
||||
namespace Totem
|
||||
{
|
||||
class TotemDestroyed final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
TotemDestroyed(WorldPacket&& packet) : ClientPacket(CMSG_TOTEM_DESTROYED, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
uint8 Slot = 0;
|
||||
};
|
||||
|
||||
class TotemCreated final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
TotemCreated() : ServerPacket(SMSG_TOTEM_CREATED, 1 + 8 + 4 + 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint8 Slot = 0;
|
||||
ObjectGuid Totem;
|
||||
uint32 Duration = 0;
|
||||
uint32 SpellID = 0;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // TotemPackets_h__
|
||||
46
src/server/game/Server/Packets/WorldStatePackets.cpp
Normal file
46
src/server/game/Server/Packets/WorldStatePackets.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "WorldStatePackets.h"
|
||||
|
||||
WorldPackets::WorldState::InitWorldStates::InitWorldStates() : ServerPacket(SMSG_INIT_WORLD_STATES, 4 + 4 + 4 + 2) { }
|
||||
|
||||
WorldPacket const* WorldPackets::WorldState::InitWorldStates::Write()
|
||||
{
|
||||
_worldPacket.reserve(4 + 4 + 4 + 2 + Worldstates.size() * 8);
|
||||
|
||||
_worldPacket << int32(MapID);
|
||||
_worldPacket << int32(ZoneID);
|
||||
_worldPacket << int32(AreaID);
|
||||
|
||||
_worldPacket << uint16(Worldstates.size());
|
||||
for (WorldStateInfo const& wsi : Worldstates)
|
||||
{
|
||||
_worldPacket << int32(wsi.VariableID);
|
||||
_worldPacket << int32(wsi.Value);
|
||||
}
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::WorldState::UpdateWorldState::Write()
|
||||
{
|
||||
_worldPacket << int32(VariableID);
|
||||
_worldPacket << int32(Value);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
62
src/server/game/Server/Packets/WorldStatePackets.h
Normal file
62
src/server/game/Server/Packets/WorldStatePackets.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef WorldStatePackets_h__
|
||||
#define WorldStatePackets_h__
|
||||
|
||||
#include "Packet.h"
|
||||
|
||||
namespace WorldPackets
|
||||
{
|
||||
namespace WorldState
|
||||
{
|
||||
class InitWorldStates final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
struct WorldStateInfo
|
||||
{
|
||||
WorldStateInfo(int32 variableID, int32 value) : VariableID(variableID), Value(value) { }
|
||||
|
||||
int32 VariableID;
|
||||
int32 Value;
|
||||
};
|
||||
|
||||
InitWorldStates();
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
int32 MapID = 0;
|
||||
int32 ZoneID = 0;
|
||||
int32 AreaID = 0;
|
||||
|
||||
std::vector<WorldStateInfo> Worldstates;
|
||||
};
|
||||
|
||||
class UpdateWorldState final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
UpdateWorldState() : ServerPacket(SMSG_UPDATE_WORLD_STATE, 4 + 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
int32 VariableID = 0;
|
||||
int32 Value = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // WorldStatePackets_h__
|
||||
@@ -17,10 +17,10 @@
|
||||
|
||||
#include "Opcodes.h"
|
||||
#include "Log.h"
|
||||
#include "Packets/AllPackets.h"
|
||||
#include "WorldSession.h"
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
//#include "Packets/AllPackets.h"
|
||||
|
||||
template<class PacketClass, void(WorldSession::* HandlerFunction)(PacketClass&)>
|
||||
class PacketHandler : public ClientOpcodeHandler
|
||||
@@ -77,19 +77,19 @@ void OpcodeTable::ValidateAndSetClientOpcode(OpcodeClient opcode, char const* na
|
||||
{
|
||||
if (uint32(opcode) == NULL_OPCODE)
|
||||
{
|
||||
LOG_ERROR("network", "Opcode %s does not have a value", name);
|
||||
LOG_ERROR("network", "Opcode {} does not have a value", name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (uint32(opcode) >= NUM_OPCODE_HANDLERS)
|
||||
{
|
||||
LOG_ERROR("network", "Tried to set handler for an invalid opcode %u", uint32(opcode));
|
||||
LOG_ERROR("network", "Tried to set handler for an invalid opcode {}", uint32(opcode));
|
||||
return;
|
||||
}
|
||||
|
||||
if (_internalTableClient[opcode] != nullptr)
|
||||
{
|
||||
LOG_ERROR("network", "Tried to override client handler of %s with %s (opcode %u)", opcodeTable[opcode]->Name, name, uint32(opcode));
|
||||
LOG_ERROR("network", "Tried to override client handler of {} with {} (opcode {})", opcodeTable[opcode]->Name, name, uint32(opcode));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -100,19 +100,19 @@ void OpcodeTable::ValidateAndSetServerOpcode(OpcodeServer opcode, char const* na
|
||||
{
|
||||
if (uint32(opcode) == NULL_OPCODE)
|
||||
{
|
||||
LOG_ERROR("network", "Opcode %s does not have a value", name);
|
||||
LOG_ERROR("network", "Opcode {} does not have a value", name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (uint32(opcode) >= NUM_OPCODE_HANDLERS)
|
||||
{
|
||||
LOG_ERROR("network", "Tried to set handler for an invalid opcode %u", uint32(opcode));
|
||||
LOG_ERROR("network", "Tried to set handler for an invalid opcode {}", uint32(opcode));
|
||||
return;
|
||||
}
|
||||
|
||||
if (_internalTableClient[opcode] != nullptr)
|
||||
{
|
||||
LOG_ERROR("network", "Tried to override server handler of %s with %s (opcode %u)", opcodeTable[opcode]->Name, name, uint32(opcode));
|
||||
LOG_ERROR("network", "Tried to override server handler of {} with {} (opcode {})", opcodeTable[opcode]->Name, name, uint32(opcode));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -608,7 +608,7 @@ void OpcodeTable::Initialize()
|
||||
/*0x1DD*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_PONG, STATUS_NEVER);
|
||||
/*0x1DE*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_CLEAR_COOLDOWN, STATUS_NEVER);
|
||||
/*0x1DF*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_GAMEOBJECT_PAGETEXT, STATUS_NEVER);
|
||||
/*0x1E0*/ DEFINE_HANDLER(CMSG_SETSHEATHED, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleSetSheathedOpcode );
|
||||
/*0x1E0*/ DEFINE_HANDLER(CMSG_SET_SHEATHED, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleSetSheathedOpcode );
|
||||
/*0x1E1*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_COOLDOWN_CHEAT, STATUS_NEVER);
|
||||
/*0x1E2*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_DELAYED, STATUS_NEVER);
|
||||
/*0x1E3*/ DEFINE_HANDLER(CMSG_QUEST_POI_QUERY, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleQuestPOIQuery );
|
||||
@@ -636,7 +636,7 @@ void OpcodeTable::Initialize()
|
||||
/*0x1F9*/ DEFINE_HANDLER(CMSG_GM_SET_SECURITY_GROUP, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL );
|
||||
/*0x1FA*/ DEFINE_HANDLER(CMSG_GM_NUKE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL );
|
||||
/*0x1FB*/ DEFINE_HANDLER(MSG_RANDOM_ROLL, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleRandomRollOpcode );
|
||||
/*0x1FC*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_ENVIRONMENTALDAMAGELOG, STATUS_NEVER);
|
||||
/*0x1FC*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_ENVIRONMENTAL_DAMAGE_LOG, STATUS_NEVER);
|
||||
/*0x1FD*/ DEFINE_HANDLER(CMSG_CHANGEPLAYER_DIFFICULTY, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL );
|
||||
/*0x1FE*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_RWHOIS, STATUS_NEVER);
|
||||
/*0x1FF*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_LFG_PLAYER_REWARD, STATUS_NEVER);
|
||||
@@ -761,8 +761,8 @@ void OpcodeTable::Initialize()
|
||||
/*0x276*/ DEFINE_HANDLER(MSG_QUEST_PUSH_RESULT, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleQuestPushResult );
|
||||
/*0x277*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_PLAY_MUSIC, STATUS_NEVER);
|
||||
/*0x278*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_PLAY_OBJECT_SOUND, STATUS_NEVER);
|
||||
/*0x279*/ DEFINE_HANDLER(CMSG_REQUEST_PET_INFO, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRequestPetInfoOpcode );
|
||||
/*0x27A*/ DEFINE_HANDLER(CMSG_FAR_SIGHT, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleFarSightOpcode );
|
||||
/*0x279*/ DEFINE_HANDLER(CMSG_REQUEST_PET_INFO, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRequestPetInfo );
|
||||
/*0x27A*/ DEFINE_HANDLER(CMSG_FAR_SIGHT, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleFarSightOpcode );
|
||||
/*0x27B*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELLDISPELLOG, STATUS_NEVER);
|
||||
/*0x27C*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_DAMAGE_CALC_LOG, STATUS_NEVER);
|
||||
/*0x27D*/ DEFINE_HANDLER(CMSG_ENABLE_DAMAGE_LOG, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL );
|
||||
@@ -785,7 +785,7 @@ void OpcodeTable::Initialize()
|
||||
/*0x28E*/ DEFINE_HANDLER(CMSG_GROUP_RAID_CONVERT, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGroupRaidConvertOpcode );
|
||||
/*0x28F*/ DEFINE_HANDLER(CMSG_GROUP_ASSISTANT_LEADER, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGroupAssistantLeaderOpcode );
|
||||
/*0x290*/ DEFINE_HANDLER(CMSG_BUYBACK_ITEM, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleBuybackItem );
|
||||
/*0x291*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_SERVER_MESSAGE, STATUS_NEVER);
|
||||
/*0x291*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_CHAT_SERVER_MESSAGE, STATUS_NEVER);
|
||||
/*0x292*/ DEFINE_HANDLER(CMSG_SET_SAVED_INSTANCE_EXTEND, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleSetSavedInstanceExtend );
|
||||
/*0x293*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_LFG_OFFER_CONTINUE, STATUS_NEVER);
|
||||
/*0x294*/ DEFINE_HANDLER(CMSG_TEST_DROP_RATE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL );
|
||||
@@ -1306,7 +1306,7 @@ void OpcodeTable::Initialize()
|
||||
/*0x497*/ DEFINE_HANDLER(CMSG_FLOOD_GRACE_CHEAT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL );
|
||||
/*0x498*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_SERVER_FIRST_ACHIEVEMENT, STATUS_NEVER);
|
||||
/*0x499*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_PET_LEARNED_SPELL, STATUS_NEVER);
|
||||
/*0x49A*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_PET_REMOVED_SPELL, STATUS_NEVER);
|
||||
/*0x49A*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_PET_UNLEARNED_SPELL, STATUS_NEVER);
|
||||
/*0x49B*/ DEFINE_HANDLER(CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleChangeSeatsOnControlledVehicle );
|
||||
/*0x49C*/ DEFINE_HANDLER(CMSG_HEARTH_AND_RESURRECT, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleHearthAndResurrect );
|
||||
/*0x49D*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, STATUS_NEVER);
|
||||
|
||||
@@ -507,7 +507,7 @@ enum Opcodes : uint16
|
||||
SMSG_PONG = 0x1DD,
|
||||
SMSG_CLEAR_COOLDOWN = 0x1DE,
|
||||
SMSG_GAMEOBJECT_PAGETEXT = 0x1DF,
|
||||
CMSG_SETSHEATHED = 0x1E0,
|
||||
CMSG_SET_SHEATHED = 0x1E0,
|
||||
SMSG_COOLDOWN_CHEAT = 0x1E1,
|
||||
SMSG_SPELL_DELAYED = 0x1E2,
|
||||
CMSG_QUEST_POI_QUERY = 0x1E3,
|
||||
@@ -535,7 +535,7 @@ enum Opcodes : uint16
|
||||
CMSG_GM_SET_SECURITY_GROUP = 0x1F9,
|
||||
CMSG_GM_NUKE = 0x1FA,
|
||||
MSG_RANDOM_ROLL = 0x1FB,
|
||||
SMSG_ENVIRONMENTALDAMAGELOG = 0x1FC,
|
||||
SMSG_ENVIRONMENTAL_DAMAGE_LOG = 0x1FC,
|
||||
CMSG_CHANGEPLAYER_DIFFICULTY = 0x1FD,
|
||||
SMSG_RWHOIS = 0x1FE,
|
||||
SMSG_LFG_PLAYER_REWARD = 0x1FF, // uint32, uint8, uint32, uint32, uint32, uint32, uint32, uint8, for (uint8) {uint32, uint32, uint32}
|
||||
@@ -684,7 +684,7 @@ enum Opcodes : uint16
|
||||
CMSG_GROUP_RAID_CONVERT = 0x28E,
|
||||
CMSG_GROUP_ASSISTANT_LEADER = 0x28F,
|
||||
CMSG_BUYBACK_ITEM = 0x290,
|
||||
SMSG_SERVER_MESSAGE = 0x291,
|
||||
SMSG_CHAT_SERVER_MESSAGE = 0x291,
|
||||
CMSG_SET_SAVED_INSTANCE_EXTEND = 0x292,
|
||||
SMSG_LFG_OFFER_CONTINUE = 0x293,
|
||||
CMSG_TEST_DROP_RATE = 0x294,
|
||||
@@ -1205,7 +1205,7 @@ enum Opcodes : uint16
|
||||
CMSG_FLOOD_GRACE_CHEAT = 0x497,
|
||||
SMSG_SERVER_FIRST_ACHIEVEMENT = 0x498,
|
||||
SMSG_PET_LEARNED_SPELL = 0x499,
|
||||
SMSG_PET_REMOVED_SPELL = 0x49A,
|
||||
SMSG_PET_UNLEARNED_SPELL = 0x49A,
|
||||
CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE = 0x49B,
|
||||
CMSG_HEARTH_AND_RESURRECT = 0x49C,
|
||||
SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA = 0x49D,
|
||||
@@ -1374,7 +1374,7 @@ class OpcodeHandler
|
||||
{
|
||||
public:
|
||||
OpcodeHandler(char const* name, SessionStatus status) : Name(name), Status(status) { }
|
||||
virtual ~OpcodeHandler() { }
|
||||
virtual ~OpcodeHandler() = default;
|
||||
|
||||
char const* Name;
|
||||
SessionStatus Status;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include "PacketLog.h"
|
||||
#include "Config.h"
|
||||
#include "GameTime.h"
|
||||
#include "IpAddress.h"
|
||||
#include "Timer.h"
|
||||
#include "WorldPacket.h"
|
||||
@@ -99,7 +100,7 @@ void PacketLog::Initialize()
|
||||
header.Build = 12340;
|
||||
header.Locale[0] = 'e'; header.Locale[1] = 'n'; header.Locale[2] = 'U'; header.Locale[3] = 'S';
|
||||
std::memset(header.SessionKey, 0, sizeof(header.SessionKey));
|
||||
header.SniffStartUnixtime = time(nullptr);
|
||||
header.SniffStartUnixtime = GameTime::GetGameTime().count();
|
||||
header.SniffStartTicks = getMSTime();
|
||||
header.OptionalDataSize = 0;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ struct ServerPktHeader
|
||||
uint8 headerIndex=0;
|
||||
if (isLargePacket())
|
||||
{
|
||||
LOG_DEBUG("network", "initializing large server to client packet. Size: %u, cmd: %u", size, cmd);
|
||||
LOG_DEBUG("network", "initializing large server to client packet. Size: {}, cmd: {}", size, cmd);
|
||||
header[headerIndex++] = 0x80 | (0xFF & (size >> 16));
|
||||
}
|
||||
header[headerIndex++] = 0xFF &(size >> 8);
|
||||
|
||||
@@ -27,7 +27,7 @@ class WorldPacket : public ByteBuffer
|
||||
{
|
||||
public:
|
||||
// just container for later use
|
||||
WorldPacket() : ByteBuffer(0), m_opcode(NULL_OPCODE) { }
|
||||
WorldPacket() : ByteBuffer(0) { }
|
||||
|
||||
explicit WorldPacket(uint16 opcode, size_t res = 200) :
|
||||
ByteBuffer(res), m_opcode(opcode) { }
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
[[nodiscard]] TimePoint GetReceivedTime() const { return m_receivedTime; }
|
||||
|
||||
protected:
|
||||
uint16 m_opcode;
|
||||
uint16 m_opcode{NULL_OPCODE};
|
||||
TimePoint m_receivedTime; // only set for a specific set of opcodes, for performance reasons.
|
||||
};
|
||||
|
||||
|
||||
@@ -22,8 +22,10 @@
|
||||
#include "WorldSession.h"
|
||||
#include "AccountMgr.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "CharacterPackets.h"
|
||||
#include "Common.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
@@ -35,11 +37,10 @@
|
||||
#include "ObjectMgr.h"
|
||||
#include "Opcodes.h"
|
||||
#include "OutdoorPvPMgr.h"
|
||||
#include "QueryHolder.h"
|
||||
#include "PacketUtilities.h"
|
||||
#include "Pet.h"
|
||||
#include "Player.h"
|
||||
#include "QueryHolder.h"
|
||||
#include "SavingSystem.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "SocialMgr.h"
|
||||
#include "Transport.h"
|
||||
@@ -51,10 +52,6 @@
|
||||
#include "WorldSocket.h"
|
||||
#include <zlib.h>
|
||||
|
||||
#ifdef PLAYERBOTS
|
||||
#include "Playerbot.h"
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
std::string const DefaultPlayerName = "<none>";
|
||||
@@ -105,7 +102,7 @@ bool WorldSessionFilter::Process(WorldPacket* packet)
|
||||
|
||||
/// WorldSession constructor
|
||||
WorldSession::WorldSession(uint32 id, std::string&& name, std::shared_ptr<WorldSocket> sock, AccountTypes sec, uint8 expansion,
|
||||
time_t mute_time, LocaleConstant locale, uint32 recruiter, bool isARecruiter, bool skipQueue, uint32 TotalTime) :
|
||||
time_t mute_time, LocaleConstant locale, uint32 recruiter, bool isARecruiter, bool skipQueue, uint32 TotalTime, bool isBot) :
|
||||
m_muteTime(mute_time),
|
||||
m_timeOutTime(0),
|
||||
_lastAuctionListItemsMSTime(0),
|
||||
@@ -135,7 +132,8 @@ WorldSession::WorldSession(uint32 id, std::string&& name, std::shared_ptr<WorldS
|
||||
_calendarEventCreationCooldown(0),
|
||||
_timeSyncClockDeltaQueue(6),
|
||||
_timeSyncClockDelta(0),
|
||||
_pendingTimeSyncRequests()
|
||||
_pendingTimeSyncRequests(),
|
||||
_isBot(isBot)
|
||||
{
|
||||
memset(m_Tutorials, 0, sizeof(m_Tutorials));
|
||||
|
||||
@@ -150,14 +148,18 @@ WorldSession::WorldSession(uint32 id, std::string&& name, std::shared_ptr<WorldS
|
||||
{
|
||||
m_Address = sock->GetRemoteIpAddress().to_string();
|
||||
ResetTimeOutTime(false);
|
||||
LoginDatabase.PExecute("UPDATE account SET online = 1 WHERE id = %u;", GetAccountId()); // One-time query
|
||||
LoginDatabase.Execute("UPDATE account SET online = 1 WHERE id = {};", GetAccountId()); // One-time query
|
||||
}
|
||||
else if (isBot)
|
||||
{
|
||||
m_Address = "bot";
|
||||
}
|
||||
}
|
||||
|
||||
/// WorldSession destructor
|
||||
WorldSession::~WorldSession()
|
||||
{
|
||||
LoginDatabase.PExecute("UPDATE account SET totaltime = %u WHERE id = %u", GetTotalTime(), GetAccountId());
|
||||
LoginDatabase.Execute("UPDATE account SET totaltime = {} WHERE id = {}", GetTotalTime(), GetAccountId());
|
||||
|
||||
///- unload player if not unloaded
|
||||
if (_player)
|
||||
@@ -176,7 +178,7 @@ WorldSession::~WorldSession()
|
||||
delete packet;
|
||||
|
||||
if (GetShouldSetOfflineInDB())
|
||||
LoginDatabase.PExecute("UPDATE account SET online = 0 WHERE id = %u;", GetAccountId()); // One-time query
|
||||
LoginDatabase.Execute("UPDATE account SET online = 0 WHERE id = {};", GetAccountId()); // One-time query
|
||||
}
|
||||
|
||||
std::string const& WorldSession::GetPlayerName() const
|
||||
@@ -211,23 +213,11 @@ void WorldSession::SendPacket(WorldPacket const* packet)
|
||||
{
|
||||
if (packet->GetOpcode() == NULL_OPCODE)
|
||||
{
|
||||
LOG_ERROR("network.opcode", "%s send NULL_OPCODE", GetPlayerInfo().c_str());
|
||||
LOG_ERROR("network.opcode", "{} send NULL_OPCODE", GetPlayerInfo());
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef PLAYERBOTS
|
||||
if (Player* player = GetPlayer())
|
||||
{
|
||||
if (PlayerbotAI* playerbotAI = player->GetPlayerbotAI())
|
||||
{
|
||||
playerbotAI->HandleBotOutgoingPacket(*packet);
|
||||
}
|
||||
else if (PlayerbotMgr* playerbotMgr = GetPlayer()->GetPlayerbotMgr())
|
||||
{
|
||||
playerbotMgr->HandleMasterOutgoingPacket(*packet);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
sScriptMgr->OnPlayerbotPacketSent(GetPlayer(), packet);
|
||||
|
||||
if (!m_Socket)
|
||||
return;
|
||||
@@ -237,13 +227,13 @@ void WorldSession::SendPacket(WorldPacket const* packet)
|
||||
static uint64 sendPacketCount = 0;
|
||||
static uint64 sendPacketBytes = 0;
|
||||
|
||||
static time_t firstTime = time(nullptr);
|
||||
static time_t firstTime = GameTime::GetGameTime().count();
|
||||
static time_t lastTime = firstTime; // next 60 secs start time
|
||||
|
||||
static uint64 sendLastPacketCount = 0;
|
||||
static uint64 sendLastPacketBytes = 0;
|
||||
|
||||
time_t cur_time = time(nullptr);
|
||||
time_t cur_time = GameTime::GetGameTime().count();
|
||||
|
||||
if ((cur_time - lastTime) < 60)
|
||||
{
|
||||
@@ -258,9 +248,9 @@ void WorldSession::SendPacket(WorldPacket const* packet)
|
||||
uint64 minTime = uint64(cur_time - lastTime);
|
||||
uint64 fullTime = uint64(lastTime - firstTime);
|
||||
|
||||
LOG_DEBUG("network", "Send all time packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f time: %u", sendPacketCount, sendPacketBytes, float(sendPacketCount) / fullTime, float(sendPacketBytes) / fullTime, uint32(fullTime));
|
||||
LOG_DEBUG("network", "Send all time packets count: {} bytes: {} avr.count/sec: {} avr.bytes/sec: {} time: {}", sendPacketCount, sendPacketBytes, float(sendPacketCount) / fullTime, float(sendPacketBytes) / fullTime, uint32(fullTime));
|
||||
|
||||
LOG_DEBUG("network", "Send last min packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f", sendLastPacketCount, sendLastPacketBytes, float(sendLastPacketCount) / minTime, float(sendLastPacketBytes) / minTime);
|
||||
LOG_DEBUG("network", "Send last min packets count: {} bytes: {} avr.count/sec: {} avr.bytes/sec: {}", sendLastPacketCount, sendLastPacketBytes, float(sendLastPacketCount) / minTime, float(sendLastPacketBytes) / minTime);
|
||||
|
||||
lastTime = cur_time;
|
||||
sendLastPacketCount = 1;
|
||||
@@ -273,7 +263,7 @@ void WorldSession::SendPacket(WorldPacket const* packet)
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_TRACE("network.opcode", "S->C: %s %s", GetPlayerInfo().c_str(), GetOpcodeNameForLogging(static_cast<OpcodeServer>(packet->GetOpcode())).c_str());
|
||||
LOG_TRACE("network.opcode", "S->C: {} {}", GetPlayerInfo(), GetOpcodeNameForLogging(static_cast<OpcodeServer>(packet->GetOpcode())));
|
||||
m_Socket->SendPacket(*packet);
|
||||
}
|
||||
|
||||
@@ -286,8 +276,8 @@ void WorldSession::QueuePacket(WorldPacket* new_packet)
|
||||
/// Logging helper for unexpected opcodes
|
||||
void WorldSession::LogUnexpectedOpcode(WorldPacket* packet, char const* status, const char* reason)
|
||||
{
|
||||
LOG_ERROR("network.opcode", "Received unexpected opcode %s Status: %s Reason: %s from %s",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())).c_str(), status, reason, GetPlayerInfo().c_str());
|
||||
LOG_ERROR("network.opcode", "Received unexpected opcode {} Status: {} Reason: {} from {}",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())), status, reason, GetPlayerInfo());
|
||||
}
|
||||
|
||||
/// Logging helper for unexpected opcodes
|
||||
@@ -296,8 +286,8 @@ void WorldSession::LogUnprocessedTail(WorldPacket* packet)
|
||||
if (!sLog->ShouldLog("network.opcode", LogLevel::LOG_LEVEL_TRACE) || packet->rpos() >= packet->wpos())
|
||||
return;
|
||||
|
||||
LOG_TRACE("network.opcode", "Unprocessed tail data (read stop at %u from %u) Opcode %s from %s",
|
||||
uint32(packet->rpos()), uint32(packet->wpos()), GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())).c_str(), GetPlayerInfo().c_str());
|
||||
LOG_TRACE("network.opcode", "Unprocessed tail data (read stop at {} from {}) Opcode {} from {}",
|
||||
uint32(packet->rpos()), uint32(packet->wpos()), GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())), GetPlayerInfo());
|
||||
|
||||
packet->print_storage();
|
||||
}
|
||||
@@ -305,11 +295,6 @@ void WorldSession::LogUnprocessedTail(WorldPacket* packet)
|
||||
/// Update the WorldSession (triggered by World update)
|
||||
bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
{
|
||||
#ifdef PLAYERBOTS
|
||||
if (GetPlayer() && GetPlayer()->GetPlayerbotAI())
|
||||
return true;
|
||||
#endif
|
||||
|
||||
///- Before we process anything:
|
||||
/// If necessary, kick the player because the client didn't send anything for too long
|
||||
/// (or they've been idling in character select)
|
||||
@@ -329,7 +314,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
bool deletePacket = true;
|
||||
std::vector<WorldPacket*> requeuePackets;
|
||||
uint32 processedPackets = 0;
|
||||
time_t currentTime = time(nullptr);
|
||||
time_t currentTime = GameTime::GetGameTime().count();
|
||||
|
||||
while (m_Socket && _recvQueue.next(packet, updater))
|
||||
{
|
||||
@@ -371,10 +356,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
opHandle->Call(this, *packet);
|
||||
LogUnprocessedTail(packet);
|
||||
|
||||
#ifdef PLAYERBOTS
|
||||
if (_player && _player->GetPlayerbotMgr())
|
||||
_player->GetPlayerbotMgr()->HandleMasterIncomingPacket(*packet);
|
||||
#endif
|
||||
sScriptMgr->OnPacketReceived(this, *packet);
|
||||
}
|
||||
break;
|
||||
case STATUS_TRANSFER:
|
||||
@@ -387,6 +369,8 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
|
||||
opHandle->Call(this, *packet);
|
||||
LogUnprocessedTail(packet);
|
||||
|
||||
sScriptMgr->OnPacketReceived(this, *packet);
|
||||
}
|
||||
break;
|
||||
case STATUS_AUTHED:
|
||||
@@ -402,22 +386,24 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
|
||||
opHandle->Call(this, *packet);
|
||||
LogUnprocessedTail(packet);
|
||||
|
||||
sScriptMgr->OnPacketReceived(this, *packet);
|
||||
}
|
||||
break;
|
||||
case STATUS_NEVER:
|
||||
LOG_ERROR("network.opcode", "Received not allowed opcode %s from %s",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())).c_str(), GetPlayerInfo().c_str());
|
||||
LOG_ERROR("network.opcode", "Received not allowed opcode {} from {}",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())), GetPlayerInfo());
|
||||
break;
|
||||
case STATUS_UNHANDLED:
|
||||
LOG_DEBUG("network.opcode", "Received not handled opcode %s from %s",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())).c_str(), GetPlayerInfo().c_str());
|
||||
LOG_DEBUG("network.opcode", "Received not handled opcode {} from {}",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())), GetPlayerInfo());
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (WorldPackets::InvalidHyperlinkException const& ihe)
|
||||
{
|
||||
LOG_ERROR("network", "%s sent %s with an invalid link:\n%s", GetPlayerInfo().c_str(),
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())).c_str(), ihe.GetInvalidValue().c_str());
|
||||
LOG_ERROR("network", "{} sent {} with an invalid link:\n{}", GetPlayerInfo(),
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())), ihe.GetInvalidValue());
|
||||
|
||||
if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK))
|
||||
{
|
||||
@@ -426,8 +412,8 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
}
|
||||
catch (WorldPackets::IllegalHyperlinkException const& ihe)
|
||||
{
|
||||
LOG_ERROR("network", "%s sent %s which illegally contained a hyperlink:\n%s", GetPlayerInfo().c_str(),
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())).c_str(), ihe.GetInvalidValue().c_str());
|
||||
LOG_ERROR("network", "{} sent {} which illegally contained a hyperlink:\n{}", GetPlayerInfo(),
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())), ihe.GetInvalidValue());
|
||||
|
||||
if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK))
|
||||
{
|
||||
@@ -436,12 +422,12 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
}
|
||||
catch (WorldPackets::PacketArrayMaxCapacityException const& pamce)
|
||||
{
|
||||
LOG_ERROR("network", "PacketArrayMaxCapacityException: %s while parsing %s from %s.",
|
||||
pamce.what(), GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())).c_str(), GetPlayerInfo().c_str());
|
||||
LOG_ERROR("network", "PacketArrayMaxCapacityException: {} while parsing {} from {}.",
|
||||
pamce.what(), GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())), GetPlayerInfo());
|
||||
}
|
||||
catch (ByteBufferException const&)
|
||||
{
|
||||
LOG_ERROR("network", "WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.", packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId());
|
||||
LOG_ERROR("network", "WorldSession::Update ByteBufferException occured while parsing a packet (opcode: {}) from client {}, accountid={}. Skipped packet.", packet->GetOpcode(), GetRemoteAddress(), GetAccountId());
|
||||
if (sLog->ShouldLog("network", LogLevel::LOG_LEVEL_DEBUG))
|
||||
{
|
||||
LOG_DEBUG("network", "Dumping error causing packet:");
|
||||
@@ -485,15 +471,12 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
|
||||
ProcessQueryCallbacks();
|
||||
|
||||
#ifdef PLAYERBOTS
|
||||
if (GetPlayer() && GetPlayer()->GetPlayerbotMgr())
|
||||
GetPlayer()->GetPlayerbotMgr()->UpdateSessions(0);
|
||||
#endif
|
||||
|
||||
//check if we are safe to proceed with logout
|
||||
//logout procedure should happen only in World::UpdateSessions() method!!!
|
||||
if (updater.ProcessUnsafe())
|
||||
{
|
||||
sScriptMgr->OnPlayerbotUpdateSessions(GetPlayer());
|
||||
|
||||
if (m_Socket && m_Socket->IsOpen() && _warden)
|
||||
{
|
||||
_warden->Update(diff);
|
||||
@@ -543,7 +526,7 @@ void WorldSession::HandleTeleportTimeout(bool updateInSessions)
|
||||
// pussywizard: handle teleport ack timeout
|
||||
if (m_Socket && m_Socket->IsOpen() && GetPlayer() && GetPlayer()->IsBeingTeleported())
|
||||
{
|
||||
time_t currTime = time(nullptr);
|
||||
time_t currTime = GameTime::GetGameTime().count();
|
||||
if (updateInSessions) // session update from World::UpdateSessions
|
||||
{
|
||||
if (GetPlayer()->IsBeingTeleportedFar() && GetPlayer()->GetSemaphoreTeleportFar() + sWorld->getIntConfig(CONFIG_TELEPORT_TIMEOUT_FAR) < currTime)
|
||||
@@ -583,6 +566,8 @@ void WorldSession::LogoutPlayer(bool save)
|
||||
if (ObjectGuid lguid = _player->GetLootGUID())
|
||||
DoLootRelease(lguid);
|
||||
|
||||
sScriptMgr->OnPlayerbotLogout(_player);
|
||||
|
||||
///- If the player just died before logging out, make him appear as a ghost
|
||||
//FIXME: logout must be delayed in case lost connection with client in time of combat
|
||||
if (_player->GetDeathTimer())
|
||||
@@ -627,8 +612,8 @@ void WorldSession::LogoutPlayer(bool save)
|
||||
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_TRACK_DESERTERS))
|
||||
{
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_DESERTER_TRACK);
|
||||
stmt->setUInt32(0, _player->GetGUID().GetCounter());
|
||||
stmt->setUInt8(1, BG_DESERTION_TYPE_INVITE_LOGOUT);
|
||||
stmt->SetData(0, _player->GetGUID().GetCounter());
|
||||
stmt->SetData(1, BG_DESERTION_TYPE_INVITE_LOGOUT);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
sScriptMgr->OnBattlegroundDesertion(_player, BG_DESERTION_TYPE_INVITE_LOGOUT);
|
||||
@@ -640,13 +625,12 @@ void WorldSession::LogoutPlayer(bool save)
|
||||
guild->HandleMemberLogout(this);
|
||||
|
||||
///- Remove pet
|
||||
_player->RemovePet(nullptr, PET_SAVE_AS_CURRENT);
|
||||
_player->RemovePet(nullptr, PET_SAVE_AS_CURRENT, true);
|
||||
|
||||
// pussywizard: on logout remove auras that are removed at map change (before saving to db)
|
||||
// there are some positive auras from boss encounters that can be kept by logging out and logging in after boss is dead, and may be used on next bosses
|
||||
_player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CHANGE_MAP);
|
||||
|
||||
#ifndef PLAYERBOTS
|
||||
///- If the player is in a group (or invited), remove him. If the group if then only 1 person, disband the group.
|
||||
_player->UninviteFromGroup();
|
||||
|
||||
@@ -655,7 +639,6 @@ void WorldSession::LogoutPlayer(bool save)
|
||||
if (_player->GetGroup() && !_player->GetGroup()->isRaidGroup() && !_player->GetGroup()->isLFGGroup() && m_Socket)
|
||||
_player->RemoveFromGroup();
|
||||
|
||||
#endif
|
||||
// pussywizard: checked second time after being removed from a group
|
||||
if (!_player->IsBeingTeleportedFar() && !_player->m_InstanceValid && !_player->IsGameMaster())
|
||||
_player->RepopAtGraveyard();
|
||||
@@ -667,7 +650,6 @@ void WorldSession::LogoutPlayer(bool save)
|
||||
|
||||
///- empty buyback items and save the player in the database
|
||||
// some save parts only correctly work in case player present in map/player_lists (pets, etc)
|
||||
SavingSystemMgr::InsertToSavingSkipListIfNeeded(_player->GetNextSave()); // pussywizard
|
||||
if (save)
|
||||
{
|
||||
uint32 eslot;
|
||||
@@ -693,7 +675,7 @@ void WorldSession::LogoutPlayer(bool save)
|
||||
Map::PlayerList const& playerList = _player->GetMap()->GetPlayers();
|
||||
|
||||
if (_player->GetMap()->IsDungeon() || _player->GetMap()->IsRaidOrHeroicDungeon())
|
||||
if (playerList.isEmpty())
|
||||
if (playerList.IsEmpty())
|
||||
_player->TeleportToEntryPoint();
|
||||
}
|
||||
|
||||
@@ -706,8 +688,12 @@ void WorldSession::LogoutPlayer(bool save)
|
||||
|
||||
METRIC_EVENT("player_events", "Logout", _player->GetName());
|
||||
|
||||
LOG_INFO("entities.player", "Account: %d (IP: %s) Logout Character:[%s] (%s) Level: %d",
|
||||
GetAccountId(), GetRemoteAddress().c_str(), _player->GetName().c_str(), _player->GetGUID().ToString().c_str(), _player->getLevel());
|
||||
LOG_INFO("entities.player", "Account: {} (IP: {}) Logout Character:[{}] ({}) Level: {}",
|
||||
GetAccountId(), GetRemoteAddress(), _player->GetName(), _player->GetGUID().ToString(), _player->getLevel());
|
||||
|
||||
uint32 statementIndex = CHAR_UPD_ACCOUNT_ONLINE;
|
||||
uint32 statementParam = GetAccountId();
|
||||
sScriptMgr->OnDatabaseSelectIndexLogout(_player, statementIndex, statementParam);
|
||||
|
||||
//! Remove the player from the world
|
||||
// the player may not be in the world when logging out
|
||||
@@ -724,19 +710,18 @@ void WorldSession::LogoutPlayer(bool save)
|
||||
|
||||
//! Send the 'logout complete' packet to the client
|
||||
//! Client will respond by sending 3x CMSG_CANCEL_TRADE, which we currently dont handle
|
||||
WorldPacket data(SMSG_LOGOUT_COMPLETE, 0);
|
||||
SendPacket(&data);
|
||||
SendPacket(WorldPackets::Character::LogoutComplete().Write());
|
||||
LOG_DEBUG("network", "SESSION: Sent SMSG_LOGOUT_COMPLETE Message");
|
||||
|
||||
//! Since each account can only have one online character at any given time, ensure all characters for active account are marked as offline
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ACCOUNT_ONLINE);
|
||||
stmt->setUInt32(0, GetAccountId());
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CharacterDatabaseStatements(statementIndex));
|
||||
stmt->SetData(0, statementParam);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
m_playerLogout = false;
|
||||
m_playerSave = false;
|
||||
LogoutRequest(0);
|
||||
SetLogoutStartTime(0);
|
||||
}
|
||||
|
||||
/// Kick a player out of the World
|
||||
@@ -744,8 +729,8 @@ void WorldSession::KickPlayer(std::string const& reason, bool setKicked)
|
||||
{
|
||||
if (m_Socket)
|
||||
{
|
||||
LOG_INFO("network.kick", "Account: %u Character: '%s' %s kicked with reason: %s", GetAccountId(), _player ? _player->GetName().c_str() : "<none>",
|
||||
_player ? _player->GetGUID().ToString().c_str() : "", reason.c_str());
|
||||
LOG_INFO("network.kick", "Account: {} Character: '{}' {} kicked with reason: {}", GetAccountId(), _player ? _player->GetName() : "<none>",
|
||||
_player ? _player->GetGUID().ToString() : "", reason);
|
||||
|
||||
m_Socket->CloseSocket();
|
||||
}
|
||||
@@ -759,8 +744,8 @@ bool WorldSession::ValidateHyperlinksAndMaybeKick(std::string_view str)
|
||||
if (Acore::Hyperlinks::CheckAllLinks(str))
|
||||
return true;
|
||||
|
||||
LOG_ERROR("network", "Player %s%s sent a message with an invalid link:\n%.*s", GetPlayer()->GetName().c_str(),
|
||||
GetPlayer()->GetGUID().ToString().c_str(), STRING_VIEW_FMT_ARG(str));
|
||||
LOG_ERROR("network", "Player {}{} sent a message with an invalid link:\n%.*s", GetPlayer()->GetName(),
|
||||
GetPlayer()->GetGUID().ToString(), STRING_VIEW_FMT_ARG(str));
|
||||
|
||||
if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK))
|
||||
KickPlayer("WorldSession::ValidateHyperlinksAndMaybeKick Invalid chat link");
|
||||
@@ -773,8 +758,8 @@ bool WorldSession::DisallowHyperlinksAndMaybeKick(std::string_view str)
|
||||
if (str.find('|') == std::string_view::npos)
|
||||
return true;
|
||||
|
||||
LOG_ERROR("network", "Player %s %s sent a message which illegally contained a hyperlink:\n%.*s", GetPlayer()->GetName().c_str(),
|
||||
GetPlayer()->GetGUID().ToString().c_str(), STRING_VIEW_FMT_ARG(str));
|
||||
LOG_ERROR("network", "Player {} {} sent a message which illegally contained a hyperlink:\n%.*s", GetPlayer()->GetName(),
|
||||
GetPlayer()->GetGUID().ToString(), STRING_VIEW_FMT_ARG(str));
|
||||
|
||||
if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK))
|
||||
KickPlayer("WorldSession::DisallowHyperlinksAndMaybeKick Illegal chat link");
|
||||
@@ -824,26 +809,26 @@ char const* WorldSession::GetAcoreString(uint32 entry) const
|
||||
|
||||
void WorldSession::Handle_NULL(WorldPacket& null)
|
||||
{
|
||||
LOG_ERROR("network.opcode", "Received unhandled opcode %s from %s",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(null.GetOpcode())).c_str(), GetPlayerInfo().c_str());
|
||||
LOG_ERROR("network.opcode", "Received unhandled opcode {} from {}",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(null.GetOpcode())), GetPlayerInfo());
|
||||
}
|
||||
|
||||
void WorldSession::Handle_EarlyProccess(WorldPacket& recvPacket)
|
||||
{
|
||||
LOG_ERROR("network.opcode", "Received opcode %s that must be processed in WorldSocket::ReadDataHandler from %s",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(recvPacket.GetOpcode())).c_str(), GetPlayerInfo().c_str());
|
||||
LOG_ERROR("network.opcode", "Received opcode {} that must be processed in WorldSocket::ReadDataHandler from {}",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(recvPacket.GetOpcode())), GetPlayerInfo());
|
||||
}
|
||||
|
||||
void WorldSession::Handle_ServerSide(WorldPacket& recvPacket)
|
||||
{
|
||||
LOG_ERROR("network.opcode", "Received server-side opcode %s from %s",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeServer>(recvPacket.GetOpcode())).c_str(), GetPlayerInfo().c_str());
|
||||
LOG_ERROR("network.opcode", "Received server-side opcode {} from {}",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeServer>(recvPacket.GetOpcode())), GetPlayerInfo());
|
||||
}
|
||||
|
||||
void WorldSession::Handle_Deprecated(WorldPacket& recvPacket)
|
||||
{
|
||||
LOG_ERROR("network.opcode", "Received deprecated opcode %s from %s",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(recvPacket.GetOpcode())).c_str(), GetPlayerInfo().c_str());
|
||||
LOG_ERROR("network.opcode", "Received deprecated opcode {} from {}",
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(recvPacket.GetOpcode())), GetPlayerInfo());
|
||||
}
|
||||
|
||||
void WorldSession::SendAuthWaitQueue(uint32 position)
|
||||
@@ -867,7 +852,7 @@ void WorldSession::SendAuthWaitQueue(uint32 position)
|
||||
void WorldSession::LoadGlobalAccountData()
|
||||
{
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ACCOUNT_DATA);
|
||||
stmt->setUInt32(0, GetAccountId());
|
||||
stmt->SetData(0, GetAccountId());
|
||||
LoadAccountData(CharacterDatabase.Query(stmt), GLOBAL_CACHE_MASK);
|
||||
}
|
||||
|
||||
@@ -883,21 +868,21 @@ void WorldSession::LoadAccountData(PreparedQueryResult result, uint32 mask)
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
uint32 type = fields[0].GetUInt8();
|
||||
uint32 type = fields[0].Get<uint8>();
|
||||
if (type >= NUM_ACCOUNT_DATA_TYPES)
|
||||
{
|
||||
LOG_ERROR("network", "Table `%s` have invalid account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
|
||||
LOG_ERROR("network", "Table `{}` have invalid account data type ({}), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((mask & (1 << type)) == 0)
|
||||
{
|
||||
LOG_ERROR("network", "Table `%s` have non appropriate for table account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
|
||||
LOG_ERROR("network", "Table `{}` have non appropriate for table account data type ({}), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
|
||||
continue;
|
||||
}
|
||||
|
||||
m_accountData[type].Time = time_t(fields[1].GetUInt32());
|
||||
m_accountData[type].Data = fields[2].GetString();
|
||||
m_accountData[type].Time = time_t(fields[1].Get<uint32>());
|
||||
m_accountData[type].Data = fields[2].Get<std::string>();
|
||||
} while (result->NextRow());
|
||||
}
|
||||
|
||||
@@ -921,10 +906,10 @@ void WorldSession::SetAccountData(AccountDataType type, time_t tm, std::string c
|
||||
}
|
||||
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(index);
|
||||
stmt->setUInt32(0, id);
|
||||
stmt->setUInt8(1, type);
|
||||
stmt->setUInt32(2, uint32(tm));
|
||||
stmt->setString(3, data);
|
||||
stmt->SetData(0, id);
|
||||
stmt->SetData(1, type);
|
||||
stmt->SetData(2, uint32(tm));
|
||||
stmt->SetData(3, data);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
m_accountData[type].Time = tm;
|
||||
@@ -934,7 +919,7 @@ void WorldSession::SetAccountData(AccountDataType type, time_t tm, std::string c
|
||||
void WorldSession::SendAccountDataTimes(uint32 mask)
|
||||
{
|
||||
WorldPacket data(SMSG_ACCOUNT_DATA_TIMES, 4 + 1 + 4 + 8 * 4); // changed in WotLK
|
||||
data << uint32(time(nullptr)); // unix time of something
|
||||
data << uint32(GameTime::GetGameTime().count()); // unix time of something
|
||||
data << uint8(1);
|
||||
data << uint32(mask); // type mask
|
||||
for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i)
|
||||
@@ -948,10 +933,10 @@ void WorldSession::LoadTutorialsData()
|
||||
memset(m_Tutorials, 0, sizeof(uint32) * MAX_ACCOUNT_TUTORIAL_VALUES);
|
||||
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_TUTORIALS);
|
||||
stmt->setUInt32(0, GetAccountId());
|
||||
stmt->SetData(0, GetAccountId());
|
||||
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
|
||||
for (uint8 i = 0; i < MAX_ACCOUNT_TUTORIAL_VALUES; ++i)
|
||||
m_Tutorials[i] = (*result)[i].GetUInt32();
|
||||
m_Tutorials[i] = (*result)[i].Get<uint32>();
|
||||
|
||||
m_TutorialsChanged = false;
|
||||
}
|
||||
@@ -970,14 +955,14 @@ void WorldSession::SaveTutorialsData(CharacterDatabaseTransaction trans)
|
||||
return;
|
||||
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_HAS_TUTORIALS);
|
||||
stmt->setUInt32(0, GetAccountId());
|
||||
stmt->SetData(0, GetAccountId());
|
||||
bool hasTutorials = bool(CharacterDatabase.Query(stmt));
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(hasTutorials ? CHAR_UPD_TUTORIALS : CHAR_INS_TUTORIALS);
|
||||
|
||||
for (uint8 i = 0; i < MAX_ACCOUNT_TUTORIAL_VALUES; ++i)
|
||||
stmt->setUInt32(i, m_Tutorials[i]);
|
||||
stmt->setUInt32(MAX_ACCOUNT_TUTORIAL_VALUES, GetAccountId());
|
||||
stmt->SetData(i, m_Tutorials[i]);
|
||||
stmt->SetData(MAX_ACCOUNT_TUTORIAL_VALUES, GetAccountId());
|
||||
trans->Append(stmt);
|
||||
|
||||
m_TutorialsChanged = false;
|
||||
@@ -1025,9 +1010,9 @@ void WorldSession::ReadMovementInfo(WorldPacket& data, MovementInfo* mi)
|
||||
{ \
|
||||
if (check) \
|
||||
{ \
|
||||
LOG_DEBUG("entities.unit", "WorldSession::ReadMovementInfo: Violation of MovementFlags found (%s). " \
|
||||
"MovementFlags: %u, MovementFlags2: %u for player %s. Mask %u will be removed.", \
|
||||
STRINGIZE(check), mi->GetMovementFlags(), mi->GetExtraMovementFlags(), GetPlayer()->GetGUID().ToString().c_str(), maskToRemove); \
|
||||
LOG_DEBUG("entities.unit", "WorldSession::ReadMovementInfo: Violation of MovementFlags found ({}). " \
|
||||
"MovementFlags: {}, MovementFlags2: {} for player {}. Mask {} will be removed.", \
|
||||
STRINGIZE(check), mi->GetMovementFlags(), mi->GetExtraMovementFlags(), GetPlayer()->GetGUID().ToString(), maskToRemove); \
|
||||
mi->RemoveMovementFlag((maskToRemove)); \
|
||||
} \
|
||||
}
|
||||
@@ -1148,7 +1133,7 @@ void WorldSession::ReadAddonsInfo(ByteBuffer& data)
|
||||
|
||||
if (size > 0xFFFFF)
|
||||
{
|
||||
LOG_ERROR("network", "WorldSession::ReadAddonsInfo addon info too big, size %u", size);
|
||||
LOG_ERROR("network", "WorldSession::ReadAddonsInfo addon info too big, size {}", size);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1178,7 +1163,7 @@ void WorldSession::ReadAddonsInfo(ByteBuffer& data)
|
||||
|
||||
addonInfo >> enabled >> crc >> unk1;
|
||||
|
||||
LOG_DEBUG("network", "ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk1);
|
||||
LOG_DEBUG("network", "ADDON: Name: {}, Enabled: 0x{:x}, CRC: 0x{:x}, Unknown2: 0x{:x}", addonName, enabled, crc, unk1);
|
||||
|
||||
AddonInfo addon(addonName, enabled, crc, 2, true);
|
||||
|
||||
@@ -1191,15 +1176,15 @@ void WorldSession::ReadAddonsInfo(ByteBuffer& data)
|
||||
match = false;
|
||||
|
||||
if (!match)
|
||||
LOG_DEBUG("network", "ADDON: %s was known, but didn't match known CRC (0x%x)!", addon.Name.c_str(), savedAddon->CRC);
|
||||
LOG_DEBUG("network", "ADDON: {} was known, but didn't match known CRC (0x{:x})!", addon.Name, savedAddon->CRC);
|
||||
else
|
||||
LOG_DEBUG("network", "ADDON: %s was known, CRC is correct (0x%x)", addon.Name.c_str(), savedAddon->CRC);
|
||||
LOG_DEBUG("network", "ADDON: {} was known, CRC is correct (0x{:x})", addon.Name, savedAddon->CRC);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddonMgr::SaveAddon(addon);
|
||||
|
||||
LOG_DEBUG("network", "ADDON: %s (0x%x) was not known, saving...", addon.Name.c_str(), addon.CRC);
|
||||
LOG_DEBUG("network", "ADDON: {} (0x{:x}) was not known, saving...", addon.Name, addon.CRC);
|
||||
}
|
||||
|
||||
// TODO: Find out when to not use CRC/pubkey, and other possible states.
|
||||
@@ -1208,7 +1193,7 @@ void WorldSession::ReadAddonsInfo(ByteBuffer& data)
|
||||
|
||||
uint32 currentTime;
|
||||
addonInfo >> currentTime;
|
||||
LOG_DEBUG("network", "ADDON: CurrentTime: %u", currentTime);
|
||||
LOG_DEBUG("network", "ADDON: CurrentTime: {}", currentTime);
|
||||
|
||||
if (addonInfo.rpos() != addonInfo.size())
|
||||
LOG_DEBUG("network", "packet under-read!");
|
||||
@@ -1253,7 +1238,7 @@ void WorldSession::SendAddonsInfo()
|
||||
data << uint8(usepk);
|
||||
if (usepk) // if CRC is wrong, add public key (client need it)
|
||||
{
|
||||
LOG_DEBUG("network", "ADDON: CRC (0x%x) for addon %s is wrong (does not match expected 0x%x), sending pubkey", itr->CRC, itr->Name.c_str(), STANDARD_ADDON_CRC);
|
||||
LOG_DEBUG("network", "ADDON: CRC (0x{:x}) for addon {} is wrong (does not match expected 0x{:x}), sending pubkey", itr->CRC, itr->Name, STANDARD_ADDON_CRC);
|
||||
data.append(addonPublicKey, sizeof(addonPublicKey));
|
||||
}
|
||||
|
||||
@@ -1343,8 +1328,8 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p, time_t time) co
|
||||
if (++packetCounter.amountCounter <= maxPacketCounterAllowed)
|
||||
return true;
|
||||
|
||||
LOG_WARN("network", "AntiDOS: Account %u, IP: %s, Ping: %u, Character: %s, flooding packet (opc: %s (0x%X), count: %u)",
|
||||
Session->GetAccountId(), Session->GetRemoteAddress().c_str(), Session->GetLatency(), Session->GetPlayerName().c_str(),
|
||||
LOG_WARN("network", "AntiDOS: Account {}, IP: {}, Ping: {}, Character: {}, flooding packet (opc: {} (0x{:X}), count: {})",
|
||||
Session->GetAccountId(), Session->GetRemoteAddress(), Session->GetLatency(), Session->GetPlayerName(),
|
||||
opcodeTable[static_cast<OpcodeClient>(p.GetOpcode())]->Name, p.GetOpcode(), packetCounter.amountCounter);
|
||||
|
||||
switch (_policy)
|
||||
@@ -1353,7 +1338,7 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p, time_t time) co
|
||||
return true;
|
||||
case POLICY_KICK:
|
||||
{
|
||||
LOG_INFO("network", "AntiDOS: Player %s kicked!", Session->GetPlayerName().c_str());
|
||||
LOG_INFO("network", "AntiDOS: Player {} kicked!", Session->GetPlayerName());
|
||||
Session->KickPlayer();
|
||||
return false;
|
||||
}
|
||||
@@ -1374,7 +1359,7 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p, time_t time) co
|
||||
break;
|
||||
}
|
||||
|
||||
LOG_INFO("network", "AntiDOS: Player automatically banned for %u seconds.", duration);
|
||||
LOG_INFO("network", "AntiDOS: Player automatically banned for {} seconds.", duration);
|
||||
return false;
|
||||
}
|
||||
default: // invalid policy
|
||||
@@ -1399,7 +1384,7 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co
|
||||
case CMSG_CORPSE_MAP_POSITION_QUERY: // 0 1
|
||||
case CMSG_MOVE_TIME_SKIPPED: // 0 1
|
||||
case MSG_QUERY_NEXT_MAIL_TIME: // 0 1
|
||||
case CMSG_SETSHEATHED: // 0 1
|
||||
case CMSG_SET_SHEATHED: // 0 1
|
||||
case MSG_RAID_TARGET_UPDATE: // 0 1
|
||||
case CMSG_PLAYER_LOGOUT: // 0 1
|
||||
case CMSG_LOGOUT_REQUEST: // 0 1
|
||||
@@ -1650,16 +1635,7 @@ void WorldSession::SendTimeSync()
|
||||
_timeSyncNextCounter++;
|
||||
}
|
||||
|
||||
#ifdef PLAYERBOTS
|
||||
void WorldSession::HandleBotPackets()
|
||||
LockedQueue<WorldPacket*>& WorldSession::GetPacketQueue()
|
||||
{
|
||||
WorldPacket* packet;
|
||||
while (_recvQueue.next(packet))
|
||||
{
|
||||
OpcodeClient opcode = static_cast<OpcodeClient>(packet->GetOpcode());
|
||||
ClientOpcodeHandler const* opHandle = opcodeTable[opcode];
|
||||
opHandle->Call(this, *packet);
|
||||
delete packet;
|
||||
}
|
||||
return _recvQueue;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "Common.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GossipDef.h"
|
||||
#include "QueryHolder.h"
|
||||
#include "Packet.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "World.h"
|
||||
@@ -40,7 +41,6 @@ class Creature;
|
||||
class GameObject;
|
||||
class InstanceSave;
|
||||
class Item;
|
||||
class LoginQueryHolder;
|
||||
class LoadPetFromDBQueryHolder;
|
||||
class Object;
|
||||
class Pet;
|
||||
@@ -71,6 +71,94 @@ namespace lfg
|
||||
|
||||
namespace WorldPackets
|
||||
{
|
||||
namespace LFG
|
||||
{
|
||||
class LFGJoin;
|
||||
class LFGLeave;
|
||||
}
|
||||
|
||||
namespace Chat
|
||||
{
|
||||
class EmoteClient;
|
||||
}
|
||||
|
||||
namespace Character
|
||||
{
|
||||
class LogoutCancel;
|
||||
class LogoutRequest;
|
||||
class ShowingCloak;
|
||||
class ShowingHelm;
|
||||
class PlayerLogout;
|
||||
class PlayedTimeClient;
|
||||
}
|
||||
|
||||
namespace Totem
|
||||
{
|
||||
class TotemDestroyed;
|
||||
}
|
||||
|
||||
namespace Bank
|
||||
{
|
||||
class AutoBankItem;
|
||||
class AutoStoreBankItem;
|
||||
class BuyBankSlot;
|
||||
}
|
||||
|
||||
namespace Combat
|
||||
{
|
||||
class SetSheathed;
|
||||
}
|
||||
|
||||
namespace Guild
|
||||
{
|
||||
class QueryGuildInfo;
|
||||
class GuildCreate;
|
||||
class GuildInviteByName;
|
||||
class AcceptGuildInvite;
|
||||
class GuildDeclineInvitation;
|
||||
class GuildGetInfo;
|
||||
class GuildGetRoster;
|
||||
class GuildPromoteMember;
|
||||
class GuildDemoteMember;
|
||||
class GuildOfficerRemoveMember;
|
||||
class GuildLeave;
|
||||
class GuildDelete;
|
||||
class GuildUpdateMotdText;
|
||||
class GuildAddRank;
|
||||
class GuildDeleteRank;
|
||||
class GuildUpdateInfoText;
|
||||
class GuildSetMemberNote;
|
||||
class GuildEventLogQuery;
|
||||
class GuildBankRemainingWithdrawMoneyQuery;
|
||||
class GuildPermissionsQuery;
|
||||
class GuildSetRankPermissions;
|
||||
class GuildBankActivate;
|
||||
class GuildBankQueryTab;
|
||||
class GuildBankDepositMoney;
|
||||
class GuildBankWithdrawMoney;
|
||||
class GuildBankSwapItems;
|
||||
class GuildBankBuyTab;
|
||||
class GuildBankUpdateTab;
|
||||
class GuildBankLogQuery;
|
||||
class GuildBankTextQuery;
|
||||
class GuildBankSetTabText;
|
||||
class GuildSetGuildMaster;
|
||||
class SaveGuildEmblem;
|
||||
}
|
||||
|
||||
namespace Misc
|
||||
{
|
||||
class RandomRollClient;
|
||||
}
|
||||
|
||||
namespace Pet
|
||||
{
|
||||
class DismissCritter;
|
||||
class PetAbandon;
|
||||
class PetStopAttack;
|
||||
class PetSpellAutocast;
|
||||
class RequestPetInfo;
|
||||
}
|
||||
}
|
||||
|
||||
enum AccountDataType
|
||||
@@ -137,6 +225,20 @@ enum CharterTypes
|
||||
ARENA_TEAM_CHARTER_5v5_TYPE = 5
|
||||
};
|
||||
|
||||
class LoginQueryHolder : public CharacterDatabaseQueryHolder
|
||||
{
|
||||
private:
|
||||
uint32 m_accountId;
|
||||
ObjectGuid m_guid;
|
||||
|
||||
public:
|
||||
LoginQueryHolder(uint32 accountId, ObjectGuid guid);
|
||||
|
||||
ObjectGuid GetGuid() const { return m_guid; }
|
||||
uint32 GetAccountId() const { return m_accountId; }
|
||||
bool Initialize();
|
||||
};
|
||||
|
||||
//class to deal with packet processing
|
||||
//allows to determine if next packet is safe to be processed
|
||||
class PacketFilter
|
||||
@@ -181,6 +283,11 @@ class CharacterCreateInfo
|
||||
friend class WorldSession;
|
||||
friend class Player;
|
||||
|
||||
public:
|
||||
CharacterCreateInfo(std::string const name = "", uint8 _race = 0, uint8 _class = 0, uint8 gender = 0, uint8 skin = 0, uint8 face = 0,
|
||||
uint8 hairStyle = 0, uint8 hairColor = 0, uint8 facialHair = 0)
|
||||
: Name(name), Race(_race), Class(_class), Gender(gender), Skin(skin), Face(face), HairStyle(hairStyle), HairColor(hairColor), FacialHair(facialHair) { }
|
||||
|
||||
protected:
|
||||
/// User specified variables
|
||||
std::string Name;
|
||||
@@ -241,7 +348,8 @@ struct PacketCounter
|
||||
class WorldSession
|
||||
{
|
||||
public:
|
||||
WorldSession(uint32 id, std::string&& name, std::shared_ptr<WorldSocket> sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale, uint32 recruiter, bool isARecruiter, bool skipQueue, uint32 TotalTime);
|
||||
WorldSession(uint32 id, std::string&& name, std::shared_ptr<WorldSocket> sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale,
|
||||
uint32 recruiter, bool isARecruiter, bool skipQueue, uint32 TotalTime, bool isBot = false);
|
||||
~WorldSession();
|
||||
|
||||
bool PlayerLoading() const { return m_playerLoading; }
|
||||
@@ -294,7 +402,7 @@ public:
|
||||
bool isLogingOut() const { return _logoutTime || m_playerLogout; }
|
||||
|
||||
/// Engage the logout process for the user
|
||||
void LogoutRequest(time_t requestTime)
|
||||
void SetLogoutStartTime(time_t requestTime)
|
||||
{
|
||||
_logoutTime = requestTime;
|
||||
}
|
||||
@@ -443,10 +551,6 @@ public:
|
||||
void ResetTimeSync();
|
||||
void SendTimeSync();
|
||||
|
||||
#ifdef PLAYERBOTS
|
||||
void HandleBotPackets();
|
||||
#endif
|
||||
|
||||
public: // opcodes handlers
|
||||
void Handle_NULL(WorldPacket& null); // not used
|
||||
void Handle_EarlyProccess(WorldPacket& recvPacket); // just mark packets processed in WorldSocket::OnRead
|
||||
@@ -472,7 +576,7 @@ public: // opcodes handlers
|
||||
void SendSetPlayerDeclinedNamesResult(DeclinedNameResult result, ObjectGuid guid);
|
||||
|
||||
// played time
|
||||
void HandlePlayedTime(WorldPacket& recvPacket);
|
||||
void HandlePlayedTime(WorldPackets::Character::PlayedTimeClient& packet);
|
||||
|
||||
// new
|
||||
void HandleMoveUnRootAck(WorldPacket& recvPacket);
|
||||
@@ -492,8 +596,8 @@ public: // opcodes handlers
|
||||
void HandleMountSpecialAnimOpcode(WorldPacket& recvdata);
|
||||
|
||||
// character view
|
||||
void HandleShowingHelmOpcode(WorldPacket& recvData);
|
||||
void HandleShowingCloakOpcode(WorldPacket& recvData);
|
||||
void HandleShowingHelmOpcode(WorldPackets::Character::ShowingHelm& packet);
|
||||
void HandleShowingCloakOpcode(WorldPackets::Character::ShowingCloak& packet);
|
||||
|
||||
// repair
|
||||
void HandleRepairItemOpcode(WorldPacket& recvPacket);
|
||||
@@ -511,9 +615,9 @@ public: // opcodes handlers
|
||||
void HandleLootReleaseOpcode(WorldPacket& recvPacket);
|
||||
void HandleLootMasterGiveOpcode(WorldPacket& recvPacket);
|
||||
void HandleWhoOpcode(WorldPacket& recvPacket);
|
||||
void HandleLogoutRequestOpcode(WorldPacket& recvPacket);
|
||||
void HandlePlayerLogoutOpcode(WorldPacket& recvPacket);
|
||||
void HandleLogoutCancelOpcode(WorldPacket& recvPacket);
|
||||
void HandleLogoutRequestOpcode(WorldPackets::Character::LogoutRequest& logoutRequest);
|
||||
void HandlePlayerLogoutOpcode(WorldPackets::Character::PlayerLogout& playerLogout);
|
||||
void HandleLogoutCancelOpcode(WorldPackets::Character::LogoutCancel& logoutCancel);
|
||||
|
||||
// GM Ticket opcodes
|
||||
void HandleGMTicketCreateOpcode(WorldPacket& recvPacket);
|
||||
@@ -530,7 +634,7 @@ public: // opcodes handlers
|
||||
void HandleZoneUpdateOpcode(WorldPacket& recvPacket);
|
||||
void HandleSetSelectionOpcode(WorldPacket& recvPacket);
|
||||
void HandleStandStateChangeOpcode(WorldPacket& recvPacket);
|
||||
void HandleEmoteOpcode(WorldPacket& recvPacket);
|
||||
void HandleEmoteOpcode(WorldPackets::Chat::EmoteClient& packet);
|
||||
void HandleContactListOpcode(WorldPacket& recvPacket);
|
||||
void HandleAddFriendOpcode(WorldPacket& recvPacket);
|
||||
void HandleDelFriendOpcode(WorldPacket& recvPacket);
|
||||
@@ -607,28 +711,28 @@ public: // opcodes handlers
|
||||
void HandleOfferPetitionOpcode(WorldPacket& recvData);
|
||||
void HandleTurnInPetitionOpcode(WorldPacket& recvData);
|
||||
|
||||
void HandleGuildQueryOpcode(WorldPacket& recvPacket);
|
||||
void HandleGuildCreateOpcode(WorldPacket& recvPacket);
|
||||
void HandleGuildInviteOpcode(WorldPacket& recvPacket);
|
||||
void HandleGuildRemoveOpcode(WorldPacket& recvPacket);
|
||||
void HandleGuildAcceptOpcode(WorldPacket& recvPacket);
|
||||
void HandleGuildDeclineOpcode(WorldPacket& recvPacket);
|
||||
void HandleGuildInfoOpcode(WorldPacket& recvPacket);
|
||||
void HandleGuildEventLogQueryOpcode(WorldPacket& recvPacket);
|
||||
void HandleGuildRosterOpcode(WorldPacket& recvPacket);
|
||||
void HandleGuildPromoteOpcode(WorldPacket& recvPacket);
|
||||
void HandleGuildDemoteOpcode(WorldPacket& recvPacket);
|
||||
void HandleGuildLeaveOpcode(WorldPacket& recvPacket);
|
||||
void HandleGuildDisbandOpcode(WorldPacket& recvPacket);
|
||||
void HandleGuildLeaderOpcode(WorldPacket& recvPacket);
|
||||
void HandleGuildMOTDOpcode(WorldPacket& recvPacket);
|
||||
void HandleGuildSetPublicNoteOpcode(WorldPacket& recvPacket);
|
||||
void HandleGuildSetOfficerNoteOpcode(WorldPacket& recvPacket);
|
||||
void HandleGuildRankOpcode(WorldPacket& recvPacket);
|
||||
void HandleGuildAddRankOpcode(WorldPacket& recvPacket);
|
||||
void HandleGuildDelRankOpcode(WorldPacket& recvPacket);
|
||||
void HandleGuildChangeInfoTextOpcode(WorldPacket& recvPacket);
|
||||
void HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket);
|
||||
void HandleGuildQueryOpcode(WorldPackets::Guild::QueryGuildInfo& query);
|
||||
void HandleGuildCreateOpcode(WorldPackets::Guild::GuildCreate& packet);
|
||||
void HandleGuildInviteOpcode(WorldPackets::Guild::GuildInviteByName& packet);
|
||||
void HandleGuildRemoveOpcode(WorldPackets::Guild::GuildOfficerRemoveMember& packet);
|
||||
void HandleGuildAcceptOpcode(WorldPackets::Guild::AcceptGuildInvite& invite);
|
||||
void HandleGuildDeclineOpcode(WorldPackets::Guild::GuildDeclineInvitation& decline);
|
||||
void HandleGuildInfoOpcode(WorldPackets::Guild::GuildGetInfo& packet);
|
||||
void HandleGuildEventLogQueryOpcode(WorldPackets::Guild::GuildEventLogQuery& packet);
|
||||
void HandleGuildRosterOpcode(WorldPackets::Guild::GuildGetRoster& packet);
|
||||
void HandleGuildPromoteOpcode(WorldPackets::Guild::GuildPromoteMember& promote);
|
||||
void HandleGuildDemoteOpcode(WorldPackets::Guild::GuildDemoteMember& demote);
|
||||
void HandleGuildLeaveOpcode(WorldPackets::Guild::GuildLeave& leave);
|
||||
void HandleGuildDisbandOpcode(WorldPackets::Guild::GuildDelete& packet);
|
||||
void HandleGuildLeaderOpcode(WorldPackets::Guild::GuildSetGuildMaster& packet);
|
||||
void HandleGuildMOTDOpcode(WorldPackets::Guild::GuildUpdateMotdText& packet);
|
||||
void HandleGuildSetPublicNoteOpcode(WorldPackets::Guild::GuildSetMemberNote& packet);
|
||||
void HandleGuildSetOfficerNoteOpcode(WorldPackets::Guild::GuildSetMemberNote& packet);
|
||||
void HandleGuildRankOpcode(WorldPackets::Guild::GuildSetRankPermissions& packet);
|
||||
void HandleGuildAddRankOpcode(WorldPackets::Guild::GuildAddRank& packet);
|
||||
void HandleGuildDelRankOpcode(WorldPackets::Guild::GuildDeleteRank& packet);
|
||||
void HandleGuildChangeInfoTextOpcode(WorldPackets::Guild::GuildUpdateInfoText& packet);
|
||||
void HandleSaveGuildEmblemOpcode(WorldPackets::Guild::SaveGuildEmblem& packet);
|
||||
|
||||
void HandleTaxiNodeStatusQueryOpcode(WorldPacket& recvPacket);
|
||||
void HandleTaxiQueryAvailableNodes(WorldPacket& recvPacket);
|
||||
@@ -638,8 +742,6 @@ public: // opcodes handlers
|
||||
void SendActivateTaxiReply(ActivateTaxiReply reply);
|
||||
|
||||
void HandleTabardVendorActivateOpcode(WorldPacket& recvPacket);
|
||||
void HandleBankerActivateOpcode(WorldPacket& recvPacket);
|
||||
void HandleBuyBankSlotOpcode(WorldPacket& recvPacket);
|
||||
void HandleTrainerListOpcode(WorldPacket& recvPacket);
|
||||
void HandleTrainerBuySpellOpcode(WorldPacket& recvPacket);
|
||||
void HandlePetitionShowListOpcode(WorldPacket& recvPacket);
|
||||
@@ -650,18 +752,13 @@ public: // opcodes handlers
|
||||
void HandleBinderActivateOpcode(WorldPacket& recvPacket);
|
||||
void HandleListStabledPetsOpcode(WorldPacket& recvPacket);
|
||||
void HandleStablePet(WorldPacket& recvPacket);
|
||||
void HandleStablePetCallback(PreparedQueryResult result);
|
||||
void HandleUnstablePet(WorldPacket& recvPacket);
|
||||
void HandleUnstablePetCallback(uint32 petId, PreparedQueryResult result);
|
||||
void HandleBuyStableSlot(WorldPacket& recvPacket);
|
||||
void HandleStableRevivePet(WorldPacket& recvPacket);
|
||||
void HandleStableSwapPet(WorldPacket& recvPacket);
|
||||
void HandleStableSwapPetCallback(uint32 petId, PreparedQueryResult result);
|
||||
void HandleOpenWrappedItemCallback(uint8 bagIndex, uint8 slot, ObjectGuid::LowType itemLowGUID, PreparedQueryResult result);
|
||||
void HandleLoadActionsSwitchSpec(PreparedQueryResult result);
|
||||
void HandleCharacterAuraFrozen(PreparedQueryResult result);
|
||||
uint8 HandleLoadPetFromDBFirstCallback(PreparedQueryResult result, uint8 asynchLoadType);
|
||||
void HandleLoadPetFromDBSecondCallback(LoadPetFromDBQueryHolder const& holder);
|
||||
|
||||
void HandleDuelAcceptedOpcode(WorldPacket& recvPacket);
|
||||
void HandleDuelCancelledOpcode(WorldPacket& recvPacket);
|
||||
@@ -687,6 +784,12 @@ public: // opcodes handlers
|
||||
void HandleAuctionPlaceBid(WorldPacket& recvData);
|
||||
void HandleAuctionListPendingSales(WorldPacket& recvData);
|
||||
|
||||
// Bank
|
||||
void HandleBankerActivateOpcode(WorldPacket& recvData);
|
||||
void HandleAutoBankItemOpcode(WorldPackets::Bank::AutoBankItem& packet);
|
||||
void HandleAutoStoreBankItemOpcode(WorldPackets::Bank::AutoStoreBankItem& packet);
|
||||
void HandleBuyBankSlotOpcode(WorldPackets::Bank::BuyBankSlot& buyBankSlot);
|
||||
|
||||
void HandleGetMailList(WorldPacket& recvData);
|
||||
void HandleSendMail(WorldPacket& recvData);
|
||||
void HandleMailTakeMoney(WorldPacket& recvData);
|
||||
@@ -713,13 +816,11 @@ public: // opcodes handlers
|
||||
void HandleAutoEquipItemSlotOpcode(WorldPacket& recvPacket);
|
||||
void HandleSwapItem(WorldPacket& recvPacket);
|
||||
void HandleBuybackItem(WorldPacket& recvPacket);
|
||||
void HandleAutoBankItemOpcode(WorldPacket& recvPacket);
|
||||
void HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket);
|
||||
void HandleWrapItemOpcode(WorldPacket& recvPacket);
|
||||
|
||||
void HandleAttackSwingOpcode(WorldPacket& recvPacket);
|
||||
void HandleAttackStopOpcode(WorldPacket& recvPacket);
|
||||
void HandleSetSheathedOpcode(WorldPacket& recvPacket);
|
||||
void HandleSetSheathedOpcode(WorldPackets::Combat::SetSheathed& packet);
|
||||
|
||||
void HandleUseItemOpcode(WorldPacket& recvPacket);
|
||||
void HandleOpenItemOpcode(WorldPacket& recvPacket);
|
||||
@@ -798,14 +899,14 @@ public: // opcodes handlers
|
||||
|
||||
//Pet
|
||||
void HandlePetAction(WorldPacket& recvData);
|
||||
void HandlePetStopAttack(WorldPacket& recvData);
|
||||
void HandlePetStopAttack(WorldPackets::Pet::PetStopAttack& packet);
|
||||
void HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spellid, uint16 flag, ObjectGuid guid2);
|
||||
void HandlePetNameQuery(WorldPacket& recvData);
|
||||
void HandlePetSetAction(WorldPacket& recvData);
|
||||
void HandlePetAbandon(WorldPacket& recvData);
|
||||
void HandlePetAbandon(WorldPackets::Pet::PetAbandon& packet);
|
||||
void HandlePetRename(WorldPacket& recvData);
|
||||
void HandlePetCancelAuraOpcode(WorldPacket& recvPacket);
|
||||
void HandlePetSpellAutocastOpcode(WorldPacket& recvPacket);
|
||||
void HandlePetSpellAutocastOpcode(WorldPackets::Pet::PetSpellAutocast& packet);
|
||||
void HandlePetCastSpellOpcode(WorldPacket& recvPacket);
|
||||
void HandlePetLearnTalent(WorldPacket& recvPacket);
|
||||
void HandleLearnPreviewTalentsPet(WorldPacket& recvPacket);
|
||||
@@ -816,8 +917,8 @@ public: // opcodes handlers
|
||||
void HandleCharRenameCallBack(std::shared_ptr<CharacterRenameInfo> renameInfo, PreparedQueryResult result);
|
||||
void HandleSetPlayerDeclinedNames(WorldPacket& recvData);
|
||||
|
||||
void HandleTotemDestroyed(WorldPacket& recvData);
|
||||
void HandleDismissCritter(WorldPacket& recvData);
|
||||
void HandleTotemDestroyed(WorldPackets::Totem::TotemDestroyed& totemDestroyed);
|
||||
void HandleDismissCritter(WorldPackets::Pet::DismissCritter& dismissCritter);
|
||||
|
||||
//Battleground
|
||||
void HandleBattlemasterHelloOpcode(WorldPacket& recvData);
|
||||
@@ -833,7 +934,7 @@ public: // opcodes handlers
|
||||
void HandleWardenDataOpcode(WorldPacket& recvData);
|
||||
void HandleWorldTeleportOpcode(WorldPacket& recvData);
|
||||
void HandleMinimapPingOpcode(WorldPacket& recvData);
|
||||
void HandleRandomRollOpcode(WorldPacket& recvData);
|
||||
void HandleRandomRollOpcode(WorldPackets::Misc::RandomRollClient& packet);
|
||||
void HandleFarSightOpcode(WorldPacket& recvData);
|
||||
void HandleSetDungeonDifficultyOpcode(WorldPacket& recvData);
|
||||
void HandleSetRaidDifficultyOpcode(WorldPacket& recvData);
|
||||
@@ -861,8 +962,8 @@ public: // opcodes handlers
|
||||
void HandleLfgSetCommentOpcode(WorldPacket& recvData);
|
||||
void HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& recvData);
|
||||
void HandleLfgPartyLockInfoRequestOpcode(WorldPacket& recvData);
|
||||
void HandleLfgJoinOpcode(WorldPacket& recvData);
|
||||
void HandleLfgLeaveOpcode(WorldPacket& recvData);
|
||||
void HandleLfgJoinOpcode(WorldPackets::LFG::LFGJoin& lfgJoin);
|
||||
void HandleLfgLeaveOpcode(WorldPackets::LFG::LFGLeave& lfgleave);
|
||||
void HandleLfgSetRolesOpcode(WorldPacket& recvData);
|
||||
void HandleLfgProposalResultOpcode(WorldPacket& recvData);
|
||||
void HandleLfgSetBootVoteOpcode(WorldPacket& recvData);
|
||||
@@ -902,7 +1003,7 @@ public: // opcodes handlers
|
||||
void HandleCancelMountAuraOpcode(WorldPacket& recvData);
|
||||
void HandleSelfResOpcode(WorldPacket& recvData);
|
||||
void HandleComplainOpcode(WorldPacket& recvData);
|
||||
void HandleRequestPetInfoOpcode(WorldPacket& recvData);
|
||||
void HandleRequestPetInfo(WorldPackets::Pet::RequestPetInfo& packet);
|
||||
|
||||
// Socket gem
|
||||
void HandleSocketOpcode(WorldPacket& recvData);
|
||||
@@ -918,19 +1019,19 @@ public: // opcodes handlers
|
||||
void HandleSetTaxiBenchmarkOpcode(WorldPacket& recvData);
|
||||
|
||||
// Guild Bank
|
||||
void HandleGuildPermissions(WorldPacket& recvData);
|
||||
void HandleGuildBankMoneyWithdrawn(WorldPacket& recvData);
|
||||
void HandleGuildBankerActivate(WorldPacket& recvData);
|
||||
void HandleGuildBankQueryTab(WorldPacket& recvData);
|
||||
void HandleGuildBankLogQuery(WorldPacket& recvData);
|
||||
void HandleGuildBankDepositMoney(WorldPacket& recvData);
|
||||
void HandleGuildBankWithdrawMoney(WorldPacket& recvData);
|
||||
void HandleGuildBankSwapItems(WorldPacket& recvData);
|
||||
void HandleGuildPermissions(WorldPackets::Guild::GuildPermissionsQuery& packet);
|
||||
void HandleGuildBankMoneyWithdrawn(WorldPackets::Guild::GuildBankRemainingWithdrawMoneyQuery& packet);
|
||||
void HandleGuildBankerActivate(WorldPackets::Guild::GuildBankActivate& packet);
|
||||
void HandleGuildBankQueryTab(WorldPackets::Guild::GuildBankQueryTab& packet);
|
||||
void HandleGuildBankLogQuery(WorldPackets::Guild::GuildBankLogQuery& packet);
|
||||
void HandleGuildBankDepositMoney(WorldPackets::Guild::GuildBankDepositMoney& packet);
|
||||
void HandleGuildBankWithdrawMoney(WorldPackets::Guild::GuildBankWithdrawMoney& packet);
|
||||
void HandleGuildBankSwapItems(WorldPackets::Guild::GuildBankSwapItems& packet);
|
||||
|
||||
void HandleGuildBankUpdateTab(WorldPacket& recvData);
|
||||
void HandleGuildBankBuyTab(WorldPacket& recvData);
|
||||
void HandleQueryGuildBankTabText(WorldPacket& recvData);
|
||||
void HandleSetGuildBankTabText(WorldPacket& recvData);
|
||||
void HandleGuildBankUpdateTab(WorldPackets::Guild::GuildBankUpdateTab& packet);
|
||||
void HandleGuildBankBuyTab(WorldPackets::Guild::GuildBankBuyTab& packet);
|
||||
void HandleQueryGuildBankTabText(WorldPackets::Guild::GuildBankTextQuery& packet);
|
||||
void HandleSetGuildBankTabText(WorldPackets::Guild::GuildBankSetTabText& packet);
|
||||
|
||||
// Refer-a-Friend
|
||||
void HandleGrantLevel(WorldPacket& recvData);
|
||||
@@ -999,6 +1100,13 @@ public: // opcodes handlers
|
||||
TransactionCallback& AddTransactionCallback(TransactionCallback&& callback);
|
||||
SQLQueryHolderCallback& AddQueryHolderCallback(SQLQueryHolderCallback&& callback);
|
||||
|
||||
LockedQueue<WorldPacket*>& GetPacketQueue();
|
||||
|
||||
[[nodiscard]] bool IsBot() const
|
||||
{
|
||||
return _isBot;
|
||||
}
|
||||
|
||||
private:
|
||||
void ProcessQueryCallbacks();
|
||||
|
||||
@@ -1106,6 +1214,8 @@ private:
|
||||
uint32 _timeSyncNextCounter;
|
||||
uint32 _timeSyncTimer;
|
||||
|
||||
bool _isBot;
|
||||
|
||||
WorldSession(WorldSession const& right) = delete;
|
||||
WorldSession& operator=(WorldSession const& right) = delete;
|
||||
};
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
|
||||
#include "WorldSocket.h"
|
||||
#include "AccountMgr.h"
|
||||
#include "BigNumber.h"
|
||||
#include "Config.h"
|
||||
#include "CryptoHash.h"
|
||||
#include "CryptoRandom.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "IPLocation.h"
|
||||
#include "Opcodes.h"
|
||||
#include "PacketLog.h"
|
||||
@@ -48,7 +48,7 @@ void WorldSocket::Start()
|
||||
std::string ip_address = GetRemoteIpAddress().to_string();
|
||||
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_INFO);
|
||||
stmt->setString(0, ip_address);
|
||||
stmt->SetData(0, ip_address);
|
||||
|
||||
_queryProcessor.AddCallback(LoginDatabase.AsyncQuery(stmt).WithPreparedCallback(std::bind(&WorldSocket::CheckIpCallback, this, std::placeholders::_1)));
|
||||
}
|
||||
@@ -61,7 +61,7 @@ void WorldSocket::CheckIpCallback(PreparedQueryResult result)
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
if (fields[0].GetUInt64() != 0)
|
||||
if (fields[0].Get<uint64>() != 0)
|
||||
banned = true;
|
||||
|
||||
} while (result->NextRow());
|
||||
@@ -69,7 +69,7 @@ void WorldSocket::CheckIpCallback(PreparedQueryResult result)
|
||||
if (banned)
|
||||
{
|
||||
SendAuthResponseError(AUTH_REJECT);
|
||||
LOG_ERROR("network", "WorldSocket::CheckIpCallback: Sent Auth Response (IP %s banned).", GetRemoteIpAddress().to_string().c_str());
|
||||
LOG_ERROR("network", "WorldSocket::CheckIpCallback: Sent Auth Response (IP {} banned).", GetRemoteIpAddress().to_string());
|
||||
DelayedCloseSocket();
|
||||
return;
|
||||
}
|
||||
@@ -223,8 +223,8 @@ bool WorldSocket::ReadHeaderHandler()
|
||||
|
||||
if (!header->IsValidSize() || !header->IsValidOpcode())
|
||||
{
|
||||
LOG_ERROR("network", "WorldSocket::ReadHeaderHandler(): client %s sent malformed packet (size: %hu, cmd: %u)",
|
||||
GetRemoteIpAddress().to_string().c_str(), header->size, header->cmd);
|
||||
LOG_ERROR("network", "WorldSocket::ReadHeaderHandler(): client {} sent malformed packet (size: {}, cmd: {})",
|
||||
GetRemoteIpAddress().to_string(), header->size, header->cmd);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -278,20 +278,20 @@ struct AccountInfo
|
||||
// LEFT JOIN account_banned ab ON a.id = ab.id
|
||||
// LEFT JOIN account r ON a.id = r.recruiter
|
||||
// WHERE a.username = ? ORDER BY aa.RealmID DESC LIMIT 1
|
||||
Id = fields[0].GetUInt32();
|
||||
SessionKey = fields[1].GetBinary<SESSION_KEY_LENGTH>();
|
||||
LastIP = fields[2].GetString();
|
||||
IsLockedToIP = fields[3].GetBool();
|
||||
LockCountry = fields[4].GetString();
|
||||
Expansion = fields[5].GetUInt8();
|
||||
MuteTime = fields[6].GetInt64();
|
||||
Locale = LocaleConstant(fields[7].GetUInt8());
|
||||
Recruiter = fields[8].GetUInt32();
|
||||
OS = fields[9].GetString();
|
||||
TotalTime = fields[10].GetUInt32();
|
||||
Security = AccountTypes(fields[11].GetUInt8());
|
||||
IsBanned = fields[12].GetUInt64() != 0;
|
||||
IsRectuiter = fields[13].GetUInt32() != 0;
|
||||
Id = fields[0].Get<uint32>();
|
||||
SessionKey = fields[1].Get<Binary, SESSION_KEY_LENGTH>();
|
||||
LastIP = fields[2].Get<std::string>();
|
||||
IsLockedToIP = fields[3].Get<bool>();
|
||||
LockCountry = fields[4].Get<std::string>();
|
||||
Expansion = fields[5].Get<uint8>();
|
||||
MuteTime = fields[6].Get<int64>();
|
||||
Locale = LocaleConstant(fields[7].Get<uint8>());
|
||||
Recruiter = fields[8].Get<uint32>();
|
||||
OS = fields[9].Get<std::string>();
|
||||
TotalTime = fields[10].Get<uint32>();
|
||||
Security = AccountTypes(fields[11].Get<uint8>());
|
||||
IsBanned = fields[12].Get<uint64>() != 0;
|
||||
IsRectuiter = fields[13].Get<uint32>() != 0;
|
||||
|
||||
uint32 world_expansion = sWorld->getIntConfig(CONFIG_EXPANSION);
|
||||
if (Expansion > world_expansion)
|
||||
@@ -327,7 +327,7 @@ WorldSocket::ReadDataHandlerResult WorldSocket::ReadDataHandler()
|
||||
catch (ByteBufferException const&)
|
||||
{
|
||||
}
|
||||
LOG_ERROR("network", "WorldSocket::ReadDataHandler(): client %s sent malformed CMSG_PING", GetRemoteIpAddress().to_string().c_str());
|
||||
LOG_ERROR("network", "WorldSocket::ReadDataHandler(): client {} sent malformed CMSG_PING", GetRemoteIpAddress().to_string());
|
||||
return ReadDataHandlerResult::Error;
|
||||
}
|
||||
case CMSG_AUTH_SESSION:
|
||||
@@ -337,7 +337,7 @@ WorldSocket::ReadDataHandlerResult WorldSocket::ReadDataHandler()
|
||||
{
|
||||
// locking just to safely log offending user is probably overkill but we are disconnecting him anyway
|
||||
if (sessionGuard.try_lock())
|
||||
LOG_ERROR("network", "WorldSocket::ProcessIncoming: received duplicate CMSG_AUTH_SESSION from %s", _worldSession->GetPlayerInfo().c_str());
|
||||
LOG_ERROR("network", "WorldSocket::ProcessIncoming: received duplicate CMSG_AUTH_SESSION from {}", _worldSession->GetPlayerInfo());
|
||||
return ReadDataHandlerResult::Error;
|
||||
}
|
||||
|
||||
@@ -348,7 +348,7 @@ WorldSocket::ReadDataHandlerResult WorldSocket::ReadDataHandler()
|
||||
}
|
||||
catch (ByteBufferException const&) { }
|
||||
|
||||
LOG_ERROR("network", "WorldSocket::ReadDataHandler(): client %s sent malformed CMSG_AUTH_SESSION", GetRemoteIpAddress().to_string().c_str());
|
||||
LOG_ERROR("network", "WorldSocket::ReadDataHandler(): client {} sent malformed CMSG_AUTH_SESSION", GetRemoteIpAddress().to_string());
|
||||
return ReadDataHandlerResult::Error;
|
||||
}
|
||||
case CMSG_KEEP_ALIVE: // todo: handle this packet in the same way of CMSG_TIME_SYNC_RESP
|
||||
@@ -358,7 +358,7 @@ WorldSocket::ReadDataHandlerResult WorldSocket::ReadDataHandler()
|
||||
_worldSession->ResetTimeOutTime(true);
|
||||
return ReadDataHandlerResult::Ok;
|
||||
case CMSG_TIME_SYNC_RESP:
|
||||
packetToQueue = new WorldPacket(std::move(packet), std::chrono::steady_clock::now());
|
||||
packetToQueue = new WorldPacket(std::move(packet), GameTime::Now());
|
||||
break;
|
||||
default:
|
||||
packetToQueue = new WorldPacket(std::move(packet));
|
||||
@@ -371,7 +371,7 @@ WorldSocket::ReadDataHandlerResult WorldSocket::ReadDataHandler()
|
||||
|
||||
if (!_worldSession)
|
||||
{
|
||||
LOG_ERROR("network.opcode", "ProcessIncoming: Client not authed opcode = %u", uint32(opcode));
|
||||
LOG_ERROR("network.opcode", "ProcessIncoming: Client not authed opcode = {}", uint32(opcode));
|
||||
delete packetToQueue;
|
||||
return ReadDataHandlerResult::Error;
|
||||
}
|
||||
@@ -379,7 +379,7 @@ WorldSocket::ReadDataHandlerResult WorldSocket::ReadDataHandler()
|
||||
OpcodeHandler const* handler = opcodeTable[opcode];
|
||||
if (!handler)
|
||||
{
|
||||
LOG_ERROR("network.opcode", "No defined handler for opcode %s sent by %s", GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet.GetOpcode())).c_str(), _worldSession->GetPlayerInfo().c_str());
|
||||
LOG_ERROR("network.opcode", "No defined handler for opcode {} sent by {}", GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet.GetOpcode())), _worldSession->GetPlayerInfo());
|
||||
delete packetToQueue;
|
||||
return ReadDataHandlerResult::Error;
|
||||
}
|
||||
@@ -397,18 +397,18 @@ void WorldSocket::LogOpcodeText(OpcodeClient opcode, std::unique_lock<std::mutex
|
||||
{
|
||||
if (!guard)
|
||||
{
|
||||
LOG_TRACE("network.opcode", "C->S: %s %s", GetRemoteIpAddress().to_string().c_str(), GetOpcodeNameForLogging(opcode).c_str());
|
||||
LOG_TRACE("network.opcode", "C->S: {} {}", GetRemoteIpAddress().to_string(), GetOpcodeNameForLogging(opcode));
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_TRACE("network.opcode", "C->S: %s %s", (_worldSession ? _worldSession->GetPlayerInfo() : GetRemoteIpAddress().to_string()).c_str(),
|
||||
GetOpcodeNameForLogging(opcode).c_str());
|
||||
LOG_TRACE("network.opcode", "C->S: {} {}", (_worldSession ? _worldSession->GetPlayerInfo() : GetRemoteIpAddress().to_string()),
|
||||
GetOpcodeNameForLogging(opcode));
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSocket::SendPacketAndLogOpcode(WorldPacket const& packet)
|
||||
{
|
||||
LOG_TRACE("network.opcode", "S->C: %s %s", GetRemoteIpAddress().to_string().c_str(), GetOpcodeNameForLogging(static_cast<OpcodeServer>(packet.GetOpcode())).c_str());
|
||||
LOG_TRACE("network.opcode", "S->C: {} {}", GetRemoteIpAddress().to_string(), GetOpcodeNameForLogging(static_cast<OpcodeServer>(packet.GetOpcode())));
|
||||
SendPacket(packet);
|
||||
}
|
||||
|
||||
@@ -443,8 +443,8 @@ void WorldSocket::HandleAuthSession(WorldPacket & recvPacket)
|
||||
|
||||
// Get the account information from the auth database
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_INFO_BY_NAME);
|
||||
stmt->setInt32(0, int32(realm.Id.Realm));
|
||||
stmt->setString(1, authSession->Account);
|
||||
stmt->SetData(0, int32(realm.Id.Realm));
|
||||
stmt->SetData(1, authSession->Account);
|
||||
|
||||
_queryProcessor.AddCallback(LoginDatabase.AsyncQuery(stmt).WithPreparedCallback(std::bind(&WorldSocket::HandleAuthSessionCallback, this, authSession, std::placeholders::_1)));
|
||||
}
|
||||
@@ -470,8 +470,8 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<AuthSession> authSes
|
||||
|
||||
// As we don't know if attempted login process by ip works, we update last_attempt_ip right away
|
||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LAST_ATTEMPT_IP);
|
||||
stmt->setString(0, address);
|
||||
stmt->setString(1, authSession->Account);
|
||||
stmt->SetData(0, address);
|
||||
stmt->SetData(1, authSession->Account);
|
||||
LoginDatabase.Execute(stmt);
|
||||
// This also allows to check for possible "hack" attempts on account
|
||||
|
||||
@@ -482,7 +482,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<AuthSession> authSes
|
||||
if (sWorld->IsClosed())
|
||||
{
|
||||
SendAuthResponseError(AUTH_REJECT);
|
||||
LOG_ERROR("network", "WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteIpAddress().to_string().c_str());
|
||||
LOG_ERROR("network", "WorldSocket::HandleAuthSession: World closed, denying client ({}).", GetRemoteIpAddress().to_string());
|
||||
DelayedCloseSocket();
|
||||
return;
|
||||
}
|
||||
@@ -490,8 +490,8 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<AuthSession> authSes
|
||||
if (authSession->RealmID != realm.Id.Realm)
|
||||
{
|
||||
SendAuthResponseError(REALM_LIST_REALM_NOT_FOUND);
|
||||
LOG_ERROR("network", "WorldSocket::HandleAuthSession: Client %s requested connecting with realm id %u but this realm has id %u set in config.",
|
||||
GetRemoteIpAddress().to_string().c_str(), authSession->RealmID, realm.Id.Realm);
|
||||
LOG_ERROR("network", "WorldSocket::HandleAuthSession: Client {} requested connecting with realm id {} but this realm has id {} set in config.",
|
||||
GetRemoteIpAddress().to_string(), authSession->RealmID, realm.Id.Realm);
|
||||
DelayedCloseSocket();
|
||||
return;
|
||||
}
|
||||
@@ -501,7 +501,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<AuthSession> authSes
|
||||
if (wardenActive && account.OS != "Win" && account.OS != "OSX")
|
||||
{
|
||||
SendAuthResponseError(AUTH_REJECT);
|
||||
LOG_ERROR("network", "WorldSocket::HandleAuthSession: Client %s attempted to log in using invalid client OS (%s).", address.c_str(), account.OS.c_str());
|
||||
LOG_ERROR("network", "WorldSocket::HandleAuthSession: Client {} attempted to log in using invalid client OS ({}).", address, account.OS);
|
||||
DelayedCloseSocket();
|
||||
return;
|
||||
}
|
||||
@@ -520,7 +520,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<AuthSession> authSes
|
||||
if (sha.GetDigest() != authSession->Digest)
|
||||
{
|
||||
SendAuthResponseError(AUTH_FAILED);
|
||||
LOG_ERROR("network", "WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", account.Id, authSession->Account.c_str(), address.c_str());
|
||||
LOG_ERROR("network", "WorldSocket::HandleAuthSession: Authentication failed for account: {} ('{}') address: {}", account.Id, authSession->Account, address);
|
||||
DelayedCloseSocket();
|
||||
return;
|
||||
}
|
||||
@@ -534,7 +534,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<AuthSession> authSes
|
||||
if (account.LastIP != address)
|
||||
{
|
||||
SendAuthResponseError(AUTH_FAILED);
|
||||
LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs. Original IP: %s, new IP: %s).", account.LastIP.c_str(), address.c_str());
|
||||
LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs. Original IP: {}, new IP: {}).", account.LastIP, address);
|
||||
// We could log on hook only instead of an additional db log, however action logger is config based. Better keep DB logging as well
|
||||
sScriptMgr->OnFailedAccountLogin(account.Id);
|
||||
DelayedCloseSocket();
|
||||
@@ -546,7 +546,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<AuthSession> authSes
|
||||
if (account.LockCountry != _ipCountry)
|
||||
{
|
||||
SendAuthResponseError(AUTH_FAILED);
|
||||
LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account country differs. Original country: %s, new country: %s).", account.LockCountry.c_str(), _ipCountry.c_str());
|
||||
LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account country differs. Original country: {}, new country: {}).", account.LockCountry, _ipCountry);
|
||||
// We could log on hook only instead of an additional db log, however action logger is config based. Better keep DB logging as well
|
||||
sScriptMgr->OnFailedAccountLogin(account.Id);
|
||||
DelayedCloseSocket();
|
||||
@@ -557,11 +557,11 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<AuthSession> authSes
|
||||
//! Negative mutetime indicates amount of minutes to be muted effective on next login - which is now.
|
||||
if (account.MuteTime < 0)
|
||||
{
|
||||
account.MuteTime = time(nullptr) + llabs(account.MuteTime);
|
||||
account.MuteTime = GameTime::GetGameTime().count() + llabs(account.MuteTime);
|
||||
|
||||
auto* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME_LOGIN);
|
||||
stmt->setInt64(0, account.MuteTime);
|
||||
stmt->setUInt32(1, account.Id);
|
||||
stmt->SetData(0, account.MuteTime);
|
||||
stmt->SetData(1, account.Id);
|
||||
LoginDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
@@ -576,7 +576,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<AuthSession> authSes
|
||||
|
||||
// Check locked state for server
|
||||
AccountTypes allowedAccountType = sWorld->GetPlayerSecurityLimit();
|
||||
LOG_DEBUG("network", "Allowed Level: %u Player Level %u", allowedAccountType, account.Security);
|
||||
LOG_DEBUG("network", "Allowed Level: {} Player Level {}", allowedAccountType, account.Security);
|
||||
if (allowedAccountType > SEC_PLAYER && account.Security < allowedAccountType)
|
||||
{
|
||||
SendAuthResponseError(AUTH_UNAVAILABLE);
|
||||
@@ -586,12 +586,12 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<AuthSession> authSes
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.", authSession->Account.c_str(), address.c_str());
|
||||
LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Client '{}' authenticated successfully from {}.", authSession->Account, address);
|
||||
|
||||
// Update the last_ip in the database as it was successful for login
|
||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LAST_IP);
|
||||
stmt->setString(0, address);
|
||||
stmt->setString(1, authSession->Account);
|
||||
stmt->SetData(0, address);
|
||||
stmt->SetData(1, authSession->Account);
|
||||
|
||||
LoginDatabase.Execute(stmt);
|
||||
|
||||
@@ -660,8 +660,8 @@ bool WorldSocket::HandlePing(WorldPacket& recvPacket)
|
||||
|
||||
if (_worldSession && AccountMgr::IsPlayerAccount(_worldSession->GetSecurity()))
|
||||
{
|
||||
LOG_ERROR("network", "WorldSocket::HandlePing: %s kicked for over-speed pings (address: %s)",
|
||||
_worldSession->GetPlayerInfo().c_str(), GetRemoteIpAddress().to_string().c_str());
|
||||
LOG_ERROR("network", "WorldSocket::HandlePing: {} kicked for over-speed pings (address: {})",
|
||||
_worldSession->GetPlayerInfo(), GetRemoteIpAddress().to_string());
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -680,7 +680,7 @@ bool WorldSocket::HandlePing(WorldPacket& recvPacket)
|
||||
_worldSession->SetLatency(latency);
|
||||
else
|
||||
{
|
||||
LOG_ERROR("network", "WorldSocket::HandlePing: peer sent CMSG_PING, but is not authenticated or got recently kicked, address = %s", GetRemoteIpAddress().to_string().c_str());
|
||||
LOG_ERROR("network", "WorldSocket::HandlePing: peer sent CMSG_PING, but is not authenticated or got recently kicked, address = {}", GetRemoteIpAddress().to_string());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ bool WorldSocketMgr::StartWorldNetwork(Acore::Asio::IoContext& ioContext, std::s
|
||||
_tcpNoDelay = sConfigMgr->GetOption<bool>("Network.TcpNodelay", true);
|
||||
|
||||
int const max_connections = ACORE_MAX_LISTEN_CONNECTIONS;
|
||||
LOG_DEBUG("network", "Max allowed socket connections %d", max_connections);
|
||||
LOG_DEBUG("network", "Max allowed socket connections {}", max_connections);
|
||||
|
||||
// -1 means use default
|
||||
_socketSystemSendBufferSize = sConfigMgr->GetOption<int32>("Network.OutKBuff", -1);
|
||||
@@ -91,7 +91,7 @@ void WorldSocketMgr::OnSocketOpen(tcp::socket&& sock, uint32 threadIndex)
|
||||
|
||||
if (err && err != boost::system::errc::not_supported)
|
||||
{
|
||||
LOG_ERROR("network", "WorldSocketMgr::OnSocketOpen sock.set_option(boost::asio::socket_base::send_buffer_size) err = %s", err.message().c_str());
|
||||
LOG_ERROR("network", "WorldSocketMgr::OnSocketOpen sock.set_option(boost::asio::socket_base::send_buffer_size) err = {}", err.message());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -104,7 +104,7 @@ void WorldSocketMgr::OnSocketOpen(tcp::socket&& sock, uint32 threadIndex)
|
||||
|
||||
if (err)
|
||||
{
|
||||
LOG_ERROR("network", "WorldSocketMgr::OnSocketOpen sock.set_option(boost::asio::ip::tcp::no_delay) err = %s", err.message().c_str());
|
||||
LOG_ERROR("network", "WorldSocketMgr::OnSocketOpen sock.set_option(boost::asio::ip::tcp::no_delay) err = {}", err.message());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user