diff --git a/apps/openmw-mp/CMakeLists.txt b/apps/openmw-mp/CMakeLists.txt index f4725f259..796ca098e 100644 --- a/apps/openmw-mp/CMakeLists.txt +++ b/apps/openmw-mp/CMakeLists.txt @@ -78,10 +78,10 @@ set(SERVER Script/Functions/Actors.cpp Script/Functions/World.cpp Script/Functions/Miscellaneous.cpp Script/Functions/Cells.cpp Script/Functions/CharClass.cpp Script/Functions/Chat.cpp - Script/Functions/Dialogue.cpp Script/Functions/Factions.cpp Script/Functions/GUI.cpp - Script/Functions/Items.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 + Script/Functions/Death.cpp Script/Functions/Dialogue.cpp Script/Functions/Factions.cpp + Script/Functions/GUI.cpp Script/Functions/Items.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 ProcessorInitializer.cpp PlayerProcessor.cpp ActorProcessor.cpp WorldProcessor.cpp diff --git a/apps/openmw-mp/Script/Functions/Death.cpp b/apps/openmw-mp/Script/Functions/Death.cpp new file mode 100644 index 000000000..ce283bfcf --- /dev/null +++ b/apps/openmw-mp/Script/Functions/Death.cpp @@ -0,0 +1,26 @@ +#include "Death.hpp" +#include +#include +#include +#include + +#include +using namespace std; + +void DeathFunctions::SetResurrectType(unsigned short pid, unsigned int type) +{ + Player *player; + GET_PLAYER(pid, player,); + + player->resurrectType = type; +} + +void DeathFunctions::SendResurrect(unsigned short pid) noexcept +{ + Player *player; + GET_PLAYER(pid, player, ); + + 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/Death.hpp b/apps/openmw-mp/Script/Functions/Death.hpp new file mode 100644 index 000000000..a16b2d55e --- /dev/null +++ b/apps/openmw-mp/Script/Functions/Death.hpp @@ -0,0 +1,19 @@ +#ifndef OPENMW_DEATHAPI_HPP +#define OPENMW_DEATHAPI_HPP + +#include "../Types.hpp" + +#define DEATHAPI \ + {"SetResurrectType", DeathFunctions::SetResurrectType},\ + \ + {"SendResurrect", DeathFunctions::SendResurrect} + +class DeathFunctions +{ +public: + static void SetResurrectType(unsigned short pid, unsigned int type); + + static void SendResurrect(unsigned short pid) noexcept; +}; + +#endif //OPENMW_DEATHAPI_HPP diff --git a/apps/openmw-mp/Script/Functions/Stats.cpp b/apps/openmw-mp/Script/Functions/Stats.cpp index 8b5e66c6b..1d531ba2b 100644 --- a/apps/openmw-mp/Script/Functions/Stats.cpp +++ b/apps/openmw-mp/Script/Functions/Stats.cpp @@ -504,13 +504,6 @@ void StatsFunctions::SetCharGenStage(unsigned short pid, int start, int end) noe mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_CHARGEN)->Send(false); } -void StatsFunctions::Resurrect(unsigned short pid) -{ - Player *player; - GET_PLAYER(pid, player,); - mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_RESURRECT)->RequestData(player->guid); -} - void StatsFunctions::SendBaseInfo(unsigned short pid) noexcept { Player *player; diff --git a/apps/openmw-mp/Script/Functions/Stats.hpp b/apps/openmw-mp/Script/Functions/Stats.hpp index 13456fda5..8ee0421d7 100644 --- a/apps/openmw-mp/Script/Functions/Stats.hpp +++ b/apps/openmw-mp/Script/Functions/Stats.hpp @@ -74,7 +74,6 @@ {"SetBounty", StatsFunctions::SetBounty},\ {"SetCharGenStage", StatsFunctions::SetCharGenStage},\ \ - {"Resurrect", StatsFunctions::Resurrect},\ {"SendBaseInfo", StatsFunctions::SendBaseInfo},\ \ {"SendStatsDynamic", StatsFunctions::SendStatsDynamic},\ @@ -152,7 +151,6 @@ public: static void SetBounty(unsigned short pid, int value) noexcept; static void SetCharGenStage(unsigned short pid, int start, int end) noexcept; - static void Resurrect(unsigned short pid); static void SendBaseInfo(unsigned short pid) noexcept; static void SendStatsDynamic(unsigned short pid) noexcept; diff --git a/apps/openmw-mp/Script/ScriptFunctions.hpp b/apps/openmw-mp/Script/ScriptFunctions.hpp index d2682316b..10d2da2cb 100644 --- a/apps/openmw-mp/Script/ScriptFunctions.hpp +++ b/apps/openmw-mp/Script/ScriptFunctions.hpp @@ -8,6 +8,7 @@ #include