[General] Add SetResetStats server script function

Add reading and writing of resetStats variable to PlayerBaseInfo Packet

Fix typos in various server script function descriptions
This commit is contained in:
David Cernat 2018-04-09 19:24:24 +03:00
parent 73dea494c4
commit bdc9132e7c
5 changed files with 33 additions and 9 deletions

View file

@ -201,7 +201,7 @@ public:
* does not by itself send a packet.
*
* \param pid The player ID.
* \param bool The new scale.
* \param scale The new scale.
* \return void
*/
static void SetScale(unsigned short pid, double scale) noexcept;
@ -213,7 +213,7 @@ public:
* does not by itself send a packet.
*
* \param pid The player ID.
* \param bool The new werewolf state.
* \param isWerewolf The new werewolf state.
* \return void
*/
static void SetWerewolfState(unsigned short pid, bool isWerewolf) noexcept;

View file

@ -26,7 +26,7 @@ public:
* send a packet.
*
* \param pid The player ID.
* \param bool The difficulty.
* \param difficulty The difficulty.
* \return void
*/
static void SetDifficulty(unsigned short pid, int difficulty);
@ -44,7 +44,7 @@ public:
* If you do not wish to enforce a log level, simply set enforcedLogLevel to -1
*
* \param pid The player ID.
* \param bool The enforced log level.
* \param enforcedLogLevel The enforced log level.
* \return void
*/
static void SetEnforcedLogLevel(unsigned short pid, int enforcedLogLevel);
@ -56,7 +56,7 @@ public:
* send a packet.
*
* \param pid The player ID.
* \param bool The physics framerate.
* \param physicsFramerate The physics framerate.
* \return void
*/
static void SetPhysicsFramerate(unsigned short pid, double physicsFramerate);
@ -68,7 +68,7 @@ public:
* by itself send a packet.
*
* \param pid The player ID.
* \param bool The console permission state.
* \param state The console permission state.
* \return void
*/
static void SetConsoleAllowed(unsigned short pid, bool state);
@ -80,7 +80,7 @@ public:
* by itself send a packet.
*
* \param pid The player ID.
* \param bool The resting permission state.
* \param state The resting permission state.
* \return void
*/
static void SetBedRestAllowed(unsigned short pid, bool state);
@ -92,7 +92,7 @@ public:
* by itself send a packet.
*
* \param pid The player ID.
* \param bool The resting permission state.
* \param state The resting permission state.
* \return void
*/
static void SetWildernessRestAllowed(unsigned short pid, bool state);
@ -104,7 +104,7 @@ public:
* by itself send a packet.
*
* \param pid The player ID.
* \param bool The waiting permission state.
* \param state The waiting permission state.
* \return void
*/
static void SetWaitAllowed(unsigned short pid, bool state);

View file

@ -330,6 +330,14 @@ void StatsFunctions::SetBirthsign(unsigned short pid, const char *sign) noexcept
player->birthsign = sign;
}
void StatsFunctions::SetResetStats(unsigned short pid, bool resetStats) noexcept
{
Player *player;
GET_PLAYER(pid, player, );
player->resetStats = resetStats;
}
void StatsFunctions::SetLevel(unsigned short pid, int value) noexcept
{
Player *player;

View file

@ -49,6 +49,7 @@
{"SetHair", StatsFunctions::SetHairstyle},\
{"SetIsMale", StatsFunctions::SetIsMale},\
{"SetBirthsign", StatsFunctions::SetBirthsign},\
{"SetResetStats", StatsFunctions::SetResetStats},\
\
{"SetLevel", StatsFunctions::SetLevel},\
{"SetLevelProgress", StatsFunctions::SetLevelProgress},\
@ -123,6 +124,19 @@ public:
static void SetHairstyle(unsigned short pid, const char *style) noexcept;
static void SetIsMale(unsigned short pid, int male) noexcept;
static void SetBirthsign(unsigned short pid, const char *name) noexcept;
/**
* \brief Set whether the player's stats should be reset based on their
* current race as the result of a PlayerBaseInfo packet.
*
* This changes the resetState for that player in the server memory, but does not by itself
* send a packet.
*
* \param pid The player ID.
* \param resetStats The stat reset state.
* \return void
*/
static void SetResetStats(unsigned short pid, bool resetStats) noexcept;
static void SetLevel(unsigned short pid, int value) noexcept;
static void SetLevelProgress(unsigned short pid, int value) noexcept;

View file

@ -25,4 +25,6 @@ void PacketPlayerBaseInfo::Packet(RakNet::BitStream *bs, bool send)
RW(player->npc.mFlags, send);
RW(player->birthsign, send, 1);
RW(player->resetStats, send);
}