1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-01 16:37:45 +00:00

Added triggerOwner to bnpc

This commit is contained in:
Mordred 2022-01-18 08:03:49 +01:00
parent 00f0c1b431
commit 9ab636662d
6 changed files with 21 additions and 4 deletions

View file

@ -517,6 +517,16 @@ void Sapphire::Entity::BNpc::hateListRemove( Sapphire::Entity::CharaPtr pChara )
} }
} }
uint32_t Sapphire::Entity::BNpc::getTriggerOwnerId() const
{
return m_triggerOwnerId;
}
void Sapphire::Entity::BNpc::setTriggerOwnerId( uint32_t triggerOwnerId )
{
m_triggerOwnerId = triggerOwnerId;
}
bool Sapphire::Entity::BNpc::hateListHasActor( Sapphire::Entity::CharaPtr pChara ) bool Sapphire::Entity::BNpc::hateListHasActor( Sapphire::Entity::CharaPtr pChara )
{ {
for( auto& listEntry : m_hateList ) for( auto& listEntry : m_hateList )

View file

@ -87,6 +87,8 @@ namespace Sapphire::Entity
uint8_t getAggressionMode() const; uint8_t getAggressionMode() const;
uint32_t getTriggerOwnerId() const;
void setTriggerOwnerId( uint32_t triggerOwnerId );
float getNaviTargetReachedDistance() const; float getNaviTargetReachedDistance() const;
@ -159,6 +161,7 @@ namespace Sapphire::Entity
uint32_t m_rank; uint32_t m_rank;
uint32_t m_boundInstanceId; uint32_t m_boundInstanceId;
uint32_t m_layoutId; uint32_t m_layoutId;
uint32_t m_triggerOwnerId;
uint32_t m_flags; uint32_t m_flags;

View file

@ -61,7 +61,7 @@ namespace Sapphire::Network::Packets::WorldPackets::Server
m_data.MainTarget = bnpc.getTargetId(); m_data.MainTarget = bnpc.getTargetId();
// no idea ... m_data.spawnerId = Common::INVALID_GAME_OBJECT_ID64; // no idea ... m_data.spawnerId = Common::INVALID_GAME_OBJECT_ID64;
m_data.ParentId = Common::INVALID_GAME_OBJECT_ID; m_data.ParentId = Common::INVALID_GAME_OBJECT_ID;
m_data.TriggerId = 0; m_data.TriggerId = bnpc.getTriggerOwnerId();
m_data.ChannelingTarget = Common::INVALID_GAME_OBJECT_ID; m_data.ChannelingTarget = Common::INVALID_GAME_OBJECT_ID;
m_data.OwnerId = Common::INVALID_GAME_OBJECT_ID; m_data.OwnerId = Common::INVALID_GAME_OBJECT_ID;

View file

@ -92,6 +92,10 @@ Sapphire::InstanceObjectCache::InstanceObjectCache()
auto pPopRange = std::reinterpret_pointer_cast< LGB_POP_RANGE_ENTRY >( pEntry ); auto pPopRange = std::reinterpret_pointer_cast< LGB_POP_RANGE_ENTRY >( pEntry );
m_popRangeCache.insert( id, pPopRange ); m_popRangeCache.insert( id, pPopRange );
} }
else if( pEntry->getType() == LgbEntryType::SharedGroup6 )
{
}
} }
} }
} }

View file

@ -850,14 +850,14 @@ uint32_t Sapphire::Territory::getNextEffectSequence()
return m_effectCounter++; return m_effectCounter++;
} }
Sapphire::Entity::BNpcPtr Sapphire::Territory::createBNpcFromInstanceId( uint32_t levelId, uint32_t hp, Common::BNpcType bnpcType ) Sapphire::Entity::BNpcPtr Sapphire::Territory::createBNpcFromInstanceId( uint32_t levelId, uint32_t hp, Common::BNpcType bnpcType, uint32_t triggerOwnerId )
{ {
auto infoPtr = m_bNpcBaseMap.find( levelId ); auto infoPtr = m_bNpcBaseMap.find( levelId );
if( infoPtr == m_bNpcBaseMap.end() ) if( infoPtr == m_bNpcBaseMap.end() )
return nullptr; return nullptr;
auto pBNpc = std::make_shared< Entity::BNpc >( getNextActorId(), infoPtr->second, shared_from_this(), hp, bnpcType ); auto pBNpc = std::make_shared< Entity::BNpc >( getNextActorId(), infoPtr->second, shared_from_this(), hp, bnpcType );
pBNpc->setTriggerOwnerId( triggerOwnerId );
pushActor( pBNpc ); pushActor( pBNpc );
return pBNpc; return pBNpc;
} }

View file

@ -169,7 +169,7 @@ namespace Sapphire
void registerEObj( Entity::EventObjectPtr object ); void registerEObj( Entity::EventObjectPtr object );
Entity::BNpcPtr createBNpcFromInstanceId( uint32_t levelId, uint32_t hp, Common::BNpcType bnpcType ); Entity::BNpcPtr createBNpcFromInstanceId( uint32_t levelId, uint32_t hp, Common::BNpcType bnpcType, uint32_t triggerOwnerId = 0 );
Entity::BNpcPtr getActiveBNpcByInstanceId( uint32_t instanceId ); Entity::BNpcPtr getActiveBNpcByInstanceId( uint32_t instanceId );