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

Forward entity and name id to the onKill event

This commit is contained in:
Mordred 2021-12-21 12:19:35 +01:00
parent 532645fc88
commit d6dd81ad1b
9 changed files with 14 additions and 14 deletions

View file

@ -98,9 +98,9 @@ class SubFst033 : public Sapphire::ScriptAPI::QuestScript
}
void onBNpcKill( World::Quest& quest, uint32_t npcId, Entity::Player& player ) override
void onBNpcKill( World::Quest& quest, uint16_t nameId, uint32_t entityId, Entity::Player& player ) override
{
switch( npcId )
switch( entityId )
{
case Enemy0: { break; }
case Enemy1: { break; }

View file

@ -390,9 +390,9 @@ createScript( std::shared_ptr< Component::Excel::ExcelStruct< Component::Excel::
if( !enemy_ids.empty() )
scriptEntry += std::string(
" void onBNpcKill( uint32_t npcId, Entity::Player& player ) override\n"
" void onBNpcKill( World::Quest& quest, uint16_t nameId, uint32_t entityId, Entity::Player& player ) override\n"
" {\n"
" switch( npcId )\n"
" switch( entityId )\n"
" {\n" );
for( auto enemy : enemy_strings )
@ -406,7 +406,7 @@ createScript( std::shared_ptr< Component::Excel::ExcelStruct< Component::Excel::
if( !action_ids.empty() )
actionEntry += std::string(
" void onEObjHit( uint32_t npcId, Entity::Player& player, uint32_t actionId )\n"
" void onEObjHit( World::Quest& quest, uint32_t npcId, Entity::Player& player, uint32_t actionId )\n"
" {\n"
" switch( actionId )\n"
" {\n" );

View file

@ -741,7 +741,7 @@ void Sapphire::Entity::BNpc::onDeath()
if( pPlayer )
{
auto& playerMgr = Common::Service< World::Manager::PlayerMgr >::ref();
playerMgr.onMobKill( *pPlayer, static_cast< uint16_t >( m_bNpcNameId ) );
playerMgr.onMobKill( *pPlayer, static_cast< uint16_t >( m_bNpcNameId ), m_id );
}
}
hateListClear();

View file

@ -252,10 +252,10 @@ void PlayerMgr::onMountUpdate( Sapphire::Entity::Player& player, uint32_t mountI
}
}
void PlayerMgr::onMobKill( Sapphire::Entity::Player& player, uint16_t nameId )
void PlayerMgr::onMobKill( Sapphire::Entity::Player& player, uint16_t nameId, uint32_t entityId )
{
auto& scriptMgr = Common::Service< Scripting::ScriptMgr >::ref();
scriptMgr.onBNpcKill( player, nameId );
scriptMgr.onBNpcKill( player, nameId, entityId );
if( player.isActionLearned( Common::UnlockEntry::HuntingLog ) )
{

View file

@ -40,7 +40,7 @@ class PlayerMgr
void onMountUpdate( Sapphire::Entity::Player& player, uint32_t mountId );
void onMobKill( Sapphire::Entity::Player& player, uint16_t nameId );
void onMobKill( Sapphire::Entity::Player& player, uint16_t nameId, uint32_t entityId );
void onHateListChanged( Sapphire::Entity::Player& player );

View file

@ -146,7 +146,7 @@ namespace Sapphire::ScriptAPI
{
}
void QuestScript::onBNpcKill( World::Quest& quest, uint32_t nameId, Entity::Player& player )
void QuestScript::onBNpcKill( World::Quest& quest, uint16_t nameId, uint32_t entityId, Entity::Player& player )
{
}

View file

@ -210,7 +210,7 @@ namespace Sapphire::ScriptAPI
virtual void onEventItem( World::Quest& quest, Sapphire::Entity::Player& player, uint64_t actorId );
virtual void onBNpcKill( World::Quest& quest, uint32_t nameId, Sapphire::Entity::Player& player );
virtual void onBNpcKill( World::Quest& quest, uint16_t nameId, uint32_t entityId, Sapphire::Entity::Player& player );
virtual void onEmote( World::Quest& quest, uint64_t actorId, uint32_t emoteId, Sapphire::Entity::Player& player );

View file

@ -352,7 +352,7 @@ bool Sapphire::Scripting::ScriptMgr::onEventItem( Entity::Player& player, uint32
return false;
}
bool Sapphire::Scripting::ScriptMgr::onBNpcKill( Entity::Player& player, uint16_t nameId )
bool Sapphire::Scripting::ScriptMgr::onBNpcKill( Entity::Player& player, uint16_t nameId, uint32_t entityId )
{
auto& eventMgr = Common::Service< World::Manager::EventMgr >::ref();
@ -374,7 +374,7 @@ bool Sapphire::Scripting::ScriptMgr::onBNpcKill( Entity::Player& player, uint16_
World::Quest preQ = quest;
script->onBNpcKill( quest, nameId, player );
script->onBNpcKill( quest, nameId, entityId, player );
if( quest != preQ )
player.updateQuest( quest );
}

View file

@ -66,7 +66,7 @@ namespace Sapphire::Scripting
bool onEventItem( Entity::Player& player, uint32_t eventItemId, uint32_t eventId, uint64_t targetId );
bool onBNpcKill( Entity::Player& player, uint16_t nameId );
bool onBNpcKill( Entity::Player& player, uint16_t nameId, uint32_t entityId );
bool onEObjHit( Entity::Player& player, uint64_t actorId, uint32_t actionId );