[Server] Add SetCreatureNameDisplayState script function

This commit is contained in:
David Cernat 2018-04-17 15:04:18 +03:00
parent db41704e52
commit 36e0f0471a
2 changed files with 21 additions and 3 deletions

View file

@ -159,13 +159,20 @@ void MechanicsFunctions::SetWerewolfState(unsigned short pid, bool isWerewolf) n
player->isWerewolf = isWerewolf; player->isWerewolf = isWerewolf;
} }
void MechanicsFunctions::SetCreatureRefId(unsigned short pid, const char *refId, bool displayCreatureName) noexcept void MechanicsFunctions::SetCreatureRefId(unsigned short pid, const char *refId) noexcept
{ {
Player *player; Player *player;
GET_PLAYER(pid, player, ); GET_PLAYER(pid, player, );
player->creatureRefId = refId; player->creatureRefId = refId;
player->displayCreatureName = displayCreatureName; }
void MechanicsFunctions::SetCreatureNameDisplayState(unsigned short pid, bool displayState) noexcept
{
Player *player;
GET_PLAYER(pid, player, );
player->displayCreatureName = displayState;
} }
void MechanicsFunctions::SendMarkLocation(unsigned short pid) void MechanicsFunctions::SendMarkLocation(unsigned short pid)

View file

@ -27,6 +27,7 @@
{"SetScale", MechanicsFunctions::SetScale},\ {"SetScale", MechanicsFunctions::SetScale},\
{"SetWerewolfState", MechanicsFunctions::SetWerewolfState},\ {"SetWerewolfState", MechanicsFunctions::SetWerewolfState},\
{"SetCreatureRefId", MechanicsFunctions::SetCreatureRefId},\ {"SetCreatureRefId", MechanicsFunctions::SetCreatureRefId},\
{"SetCreatureNameDisplayState", MechanicsFunctions::SetCreatureNameDisplayState},\
\ \
{"SendMarkLocation", MechanicsFunctions::SendMarkLocation},\ {"SendMarkLocation", MechanicsFunctions::SendMarkLocation},\
{"SendSelectedSpell", MechanicsFunctions::SendSelectedSpell},\ {"SendSelectedSpell", MechanicsFunctions::SendSelectedSpell},\
@ -230,7 +231,17 @@ public:
* when hovered over by others. * when hovered over by others.
* \return void * \return void
*/ */
static void SetCreatureRefId(unsigned short pid, const char *refId, bool displayCreatureName) noexcept; static void SetCreatureRefId(unsigned short pid, const char *refId) noexcept;
/**
* \brief Set whether a player's name is replaced by that of the creature they are
* disguised as when other players hover over them.
*
* \param pid The player ID.
* \param displayState The creature name display state.
* \return void
*/
static void SetCreatureNameDisplayState(unsigned short pid, bool displayState) noexcept;
/** /**
* \brief Send a PlayerMiscellaneous packet with a Mark location to a player. * \brief Send a PlayerMiscellaneous packet with a Mark location to a player.