1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 19:19:56 +00:00

[General] Add jailText to PlayerJail packets

This commit is contained in:
David Cernat 2017-07-12 16:39:31 +03:00
parent 5774023f8b
commit 5962570c48
6 changed files with 21 additions and 2 deletions

View file

@ -7,13 +7,14 @@
#include <iostream>
using namespace std;
void MechanicsFunctions::Jail(unsigned short pid, int jailDays, bool ignoreJailTeleportation) noexcept
void MechanicsFunctions::Jail(unsigned short pid, int jailDays, bool ignoreJailTeleportation, const char* jailText) noexcept
{
Player *player;
GET_PLAYER(pid, player, );
player->jailDays = jailDays;
player->ignoreJailTeleportation = ignoreJailTeleportation;
player->jailText = jailText;
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_JAIL)->setPlayer(player);
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_JAIL)->Send(false);

View file

@ -11,7 +11,7 @@
class MechanicsFunctions
{
public:
static void Jail(unsigned short pid, int jailDays, bool ignoreJailTeleportation) noexcept;
static void Jail(unsigned short pid, int jailDays, bool ignoreJailTeleportation = false, const char* jailText = "") noexcept;
static void Resurrect(unsigned short pid, unsigned int type) noexcept;
};

View file

@ -138,6 +138,20 @@ namespace MWGui
End of tes3mp addition
*/
/*
Start of tes3mp addition
If we've received a packet overriding the default jail text, use the new text
*/
if (!mwmp::Main::get().getLocalPlayer()->jailText.empty())
{
message = mwmp::Main::get().getLocalPlayer()->jailText;
mwmp::Main::get().getLocalPlayer()->jailText = "";
}
/*
End of tes3mp addition
*/
std::stringstream dayStr;
dayStr << mDays;
if (message.find("%d") != std::string::npos)

View file

@ -57,6 +57,8 @@ LocalPlayer::LocalPlayer()
deathReason = "suicide";
isChangingRegion = false;
jailText = "";
}
LocalPlayer::~LocalPlayer()

View file

@ -253,6 +253,7 @@ namespace mwmp
int jailDays;
bool ignoreJailTeleportation;
std::string jailText;
unsigned int resurrectType;
};

View file

@ -15,4 +15,5 @@ void PacketPlayerJail::Packet(RakNet::BitStream *bs, bool send)
RW(player->jailDays, send);
RW(player->ignoreJailTeleportation, send);
RW(player->jailText, send, 1);
}