From 8badc6e34d9c20a752a593ba1ab09ebb18cda5d5 Mon Sep 17 00:00:00 2001 From: mordred Date: Wed, 17 Apr 2019 08:34:58 +0200 Subject: [PATCH] implicitly add bnpc to player hatelist if player hate is added to the bnpc --- .../instances/questbattles/ChasingShadows.cpp | 12 ++++-------- src/world/Actor/BNpc.cpp | 7 ++++++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/scripts/instances/questbattles/ChasingShadows.cpp b/src/scripts/instances/questbattles/ChasingShadows.cpp index 60f0702a..0dd97caa 100644 --- a/src/scripts/instances/questbattles/ChasingShadows.cpp +++ b/src/scripts/instances/questbattles/ChasingShadows.cpp @@ -2,7 +2,7 @@ #include #include #include -#include +#include using namespace Sapphire; @@ -69,10 +69,8 @@ public: auto pPlayer = instance.getPlayerPtr(); a2->hateListAdd( pPlayer, 1 ); - pPlayer->hateListAdd( a2 ); a3->hateListAdd( pPlayer, 1 ); - pPlayer->hateListAdd( a3 ); } } @@ -116,15 +114,13 @@ public: a1->hateListAdd( a4, 10000 ); a1->hateListAdd( a5, 10000 ); + a2->hateListAdd( player.getAsPlayer(), 1 ); a2->hateListAdd( a4, 10000 ); a2->hateListAdd( a5, 10000 ); - a2->hateListAdd( player.getAsPlayer(), 1 ); - player.hateListAdd( a2 ); + a3->hateListAdd( player.getAsPlayer(), 1 ); a3->hateListAdd( a4, 10000 ); a3->hateListAdd( a5, 10000 ); - a3->hateListAdd( player.getAsPlayer(), 1 ); - player.hateListAdd( a3 ); a4->hateListAdd( a1, 10000 ); a4->hateListAdd( a2, 9999 ); @@ -137,4 +133,4 @@ public: }; -EXPOSE_SCRIPT( ChasingShadows ); \ No newline at end of file +EXPOSE_SCRIPT( ChasingShadows ); diff --git a/src/world/Actor/BNpc.cpp b/src/world/Actor/BNpc.cpp index 6d3684dd..fbb8003b 100644 --- a/src/world/Actor/BNpc.cpp +++ b/src/world/Actor/BNpc.cpp @@ -338,6 +338,11 @@ void Sapphire::Entity::BNpc::hateListAdd( Sapphire::Entity::CharaPtr pChara, int hateEntry->m_pChara = pChara; m_hateList.insert( hateEntry ); + if( pChara->isPlayer() ) + { + auto pPlayer = pChara->getAsPlayer(); + pPlayer->hateListAdd( getAsBNpc() ); + } } void Sapphire::Entity::BNpc::hateListUpdate( Sapphire::Entity::CharaPtr pChara, int32_t hateAmount ) @@ -705,4 +710,4 @@ void Sapphire::Entity::BNpc::setLevelId( uint32_t levelId ) uint32_t Sapphire::Entity::BNpc::getLevelId() const { return m_levelId; -} \ No newline at end of file +}