1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-25 05:57:45 +00:00

implicitly add bnpc to player hatelist if player hate is added to the bnpc

This commit is contained in:
mordred 2019-04-17 08:34:58 +02:00
parent 6c43c79af1
commit 8badc6e34d
2 changed files with 10 additions and 9 deletions

View file

@ -2,7 +2,7 @@
#include <Territory/QuestBattle.h>
#include <Actor/Player.h>
#include <Actor/Actor.h>
#include <Actor/Bnpc.h>
#include <Actor/BNpc.h>
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 );
EXPOSE_SCRIPT( ChasingShadows );

View file

@ -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;
}
}