diff --git a/src/common/Common.h b/src/common/Common.h index 5c9f1d57..4b9b6c60 100644 --- a/src/common/Common.h +++ b/src/common/Common.h @@ -1499,64 +1499,63 @@ namespace Sapphire::Common using PlayerStateFlagList = std::vector< PlayerStateFlag >; + struct BNPCInstanceObject + { + uint16_t territoryType; + std::string bnpcName; + uint32_t instanceId; + uint32_t nameOffset; + float x; + float y; + float z; + float rotation; + uint32_t BaseId; + uint32_t PopWeather; + uint8_t PopTimeStart; + uint8_t PopTimeEnd; + uint32_t MoveAI; + uint8_t WanderingRange; + uint8_t Route; + uint16_t EventGroup; + uint32_t NameId; + uint32_t DropItem; + float SenseRangeRate; + uint16_t Level; + uint8_t ActiveType; + uint8_t PopInterval; + uint8_t PopRate; + uint8_t PopEvent; + uint8_t LinkGroup; + uint8_t LinkFamily; + uint8_t LinkRange; + uint8_t LinkCountLimit; + int8_t NonpopInitZone; + int8_t InvalidRepop; + int8_t LinkParent; + int8_t LinkOverride; + int8_t LinkReply; + int8_t Nonpop; + float HorizontalPopRange; + float VerticalPopRange; + int32_t BNpcBaseData; + uint8_t RepopId; + uint8_t BNPCRankId; + uint16_t TerritoryRange; + uint32_t BoundInstanceID; + uint32_t FateLayoutLabelId; + uint32_t NormalAI; + uint32_t ServerPathId; + uint32_t EquipmentID; + uint32_t CustomizeID; + }; -struct BNPCInstanceObject -{ - uint16_t territoryType; - std::string bnpcName; - uint32_t instanceId; - uint32_t nameOffset; - float x; - float y; - float z; - float rotation; - uint32_t BaseId; - uint32_t PopWeather; - uint8_t PopTimeStart; - uint8_t PopTimeEnd; - uint32_t MoveAI; - uint8_t WanderingRange; - uint8_t Route; - uint16_t EventGroup; - uint32_t NameId; - uint32_t DropItem; - float SenseRangeRate; - uint16_t Level; - uint8_t ActiveType; - uint8_t PopInterval; - uint8_t PopRate; - uint8_t PopEvent; - uint8_t LinkGroup; - uint8_t LinkFamily; - uint8_t LinkRange; - uint8_t LinkCountLimit; - int8_t NonpopInitZone; - int8_t InvalidRepop; - int8_t LinkParent; - int8_t LinkOverride; - int8_t LinkReply; - int8_t Nonpop; - float HorizontalPopRange; - float VerticalPopRange; - int32_t BNpcBaseData; - uint8_t RepopId; - uint8_t BNPCRankId; - uint16_t TerritoryRange; - uint32_t BoundInstanceID; - uint32_t FateLayoutLabelId; - uint32_t NormalAI; - uint32_t ServerPathId; - uint32_t EquipmentID; - uint32_t CustomizeID; -}; - -/* - * CellId is used to identify a cell in the cell container of a zone - */ -struct CellId -{ - uint32_t x{ 0 }; - uint32_t y{ 0 }; -}; + /* + * CellId is used to identify a cell in the cell container of a zone + */ + struct CellId + { + uint32_t x{ 0 }; + uint32_t y{ 0 }; + }; } diff --git a/src/world/Actor/BNpc.cpp b/src/world/Actor/BNpc.cpp index e860bb5d..b93451fa 100644 --- a/src/world/Actor/BNpc.cpp +++ b/src/world/Actor/BNpc.cpp @@ -731,6 +731,7 @@ void Sapphire::Entity::BNpc::update( uint64_t tickCount ) } checkAggro(); + break; } case BNpcState::Combat: @@ -796,6 +797,7 @@ void Sapphire::Entity::BNpc::update( uint64_t tickCount ) pNaviProvider->updateAgentParameters( *this ); } } + break; } @@ -832,20 +834,21 @@ void Sapphire::Entity::BNpc::onDeath() { auto& server = Common::Service< World::WorldServer >::ref(); auto& playerMgr = Common::Service< World::Manager::PlayerMgr >::ref(); + auto& taskMgr = Common::Service< World::Manager::TaskMgr >::ref(); + setTargetId( INVALID_GAME_OBJECT_ID64 ); m_currentStance = Stance::Passive; m_state = BNpcState::Dead; m_timeOfDeath = Util::getTimeSeconds(); setOwner( nullptr ); - auto& taskMgr = Common::Service< World::Manager::TaskMgr >::ref(); taskMgr.queueTask( World::makeFadeBNpcTask( 10000, getAsBNpc() ) ); taskMgr.queueTask( World::makeRemoveBNpcTask( 12000, getAsBNpc() ) ); auto& exdData = Common::Service< Data::ExdData >::ref(); auto paramGrowthInfo = exdData.getRow< Excel::ParamGrow >( m_level ); - for( auto& pHateEntry : m_hateList ) + for( const auto& pHateEntry : m_hateList ) { // TODO: handle drops auto pPlayer = pHateEntry->m_pChara->getAsPlayer(); @@ -855,6 +858,7 @@ void Sapphire::Entity::BNpc::onDeath() pPlayer->gainExp( paramGrowthInfo->data().BaseExp ); } } + hateListClear(); } diff --git a/src/world/Territory/Territory.cpp b/src/world/Territory/Territory.cpp index 504eeadd..94ba7085 100644 --- a/src/world/Territory/Territory.cpp +++ b/src/world/Territory/Territory.cpp @@ -54,6 +54,7 @@ using namespace Sapphire::World::Manager; Territory::Territory() : m_territoryTypeId( 0 ), + m_ident(), m_guId( 0 ), m_currentWeather( Common::Weather::FairSkies ), m_weatherOverride( Common::Weather::None ), @@ -908,7 +909,6 @@ bool Territory::loadBNpcs() while( res->next() ) { - auto bnpc = std::make_shared< Common::BNPCInstanceObject >(); bnpc->territoryType = res->getInt( 1 ); @@ -970,8 +970,6 @@ bool Territory::loadBNpcs() m_spawnInfo.emplace_back( info ); } - - } return true; }