mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 21:49:55 +00:00
[General] Add jailText to PlayerJail packets
This commit is contained in:
parent
5774023f8b
commit
5962570c48
6 changed files with 21 additions and 2 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -57,6 +57,8 @@ LocalPlayer::LocalPlayer()
|
|||
|
||||
deathReason = "suicide";
|
||||
isChangingRegion = false;
|
||||
|
||||
jailText = "";
|
||||
}
|
||||
|
||||
LocalPlayer::~LocalPlayer()
|
||||
|
|
|
@ -253,6 +253,7 @@ namespace mwmp
|
|||
|
||||
int jailDays;
|
||||
bool ignoreJailTeleportation;
|
||||
std::string jailText;
|
||||
|
||||
unsigned int resurrectType;
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue