diff --git a/apps/openmw-mp/CMakeLists.txt b/apps/openmw-mp/CMakeLists.txt index d752012a5..2a38be755 100644 --- a/apps/openmw-mp/CMakeLists.txt +++ b/apps/openmw-mp/CMakeLists.txt @@ -85,8 +85,8 @@ set(SERVER Script/Functions/Actors.cpp Script/Functions/World.cpp Script/Functions/Miscellaneous.cpp Script/Functions/Books.cpp Script/Functions/Cells.cpp Script/Functions/CharClass.cpp - Script/Functions/Chat.cpp Script/Functions/Death.cpp Script/Functions/Dialogue.cpp - Script/Functions/Factions.cpp Script/Functions/GUI.cpp Script/Functions/Items.cpp + Script/Functions/Chat.cpp Script/Functions/Dialogue.cpp Script/Functions/Factions.cpp + Script/Functions/GUI.cpp Script/Functions/Items.cpp Script/Functions/Mechanics.cpp Script/Functions/Positions.cpp Script/Functions/Quests.cpp Script/Functions/Settings.cpp Script/Functions/Spells.cpp Script/Functions/Stats.cpp Script/Functions/Timer.cpp diff --git a/apps/openmw-mp/Script/Functions/Death.hpp b/apps/openmw-mp/Script/Functions/Death.hpp deleted file mode 100644 index a9ed09c27..000000000 --- a/apps/openmw-mp/Script/Functions/Death.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef OPENMW_DEATHAPI_HPP -#define OPENMW_DEATHAPI_HPP - -#include "../Types.hpp" - -#define DEATHAPI \ - {"SetDeathPenaltyJailDays", DeathFunctions::SetDeathPenaltyJailDays},\ - \ - {"Resurrect", DeathFunctions::Resurrect} - -class DeathFunctions -{ -public: - static void SetDeathPenaltyJailDays(unsigned short pid, int days) noexcept; - - static void Resurrect(unsigned short pid, unsigned int type) noexcept; -}; - -#endif //OPENMW_DEATHAPI_HPP diff --git a/apps/openmw-mp/Script/Functions/Death.cpp b/apps/openmw-mp/Script/Functions/Mechanics.cpp similarity index 57% rename from apps/openmw-mp/Script/Functions/Death.cpp rename to apps/openmw-mp/Script/Functions/Mechanics.cpp index df2500484..fd78299af 100644 --- a/apps/openmw-mp/Script/Functions/Death.cpp +++ b/apps/openmw-mp/Script/Functions/Mechanics.cpp @@ -1,4 +1,4 @@ -#include "Death.hpp" +#include "Mechanics.hpp" #include #include #include @@ -7,20 +7,25 @@ #include using namespace std; -void DeathFunctions::SetDeathPenaltyJailDays(unsigned short pid, int days) noexcept +void MechanicsFunctions::Jail(unsigned short pid, int jailDays, bool ignoreJailTeleportation) noexcept { Player *player; GET_PLAYER(pid, player, ); - player->deathPenaltyJailDays = days; + player->jailDays = jailDays; + player->ignoreJailTeleportation = ignoreJailTeleportation; + + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_JAIL)->setPlayer(player); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_JAIL)->Send(false); } -void DeathFunctions::Resurrect(unsigned short pid, unsigned int type) noexcept +void MechanicsFunctions::Resurrect(unsigned short pid, unsigned int type) noexcept { Player *player; GET_PLAYER(pid, player, ); player->resurrectType = type; + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_RESURRECT)->setPlayer(player); mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_RESURRECT)->Send(false); mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_RESURRECT)->Send(true); diff --git a/apps/openmw-mp/Script/Functions/Mechanics.hpp b/apps/openmw-mp/Script/Functions/Mechanics.hpp new file mode 100644 index 000000000..004692091 --- /dev/null +++ b/apps/openmw-mp/Script/Functions/Mechanics.hpp @@ -0,0 +1,19 @@ +#ifndef OPENMW_MECHANICSAPI_HPP +#define OPENMW_MECHANICSAPI_HPP + +#include "../Types.hpp" + +#define MECHANICSAPI \ + {"Jail", MechanicsFunctions::Jail},\ + \ + {"Resurrect", MechanicsFunctions::Resurrect} + +class MechanicsFunctions +{ +public: + static void Jail(unsigned short pid, int jailDays, bool ignoreJailTeleportation) noexcept; + + static void Resurrect(unsigned short pid, unsigned int type) noexcept; +}; + +#endif //OPENMW_MECHANICSAPI_HPP diff --git a/apps/openmw-mp/Script/ScriptFunctions.hpp b/apps/openmw-mp/Script/ScriptFunctions.hpp index ff2968b8e..3f38c64dd 100644 --- a/apps/openmw-mp/Script/ScriptFunctions.hpp +++ b/apps/openmw-mp/Script/ScriptFunctions.hpp @@ -9,11 +9,11 @@ #include