From 99a02d8c9bc9a2313c2d63f065c3073f672dae95 Mon Sep 17 00:00:00 2001 From: mordred Date: Tue, 29 Jan 2019 08:02:39 +0100 Subject: [PATCH] Added onMobKill call for it to actually be forwarded to scripts --- src/world/Actor/BNpc.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/world/Actor/BNpc.cpp b/src/world/Actor/BNpc.cpp index 2191e9c6..6cc4f88e 100644 --- a/src/world/Actor/BNpc.cpp +++ b/src/world/Actor/BNpc.cpp @@ -350,7 +350,7 @@ void Sapphire::Entity::BNpc::hateListRemove( Sapphire::Entity::CharaPtr pChara ) bool Sapphire::Entity::BNpc::hateListHasActor( Sapphire::Entity::CharaPtr pChara ) { - for( auto listEntry : m_hateList ) + for( auto& listEntry : m_hateList ) { if( listEntry->m_pChara == pChara ) return true; @@ -550,6 +550,14 @@ void Sapphire::Entity::BNpc::onDeath() m_currentStance = Stance::Passive; m_state = BNpcState::Dead; m_timeOfDeath = Util::getTimeSeconds(); + + for( auto& pHateEntry : m_hateList ) + { + // TODO: handle drops + auto pPlayer = pHateEntry->m_pChara->getAsPlayer(); + if( pPlayer ) + pPlayer->onMobKill( m_bNpcNameId ); + } hateListClear(); }