forked from teamnwah/openmw-tes3coop
[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>
|
#include <iostream>
|
||||||
using namespace std;
|
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;
|
Player *player;
|
||||||
GET_PLAYER(pid, player, );
|
GET_PLAYER(pid, player, );
|
||||||
|
|
||||||
player->jailDays = jailDays;
|
player->jailDays = jailDays;
|
||||||
player->ignoreJailTeleportation = ignoreJailTeleportation;
|
player->ignoreJailTeleportation = ignoreJailTeleportation;
|
||||||
|
player->jailText = jailText;
|
||||||
|
|
||||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_JAIL)->setPlayer(player);
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_JAIL)->setPlayer(player);
|
||||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_JAIL)->Send(false);
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_JAIL)->Send(false);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
class MechanicsFunctions
|
class MechanicsFunctions
|
||||||
{
|
{
|
||||||
public:
|
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;
|
static void Resurrect(unsigned short pid, unsigned int type) noexcept;
|
||||||
};
|
};
|
||||||
|
|
|
@ -138,6 +138,20 @@ namespace MWGui
|
||||||
End of tes3mp addition
|
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;
|
std::stringstream dayStr;
|
||||||
dayStr << mDays;
|
dayStr << mDays;
|
||||||
if (message.find("%d") != std::string::npos)
|
if (message.find("%d") != std::string::npos)
|
||||||
|
|
|
@ -57,6 +57,8 @@ LocalPlayer::LocalPlayer()
|
||||||
|
|
||||||
deathReason = "suicide";
|
deathReason = "suicide";
|
||||||
isChangingRegion = false;
|
isChangingRegion = false;
|
||||||
|
|
||||||
|
jailText = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalPlayer::~LocalPlayer()
|
LocalPlayer::~LocalPlayer()
|
||||||
|
|
|
@ -253,6 +253,7 @@ namespace mwmp
|
||||||
|
|
||||||
int jailDays;
|
int jailDays;
|
||||||
bool ignoreJailTeleportation;
|
bool ignoreJailTeleportation;
|
||||||
|
std::string jailText;
|
||||||
|
|
||||||
unsigned int resurrectType;
|
unsigned int resurrectType;
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,4 +15,5 @@ void PacketPlayerJail::Packet(RakNet::BitStream *bs, bool send)
|
||||||
|
|
||||||
RW(player->jailDays, send);
|
RW(player->jailDays, send);
|
||||||
RW(player->ignoreJailTeleportation, send);
|
RW(player->ignoreJailTeleportation, send);
|
||||||
|
RW(player->jailText, send, 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue