From 859a4a5d6877b27aa23989a1c40805ab58acc438 Mon Sep 17 00:00:00 2001 From: NotAdam Date: Tue, 28 May 2019 22:03:55 +1000 Subject: [PATCH 1/2] fix self targeted actions failing target snapshot, fix player being unable to complete chasing shadows --- .../instances/questbattles/ChasingShadows.cpp | 15 +++++++-------- src/world/Action/Action.cpp | 7 +++---- src/world/Territory/QuestBattle.cpp | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/scripts/instances/questbattles/ChasingShadows.cpp b/src/scripts/instances/questbattles/ChasingShadows.cpp index 0c11887e..9923796c 100644 --- a/src/scripts/instances/questbattles/ChasingShadows.cpp +++ b/src/scripts/instances/questbattles/ChasingShadows.cpp @@ -67,6 +67,13 @@ public: return; } + if( instance.getCountEnemyBNpc() == 0 && successCalled == 0 ) + { + instance.setCustomVar( SUCCESS_CALLED, 1 ); + instance.success(); + return; + } + if( !boss || !ida || !papa ) return; @@ -141,14 +148,6 @@ public: a4->hateListAdd( pPlayer, 1 ); a5->hateListAdd( pPlayer, 1 ); } - - if( instance.getCountEnemyBNpc() == 0 && successCalled == 0 ) - { - instance.setCustomVar( SUCCESS_CALLED, 1 ); - instance.success(); - return; - } - } void onEnterTerritory( QuestBattle& instance, Entity::Player& player, uint32_t eventId, uint16_t param1, diff --git a/src/world/Action/Action.cpp b/src/world/Action/Action.cpp index c7c7790f..7f04a63f 100644 --- a/src/world/Action/Action.cpp +++ b/src/world/Action/Action.cpp @@ -491,7 +491,7 @@ bool Sapphire::Action::Action::consumeResources() bool Sapphire::Action::Action::snapshotAffectedActors( std::vector< Entity::CharaPtr >& actors ) { - for( const auto& actor : m_pSource->getInRangeActors() ) + for( const auto& actor : m_pSource->getInRangeActors( true ) ) { // check for initial target validity based on flags in action exd (pc/enemy/etc.) if( !preFilterActor( *actor ) ) @@ -515,9 +515,8 @@ bool Sapphire::Action::Action::snapshotAffectedActors( std::vector< Entity::Char player->sendDebug( "hit actor#{}", actor->getId() ); } } - if( actors.empty() ) - return false; - return true; + + return !actors.empty(); } void Sapphire::Action::Action::addActorFilter( World::Util::ActorFilterPtr filter ) diff --git a/src/world/Territory/QuestBattle.cpp b/src/world/Territory/QuestBattle.cpp index 39d0f821..0227bbcd 100644 --- a/src/world/Territory/QuestBattle.cpp +++ b/src/world/Territory/QuestBattle.cpp @@ -385,7 +385,7 @@ uint32_t Sapphire::QuestBattle::getQuestId() const uint32_t Sapphire::QuestBattle::getCountEnemyBNpc() { uint32_t count = 0; - for( auto bnpcIt : m_bNpcMap ) + for( const auto& bnpcIt : m_bNpcMap ) { if( bnpcIt.second->getEnemyType() == 4 && bnpcIt.second->isAlive() ) count++; From 92f41f8d4147d89ee1a31c6387b428df5a2aa1cf Mon Sep 17 00:00:00 2001 From: NotAdam Date: Tue, 28 May 2019 22:30:47 +1000 Subject: [PATCH 2/2] if the 'boss' is killed instantly, spawn all add phases instantly no mercy for //gm kill --- .../instances/questbattles/ChasingShadows.cpp | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/scripts/instances/questbattles/ChasingShadows.cpp b/src/scripts/instances/questbattles/ChasingShadows.cpp index 9923796c..336cd0d6 100644 --- a/src/scripts/instances/questbattles/ChasingShadows.cpp +++ b/src/scripts/instances/questbattles/ChasingShadows.cpp @@ -61,23 +61,20 @@ public: auto papa = instance.getActiveBNpcByLevelId( INIT_P_POP_PAPARIMO ); auto pPlayer = instance.getPlayerPtr(); + uint32_t bossHpPercent = 0; + if( boss ) + bossHpPercent = boss->getHpPercent(); + if( pPlayer && !pPlayer->isAlive() ) { instance.fail(); return; } - if( instance.getCountEnemyBNpc() == 0 && successCalled == 0 ) - { - instance.setCustomVar( SUCCESS_CALLED, 1 ); - instance.success(); - return; - } - - if( !boss || !ida || !papa ) + if( !ida || !papa ) return; - if( pair1Spawnd == 0 && boss->getHpPercent() <= 75 ) + if( pair1Spawnd == 0 && bossHpPercent <= 75 ) { instance.setCustomVar( SET_1_SPAWNED, 1 ); auto a2 = instance.createBNpcFromLevelEntry( INIT_POP_ENEMY_B_03, 10, 0, 1440, 938, @@ -105,7 +102,7 @@ public: a5->hateListAdd( pPlayer, 1 ); } - if( pair2Spawnd == 0 && boss->getHpPercent() <= 50 ) + if( pair2Spawnd == 0 && bossHpPercent <= 50 ) { instance.setCustomVar( SET_2_SPAWNED, 1 ); auto a2 = instance.createBNpcFromLevelEntry( INIT_POP_ENEMY_B_05, 10, 0, 1440, 938, @@ -133,7 +130,7 @@ public: } - if( pair3Spawnd == 0 && boss->getHpPercent() <= 25 ) + if( pair3Spawnd == 0 && bossHpPercent <= 25 ) { instance.setCustomVar( SET_3_SPAWNED, 1 ); @@ -148,6 +145,13 @@ public: a4->hateListAdd( pPlayer, 1 ); a5->hateListAdd( pPlayer, 1 ); } + + if( instance.getCountEnemyBNpc() == 0 && successCalled == 0 ) + { + instance.setCustomVar( SUCCESS_CALLED, 1 ); + instance.success(); + return; + } } void onEnterTerritory( QuestBattle& instance, Entity::Player& player, uint32_t eventId, uint16_t param1,