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

Change onTriggerOwner deaggro to pass a bnpc reference

This commit is contained in:
Mordred 2022-01-25 14:15:19 +01:00
parent 8a55a8b42c
commit db6506a7b9
5 changed files with 8 additions and 7 deletions

View file

@ -579,7 +579,7 @@ void Sapphire::Entity::BNpc::deaggro( const Sapphire::Entity::CharaPtr& pChara )
if( getTriggerOwnerId() == pChara->getId() )
{
auto pScript = std::make_shared< Scripting::ScriptMgr >();
pScript->onTriggerOwnerDeaggro( *pChara->getAsPlayer(), getLayoutId(), getId() );
pScript->onTriggerOwnerDeaggro( *pChara->getAsPlayer(), *getAsBNpc() );
}
}

View file

@ -150,7 +150,7 @@ namespace Sapphire::ScriptAPI
{
}
void QuestScript::onTriggerOwnerDeaggro( World::Quest& quest, uint32_t layoutId, uint32_t entityId, Sapphire::Entity::Player& player )
void QuestScript::onTriggerOwnerDeaggro( World::Quest& quest, Sapphire::Entity::BNpc& bnpc, Sapphire::Entity::Player& player )
{
}

View file

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

View file

@ -9,6 +9,7 @@
#include "Territory/QuestBattle.h"
#include "Actor/Player.h"
#include "Actor/EventObject.h"
#include "Actor/BNpc.h"
#include "WorldServer.h"
#include "Event/EventHandler.h"
#include "Action/Action.h"
@ -410,7 +411,7 @@ bool Sapphire::Scripting::ScriptMgr::onEventItem( Entity::Player& player, uint32
return false;
}
bool Sapphire::Scripting::ScriptMgr::onTriggerOwnerDeaggro( Entity::Player& player, uint32_t layoutId, uint32_t entityId )
bool Sapphire::Scripting::ScriptMgr::onTriggerOwnerDeaggro( Entity::Player& player, Entity::BNpc& bnpc )
{
auto& eventMgr = Common::Service< World::Manager::EventMgr >::ref();
@ -428,11 +429,11 @@ bool Sapphire::Scripting::ScriptMgr::onTriggerOwnerDeaggro( Entity::Player& play
{
std::string objName = eventMgr.getEventName( questId );
PlayerMgr::sendDebug( player, "Calling: {0}.onTriggerOwnerDeaggro layoutId#{1}", objName, layoutId );
PlayerMgr::sendDebug( player, "Calling: {0}.onTriggerOwnerDeaggro layoutId#{1}", objName, bnpc.getLayoutId() );
World::Quest preQ = quest;
script->onTriggerOwnerDeaggro( quest, layoutId, entityId, player );
script->onTriggerOwnerDeaggro( quest, bnpc, player );
if( quest != preQ )
player.updateQuest( quest );
}

View file

@ -68,7 +68,7 @@ namespace Sapphire::Scripting
bool onBNpcKill( Entity::Player& player, uint16_t nameId, uint32_t layoutId );
bool onTriggerOwnerDeaggro( Entity::Player& player, uint32_t layoutId, uint32_t entityId );
bool onTriggerOwnerDeaggro( Entity::Player& player, Entity::BNpc& bnpc );
bool onEObjHit( Entity::Player& player, uint64_t actorId, uint32_t actionId );