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

Method onEObjHit

src/world/Script/ScriptMgr.cpp:303–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301}
302
303bool Sapphire::Scripting::ScriptMgr::onEObjHit( Sapphire::Entity::Player& player, uint64_t actorId, uint32_t actionId )
304{
305 auto& eventMgr = Common::Service< World::Manager::EventMgr >::ref();
306 bool didCallScript = false;
307
308 for( size_t i = 0; i < 30; i++ )
309 {
310 auto activeQuests = player.getQuestActive( static_cast< uint16_t >( i ) );
311 if( !activeQuests )
312 continue;
313
314 uint32_t questId = activeQuests->c.questId | Event::EventHandler::EventHandlerType::Quest << 16;
315
316 auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventScript >( questId );
317 if( script )
318 {
319 didCallScript = true;
320 std::string objName = eventMgr.getEventName( questId );
321
322 player.sendDebug( "Calling: {0}.onEObjHit actorId#{1}", objName, actorId );
323
324 script->onEObjHit( player, actorId, actionId );
325 }
326 }
327
328 return didCallScript;
329}
330
331bool Sapphire::Scripting::ScriptMgr::onExecute( World::Action::Action& action )
332{

Callers 1

executeMethod · 0.45

Calls 3

getQuestActiveMethod · 0.80
getEventNameMethod · 0.80
sendDebugMethod · 0.45

Tested by

no test coverage detected