1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-05 18:27:47 +00:00

fix name inconsistency with bnpc kill script callbacks

This commit is contained in:
NotAdam 2019-02-02 23:32:36 +11:00
parent 252998c194
commit 9f2dee403c
6 changed files with 9 additions and 9 deletions

View file

@ -68,7 +68,7 @@ public:
Scene00001( player ); Scene00001( player );
} }
void onNpcKill( uint32_t npcId, Entity::Player& player ) override void onBNpcKill( uint32_t npcId, Entity::Player& player ) override
{ {
if( npcId != ENEMY0 ) if( npcId != ENEMY0 )
return; return;

View file

@ -1133,7 +1133,7 @@ void Sapphire::Entity::Player::update( int64_t currTime )
void Sapphire::Entity::Player::onMobKill( uint16_t nameId ) void Sapphire::Entity::Player::onMobKill( uint16_t nameId )
{ {
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >(); auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
pScriptMgr->onMobKill( *getAsPlayer(), nameId ); pScriptMgr->onBNpcKill( *getAsPlayer(), nameId );
} }
void Sapphire::Entity::Player::freePlayerSpawnId( uint32_t actorId ) void Sapphire::Entity::Player::freePlayerSpawnId( uint32_t actorId )

View file

@ -111,7 +111,7 @@ namespace Sapphire::ScriptAPI
{ {
} }
void EventScript::onNpcKill( uint32_t npcId, Entity::Player& player ) void EventScript::onBNpcKill( uint32_t nameId, Entity::Player& player )
{ {
} }

View file

@ -165,7 +165,7 @@ namespace Sapphire::ScriptAPI
virtual void onTalk( uint32_t eventId, Sapphire::Entity::Player& player, uint64_t actorId ); virtual void onTalk( uint32_t eventId, Sapphire::Entity::Player& player, uint64_t actorId );
virtual void onNpcKill( uint32_t npcId, Sapphire::Entity::Player& player ); virtual void onBNpcKill( uint32_t nameId, Sapphire::Entity::Player& player );
virtual void onEmote( uint64_t actorId, uint32_t eventId, uint32_t emoteId, Sapphire::Entity::Player& player ); virtual void onEmote( uint64_t actorId, uint32_t eventId, uint32_t emoteId, Sapphire::Entity::Player& player );

View file

@ -272,20 +272,20 @@ bool Sapphire::Scripting::ScriptMgr::onEventItem( Entity::Player& player, uint32
return false; return false;
} }
bool Sapphire::Scripting::ScriptMgr::onMobKill( Entity::Player& player, uint16_t nameId ) bool Sapphire::Scripting::ScriptMgr::onBNpcKill( Entity::Player& player, uint16_t nameId )
{ {
auto pEventMgr = framework()->get< World::Manager::EventMgr >(); auto pEventMgr = framework()->get< World::Manager::EventMgr >();
std::string eventName = "onBnpcKill_" + std::to_string( nameId ); std::string eventName = "onBnpcKill_" + std::to_string( nameId );
// loop through all active quests and try to call available onMobKill callbacks // loop through all active quests and try to call available onBNpcKill callbacks
for( size_t i = 0; i < 30; i++ ) for( size_t i = 0; i < 30; i++ )
{ {
auto activeQuests = player.getQuestActive( static_cast< uint16_t >( i ) ); auto activeQuests = player.getQuestActive( static_cast< uint16_t >( i ) );
if( !activeQuests ) if( !activeQuests )
continue; continue;
uint32_t questId = activeQuests->c.questId | 0x00010000; uint32_t questId = activeQuests->c.questId | Event::EventHandler::EventHandlerType::Quest << 16;
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventScript >( questId ); auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventScript >( questId );
if( script ) if( script )
@ -294,7 +294,7 @@ bool Sapphire::Scripting::ScriptMgr::onMobKill( Entity::Player& player, uint16_t
player.sendDebug( "Calling: {0}.{1}", objName, eventName ); player.sendDebug( "Calling: {0}.{1}", objName, eventName );
script->onNpcKill( nameId, player ); script->onBNpcKill( nameId, player );
} }
} }

View file

@ -68,7 +68,7 @@ namespace Sapphire::Scripting
bool onEventItem( Entity::Player& player, uint32_t eventItemId, uint32_t eventId, uint32_t castTime, bool onEventItem( Entity::Player& player, uint32_t eventItemId, uint32_t eventId, uint32_t castTime,
uint64_t targetId ); uint64_t targetId );
bool onMobKill( Entity::Player& player, uint16_t nameId ); bool onBNpcKill( Entity::Player& player, uint16_t nameId );
bool onCastFinish( Entity::Player& pPlayer, Entity::CharaPtr pTarget, uint32_t actionId ); bool onCastFinish( Entity::Player& pPlayer, Entity::CharaPtr pTarget, uint32_t actionId );