[Server] Add script functions for werewolf states

0.6.1
David Cernat 8 years ago
parent e3929df38a
commit f65f996418

@ -55,7 +55,7 @@ int FactionFunctions::GetFactionRank(unsigned short pid, unsigned int i) noexcep
bool FactionFunctions::GetFactionExpelledState(unsigned short pid, unsigned int i) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
GET_PLAYER(pid, player, false);
return player->factionChanges.factions.at(i).isExpelled;
}

@ -7,6 +7,32 @@
#include <iostream>
using namespace std;
bool MechanicsFunctions::IsWerewolf(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
return player->isWerewolf;
}
void MechanicsFunctions::SetWerewolfState(unsigned short pid, bool isWerewolf)
{
Player *player;
GET_PLAYER(pid, player, );
player->isWerewolf = isWerewolf;
}
void MechanicsFunctions::SendShapeshift(unsigned short pid)
{
Player *player;
GET_PLAYER(pid, player, );
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_SHAPESHIFT)->setPlayer(player);
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_SHAPESHIFT)->Send(false);
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_SHAPESHIFT)->Send(true);
}
void MechanicsFunctions::Jail(unsigned short pid, int jailDays, bool ignoreJailTeleportation, bool ignoreJailSkillIncreases,
const char* jailProgressText, const char* jailEndText) noexcept
{

@ -4,13 +4,25 @@
#include "../Types.hpp"
#define MECHANICSAPI \
{"Jail", MechanicsFunctions::Jail},\
{"IsWerewolf", MechanicsFunctions::IsWerewolf},\
\
{"SetWerewolfState", MechanicsFunctions::SetWerewolfState},\
\
{"SendShapeshift", MechanicsFunctions::SendShapeshift},\
\
{"Jail", MechanicsFunctions::Jail},\
{"Resurrect", MechanicsFunctions::Resurrect}
class MechanicsFunctions
{
public:
static bool IsWerewolf(unsigned short pid) noexcept;
static void SetWerewolfState(unsigned short pid, bool isWerewolf);
static void SendShapeshift(unsigned short pid);
static void Jail(unsigned short pid, int jailDays, bool ignoreJailTeleportation = false, bool ignoreJailSkillIncreases = false,
const char* jailProgressText = "", const char* jailEndText = "") noexcept;

Loading…
Cancel
Save