mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-03 19:49:41 +00:00
[General] Add ignoreJailSkillIncreases to PlayerJail packets
This commit is contained in:
parent
5962570c48
commit
083b46394d
6 changed files with 41 additions and 18 deletions
|
@ -7,13 +7,14 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
void MechanicsFunctions::Jail(unsigned short pid, int jailDays, bool ignoreJailTeleportation, const char* jailText) noexcept
|
||||
void MechanicsFunctions::Jail(unsigned short pid, int jailDays, bool ignoreJailTeleportation, bool ignoreJailSkillIncreases, const char* jailText) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player, );
|
||||
|
||||
player->jailDays = jailDays;
|
||||
player->ignoreJailTeleportation = ignoreJailTeleportation;
|
||||
player->ignoreJailSkillIncreases = ignoreJailSkillIncreases;
|
||||
player->jailText = jailText;
|
||||
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_JAIL)->setPlayer(player);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
class MechanicsFunctions
|
||||
{
|
||||
public:
|
||||
static void Jail(unsigned short pid, int jailDays, bool ignoreJailTeleportation = false, const char* jailText = "") noexcept;
|
||||
static void Jail(unsigned short pid, int jailDays, bool ignoreJailTeleportation = false, bool ignoreJailSkillIncreases = false, const char* jailText = "") noexcept;
|
||||
|
||||
static void Resurrect(unsigned short pid, unsigned int type) noexcept;
|
||||
};
|
||||
|
|
|
@ -111,7 +111,18 @@ namespace MWGui
|
|||
skills.insert(skill);
|
||||
|
||||
MWMechanics::SkillValue& value = player.getClass().getNpcStats(player).getSkill(skill);
|
||||
if (skill == ESM::Skill::Security || skill == ESM::Skill::Sneak)
|
||||
|
||||
/*
|
||||
Start of tes3mp change (minor)
|
||||
|
||||
Disable increases for Security and Sneak when using ignoreJailSkillIncreases
|
||||
*/
|
||||
if (mwmp::Main::get().getLocalPlayer()->ignoreJailSkillIncreases)
|
||||
value.setBase(value.getBase() - 1);
|
||||
else if (skill == ESM::Skill::Security || skill == ESM::Skill::Sneak)
|
||||
/*
|
||||
End of tes3mp change (minor)
|
||||
*/
|
||||
value.setBase(std::min(100, value.getBase()+1));
|
||||
else
|
||||
value.setBase(value.getBase()-1);
|
||||
|
@ -125,19 +136,6 @@ namespace MWGui
|
|||
else
|
||||
message = gmst.find("sNotifyMessage43")->getString();
|
||||
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
If jail teleportation was ignored, reset its boolean here
|
||||
*/
|
||||
if (mwmp::Main::get().getLocalPlayer()->ignoreJailTeleportation)
|
||||
{
|
||||
mwmp::Main::get().getLocalPlayer()->ignoreJailTeleportation = false;
|
||||
}
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
|
@ -146,7 +144,6 @@ namespace MWGui
|
|||
if (!mwmp::Main::get().getLocalPlayer()->jailText.empty())
|
||||
{
|
||||
message = mwmp::Main::get().getLocalPlayer()->jailText;
|
||||
mwmp::Main::get().getLocalPlayer()->jailText = "";
|
||||
}
|
||||
/*
|
||||
End of tes3mp addition
|
||||
|
@ -163,7 +160,17 @@ namespace MWGui
|
|||
std::stringstream skillValue;
|
||||
skillValue << player.getClass().getNpcStats(player).getSkill(*it).getBase();
|
||||
std::string skillMsg = gmst.find("sNotifyMessage44")->getString();
|
||||
if (*it == ESM::Skill::Sneak || *it == ESM::Skill::Security)
|
||||
|
||||
/*
|
||||
Start of tes3mp change (minor)
|
||||
|
||||
Account for usage of ignoreJailSkillIncreases
|
||||
*/
|
||||
if (!mwmp::Main::get().getLocalPlayer()->ignoreJailSkillIncreases &&
|
||||
(*it == ESM::Skill::Sneak || *it == ESM::Skill::Security))
|
||||
/*
|
||||
End of tes3mp change (minor)
|
||||
*/
|
||||
skillMsg = gmst.find("sNotifyMessage39")->getString();
|
||||
|
||||
if (skillMsg.find("%s") != std::string::npos)
|
||||
|
@ -173,6 +180,18 @@ namespace MWGui
|
|||
message += "\n" + skillMsg;
|
||||
}
|
||||
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
Reset all PlayerJail-related overrides
|
||||
*/
|
||||
mwmp::Main::get().getLocalPlayer()->ignoreJailTeleportation = false;
|
||||
mwmp::Main::get().getLocalPlayer()->ignoreJailSkillIncreases = false;
|
||||
mwmp::Main::get().getLocalPlayer()->jailText = "";
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
||||
std::vector<std::string> buttons;
|
||||
buttons.push_back("#{sOk}");
|
||||
MWBase::Environment::get().getWindowManager()->interactiveMessageBox(message, buttons);
|
||||
|
|
|
@ -52,6 +52,7 @@ LocalPlayer::LocalPlayer()
|
|||
|
||||
ignorePosPacket = false;
|
||||
ignoreJailTeleportation = false;
|
||||
ignoreJailSkillIncreases = false;
|
||||
|
||||
attack.shouldSend = false;
|
||||
|
||||
|
|
|
@ -253,6 +253,7 @@ namespace mwmp
|
|||
|
||||
int jailDays;
|
||||
bool ignoreJailTeleportation;
|
||||
bool ignoreJailSkillIncreases;
|
||||
std::string jailText;
|
||||
|
||||
unsigned int resurrectType;
|
||||
|
|
|
@ -15,5 +15,6 @@ void PacketPlayerJail::Packet(RakNet::BitStream *bs, bool send)
|
|||
|
||||
RW(player->jailDays, send);
|
||||
RW(player->ignoreJailTeleportation, send);
|
||||
RW(player->ignoreJailSkillIncreases, send);
|
||||
RW(player->jailText, send, 1);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue