#include "../Packets/Player/PacketDisconnect.hpp" #include "../Packets/Player/PacketChatMessage.hpp" #include "../Packets/Player/PacketPlayerCharGen.hpp" #include "../Packets/Player/PacketHandshake.hpp" #include "../Packets/Player/PacketGUIBoxes.hpp" #include "../Packets/Player/PacketLoaded.hpp" #include "../Packets/Player/PacketGameSettings.hpp" #include "../Packets/Player/PacketPlayerActiveSkills.hpp" #include "../Packets/Player/PacketPlayerAnimFlags.hpp" #include "../Packets/Player/PacketPlayerAnimPlay.hpp" #include "../Packets/Player/PacketPlayerAttack.hpp" #include "../Packets/Player/PacketPlayerAttribute.hpp" #include "../Packets/Player/PacketPlayerBaseInfo.hpp" #include "../Packets/Player/PacketPlayerBehavior.hpp" #include "../Packets/Player/PacketPlayerBook.hpp" #include "../Packets/Player/PacketPlayerBounty.hpp" #include "../Packets/Player/PacketPlayerCellChange.hpp" #include "../Packets/Player/PacketPlayerCellState.hpp" #include "../Packets/Player/PacketPlayerClass.hpp" #include "../Packets/Player/PacketPlayerDeath.hpp" #include "../Packets/Player/PacketPlayerEquipment.hpp" #include "../Packets/Player/PacketPlayerFaction.hpp" #include "../Packets/Player/PacketPlayerInput.hpp" #include "../Packets/Player/PacketPlayerInventory.hpp" #include "../Packets/Player/PacketPlayerItemUse.hpp" #include "../Packets/Player/PacketPlayerJail.hpp" #include "../Packets/Player/PacketPlayerJournal.hpp" #include "../Packets/Player/PacketWorldKillCount.hpp" #include "../Packets/Player/PacketPlayerLevel.hpp" #include "../Packets/Player/PacketPlayerMiscellaneous.hpp" #include "../Packets/Player/PacketPlayerMomentum.hpp" #include "../Packets/Player/PacketPlayerPosition.hpp" #include "../Packets/Player/PacketPlayerQuickKeys.hpp" #include "../Packets/Player/PacketPlayerReputation.hpp" #include "../Packets/Player/PacketPlayerRest.hpp" #include "../Packets/Player/PacketPlayerResurrect.hpp" #include "../Packets/Player/PacketPlayerShapeshift.hpp" #include "../Packets/Player/PacketPlayerSkill.hpp" #include "../Packets/Player/PacketPlayerSpeech.hpp" #include "../Packets/Player/PacketPlayerSpellbook.hpp" #include "../Packets/Player/PacketPlayerStatsDynamic.hpp" #include "../Packets/Player/PacketPlayerTopic.hpp" #include "PlayerPacketController.hpp" template inline void AddPacket(mwmp::PlayerPacketController::packets_t *packets, RakNet::RakPeerInterface *peer) { T *packet = new T(peer); typedef mwmp::PlayerPacketController::packets_t::value_type value_t; packets->insert(value_t(packet->GetPacketID(), value_t::second_type(packet))); } mwmp::PlayerPacketController::PlayerPacketController(RakNet::RakPeerInterface *peer) { AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); } mwmp::PlayerPacket *mwmp::PlayerPacketController::GetPacket(RakNet::MessageID id) { return packets[(unsigned char)id].get(); } void mwmp::PlayerPacketController::SetStream(RakNet::BitStream *inStream, RakNet::BitStream *outStream) { for(const auto &packet : packets) packet.second->SetStreams(inStream, outStream); } bool mwmp::PlayerPacketController::ContainsPacket(RakNet::MessageID id) { for(const auto &packet : packets) { if (packet.first == id) return true; } return false; }