2017-04-16 07:00:25 +00:00
|
|
|
#ifndef OPENMW_PROCESSORPLAYERLEVEL_HPP
|
|
|
|
#define OPENMW_PROCESSORPLAYERLEVEL_HPP
|
|
|
|
|
|
|
|
|
2017-06-06 16:06:10 +00:00
|
|
|
#include "../PlayerProcessor.hpp"
|
2017-04-16 07:00:25 +00:00
|
|
|
|
|
|
|
namespace mwmp
|
|
|
|
{
|
|
|
|
class ProcessorPlayerLevel : public PlayerProcessor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ProcessorPlayerLevel()
|
|
|
|
{
|
|
|
|
BPP_INIT(ID_PLAYER_LEVEL)
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void Do(PlayerPacket &packet, BasePlayer *player)
|
|
|
|
{
|
|
|
|
if (isLocal())
|
|
|
|
{
|
2017-05-02 19:47:58 +00:00
|
|
|
if (isRequest())
|
2017-04-16 07:00:25 +00:00
|
|
|
static_cast<LocalPlayer *>(player)->updateLevel(true);
|
|
|
|
else
|
|
|
|
static_cast<LocalPlayer *>(player)->setLevel();
|
|
|
|
}
|
2017-04-23 22:46:27 +00:00
|
|
|
else if (player != 0)
|
2017-04-16 07:00:25 +00:00
|
|
|
{
|
|
|
|
MWWorld::Ptr ptrPlayer = static_cast<DedicatedPlayer *>(player)->getPtr();
|
|
|
|
MWMechanics::CreatureStats *ptrCreatureStats = &ptrPlayer.getClass().getCreatureStats(ptrPlayer);
|
|
|
|
|
|
|
|
ptrCreatureStats->setLevel(player->creatureStats.mLevel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif //OPENMW_PROCESSORPLAYERLEVEL_HPP
|