From 725ca11c6053ff1d663b7118dfb0e156cebd185d Mon Sep 17 00:00:00 2001 From: Mordred Date: Sun, 28 Jan 2018 11:16:34 +0100 Subject: [PATCH] Revert "Merge pull request #225 from GokuWeedLord/event_rewrite" This reverts commit 4e2319130f4ac70950082543588bc7f7f5742623, reversing changes made to 695fea7812bad7ad87b626c40b070f0b2ec3ca73. --- scripts/native/CMakeLists.txt | 7 +- .../native/CmnDef/CmnDefCutSceneReplay.cpp | 2 +- scripts/native/CmnDef/CmnDefInnBed.cpp | 2 +- scripts/native/CmnDef/CmnDefLinkShell.cpp | 2 +- scripts/native/CmnDef/HouFurOrchestrion.cpp | 2 +- scripts/native/ScriptLoader.cpp.in | 4 +- scripts/native/action/ActionSprint3.cpp | 2 +- scripts/native/aetheryte/Aethernet.cpp | 2 +- scripts/native/aetheryte/Aetheryte.cpp | 2 +- scripts/native/debugcommands/Add.cpp | 102 --- scripts/native/debugcommands/Get.cpp | 31 - scripts/native/debugcommands/Help.cpp | 23 - .../native/debugcommands/InjectChatPacket.cpp | 21 - scripts/native/debugcommands/InjectPacket.cpp | 20 - scripts/native/debugcommands/Nudge.cpp | 56 -- scripts/native/debugcommands/PreInclude.h | 7 - scripts/native/debugcommands/Replay.cpp | 29 - scripts/native/debugcommands/Script.cpp | 86 --- scripts/native/debugcommands/ServerInfo.cpp | 17 - scripts/native/debugcommands/Set.cpp | 145 ---- scripts/native/opening/OpeningGridania.cpp | 2 +- scripts/native/opening/OpeningLimsa.cpp | 2 +- scripts/native/opening/OpeningUldah.cpp | 2 +- scripts/native/quest/ManFst001.cpp | 2 +- scripts/native/quest/ManFst002.cpp | 2 +- scripts/native/quest/ManFst003.cpp | 2 +- scripts/native/quest/ManSea001.cpp | 2 +- scripts/native/quest/ManSea002.cpp | 2 +- scripts/native/quest/ManWil001.cpp | 2 +- scripts/native/quest/ManWil002.cpp | 2 +- .../quest/subquest/gridania/SubFst001.cpp | 2 +- .../quest/subquest/gridania/SubFst002.cpp | 2 +- .../quest/subquest/gridania/SubFst010.cpp | 2 +- .../quest/subquest/gridania/SubFst013.cpp | 2 +- .../sapphire_zone/DebugCommand/DebugCommand.h | 64 ++ .../DebugCommand/DebugCommandHandler.cpp | 657 ++++++++++++++++++ .../DebugCommand/DebugCommandHandler.h | 52 ++ .../sapphire_zone/Network/GameConnection.cpp | 2 + .../Network/Handlers/ActionHandler.cpp | 2 + .../Network/Handlers/GMCommandHandlers.cpp | 13 +- .../Network/Handlers/InventoryHandler.cpp | 2 + .../Network/Handlers/PacketHandlers.cpp | 8 +- .../Network/Handlers/SkillHandler.cpp | 2 + .../sapphire_zone/Script/NativeScriptApi.h | 96 +-- .../Script/NativeScriptManager.cpp | 27 - .../Script/NativeScriptManager.h | 15 +- .../sapphire_zone/Script/ScriptManager.cpp | 90 +-- .../sapphire_zone/Script/ScriptManager.h | 4 - src/servers/sapphire_zone/ServerZone.cpp | 3 +- .../sapphire_zone/Zone/TerritoryMgr.cpp | 3 +- src/servers/sapphire_zone/Zone/Zone.cpp | 13 - src/servers/sapphire_zone/Zone/Zone.h | 2 - 52 files changed, 840 insertions(+), 805 deletions(-) delete mode 100644 scripts/native/debugcommands/Add.cpp delete mode 100644 scripts/native/debugcommands/Get.cpp delete mode 100644 scripts/native/debugcommands/Help.cpp delete mode 100644 scripts/native/debugcommands/InjectChatPacket.cpp delete mode 100644 scripts/native/debugcommands/InjectPacket.cpp delete mode 100644 scripts/native/debugcommands/Nudge.cpp delete mode 100644 scripts/native/debugcommands/PreInclude.h delete mode 100644 scripts/native/debugcommands/Replay.cpp delete mode 100644 scripts/native/debugcommands/Script.cpp delete mode 100644 scripts/native/debugcommands/ServerInfo.cpp delete mode 100644 scripts/native/debugcommands/Set.cpp create mode 100644 src/servers/sapphire_zone/DebugCommand/DebugCommand.h create mode 100644 src/servers/sapphire_zone/DebugCommand/DebugCommandHandler.cpp create mode 100644 src/servers/sapphire_zone/DebugCommand/DebugCommandHandler.h diff --git a/scripts/native/CMakeLists.txt b/scripts/native/CMakeLists.txt index 6107d58f..aeaa0094 100644 --- a/scripts/native/CMakeLists.txt +++ b/scripts/native/CMakeLists.txt @@ -39,7 +39,7 @@ foreach(_scriptDir ${children}) endforeach() add_library("script_${_name}" MODULE "${SCRIPT_FILES}" "${SCRIPT_INCLUDE_FILES}" "${_scriptDir}/ScriptLoader.cpp") - target_link_libraries("script_${_name}" sapphire_zone common xivdat ${Boost_LIBRARIES}) + target_link_libraries("script_${_name}" sapphire_zone) if(MSVC) set_target_properties("script_${_name}" PROPERTIES @@ -53,10 +53,6 @@ foreach(_scriptDir ${children}) ) endif() - if(EXISTS "${_scriptDir}/PreInclude.h") - set(PreScriptIncludes "#include \"${_scriptDir}/PreInclude.h\"") - endif() - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ScriptLoader.cpp.in" "${_scriptDir}/ScriptLoader.cpp") add_custom_command(TARGET "script_${_name}" POST_BUILD @@ -67,6 +63,5 @@ foreach(_scriptDir ${children}) unset(ScriptIncludes) unset(ScriptNames) - unset(PreScriptIncludes) endif() endforeach() diff --git a/scripts/native/CmnDef/CmnDefCutSceneReplay.cpp b/scripts/native/CmnDef/CmnDefCutSceneReplay.cpp index 31fde89b..39bf4300 100644 --- a/scripts/native/CmnDef/CmnDefCutSceneReplay.cpp +++ b/scripts/native/CmnDef/CmnDefCutSceneReplay.cpp @@ -1,4 +1,4 @@ -#include +#include "../ScriptObject.h" class CmnDefCutSceneReplay : public EventScript { diff --git a/scripts/native/CmnDef/CmnDefInnBed.cpp b/scripts/native/CmnDef/CmnDefInnBed.cpp index 36ccd739..ac8a0a68 100644 --- a/scripts/native/CmnDef/CmnDefInnBed.cpp +++ b/scripts/native/CmnDef/CmnDefInnBed.cpp @@ -1,4 +1,4 @@ -#include +#include "../ScriptObject.h" class CmnDefInnBed : public EventScript { diff --git a/scripts/native/CmnDef/CmnDefLinkShell.cpp b/scripts/native/CmnDef/CmnDefLinkShell.cpp index 16aa593b..f0df71f9 100644 --- a/scripts/native/CmnDef/CmnDefLinkShell.cpp +++ b/scripts/native/CmnDef/CmnDefLinkShell.cpp @@ -1,4 +1,4 @@ -#include +#include "../ScriptObject.h" #define ACTION_CREATE 2 #define ACTION_RENAME 3 diff --git a/scripts/native/CmnDef/HouFurOrchestrion.cpp b/scripts/native/CmnDef/HouFurOrchestrion.cpp index 51273ed5..9e47c554 100644 --- a/scripts/native/CmnDef/HouFurOrchestrion.cpp +++ b/scripts/native/CmnDef/HouFurOrchestrion.cpp @@ -1,4 +1,4 @@ -#include +#include "../ScriptObject.h" class HouFurOrchestrion : public EventScript { diff --git a/scripts/native/ScriptLoader.cpp.in b/scripts/native/ScriptLoader.cpp.in index c5cbc42b..633ca309 100644 --- a/scripts/native/ScriptLoader.cpp.in +++ b/scripts/native/ScriptLoader.cpp.in @@ -1,5 +1,7 @@ +#include + class ScriptObject; -@PreScriptIncludes@ + @ScriptIncludes@ const ScriptObject* ptrs[] = diff --git a/scripts/native/action/ActionSprint3.cpp b/scripts/native/action/ActionSprint3.cpp index 82bbfc37..076bbf5f 100644 --- a/scripts/native/action/ActionSprint3.cpp +++ b/scripts/native/action/ActionSprint3.cpp @@ -1,4 +1,4 @@ -#include +#include "../ScriptObject.h" class ActionSprint3 : public ActionScript { diff --git a/scripts/native/aetheryte/Aethernet.cpp b/scripts/native/aetheryte/Aethernet.cpp index e0cda163..9a3ccd8f 100644 --- a/scripts/native/aetheryte/Aethernet.cpp +++ b/scripts/native/aetheryte/Aethernet.cpp @@ -1,4 +1,4 @@ -#include +#include "../ScriptObject.h" #define ACTION_ATTUNE 0x13 diff --git a/scripts/native/aetheryte/Aetheryte.cpp b/scripts/native/aetheryte/Aetheryte.cpp index 9f838d13..51ba6cb1 100644 --- a/scripts/native/aetheryte/Aetheryte.cpp +++ b/scripts/native/aetheryte/Aetheryte.cpp @@ -1,4 +1,4 @@ -#include +#include "../ScriptObject.h" #define ACTION_ATTUNE 0x13 #define ACTION_TELEPORT 0x4 diff --git a/scripts/native/debugcommands/Add.cpp b/scripts/native/debugcommands/Add.cpp deleted file mode 100644 index 41031f7a..00000000 --- a/scripts/native/debugcommands/Add.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include -#include -#include -#include -#include - -class Add : public DebugCommandScript -{ -public: - Add() : DebugCommandScript( "add", "Executes ADD command", 1 ) - { } - - virtual void run( Entity::Player& player, const std::string& data, const std::string &subCommand, const std::string ¶ms ) - { - if( subCommand == "status" ) - { - int32_t id; - int32_t duration; - uint16_t param; - - sscanf( params.c_str(), "%d %d %hu", &id, &duration, ¶m ); - - StatusEffect::StatusEffectPtr effect( new StatusEffect::StatusEffect( id, player.getAsPlayer(), player.getAsPlayer(), duration, 3000 ) ); - effect->setParam( param ); - - player.addStatusEffect( effect ); - } - else if( subCommand == "title" ) - { - uint32_t titleId; - sscanf( params.c_str(), "%u", &titleId ); - - player.addTitle( titleId ); - player.sendNotice( "Added title (ID: " + std::to_string( titleId ) + ")" ); - } - else if( subCommand == "spawn" ) - { - int32_t model, name; - - sscanf( params.c_str(), "%d %d", &model, &name ); - - Entity::BattleNpcPtr pBNpc( new Entity::BattleNpc( model, name, player.getPos() ) ); - - auto pZone = player.getCurrentZone(); - pBNpc->setCurrentZone( pZone ); - pZone->pushActor( pBNpc ); - - } - else if( subCommand == "op" ) - { - // temporary research packet - int32_t opcode; - sscanf( params.c_str(), "%x", &opcode ); - Network::Packets::GamePacketPtr pPe( new Network::Packets::GamePacket( opcode, 0x30, player.getId(), player.getId() ) ); - player.queuePacket( pPe ); - } - else if( subCommand == "actrl" ) - { - - // temporary research packet - - int32_t opcode; - int32_t param1; - int32_t param2; - int32_t param3; - int32_t param4; - int32_t param5; - int32_t param6; - int32_t playerId; - - sscanf( params.c_str(), "%x %x %x %x %x %x %x %x", &opcode, ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6, &playerId ); - - player.sendNotice( "Injecting ACTOR_CONTROL " + std::to_string( opcode ) ); - - Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcActorControl143 > actorControl( playerId, player.getId() ); - actorControl.data().category = opcode; - actorControl.data().param1 = param1; - actorControl.data().param2 = param2; - actorControl.data().param3 = param3; - actorControl.data().param4 = param4; - actorControl.data().param5 = param5; - actorControl.data().param6 = param6; - player.queuePacket( actorControl ); - - - /*sscanf(params.c_str(), "%x %x %x %x %x %x %x", &opcode, ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6, &playerId); - - Network::Packets::Server::ServerNoticePacket noticePacket( player, "Injecting ACTOR_CONTROL " + std::to_string( opcode ) ); - - player.queuePacket( noticePacket ); - - Network::Packets::Server::ActorControlPacket143 controlPacket( player, opcode, - param1, param2, param3, param4, param5, param6, playerId ); - player.queuePacket( controlPacket );*/ - - } - else - { - player.sendUrgent( subCommand + " is not a valid ADD command." ); - } - } -}; \ No newline at end of file diff --git a/scripts/native/debugcommands/Get.cpp b/scripts/native/debugcommands/Get.cpp deleted file mode 100644 index f20a3abe..00000000 --- a/scripts/native/debugcommands/Get.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include - -#include - -class Get : public DebugCommandScript -{ -public: - Get() : DebugCommandScript( "get", "Executes GET commands", 1 ) - { } - - virtual void run( Entity::Player& player, const std::string& data, const std::string& subCommand, const std::string& params ) - { - if( ( subCommand == "pos" ) ) - { - - int16_t map_id = m_objects->m_exd->m_zoneInfoMap[player.getCurrentZone()->getTerritoryId()].map_id; - - player.sendNotice( "Pos:\n" + - std::to_string( player.getPos().x ) + "\n" + - std::to_string( player.getPos().y ) + "\n" + - std::to_string( player.getPos().z ) + "\n" + - std::to_string( player.getRotation() ) + "\nMapId: " + - std::to_string( map_id ) + "\nZoneID: " + - std::to_string(player.getCurrentZone()->getTerritoryId() ) + "\n" ); - } - else - { - player.sendUrgent( subCommand + " is not a valid GET command." ); - } - } -}; \ No newline at end of file diff --git a/scripts/native/debugcommands/Help.cpp b/scripts/native/debugcommands/Help.cpp deleted file mode 100644 index f7ec3947..00000000 --- a/scripts/native/debugcommands/Help.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#include