mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 03:15:32 +00:00
[General] Use model variable already included in PlayerBaseInfo packets
The variable has been included since TES3MP's earliest proof of concept, but never used for anything. It is now possible to get and set it, due to semi-popular demand.
This commit is contained in:
parent
a59a37dd66
commit
2f98f31af2
3 changed files with 39 additions and 0 deletions
|
@ -104,6 +104,14 @@ int StatsFunctions::GetIsMale(unsigned short pid) noexcept
|
|||
return player->npc.isMale();
|
||||
}
|
||||
|
||||
const char* StatsFunctions::GetModel(unsigned short pid) noexcept
|
||||
{
|
||||
Player* player;
|
||||
GET_PLAYER(pid, player, 0);
|
||||
|
||||
return player->npc.mModel.c_str();
|
||||
}
|
||||
|
||||
const char *StatsFunctions::GetBirthsign(unsigned short pid) noexcept
|
||||
{
|
||||
Player *player;
|
||||
|
@ -327,6 +335,17 @@ void StatsFunctions::SetIsMale(unsigned short pid, int state) noexcept
|
|||
player->npc.setIsMale(state > 0 ? true : false);
|
||||
}
|
||||
|
||||
void StatsFunctions::SetModel(unsigned short pid, const char *model) noexcept
|
||||
{
|
||||
Player* player;
|
||||
GET_PLAYER(pid, player, );
|
||||
|
||||
if (player->npc.mModel == model)
|
||||
return;
|
||||
|
||||
player->npc.mModel = model;
|
||||
}
|
||||
|
||||
void StatsFunctions::SetBirthsign(unsigned short pid, const char *sign) noexcept
|
||||
{
|
||||
Player *player;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
{"GetHead", StatsFunctions::GetHead},\
|
||||
{"GetHair", StatsFunctions::GetHairstyle},\
|
||||
{"GetIsMale", StatsFunctions::GetIsMale},\
|
||||
{"GetModel", StatsFunctions::GetModel},\
|
||||
{"GetBirthsign", StatsFunctions::GetBirthsign},\
|
||||
\
|
||||
{"GetLevel", StatsFunctions::GetLevel},\
|
||||
|
@ -45,6 +46,7 @@
|
|||
{"SetHead", StatsFunctions::SetHead},\
|
||||
{"SetHair", StatsFunctions::SetHairstyle},\
|
||||
{"SetIsMale", StatsFunctions::SetIsMale},\
|
||||
{"SetModel", StatsFunctions::SetModel},\
|
||||
{"SetBirthsign", StatsFunctions::SetBirthsign},\
|
||||
{"SetResetStats", StatsFunctions::SetResetStats},\
|
||||
\
|
||||
|
@ -181,6 +183,14 @@ public:
|
|||
*/
|
||||
static int GetIsMale(unsigned short pid) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Get the model of a player.
|
||||
*
|
||||
* \param pid The player ID.
|
||||
* \return The model of the player.
|
||||
*/
|
||||
static const char* GetModel(unsigned short pid) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Get the birthsign of a player.
|
||||
*
|
||||
|
@ -383,6 +393,15 @@ public:
|
|||
*/
|
||||
static void SetIsMale(unsigned short pid, int state) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Set the model of a player.
|
||||
*
|
||||
* \param pid The player ID.
|
||||
* \param name The new model of the player.
|
||||
* \return void
|
||||
*/
|
||||
static void SetModel(unsigned short pid, const char *model) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Set the birthsign of a player.
|
||||
*
|
||||
|
|
|
@ -939,6 +939,7 @@ void LocalPlayer::setCharacter()
|
|||
player.mRace = npc.mRace;
|
||||
player.mHead = npc.mHead;
|
||||
player.mHair = npc.mHair;
|
||||
player.mModel = npc.mModel;
|
||||
player.setIsMale(npc.isMale());
|
||||
world->createRecord(player);
|
||||
|
||||
|
|
Loading…
Reference in a new issue