From fc0fb276b9397f4dba44f8dae61c9769e679f3e9 Mon Sep 17 00:00:00 2001 From: GokuWeedLord Date: Wed, 13 Dec 2017 14:05:50 +1100 Subject: [PATCH] use defines for fixed script ids --- scripts/native/aetheryte/Aethernet.cpp | 2 +- scripts/native/aetheryte/Aetheryte.cpp | 2 +- src/servers/Server_Zone/Script/NativeScriptApi.h | 4 ++++ src/servers/Server_Zone/Script/ScriptManager.cpp | 4 ++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/native/aetheryte/Aethernet.cpp b/scripts/native/aetheryte/Aethernet.cpp index 7563a18c..51a8f927 100644 --- a/scripts/native/aetheryte/Aethernet.cpp +++ b/scripts/native/aetheryte/Aethernet.cpp @@ -12,7 +12,7 @@ class Aethernet : public QuestScript { public: - Aethernet() : QuestScript( "Aethernet", 0x50001 ) + Aethernet() : QuestScript( "Aethernet", EVENTSCRIPT_AETHERNET_ID ) {} virtual void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) diff --git a/scripts/native/aetheryte/Aetheryte.cpp b/scripts/native/aetheryte/Aetheryte.cpp index 15a23759..939c87ca 100644 --- a/scripts/native/aetheryte/Aetheryte.cpp +++ b/scripts/native/aetheryte/Aetheryte.cpp @@ -13,7 +13,7 @@ class Aetheryte : public QuestScript { public: - Aetheryte() : QuestScript( "Aetheryte", 0x50000 ) + Aetheryte() : QuestScript( "Aetheryte", EVENTSCRIPT_AETHERYTE_ID ) {} virtual void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) diff --git a/src/servers/Server_Zone/Script/NativeScriptApi.h b/src/servers/Server_Zone/Script/NativeScriptApi.h index 0d60839b..1a80e2e8 100644 --- a/src/servers/Server_Zone/Script/NativeScriptApi.h +++ b/src/servers/Server_Zone/Script/NativeScriptApi.h @@ -18,6 +18,10 @@ extern "C" EXPORT ScriptObject* getScript() \ using namespace Core; +// constant script ids for certain events +#define EVENTSCRIPT_AETHERYTE_ID 0x50000 +#define EVENTSCRIPT_AETHERNET_ID 0x50001 + enum ScriptType { StatusEffect, diff --git a/src/servers/Server_Zone/Script/ScriptManager.cpp b/src/servers/Server_Zone/Script/ScriptManager.cpp index d8ddef03..636b5da1 100644 --- a/src/servers/Server_Zone/Script/ScriptManager.cpp +++ b/src/servers/Server_Zone/Script/ScriptManager.cpp @@ -119,9 +119,9 @@ bool Core::Scripting::ScriptManager::onTalk( Entity::Player& player, uint64_t ac if( eventType == Common::EventType::Aetheryte ) { auto aetherInfo = g_exdData.getAetheryteInfo( eventId & 0xFFFF ); - scriptId = 0x50000; + scriptId = EVENTSCRIPT_AETHERYTE_ID; if( !aetherInfo->isAetheryte ) - scriptId = 0x50001; + scriptId = EVENTSCRIPT_AETHERNET_ID; } auto script = m_nativeScriptHandler->getQuestScript( scriptId );