From 0fe75c373e56bbfacc1906173f4659b6412c35d0 Mon Sep 17 00:00:00 2001 From: collett Date: Wed, 15 Sep 2021 01:06:45 +0900 Subject: [PATCH] fix the loading of some quest battles --- src/world/Manager/TerritoryMgr.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/world/Manager/TerritoryMgr.cpp b/src/world/Manager/TerritoryMgr.cpp index 825af480..2e880256 100644 --- a/src/world/Manager/TerritoryMgr.cpp +++ b/src/world/Manager/TerritoryMgr.cpp @@ -302,7 +302,26 @@ Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::createQuestBattle if( !pQuestBattleInfo ) return nullptr; - auto pQuestInfo = exdData.get< Sapphire::Data::Quest >( pQuestBattleInfo->quest ); + auto questId = pQuestBattleInfo->quest; + + if( questId > 0x1FFFF ) + { + auto arrayEventHandler = exdData.get< Sapphire::Data::ArrayEventHandler >( questId ); + if( arrayEventHandler ) + { + int i = 0; + while( i < arrayEventHandler->data.size() ) + { + auto nextId = arrayEventHandler->data[ i ]; + if( nextId == 0 ) + break; + questId = nextId; + i++; + } + } + } + + auto pQuestInfo = exdData.get< Sapphire::Data::Quest >( questId ); if( !pQuestInfo ) return nullptr;