diff --git a/scripts/native/CmnDef/CmnDefCutSceneReplay.cpp b/scripts/native/CmnDef/CmnDefCutSceneReplay.cpp index 618c1610..39bf4300 100644 --- a/scripts/native/CmnDef/CmnDefCutSceneReplay.cpp +++ b/scripts/native/CmnDef/CmnDefCutSceneReplay.cpp @@ -3,7 +3,7 @@ class CmnDefCutSceneReplay : public EventScript { public: - CmnDefCutSceneReplay() : EventScript( "CmnDefCutSceneReplay", 721028 ) + CmnDefCutSceneReplay() : EventScript( 721028 ) {} void Scene00000( Entity::Player& player ) diff --git a/scripts/native/CmnDef/CmnDefInnBed.cpp b/scripts/native/CmnDef/CmnDefInnBed.cpp index 5e675b88..ac8a0a68 100644 --- a/scripts/native/CmnDef/CmnDefInnBed.cpp +++ b/scripts/native/CmnDef/CmnDefInnBed.cpp @@ -3,7 +3,7 @@ class CmnDefInnBed : public EventScript { public: - CmnDefInnBed() : EventScript( "CmnDefInnBed", 720916 ) + CmnDefInnBed() : EventScript( 720916 ) {} // menu diff --git a/scripts/native/CmnDef/CmnDefLinkShell.cpp b/scripts/native/CmnDef/CmnDefLinkShell.cpp index eb2a7b29..f0df71f9 100644 --- a/scripts/native/CmnDef/CmnDefLinkShell.cpp +++ b/scripts/native/CmnDef/CmnDefLinkShell.cpp @@ -7,7 +7,7 @@ class CmnDefLinkShell : public EventScript { public: - CmnDefLinkShell() : EventScript( "CmnDefLinkShell", 0xB0006 ) + CmnDefLinkShell() : EventScript( 0xB0006 ) {} void Scene00001( Entity::Player& player ) diff --git a/scripts/native/CmnDef/HouFurOrchestrion.cpp b/scripts/native/CmnDef/HouFurOrchestrion.cpp index bb370e24..9e47c554 100644 --- a/scripts/native/CmnDef/HouFurOrchestrion.cpp +++ b/scripts/native/CmnDef/HouFurOrchestrion.cpp @@ -3,7 +3,7 @@ class HouFurOrchestrion : public EventScript { public: - HouFurOrchestrion() : EventScript( "HouFurOrchestrion", 721226 ) + HouFurOrchestrion() : EventScript( 721226 ) {} void Scene00000( Entity::Player& player ) diff --git a/scripts/native/action/ActionSprint3.cpp b/scripts/native/action/ActionSprint3.cpp index 6e9af153..076bbf5f 100644 --- a/scripts/native/action/ActionSprint3.cpp +++ b/scripts/native/action/ActionSprint3.cpp @@ -3,7 +3,7 @@ class ActionSprint3 : public ActionScript { public: - ActionSprint3() : ActionScript( "ActionSprint3", 3 ) + ActionSprint3() : ActionScript( 3 ) {} void onCastFinish( Core::Entity::Player& player, Core::Entity::Actor& targetActor ) override diff --git a/scripts/native/aetheryte/Aethernet.cpp b/scripts/native/aetheryte/Aethernet.cpp index b3881120..9a3ccd8f 100644 --- a/scripts/native/aetheryte/Aethernet.cpp +++ b/scripts/native/aetheryte/Aethernet.cpp @@ -12,7 +12,7 @@ class Aethernet : public EventScript { public: - Aethernet() : EventScript( "Aethernet", EVENTSCRIPT_AETHERNET_ID ) + Aethernet() : EventScript( EVENTSCRIPT_AETHERNET_ID ) {} void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override diff --git a/scripts/native/aetheryte/Aetheryte.cpp b/scripts/native/aetheryte/Aetheryte.cpp index 96ba8675..51ba6cb1 100644 --- a/scripts/native/aetheryte/Aetheryte.cpp +++ b/scripts/native/aetheryte/Aetheryte.cpp @@ -13,7 +13,7 @@ class Aetheryte : public EventScript { public: - Aetheryte() : EventScript( "Aetheryte", EVENTSCRIPT_AETHERYTE_ID ) + Aetheryte() : EventScript( EVENTSCRIPT_AETHERYTE_ID ) {} void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override diff --git a/scripts/native/opening/OpeningGridania.cpp b/scripts/native/opening/OpeningGridania.cpp index c6463ef7..9f6d6f0a 100644 --- a/scripts/native/opening/OpeningGridania.cpp +++ b/scripts/native/opening/OpeningGridania.cpp @@ -65,7 +65,7 @@ private: } public: - OpeningGridania() : EventScript( "OpeningGridania", 1245186 ) + OpeningGridania() : EventScript( 1245186 ) {} void onEnterZone( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override diff --git a/scripts/native/opening/OpeningLimsa.cpp b/scripts/native/opening/OpeningLimsa.cpp index 369e8686..a40ea482 100644 --- a/scripts/native/opening/OpeningLimsa.cpp +++ b/scripts/native/opening/OpeningLimsa.cpp @@ -81,7 +81,7 @@ private: public: - OpeningLimsa() : EventScript( "OpeningLimsa", 1245185 ) {} + OpeningLimsa() : EventScript( 1245185 ) {} void onEnterZone( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override { diff --git a/scripts/native/opening/OpeningUldah.cpp b/scripts/native/opening/OpeningUldah.cpp index ba940295..fdd1c5d2 100644 --- a/scripts/native/opening/OpeningUldah.cpp +++ b/scripts/native/opening/OpeningUldah.cpp @@ -65,7 +65,7 @@ private: public: - OpeningUldah() : EventScript( "OpeningUldah", 1245187 ) {} + OpeningUldah() : EventScript( 1245187 ) {} void onEnterZone( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override { diff --git a/scripts/native/quest/ManFst001.cpp b/scripts/native/quest/ManFst001.cpp index 726d2dc5..b73581ac 100644 --- a/scripts/native/quest/ManFst001.cpp +++ b/scripts/native/quest/ManFst001.cpp @@ -90,7 +90,7 @@ private: } public: - ManFst001() : EventScript( "ManFst001", 65575 ) {} + ManFst001() : EventScript( 65575 ) {} void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { diff --git a/scripts/native/quest/ManFst002.cpp b/scripts/native/quest/ManFst002.cpp index 6b084490..707150cb 100644 --- a/scripts/native/quest/ManFst002.cpp +++ b/scripts/native/quest/ManFst002.cpp @@ -189,7 +189,7 @@ private: } public: - ManFst002() : EventScript( "ManFst002", 65621 ) {} + ManFst002() : EventScript( 65621 ) {} void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { diff --git a/scripts/native/quest/ManFst003.cpp b/scripts/native/quest/ManFst003.cpp index e564a7ca..c8cd4da6 100644 --- a/scripts/native/quest/ManFst003.cpp +++ b/scripts/native/quest/ManFst003.cpp @@ -12,7 +12,7 @@ private: public: - ManFst003() : EventScript( "ManFst003", 65659 ) {} + ManFst003() : EventScript( 65659 ) {} void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { diff --git a/scripts/native/quest/ManFst004.cpp b/scripts/native/quest/ManFst004.cpp index b8896a41..18ac04b8 100644 --- a/scripts/native/quest/ManFst004.cpp +++ b/scripts/native/quest/ManFst004.cpp @@ -71,7 +71,7 @@ class ManFst004 : public EventScript static constexpr auto UnlockDesion = 14; public: - ManFst004() : EventScript( "Close to Home", 65660 ){}; + ManFst004() : EventScript( 65660 ){}; ~ManFst004(){}; ////////////////////////////////////////////////////////////////////// diff --git a/scripts/native/quest/ManSea001.cpp b/scripts/native/quest/ManSea001.cpp index 2a3e4aaa..aee4da80 100644 --- a/scripts/native/quest/ManSea001.cpp +++ b/scripts/native/quest/ManSea001.cpp @@ -145,7 +145,7 @@ private: } public: - ManSea001() : EventScript( "ManSea001", 65643 ) {} + ManSea001() : EventScript( 65643 ) {} void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { diff --git a/scripts/native/quest/ManSea002.cpp b/scripts/native/quest/ManSea002.cpp index 5db24e06..57d7dda7 100644 --- a/scripts/native/quest/ManSea002.cpp +++ b/scripts/native/quest/ManSea002.cpp @@ -136,7 +136,7 @@ private: player.eventPlay( getId(), 50, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, 0, 0, callback ); } public: - ManSea002() : EventScript( "ManSea002", 65644 ) {} + ManSea002() : EventScript( 65644 ) {} void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { diff --git a/scripts/native/quest/ManWil001.cpp b/scripts/native/quest/ManWil001.cpp index 93b7f42f..ee04e2aa 100644 --- a/scripts/native/quest/ManWil001.cpp +++ b/scripts/native/quest/ManWil001.cpp @@ -129,7 +129,7 @@ private: public: - ManWil001() : EventScript( "ManWil001", 66130 ) {} + ManWil001() : EventScript( 66130 ) {} void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { diff --git a/scripts/native/quest/ManWil002.cpp b/scripts/native/quest/ManWil002.cpp index 3f1c399c..9f160f72 100644 --- a/scripts/native/quest/ManWil002.cpp +++ b/scripts/native/quest/ManWil002.cpp @@ -144,7 +144,7 @@ private: public: - ManWil002() : EventScript( "ManWil002", 66104 ) { } + ManWil002() : EventScript( 66104 ) { } void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { diff --git a/scripts/native/quest/subquest/gridania/SubFst001.cpp b/scripts/native/quest/subquest/gridania/SubFst001.cpp index c6b18dbc..2aedc7f8 100644 --- a/scripts/native/quest/subquest/gridania/SubFst001.cpp +++ b/scripts/native/quest/subquest/gridania/SubFst001.cpp @@ -60,7 +60,7 @@ private: public: - SubFst001() : EventScript( "SubFst001", 65560 ) {} + SubFst001() : EventScript( 65560 ) {} void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { diff --git a/scripts/native/quest/subquest/gridania/SubFst002.cpp b/scripts/native/quest/subquest/gridania/SubFst002.cpp index d128fe0f..2e32fa23 100644 --- a/scripts/native/quest/subquest/gridania/SubFst002.cpp +++ b/scripts/native/quest/subquest/gridania/SubFst002.cpp @@ -1,76 +1,76 @@ -#include "../../../ScriptObject.h" - -// Quest Script: SubFst002_00025 -// Quest Name: Quarrels with Squirrels -// Quest ID: 65561 -// Start NPC: 1000263 -// End NPC: 1000263 - -class SubFst002 : public EventScript -{ -private: - static constexpr auto SEQ_0 = 0; - static constexpr auto SEQ_1 = 1; - static constexpr auto SEQ_2 = 2; - static constexpr auto SEQ_FINISH = 255; - static constexpr auto ACTOR0 = 1000263; - static constexpr auto ENEMY0 = 37; - static constexpr auto SEQ_0_ACTOR0 = 0; - static constexpr auto SEQ_2_ACTOR0 = 1; - - void Scene00000( Entity::Player& player ) - { - auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) - { - if( param2 == 1 ) // accept quest - { - player.updateQuest( getId(), SEQ_1 ); - } - }; - - player.eventPlay( getId (), 0, NONE, callback ); - } - - void Scene00001(Entity::Player& player) - { - auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) - { - if( param2 == 1 ) // finish quest - { - if( player.giveQuestRewards( getId(), 0 ) ) - player.finishQuest( getId() ); - } - }; - - player.eventPlay( getId(), 1, NONE, callback ); - } - -public: - SubFst002() : EventScript( "SubFst002", 65561 ) {} - - void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override - { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); - - if( actor == ACTOR0 && !player.hasQuest( getId() ) ) - Scene00000( player ); - else if( actor == ACTOR0 && player.getQuestSeq( getId() ) == SEQ_FINISH ) - Scene00001( player ); - } - - void onNpcKill( uint32_t npcId, Entity::Player& player ) override - { - if( npcId != ENEMY0 ) - return; - - auto currentKC = player.getQuestUI8AL( getId() ) + 1; - - if( currentKC >= 6 ) - player.updateQuest( getId(), SEQ_FINISH ); - else - { - player.setQuestUI8AL( getId(), currentKC ); - player.sendQuestMessage( getId(), 0, 2, currentKC, 6 ); - } - } -}; +#include "../../../ScriptObject.h" + +// Quest Script: SubFst002_00025 +// Quest Name: Quarrels with Squirrels +// Quest ID: 65561 +// Start NPC: 1000263 +// End NPC: 1000263 + +class SubFst002 : public EventScript +{ +private: + static constexpr auto SEQ_0 = 0; + static constexpr auto SEQ_1 = 1; + static constexpr auto SEQ_2 = 2; + static constexpr auto SEQ_FINISH = 255; + static constexpr auto ACTOR0 = 1000263; + static constexpr auto ENEMY0 = 37; + static constexpr auto SEQ_0_ACTOR0 = 0; + static constexpr auto SEQ_2_ACTOR0 = 1; + + void Scene00000( Entity::Player& player ) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + if( param2 == 1 ) // accept quest + { + player.updateQuest( getId(), SEQ_1 ); + } + }; + + player.eventPlay( getId (), 0, NONE, callback ); + } + + void Scene00001(Entity::Player& player) + { + auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 ) + { + if( param2 == 1 ) // finish quest + { + if( player.giveQuestRewards( getId(), 0 ) ) + player.finishQuest( getId() ); + } + }; + + player.eventPlay( getId(), 1, NONE, callback ); + } + +public: + SubFst002() : EventScript( 65561 ) {} + + void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override + { + auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + + if( actor == ACTOR0 && !player.hasQuest( getId() ) ) + Scene00000( player ); + else if( actor == ACTOR0 && player.getQuestSeq( getId() ) == SEQ_FINISH ) + Scene00001( player ); + } + + void onNpcKill( uint32_t npcId, Entity::Player& player ) override + { + if( npcId != ENEMY0 ) + return; + + auto currentKC = player.getQuestUI8AL( getId() ) + 1; + + if( currentKC >= 6 ) + player.updateQuest( getId(), SEQ_FINISH ); + else + { + player.setQuestUI8AL( getId(), currentKC ); + player.sendQuestMessage( getId(), 0, 2, currentKC, 6 ); + } + } +}; diff --git a/scripts/native/quest/subquest/gridania/SubFst010.cpp b/scripts/native/quest/subquest/gridania/SubFst010.cpp index bccd887d..e3e03582 100644 --- a/scripts/native/quest/subquest/gridania/SubFst010.cpp +++ b/scripts/native/quest/subquest/gridania/SubFst010.cpp @@ -42,7 +42,7 @@ private: } public: - SubFst010() : EventScript( "SubFst010", 65537 ) {} + SubFst010() : EventScript( 65537 ) {} void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { diff --git a/scripts/native/quest/subquest/gridania/SubFst013.cpp b/scripts/native/quest/subquest/gridania/SubFst013.cpp index d696642f..7bf4f6da 100644 --- a/scripts/native/quest/subquest/gridania/SubFst013.cpp +++ b/scripts/native/quest/subquest/gridania/SubFst013.cpp @@ -148,7 +148,7 @@ private: public: - SubFst013() : EventScript( "SubFst013", 65576 ) {} + SubFst013() : EventScript( 65576 ) {} void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { diff --git a/src/servers/sapphire_zone/Script/NativeScriptApi.h b/src/servers/sapphire_zone/Script/NativeScriptApi.h index 4835027d..72c0fac6 100644 --- a/src/servers/sapphire_zone/Script/NativeScriptApi.h +++ b/src/servers/sapphire_zone/Script/NativeScriptApi.h @@ -24,22 +24,15 @@ using namespace Core; class ScriptObject { protected: - std::string m_scriptName; uint32_t m_id; std::size_t m_type; public: - ScriptObject( std::string name, uint32_t id, std::size_t type ) : - m_scriptName( name ), + ScriptObject( uint32_t id, std::size_t type ) : m_id( id ), m_type( type ) { } - virtual const std::string& getName() const - { - return m_scriptName; - } - virtual uint32_t getId() const { return m_id; @@ -55,8 +48,8 @@ public: class StatusEffectScript : public ScriptObject { public: - StatusEffectScript( std::string name, uint32_t effectId ) : - ScriptObject( name, effectId, typeid( StatusEffectScript ).hash_code() ) + StatusEffectScript( uint32_t effectId ) : + ScriptObject( effectId, typeid( StatusEffectScript ).hash_code() ) { } virtual void onTick( Entity::Actor& actor ) { } @@ -73,8 +66,8 @@ public: class ActionScript : public ScriptObject { public: - ActionScript( std::string name, uint32_t abilityId ) : - ScriptObject( name, abilityId, typeid( ActionScript ).hash_code() ) + ActionScript( uint32_t abilityId ) : + ScriptObject( abilityId, typeid( ActionScript ).hash_code() ) { } virtual void onStart( Entity::Actor& sourceActor, Entity::Actor& targetActor ) { } @@ -86,8 +79,8 @@ public: class EventScript : public ScriptObject { public: - EventScript( std::string name, uint32_t questId ) : - ScriptObject( name, questId, typeid( EventScript ).hash_code() ) + EventScript( uint32_t questId ) : + ScriptObject( questId, typeid( EventScript ).hash_code() ) { } virtual void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) { } @@ -104,16 +97,16 @@ public: class BattleNpcScript : public ScriptObject { public: - BattleNpcScript( std::string name, uint32_t npcId ) : - ScriptObject( name, npcId, typeid( BattleNpcScript ).hash_code() ) + BattleNpcScript( uint32_t npcId ) : + ScriptObject( npcId, typeid( BattleNpcScript ).hash_code() ) { } }; class ZoneScript : public ScriptObject { public: - ZoneScript( std::string name, uint32_t zoneId ) : - ScriptObject( name, zoneId, typeid( ZoneScript ).hash_code() ) + ZoneScript( uint32_t zoneId ) : + ScriptObject( zoneId, typeid( ZoneScript ).hash_code() ) { } virtual void onZoneInit() { }