MCPcopy Create free account
hub / github.com/SapphireServer/Sapphire / onBNpcKill

Method onBNpcKill

src/world/Script/ScriptMgr.cpp:276–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274}
275
276bool Sapphire::Scripting::ScriptMgr::onBNpcKill( Entity::Player& player, uint16_t nameId )
277{
278 auto& eventMgr = Common::Service< World::Manager::EventMgr >::ref();
279
280 // loop through all active quests and try to call available onBNpcKill callbacks
281 for( size_t i = 0; i < 30; i++ )
282 {
283 auto activeQuests = player.getQuestActive( static_cast< uint16_t >( i ) );
284 if( !activeQuests )
285 continue;
286
287 uint32_t questId = activeQuests->c.questId | Event::EventHandler::EventHandlerType::Quest << 16;
288
289 auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventScript >( questId );
290 if( script )
291 {
292 std::string objName = eventMgr.getEventName( questId );
293
294 player.sendDebug( "Calling: {0}.onBnpcKill nameId#{1}", objName, nameId );
295
296 script->onBNpcKill( nameId, player );
297 }
298 }
299
300 return true;
301}
302
303bool Sapphire::Scripting::ScriptMgr::onEObjHit( Sapphire::Entity::Player& player, uint64_t actorId, uint32_t actionId )
304{

Callers 1

onMobKillMethod · 0.45

Calls 3

getQuestActiveMethod · 0.80
getEventNameMethod · 0.80
sendDebugMethod · 0.45

Tested by

no test coverage detected