[Server] Add script functions for getting player draw & sneak states

pull/471/head
David Cernat 6 years ago
parent 8c40010c87
commit 6498bcb22b

@ -129,6 +129,23 @@ const char *MechanicsFunctions::GetSelectedSpellId(unsigned short pid) noexcept
return player->selectedSpellId.c_str();
}
unsigned int MechanicsFunctions::GetDrawState(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, false);
return player->drawState;
}
bool MechanicsFunctions::GetSneakState(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, false);
// TODO: Avoid having to use a magic number here
return (player->movementFlags & 8) != 0;
}
void MechanicsFunctions::SetMarkCell(unsigned short pid, const char *cellDescription) noexcept
{
Player *player;

@ -21,6 +21,9 @@
{"GetPlayerKillerMpNum", MechanicsFunctions::GetPlayerKillerMpNum},\
{"GetPlayerKillerName", MechanicsFunctions::GetPlayerKillerName},\
\
{"GetDrawState", MechanicsFunctions::GetDrawState},\
{"GetSneakState", MechanicsFunctions::GetSneakState},\
\
{"SetMarkCell", MechanicsFunctions::SetMarkCell},\
{"SetMarkPos", MechanicsFunctions::SetMarkPos},\
{"SetMarkRot", MechanicsFunctions::SetMarkRot},\
@ -151,6 +154,23 @@ public:
*/
static const char *GetPlayerKillerName(unsigned short pid) noexcept;
/**
* \brief Get the draw state of a player (0 for nothing, 1 for drawn weapon,
* 2 for drawn spell).
*
* \param pid The player ID.
* \return The draw state.
*/
static unsigned int GetDrawState(unsigned short pid) noexcept;
/**
* \brief Get the sneak state of a player.
*
* \param pid The player ID.
* \return Whether the player is sneaking.
*/
static bool GetSneakState(unsigned short pid) noexcept;
/**
* \brief Set the Mark cell of a player.
*

Loading…
Cancel
Save