2017-05-29 01:43:52 +00:00
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
|
|
#include "PacketObjectSpawn.hpp"
|
|
|
|
|
|
|
|
using namespace mwmp;
|
|
|
|
|
2018-05-12 16:40:00 +00:00
|
|
|
PacketObjectSpawn::PacketObjectSpawn(RakNet::RakPeerInterface *peer) : ObjectPacket(peer)
|
2017-05-29 01:43:52 +00:00
|
|
|
{
|
|
|
|
packetID = ID_OBJECT_SPAWN;
|
2017-06-02 19:10:47 +00:00
|
|
|
hasCellData = true;
|
2017-05-29 01:43:52 +00:00
|
|
|
}
|
|
|
|
|
2018-05-12 21:42:24 +00:00
|
|
|
void PacketObjectSpawn::Object(BaseObject &baseObject, bool send)
|
2017-05-29 01:43:52 +00:00
|
|
|
{
|
2018-05-12 21:42:24 +00:00
|
|
|
ObjectPacket::Object(baseObject, send);
|
|
|
|
RW(baseObject.position, send);
|
2018-06-30 21:43:29 +00:00
|
|
|
RW(baseObject.summonDuration, send);
|
2017-05-29 01:43:52 +00:00
|
|
|
|
2018-07-01 23:25:06 +00:00
|
|
|
RW(baseObject.isSummon, send);
|
2017-05-29 01:43:52 +00:00
|
|
|
|
2018-07-01 23:25:06 +00:00
|
|
|
if (baseObject.isSummon)
|
2017-06-01 22:35:32 +00:00
|
|
|
{
|
2018-05-12 21:42:24 +00:00
|
|
|
RW(baseObject.master.isPlayer, send);
|
2018-04-05 09:48:53 +00:00
|
|
|
|
2018-05-12 21:42:24 +00:00
|
|
|
if (baseObject.master.isPlayer)
|
2018-04-05 09:48:53 +00:00
|
|
|
{
|
2018-05-12 21:42:24 +00:00
|
|
|
RW(baseObject.master.guid, send);
|
2018-04-05 09:48:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-07-02 18:50:21 +00:00
|
|
|
RW(baseObject.master.refId, send, true);
|
2018-07-13 01:12:03 +00:00
|
|
|
RW(baseObject.master.refNum, send);
|
2018-05-12 21:42:24 +00:00
|
|
|
RW(baseObject.master.mpNum, send);
|
2018-04-05 09:48:53 +00:00
|
|
|
}
|
2017-05-29 01:43:52 +00:00
|
|
|
}
|
|
|
|
}
|