2017-04-09 05:51:28 +00:00
|
|
|
#include "../Packets/Actor/PacketActorList.hpp"
|
|
|
|
#include "../Packets/Actor/PacketActorAuthority.hpp"
|
2017-04-10 05:37:18 +00:00
|
|
|
#include "../Packets/Actor/PacketActorTest.hpp"
|
2017-05-29 01:43:52 +00:00
|
|
|
#include "../Packets/Actor/PacketActorAI.hpp"
|
2017-04-14 13:00:34 +00:00
|
|
|
#include "../Packets/Actor/PacketActorAnimFlags.hpp"
|
2017-04-11 08:37:38 +00:00
|
|
|
#include "../Packets/Actor/PacketActorAnimPlay.hpp"
|
|
|
|
#include "../Packets/Actor/PacketActorAttack.hpp"
|
2019-08-25 06:35:23 +00:00
|
|
|
#include "../Packets/Actor/PacketActorCast.hpp"
|
2017-04-11 08:37:38 +00:00
|
|
|
#include "../Packets/Actor/PacketActorCellChange.hpp"
|
2017-05-29 01:43:52 +00:00
|
|
|
#include "../Packets/Actor/PacketActorDeath.hpp"
|
2017-05-16 16:25:31 +00:00
|
|
|
#include "../Packets/Actor/PacketActorEquipment.hpp"
|
2017-04-11 08:37:38 +00:00
|
|
|
#include "../Packets/Actor/PacketActorPosition.hpp"
|
|
|
|
#include "../Packets/Actor/PacketActorSpeech.hpp"
|
2020-01-26 10:47:49 +00:00
|
|
|
#include "../Packets/Actor/PacketActorSpellsActive.hpp"
|
|
|
|
#include "../Packets/Actor/PacketActorStatsDynamic.hpp"
|
2017-04-11 08:37:38 +00:00
|
|
|
|
2017-04-09 05:51:28 +00:00
|
|
|
|
|
|
|
#include "ActorPacketController.hpp"
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
inline void AddPacket(mwmp::ActorPacketController::packets_t *packets, RakNet::RakPeerInterface *peer)
|
|
|
|
{
|
|
|
|
T *packet = new T(peer);
|
|
|
|
typedef mwmp::ActorPacketController::packets_t::value_type value_t;
|
|
|
|
packets->insert(value_t(packet->GetPacketID(), value_t::second_type(packet)));
|
|
|
|
}
|
|
|
|
|
|
|
|
mwmp::ActorPacketController::ActorPacketController(RakNet::RakPeerInterface *peer)
|
|
|
|
{
|
|
|
|
AddPacket<PacketActorList>(&packets, peer);
|
|
|
|
AddPacket<PacketActorAuthority>(&packets, peer);
|
2017-04-10 05:37:18 +00:00
|
|
|
AddPacket<PacketActorTest>(&packets, peer);
|
2017-05-29 01:43:52 +00:00
|
|
|
AddPacket<PacketActorAI>(&packets, peer);
|
2017-04-14 13:00:34 +00:00
|
|
|
AddPacket<PacketActorAnimFlags>(&packets, peer);
|
2017-04-11 08:37:38 +00:00
|
|
|
AddPacket<PacketActorAnimPlay>(&packets, peer);
|
|
|
|
AddPacket<PacketActorAttack>(&packets, peer);
|
2019-08-25 06:35:23 +00:00
|
|
|
AddPacket<PacketActorCast>(&packets, peer);
|
2017-04-11 08:37:38 +00:00
|
|
|
AddPacket<PacketActorCellChange>(&packets, peer);
|
2017-05-29 01:43:52 +00:00
|
|
|
AddPacket<PacketActorDeath>(&packets, peer);
|
2017-05-16 16:25:31 +00:00
|
|
|
AddPacket<PacketActorEquipment>(&packets, peer);
|
2017-04-11 08:37:38 +00:00
|
|
|
AddPacket<PacketActorPosition>(&packets, peer);
|
|
|
|
AddPacket<PacketActorSpeech>(&packets, peer);
|
2020-01-26 10:47:49 +00:00
|
|
|
AddPacket<PacketActorSpellsActive>(&packets, peer);
|
2017-05-16 16:25:31 +00:00
|
|
|
AddPacket<PacketActorStatsDynamic>(&packets, peer);
|
2017-04-09 05:51:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
mwmp::ActorPacket *mwmp::ActorPacketController::GetPacket(RakNet::MessageID id)
|
|
|
|
{
|
|
|
|
return packets[(unsigned char)id].get();
|
|
|
|
}
|
|
|
|
|
|
|
|
void mwmp::ActorPacketController::SetStream(RakNet::BitStream *inStream, RakNet::BitStream *outStream)
|
|
|
|
{
|
2017-06-27 14:41:37 +00:00
|
|
|
for(const auto &packet : packets)
|
2017-04-09 05:51:28 +00:00
|
|
|
packet.second->SetStreams(inStream, outStream);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool mwmp::ActorPacketController::ContainsPacket(RakNet::MessageID id)
|
|
|
|
{
|
2017-06-27 14:41:37 +00:00
|
|
|
for(const auto &packet : packets)
|
|
|
|
{
|
2017-04-09 05:51:28 +00:00
|
|
|
if (packet.first == id)
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|