1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-26 10:09:40 +00:00
openmw-tes3mp/apps/openmw/mwmp/processors/player/ProcessorPlayerLevel.hpp
David Cernat 5858e05362 Merge pull request #378 from TES3MP/0.6.3 while resolving conflicts
Conflicts:
	apps/openmw-mp/CMakeLists.txt
	apps/openmw-mp/Script/ScriptFunctions.hpp
	components/CMakeLists.txt
2018-01-30 00:54:56 +02:00

38 lines
1 KiB
C++

#ifndef OPENMW_PROCESSORPLAYERLEVEL_HPP
#define OPENMW_PROCESSORPLAYERLEVEL_HPP
#include "../PlayerProcessor.hpp"
namespace mwmp
{
class ProcessorPlayerLevel final: public PlayerProcessor
{
public:
ProcessorPlayerLevel()
{
BPP_INIT(ID_PLAYER_LEVEL)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
if (isLocal())
{
if (isRequest())
static_cast<LocalPlayer *>(player)->updateLevel(true);
else
static_cast<LocalPlayer *>(player)->setLevel();
}
else if (player != 0)
{
MWWorld::Ptr ptrPlayer = static_cast<DedicatedPlayer *>(player)->getPtr();
MWMechanics::CreatureStats *ptrCreatureStats = &ptrPlayer.getClass().getCreatureStats(ptrPlayer);
ptrCreatureStats->setLevel(player->creatureStats.mLevel);
}
}
};
}
#endif //OPENMW_PROCESSORPLAYERLEVEL_HPP