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

@ -21,8 +21,8 @@
{"GetIsMale", StatsFunctions::GetIsMale},\
{"SetIsMale", StatsFunctions::SetIsMale},\
\
{"GetLevel", StatsFunctions::GetLevel},\
{"SetLevel", StatsFunctions::SetLevel},\
{"GetLevel", StatsFunctions::GetLevel},\
{"SetLevel", StatsFunctions::SetLevel},\
\
{"GetBirthsign", StatsFunctions::GetBirthsign},\
{"SetBirthsign", StatsFunctions::SetBirthsign},\
@ -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);