diff --git a/apps/openmw-mp/NetActor.cpp b/apps/openmw-mp/NetActor.cpp index e2da6c23e..dffc2fc85 100644 --- a/apps/openmw-mp/NetActor.cpp +++ b/apps/openmw-mp/NetActor.cpp @@ -19,11 +19,12 @@ NetActor::NetActor() : inventory(this), cellAPI(this) void NetActor::resetUpdateFlags() { + baseInfoChanged = false; + levelChanged = false; statsChanged = false; + positionChanged = false; skillsChanged = false; attributesChanged = false; - baseInfoChanged = false; - positionChanged = false; } std::tuple NetActor::getPosition() const diff --git a/apps/openmw-mp/NetActor.hpp b/apps/openmw-mp/NetActor.hpp index b9e637388..4b3afedd3 100644 --- a/apps/openmw-mp/NetActor.hpp +++ b/apps/openmw-mp/NetActor.hpp @@ -64,7 +64,7 @@ public: mwmp::BaseNetCreature *getNetCreature() { return netCreature; } protected: - bool statsChanged, attributesChanged, skillsChanged, baseInfoChanged, positionChanged; + bool baseInfoChanged, levelChanged, statsChanged, positionChanged, attributesChanged, skillsChanged; mwmp::BasePlayer *basePlayer; mwmp::BaseNetCreature *netCreature; diff --git a/apps/openmw-mp/Player.cpp b/apps/openmw-mp/Player.cpp index 03e1d5dbf..319cc7214 100644 --- a/apps/openmw-mp/Player.cpp +++ b/apps/openmw-mp/Player.cpp @@ -123,6 +123,14 @@ void Player::update() // The character class can override values from below on the client, so send it first cClass.update(); + if (levelChanged) + { + auto packet = plPCtrl->GetPacket(ID_PLAYER_LEVEL); + packet->setPlayer(basePlayer); + packet->Send(false); + packet->Send(true); + } + if (statsChanged) { auto packet = plPCtrl->GetPacket(ID_PLAYER_STATS_DYNAMIC); @@ -356,10 +364,7 @@ void Player::setIsMale(bool male) void Player::setLevel(int level) { creatureStats.mLevel = level; - auto packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_LEVEL); - packet->setPlayer(this); - packet->Send(false); - packet->Send(true); + levelChanged = true; } int Player::getLevel() const