1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 19:19:55 +00:00
openmw-tes3mp/apps/openmw-mp/Script/Functions/Shapeshift.cpp
2019-08-19 21:39:33 +03:00

86 lines
1.9 KiB
C++

#include "Shapeshift.hpp"
#include <components/openmw-mp/NetworkMessages.hpp>
#include <components/openmw-mp/TimedLog.hpp>
#include <apps/openmw-mp/Script/ScriptFunctions.hpp>
#include <apps/openmw-mp/Networking.hpp>
#include <iostream>
using namespace std;
double ShapeshiftFunctions::GetScale(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0.0f);
return player->scale;
}
bool ShapeshiftFunctions::IsWerewolf(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
return player->isWerewolf;
}
const char *ShapeshiftFunctions::GetCreatureRefId(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
return player->creatureRefId.c_str();
}
bool ShapeshiftFunctions::GetCreatureNameDisplayState(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
return player->displayCreatureName;
}
void ShapeshiftFunctions::SetScale(unsigned short pid, double scale) noexcept
{
Player *player;
GET_PLAYER(pid, player, );
player->scale = scale;
}
void ShapeshiftFunctions::SetWerewolfState(unsigned short pid, bool isWerewolf) noexcept
{
Player *player;
GET_PLAYER(pid, player, );
player->isWerewolf = isWerewolf;
}
void ShapeshiftFunctions::SetCreatureRefId(unsigned short pid, const char *refId) noexcept
{
Player *player;
GET_PLAYER(pid, player, );
player->creatureRefId = refId;
}
void ShapeshiftFunctions::SetCreatureNameDisplayState(unsigned short pid, bool displayState) noexcept
{
Player *player;
GET_PLAYER(pid, player, );
player->displayCreatureName = displayState;
}
void ShapeshiftFunctions::SendShapeshift(unsigned short pid)
{
Player *player;
GET_PLAYER(pid, player, );
mwmp::PlayerPacket *packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_SHAPESHIFT);
packet->setPlayer(player);
packet->Send(false);
packet->Send(true);
}