1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-04-02 02:06:42 +00:00

Add packet for player levels, part 2

This commit is contained in:
David Cernat 2016-09-26 13:19:01 +03:00
parent 046a1ea899
commit 1ee2458f6e
3 changed files with 17 additions and 5 deletions

View file

@ -372,7 +372,6 @@ void StatsFunctions::SetCurrentSkill(unsigned short pid, unsigned short skill, i
player->NpcStats()->mSkills[skill].mCurrent = value;
}
int StatsFunctions::GetIncreaseSkill(unsigned short pid, unsigned int pos) noexcept
{
Player *player;
@ -447,3 +446,12 @@ void StatsFunctions::SendSkills(unsigned short pid) noexcept
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_SKILL)->Send(player, false);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_SKILL)->Send(player, true);
}
void StatsFunctions::SendLevel(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, );
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_LEVEL)->Send(player, false);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_LEVEL)->Send(player, true);
}

View file

@ -63,7 +63,8 @@
{"SendBaseInfo", StatsFunctions::SendBaseInfo},\
{"SendAttributes", StatsFunctions::SendAttributes},\
{"SendBaseStats", StatsFunctions::SendBaseStats},\
{"SendSkills", StatsFunctions::SendSkills}
{"SendSkills", StatsFunctions::SendSkills},\
{"SendLevel", StatsFunctions::SendLevel}
class StatsFunctions
{
@ -132,6 +133,7 @@ public:
static void SendAttributes(unsigned short pid) noexcept;
static void SendBaseStats(unsigned short pid) noexcept;
static void SendSkills(unsigned short pid) noexcept;
static void SendLevel(unsigned short pid) noexcept;
};
#endif //OPENMW_STATS_HPP

View file

@ -115,8 +115,10 @@ void LocalPlayer::updateClassStats(bool forceUpdate)
}
}
if (_npcStats.getLevel() != CreatureStats()->mLevel)
if (_npcStats.getLevel() != CreatureStats()->mLevel) {
CreatureStats()->mLevel = _npcStats.getLevel();
GetNetworking()->GetPacket(ID_GAME_LEVEL)->Send(this);
}
if (isUpdatingSkills) {
GetNetworking()->GetPacket(ID_GAME_SKILL)->Send(this);