1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-31 12:45:31 +00:00
openmw-tes3mp/apps/openmw/mwmp/processors/player/ProcessorPlayerResurrect.hpp
David Cernat d70b93e095 Merge pull request #373 from TES3MP/0.6.2 while resolving conflicts
# Conflicts:
#	apps/openmw/mwmp/DedicatedActor.cpp
#	apps/openmw/mwmp/processors/player/ProcessorPlayerResurrect.hpp
2018-01-27 21:14:24 +02:00

53 lines
1.7 KiB
C++

//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORPLAYERRESURRECT_HPP
#define OPENMW_PROCESSORPLAYERRESURRECT_HPP
#include "../PlayerProcessor.hpp"
#include "apps/openmw/mwmp/Main.hpp"
#include "apps/openmw/mwmp/Networking.hpp"
namespace mwmp
{
class ProcessorPlayerResurrect final: public PlayerProcessor
{
public:
ProcessorPlayerResurrect()
{
BPP_INIT(ID_PLAYER_RESURRECT)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_RESURRECT from server");
if (isLocal())
{
LOG_APPEND(Log::LOG_INFO, "- Packet was about me with resurrectType of %i", (int) player->resurrectType);
static_cast<LocalPlayer*>(player)->resurrect();
}
else if (player != 0)
{
LOG_APPEND(Log::LOG_INFO, "- Packet was about %s", player->npc.mName.c_str());
player->creatureStats.mDead = false;
if (player->creatureStats.mDynamic[0].mMod < 1)
player->creatureStats.mDynamic[0].mMod = 1;
player->creatureStats.mDynamic[0].mCurrent = player->creatureStats.mDynamic[0].mMod;
MWWorld::Ptr ptr = static_cast<DedicatedPlayer*>(player)->getPtr();
ptr.getClass().getCreatureStats(ptr).resurrect();
MWMechanics::DynamicStat<float> health;
health.readState(player->creatureStats.mDynamic[0]);
ptr.getClass().getCreatureStats(ptr).setHealth(health);
}
}
};
}
#endif //OPENMW_PROCESSORPLAYERRESURRECT_HPP