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; player->NpcStats()->mSkills[skill].mCurrent = value;
} }
int StatsFunctions::GetIncreaseSkill(unsigned short pid, unsigned int pos) noexcept int StatsFunctions::GetIncreaseSkill(unsigned short pid, unsigned int pos) noexcept
{ {
Player *player; 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, false);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_SKILL)->Send(player, true); 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},\ {"GetIsMale", StatsFunctions::GetIsMale},\
{"SetIsMale", StatsFunctions::SetIsMale},\ {"SetIsMale", StatsFunctions::SetIsMale},\
\ \
{"GetLevel", StatsFunctions::GetLevel},\ {"GetLevel", StatsFunctions::GetLevel},\
{"SetLevel", StatsFunctions::SetLevel},\ {"SetLevel", StatsFunctions::SetLevel},\
\ \
{"GetBirthsign", StatsFunctions::GetBirthsign},\ {"GetBirthsign", StatsFunctions::GetBirthsign},\
{"SetBirthsign", StatsFunctions::SetBirthsign},\ {"SetBirthsign", StatsFunctions::SetBirthsign},\
@ -63,7 +63,8 @@
{"SendBaseInfo", StatsFunctions::SendBaseInfo},\ {"SendBaseInfo", StatsFunctions::SendBaseInfo},\
{"SendAttributes", StatsFunctions::SendAttributes},\ {"SendAttributes", StatsFunctions::SendAttributes},\
{"SendBaseStats", StatsFunctions::SendBaseStats},\ {"SendBaseStats", StatsFunctions::SendBaseStats},\
{"SendSkills", StatsFunctions::SendSkills} {"SendSkills", StatsFunctions::SendSkills},\
{"SendLevel", StatsFunctions::SendLevel}
class StatsFunctions class StatsFunctions
{ {
@ -132,6 +133,7 @@ public:
static void SendAttributes(unsigned short pid) noexcept; static void SendAttributes(unsigned short pid) noexcept;
static void SendBaseStats(unsigned short pid) noexcept; static void SendBaseStats(unsigned short pid) noexcept;
static void SendSkills(unsigned short pid) noexcept; static void SendSkills(unsigned short pid) noexcept;
static void SendLevel(unsigned short pid) noexcept;
}; };
#endif //OPENMW_STATS_HPP #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); GetNetworking()->GetPacket(ID_GAME_LEVEL)->Send(this);
}
if (isUpdatingSkills) { if (isUpdatingSkills) {
GetNetworking()->GetPacket(ID_GAME_SKILL)->Send(this); GetNetworking()->GetPacket(ID_GAME_SKILL)->Send(this);