forked from mirror/openmw-tes3mp
[General] Implement resurrection at nearest shrine or temple
parent
a358dc6af8
commit
b3b73c5cd2
@ -0,0 +1,26 @@
|
||||
#include "Death.hpp"
|
||||
#include <apps/openmw-mp/Script/ScriptFunctions.hpp>
|
||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
#include <apps/openmw-mp/Networking.hpp>
|
||||
#include <components/openmw-mp/Log.hpp>
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
void DeathFunctions::SetResurrectType(unsigned short pid, unsigned int type)
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
player->resurrectType = type;
|
||||
}
|
||||
|
||||
void DeathFunctions::SendResurrect(unsigned short pid) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player, );
|
||||
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_RESURRECT)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_RESURRECT)->Send(false);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_RESURRECT)->Send(true);
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
#ifndef OPENMW_DEATHAPI_HPP
|
||||
#define OPENMW_DEATHAPI_HPP
|
||||
|
||||
#include "../Types.hpp"
|
||||
|
||||
#define DEATHAPI \
|
||||
{"SetResurrectType", DeathFunctions::SetResurrectType},\
|
||||
\
|
||||
{"SendResurrect", DeathFunctions::SendResurrect}
|
||||
|
||||
class DeathFunctions
|
||||
{
|
||||
public:
|
||||
static void SetResurrectType(unsigned short pid, unsigned int type);
|
||||
|
||||
static void SendResurrect(unsigned short pid) noexcept;
|
||||
};
|
||||
|
||||
#endif //OPENMW_DEATHAPI_HPP
|
@ -0,0 +1,18 @@
|
||||
#include "PacketPlayerResurrect.hpp"
|
||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
#include <components/openmw-mp/Log.hpp>
|
||||
|
||||
using namespace mwmp;
|
||||
|
||||
PacketPlayerResurrect::PacketPlayerResurrect(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||
{
|
||||
packetID = ID_PLAYER_RESURRECT;
|
||||
}
|
||||
|
||||
void PacketPlayerResurrect::Packet(RakNet::BitStream *bs, bool send)
|
||||
{
|
||||
PlayerPacket::Packet(bs, send);
|
||||
|
||||
RW(player->creatureStats.mDead, send);
|
||||
RW(player->resurrectType, send);
|
||||
}
|
@ -1,30 +1,17 @@
|
||||
//
|
||||
// Created by koncord on 13.01.16.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_PACKETPLAYERRESURRECT_HPP
|
||||
#define OPENMW_PACKETPLAYERRESURRECT_HPP
|
||||
|
||||
|
||||
#include <components/openmw-mp/Packets/Player/PlayerPacket.hpp>
|
||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class PacketPlayerResurrect: public PlayerPacket
|
||||
class PacketPlayerResurrect : public PlayerPacket
|
||||
{
|
||||
public:
|
||||
PacketPlayerResurrect(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||
{
|
||||
packetID = ID_PLAYER_RESURRECT;
|
||||
}
|
||||
void Packet(RakNet::BitStream *bs, bool send)
|
||||
{
|
||||
PlayerPacket::Packet(bs, send);
|
||||
RW(player->creatureStats.mDead, send);
|
||||
}
|
||||
PacketPlayerResurrect(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif //OPENMW_PACKETPLAYERRESURRECT_HPP
|
||||
|
Loading…
Reference in New Issue