forked from teamnwah/openmw-tes3coop
[General] Add placeholders for PlayerTopic & ObjectTrap packets
parent
b1264cca92
commit
08de349133
@ -0,0 +1,28 @@
|
||||
#ifndef OPENMW_PROCESSORPLAYERTOPIC_HPP
|
||||
#define OPENMW_PROCESSORPLAYERTOPIC_HPP
|
||||
|
||||
|
||||
#include "apps/openmw-mp/PlayerProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorPlayerTopic : public PlayerProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorPlayerTopic()
|
||||
{
|
||||
BPP_INIT(ID_PLAYER_TOPIC)
|
||||
}
|
||||
|
||||
void Do(PlayerPacket &packet, Player &player) override
|
||||
{
|
||||
DEBUG_PRINTF(strPacketID.c_str());
|
||||
|
||||
packet.Send(true);
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerTopic")>(player.getId());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PROCESSORPLAYERTOPIC_HPP
|
@ -0,0 +1,27 @@
|
||||
#ifndef OPENMW_PROCESSOROBJECTTRAP_HPP
|
||||
#define OPENMW_PROCESSOROBJECTTRAP_HPP
|
||||
|
||||
#include "apps/openmw-mp/WorldProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorObjectTrap : public WorldProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorObjectTrap()
|
||||
{
|
||||
BPP_INIT(ID_OBJECT_TRAP)
|
||||
}
|
||||
|
||||
void Do(WorldPacket &packet, Player &player, BaseEvent &event) override
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player.npc.mName.c_str());
|
||||
|
||||
packet.Send(true);
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnObjectTrap")>(player.getId(), event.cell.getDescription().c_str());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PROCESSOROBJECTTRAP_HPP
|
@ -0,0 +1,30 @@
|
||||
#ifndef OPENMW_PROCESSORPLAYERTOPIC_HPP
|
||||
#define OPENMW_PROCESSORPLAYERTOPIC_HPP
|
||||
|
||||
|
||||
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorPlayerTopic : public PlayerProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorPlayerTopic()
|
||||
{
|
||||
BPP_INIT(ID_PLAYER_TOPIC)
|
||||
}
|
||||
|
||||
virtual void Do(PlayerPacket &packet, BasePlayer *player)
|
||||
{
|
||||
if (isRequest())
|
||||
{
|
||||
// Entire list of topics cannot currently be requested from players
|
||||
}
|
||||
//else
|
||||
//static_cast<LocalPlayer*>(player)->addTopics();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif //OPENMW_PROCESSORPLAYERTOPIC_HPP
|
@ -0,0 +1,26 @@
|
||||
#ifndef OPENMW_PROCESSOROBJECTTRAP_HPP
|
||||
#define OPENMW_PROCESSOROBJECTTRAP_HPP
|
||||
|
||||
|
||||
#include "BaseObjectProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorObjectTrap : public BaseObjectProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorObjectTrap()
|
||||
{
|
||||
BPP_INIT(ID_OBJECT_TRAP)
|
||||
}
|
||||
|
||||
virtual void Do(WorldPacket &packet, WorldEvent &event)
|
||||
{
|
||||
BaseObjectProcessor::Do(packet, event);
|
||||
|
||||
//event.setObjectTraps(ptrCellStore);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PROCESSOROBJECTTRAP_HPP
|
@ -0,0 +1,15 @@
|
||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
#include "PacketPlayerTopic.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace mwmp;
|
||||
|
||||
PacketPlayerTopic::PacketPlayerTopic(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||
{
|
||||
packetID = ID_PLAYER_TOPIC;
|
||||
}
|
||||
|
||||
void PacketPlayerTopic::Packet(RakNet::BitStream *bs, bool send)
|
||||
{
|
||||
PlayerPacket::Packet(bs, send);
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
#ifndef OPENMW_PACKETPLAYERTOPIC_HPP
|
||||
#define OPENMW_PACKETPLAYERTOPIC_HPP
|
||||
|
||||
#include <components/openmw-mp/Packets/Player/PlayerPacket.hpp>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class PacketPlayerTopic : public PlayerPacket
|
||||
{
|
||||
public:
|
||||
PacketPlayerTopic(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif //OPENMW_PACKETPLAYERTOPIC_HPP
|
@ -0,0 +1,45 @@
|
||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
#include "PacketObjectTrap.hpp"
|
||||
|
||||
using namespace mwmp;
|
||||
|
||||
PacketObjectTrap::PacketObjectTrap(RakNet::RakPeerInterface *peer) : WorldPacket(peer)
|
||||
{
|
||||
packetID = ID_OBJECT_TRAP;
|
||||
}
|
||||
|
||||
void PacketObjectTrap::Packet(RakNet::BitStream *bs, bool send)
|
||||
{
|
||||
WorldPacket::Packet(bs, send);
|
||||
|
||||
if (!send)
|
||||
event->worldObjects.clear();
|
||||
else
|
||||
event->worldObjectCount = (unsigned int)(event->worldObjects.size());
|
||||
|
||||
RW(event->worldObjectCount, send);
|
||||
|
||||
RW(event->cell.mData.mFlags, send);
|
||||
RW(event->cell.mData.mX, send);
|
||||
RW(event->cell.mData.mY, send);
|
||||
RW(event->cell.mName, send);
|
||||
|
||||
WorldObject worldObject;
|
||||
|
||||
for (unsigned int i = 0; i < event->worldObjectCount; i++)
|
||||
{
|
||||
if (send)
|
||||
{
|
||||
worldObject = event->worldObjects.at(i);
|
||||
}
|
||||
|
||||
RW(worldObject.refId, send);
|
||||
RW(worldObject.refNumIndex, send);
|
||||
RW(worldObject.mpNum, send);
|
||||
|
||||
if (!send)
|
||||
{
|
||||
event->worldObjects.push_back(worldObject);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
#ifndef OPENMW_PACKETOBJECTTRAP_HPP
|
||||
#define OPENMW_PACKETOBJECTTRAP_HPP
|
||||
|
||||
#include <components/openmw-mp/Packets/World/WorldPacket.hpp>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class PacketObjectTrap : public WorldPacket
|
||||
{
|
||||
public:
|
||||
PacketObjectTrap(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PACKETOBJECTTRAP_HPP
|
Loading…
Reference in New Issue