forked from mirror/openmw-tes3mp
85 lines
2 KiB
C++
85 lines
2 KiB
C++
|
#include "Shapeshift.hpp"
|
||
|
|
||
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
||
|
#include <components/openmw-mp/Log.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::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);
|
||
|
}
|