1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 22:37:45 +00:00

Added onMobKill call for it to actually be forwarded to scripts

This commit is contained in:
mordred 2019-01-29 08:02:39 +01:00
parent 0ea201fd5e
commit 99a02d8c9b

View file

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