diff --git a/src/world/Actor/Player.cpp b/src/world/Actor/Player.cpp index d3b950d4..6103184d 100644 --- a/src/world/Actor/Player.cpp +++ b/src/world/Actor/Player.cpp @@ -509,12 +509,7 @@ bool Sapphire::Entity::Player::exitInstance() resetHp(); resetMp(); - TerritoryPtr pTeri = nullptr; - // check if housing zone - if( teriMgr.isHousingTerritory( m_prevTerritoryTypeId ) ) - pTeri = teriMgr.getTerritoryByGuId( m_prevTerritoryId ); - else - pTeri = teriMgr.getZoneByTerritoryTypeId( m_prevTerritoryTypeId ); + TerritoryPtr pTeri = teriMgr.getTerritoryByGuId( m_prevTerritoryId ); if( !teriMgr.movePlayer( pTeri, *this ) ) return false; @@ -1419,7 +1414,7 @@ void Sapphire::Entity::Player::setMount( uint32_t mountId ) Service< World::Manager::PlayerMgr >::ref().onMountUpdate( *this, m_mount ); } -void Sapphire::Entity::Player::setCompanion( uint16_t id ) +void Sapphire::Entity::Player::setCompanion( uint8_t id ) { auto& exdData = Common::Service< Data::ExdData >::ref(); diff --git a/src/world/Actor/Player.h b/src/world/Actor/Player.h index d65a6195..e1020a1c 100644 --- a/src/world/Actor/Player.h +++ b/src/world/Actor/Player.h @@ -396,7 +396,7 @@ namespace Sapphire::Entity /*! mount the specified setMount and send the packets */ void setMount( uint32_t mountId ); - void setCompanion( uint16_t id ); + void setCompanion( uint8_t id ); uint8_t getCurrentCompanion() const; @@ -952,7 +952,7 @@ namespace Sapphire::Entity // content finder info uint32_t m_cfPenaltyUntil{}; // unix time - uint16_t m_companionId{}; + uint8_t m_companionId{}; uint32_t m_mount; uint32_t m_emoteMode; diff --git a/src/world/Manager/HousingMgr.cpp b/src/world/Manager/HousingMgr.cpp index d287128e..1ff92033 100644 --- a/src/world/Manager/HousingMgr.cpp +++ b/src/world/Manager/HousingMgr.cpp @@ -285,7 +285,7 @@ uint64_t Sapphire::World::Manager::HousingMgr::getNextHouseId() return pQR->getUInt64( 1 ) + 1; } -uint32_t Sapphire::World::Manager::HousingMgr::toLandSetId( uint16_t territoryTypeId, uint8_t wardId ) const +uint32_t Sapphire::World::Manager::HousingMgr::toLandSetId( int16_t territoryTypeId, int16_t wardId ) const { return ( static_cast< uint32_t >( territoryTypeId ) << 16 ) | wardId; } @@ -315,7 +315,7 @@ void Sapphire::World::Manager::HousingMgr::sendLandSignOwned( Entity::Player& pl player.setActiveLand( static_cast< uint8_t >( ident.landId ), static_cast< uint8_t >( ident.wardNum ) ); - auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) ); + auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto teriMgr = Common::Service< TerritoryMgr >::ref(); auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); @@ -356,7 +356,7 @@ void Sapphire::World::Manager::HousingMgr::sendLandSignFree( Entity::Player& pla auto& server = Common::Service< World::WorldServer >::ref(); player.setActiveLand( static_cast< uint8_t >( ident.landId ), static_cast< uint8_t >( ident.wardNum ) ); - auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) ); + auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto teriMgr = Common::Service< TerritoryMgr >::ref(); auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri ); @@ -545,7 +545,7 @@ void Sapphire::World::Manager::HousingMgr::sendWardLandInfo( Entity::Player& pla void Sapphire::World::Manager::HousingMgr::sendEstateGreeting( Entity::Player& player, const Common::LandIdent ident ) { auto& server = Common::Service< World::WorldServer >::ref(); - auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) ); + auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto teriMgr = Common::Service< TerritoryMgr >::ref(); auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri ); @@ -696,8 +696,7 @@ void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& pl // create house auto ident = pLand->getLandIdent(); - auto house = make_House( getNextHouseId(), pLand->getLandSetId(), ident, - "Estate #" + std::to_string( ident.landId + 1 ), "" ); + auto house = make_House( getNextHouseId(), pLand->getLandSetId(), ident, "Estate #" + std::to_string( ident.landId + 1 ), "" ); pLand->setHouse( house ); @@ -738,7 +737,7 @@ void Sapphire::World::Manager::HousingMgr::requestEstateRename( Entity::Player& auto& server = Common::Service< World::WorldServer >::ref(); auto pSession = server.getSession( player.getCharacterId() ); - auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) ); + auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto teriMgr = Common::Service< TerritoryMgr >::ref(); auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri ); @@ -765,7 +764,7 @@ void Sapphire::World::Manager::HousingMgr::requestEstateEditGreeting( Entity::Pl auto& server = Common::Service< World::WorldServer >::ref(); auto pSession = server.getSession( player.getCharacterId() ); - auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) ); + auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto teriMgr = Common::Service< TerritoryMgr >::ref(); auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri ); @@ -791,7 +790,7 @@ void Sapphire::World::Manager::HousingMgr::requestEstateEditGreeting( Entity::Pl void Sapphire::World::Manager::HousingMgr::updateEstateGreeting( Entity::Player& player, const Common::LandIdent ident, const std::string& greeting ) { - auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) ); + auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto teriMgr = Common::Service< TerritoryMgr >::ref(); auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri ); @@ -821,7 +820,7 @@ void Sapphire::World::Manager::HousingMgr::requestEstateEditGuestAccess( Entity: auto& server = Common::Service< World::WorldServer >::ref(); auto pSession = server.getSession( player.getCharacterId() ); - auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) ); + auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto teriMgr = Common::Service< TerritoryMgr >::ref(); auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri ); @@ -845,7 +844,7 @@ void Sapphire::World::Manager::HousingMgr::requestEstateEditGuestAccess( Entity: Sapphire::Common::LandIdent Sapphire::World::Manager::HousingMgr::clientTriggerParamsToLandIdent( uint32_t param11, uint32_t param12, bool use16bits ) const { - Common::LandIdent ident; + Common::LandIdent ident{}; ident.worldId = static_cast< int16_t >( param11 >> 16 ); ident.territoryTypeId = static_cast< int16_t >( param11 & 0xFFFF ); @@ -879,7 +878,7 @@ void Sapphire::World::Manager::HousingMgr::sendEstateInventory( Entity::Player& auto ident = internalZone->getLandIdent(); - auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) ); + auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto teriMgr = Common::Service< TerritoryMgr >::ref(); auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri ); @@ -1028,7 +1027,7 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceHousingItem( Sapphire::Entity // todo: this whole process is retarded and needs to be fixed // perhaps maintain a list of estates by ident inside housingmgr? auto ident = zone->getLandIdent(); - auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) ); + auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref(); auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); @@ -1104,7 +1103,7 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceItemInStore( Sapphire::Entity // todo: this whole process is retarded and needs to be fixed // perhaps maintain a list of estates by ident inside housingmgr? auto ident = zone->getLandIdent(); - auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) ); + auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref(); auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); @@ -1293,7 +1292,7 @@ void Sapphire::World::Manager::HousingMgr::sendInternalEstateInventoryBatch( Sap void Sapphire::World::Manager::HousingMgr::reqMoveHousingItem( Entity::Player& player, Common::LandIdent ident, uint8_t slot, Common::FFXIVARR_POSITION3 pos, float rot ) { - auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) ); + auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref(); auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); @@ -1335,7 +1334,7 @@ bool Sapphire::World::Manager::HousingMgr::moveInternalItem( Entity::Player& pla { containerId = m_internalPlacedItemContainers.at( containerIdx ); } - catch( const std::out_of_range& ex ) + catch( const std::out_of_range& ) { return false; } @@ -1418,7 +1417,7 @@ void Sapphire::World::Manager::HousingMgr::reqRemoveHousingItem( Sapphire::Entit if( auto terri = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( pZone ) ) { auto ident = terri->getLandIdent(); - auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) ); + auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref(); auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); @@ -1667,7 +1666,7 @@ void Sapphire::World::Manager::HousingMgr::reqEstateInteriorRemodel( Sapphire::E return; auto ident = terri->getLandIdent(); - auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) ); + auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri ); diff --git a/src/world/Manager/HousingMgr.h b/src/world/Manager/HousingMgr.h index 98a5105d..ca147440 100644 --- a/src/world/Manager/HousingMgr.h +++ b/src/world/Manager/HousingMgr.h @@ -71,7 +71,7 @@ namespace Sapphire::World::Manager bool init(); - uint32_t toLandSetId( uint16_t territoryTypeId, uint8_t wardId ) const; + uint32_t toLandSetId( int16_t territoryTypeId, int16_t wardId ) const; Sapphire::LandPtr getLandByOwnerId( uint64_t id ); void sendLandSignOwned( Entity::Player& player, const Common::LandIdent ident ); diff --git a/src/world/Manager/TerritoryMgr.cpp b/src/world/Manager/TerritoryMgr.cpp index 566dd3a8..8a2de6fb 100644 --- a/src/world/Manager/TerritoryMgr.cpp +++ b/src/world/Manager/TerritoryMgr.cpp @@ -45,17 +45,6 @@ void Sapphire::World::Manager::TerritoryMgr::loadTerritoryTypeDetailCache() m_territoryTypeDetailCacheMap[ id ] = teri1; } - for( auto id : exdData.getIdList< Component::Excel::InstanceContent >() ) - { - // EXD TODO: how did this work back then... - /* - auto cfc = exdData.get< Sapphire::Data::ContentFinderCondition >( id ); - if( !cfc || cfc->contentLinkType != 5 ) - continue; - - m_questBattleToContentFinderMap[ cfc->content ] = id; - */ - } } bool Sapphire::World::Manager::TerritoryMgr::isValidTerritory( uint32_t territoryTypeId ) const @@ -194,30 +183,32 @@ bool Sapphire::World::Manager::TerritoryMgr::createDefaultTerritories() { auto territoryTypeId = territory.first; auto territoryInfo = territory.second; + auto& territoryData = territoryInfo->data(); // if the zone has no name set - if( territoryInfo->getString( territoryInfo->data().Name ).empty() ) + if( territoryInfo->getString( territoryData.Name ).empty() ) continue; - auto pPlaceName = exdData.getRow< Component::Excel::PlaceName >( territoryInfo->data().Area ); + auto pPlaceName = exdData.getRow< Component::Excel::PlaceName >( territoryData.Area ); if( !pPlaceName || pPlaceName->getString( pPlaceName->data().Text.SGL ).empty() || !isDefaultTerritory( territoryTypeId ) ) continue; uint32_t guid = getNextInstanceId(); - auto pZone = make_Territory( territoryTypeId, guid, territoryInfo->getString( territoryInfo->data().Name ), pPlaceName->getString( pPlaceName->data().Text.SGL ) ); + auto pZone = make_Territory( territoryTypeId, guid, territoryInfo->getString( territoryData.Name ), + pPlaceName->getString( pPlaceName->data().Text.SGL ) ); pZone->init(); - std::string bgPath = territoryInfo->getString( territoryInfo->data().LVB ); + std::string bgPath = territoryInfo->getString( territoryData.LVB ); bool hasNaviMesh = pZone->getNaviProvider() != nullptr; Logger::info( "{0}\t{1}\t{2}\t{3:<10}\t{4}\t{5}\t{6}", territoryTypeId, guid, - territoryInfo->data().IntendedUse, - territoryInfo->getString( territoryInfo->data().Name ), + territoryData.IntendedUse, + territoryInfo->getString( territoryData.Name ), ( isPrivateTerritory( territoryTypeId ) ? "PRIVATE" : "PUBLIC" ), hasNaviMesh ? "NAVI" : "", pPlaceName->getString( pPlaceName->data().Text.SGL ) ); @@ -255,7 +246,8 @@ bool Sapphire::World::Manager::TerritoryMgr::createHousingTerritories() for( wardNum = 0; wardNum < wardMaxNum; wardNum++ ) { - auto pHousingZone = make_HousingZone( wardNum, territoryTypeId, territoryInfo->getString( territoryInfo->data().Name ), pPlaceName->getString( pPlaceName->data().Text.SGL ) ); + auto pHousingZone = make_HousingZone( wardNum, territoryTypeId, territoryInfo->getString( territoryInfo->data().Name ), + pPlaceName->getString( pPlaceName->data().Text.SGL ) ); pHousingZone->init(); Logger::info( "{0}\t{1}\t{2}\t{3:<10}\tHOUSING\t\t{4}#{5}", @@ -294,9 +286,10 @@ Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::createTerritoryIn if( !pTeri || !pPlaceName ) return nullptr; - Logger::debug( "Starting instance for territory: {0} ({1})", territoryTypeId, pPlaceName->getString( pPlaceName->data().Text.SGL ) ); + auto placeName = pPlaceName->getString( pPlaceName->data().Text.SGL ); + Logger::debug( "Starting instance for territory: {0} ({1})", territoryTypeId, placeName ); - auto pZone = make_Territory( territoryTypeId, getNextInstanceId(), pTeri->getString( pTeri->data().Name ), pPlaceName->getString( pPlaceName->data().Text.SGL ) ); + auto pZone = make_Territory( territoryTypeId, getNextInstanceId(), pTeri->getString( pTeri->data().Name ), placeName ); pZone->init(); m_guIdToTerritoryPtrMap[ pZone->getGuId() ] = pZone; @@ -308,7 +301,6 @@ Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::createTerritoryIn Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::createQuestBattle( uint32_t questBattleId ) { - auto& exdData = Common::Service< Data::ExdData >::ref(); auto pQuestBattleInfo = exdData.getRow< Component::Excel::QuestBattle >( questBattleId ); @@ -319,36 +311,30 @@ Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::createQuestBattle if( !pQuestInfo || pQuestInfo->getString( pQuestInfo->data().Text.Name ).empty() ) return nullptr; - uint16_t teriId = 0; - for( auto& id : exdData.getIdList< Component::Excel::TerritoryType >() ) + for( auto& teriId : exdData.getIdList< Component::Excel::TerritoryType >() ) { - auto pTeri = exdData.getRow< Component::Excel::TerritoryType >( id ); - if( !pTeri ) + auto pTeri = exdData.getRow< Component::Excel::TerritoryType >( teriId ); + if( !pTeri || pTeri->data().QuestBattle != questBattleId ) continue; - if( pTeri->data().QuestBattle == questBattleId ) - { - teriId = id; - if( !isInstanceContentTerritory( teriId ) ) - return nullptr; + if( !isInstanceContentTerritory( teriId ) ) + return nullptr; - Logger::debug( "Starting instance for QuestBattle id: {0} ({1})", - questBattleId, pQuestInfo->getString( pQuestInfo->data().Text.Name ) ); + auto questName = pQuestInfo->getString( pQuestInfo->data().Text.Name ); + Logger::debug( "Starting instance for QuestBattle id: {0} ({1})", questBattleId, questName ); - auto instanceId = getNextInstanceId(); - auto pZone = make_QuestBattle( pQuestBattleInfo, teriId, instanceId, - pTeri->getString( pTeri->data().Name ), - pQuestInfo->getString( pQuestInfo->data().Text.Name ), questBattleId ); - pZone->init(); + auto instanceId = getNextInstanceId(); + auto pZone = make_QuestBattle( pQuestBattleInfo, teriId, instanceId, + pTeri->getString( pTeri->data().Name ), questName, questBattleId ); + pZone->init(); - m_questBattleIdToInstanceMap[ questBattleId ][ pZone->getGuId() ] = pZone; - m_guIdToTerritoryPtrMap[ pZone->getGuId() ] = pZone; - m_instanceZoneSet.insert( pZone ); + m_questBattleIdToInstanceMap[ questBattleId ][ pZone->getGuId() ] = pZone; + m_guIdToTerritoryPtrMap[ pZone->getGuId() ] = pZone; + m_instanceZoneSet.insert( pZone ); + + return pZone; - return pZone; - break; - } } @@ -361,23 +347,21 @@ Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::createInstanceCon auto& exdData = Common::Service< Data::ExdData >::ref(); auto pInstanceContent = exdData.getRow< Component::Excel::InstanceContent >( instanceContentId ); - if( !pInstanceContent ) + if( !pInstanceContent || !isInstanceContentTerritory( pInstanceContent->data().TerritoryType ) ) return nullptr; - if( !isInstanceContentTerritory( pInstanceContent->data().TerritoryType ) ) - return nullptr; + auto& instanceContentData = pInstanceContent->data(); - auto pTeri = getTerritoryDetail( pInstanceContent->data().TerritoryType ); + auto pTeri = getTerritoryDetail( instanceContentData.TerritoryType ); - std::string name = pInstanceContent->getString( pInstanceContent->data().Text.Name ); + auto name = pInstanceContent->getString( instanceContentData.Text.Name ); if( !pTeri || name.empty() ) return nullptr; Logger::debug( "Starting instance for InstanceContent id: {0} ({1})", instanceContentId, name ); - auto pZone = make_InstanceContent( pInstanceContent, pInstanceContent->data().TerritoryType, getNextInstanceId(), - " ", name, instanceContentId ); + auto pZone = make_InstanceContent( pInstanceContent, instanceContentData.TerritoryType, getNextInstanceId(), " ", name, instanceContentId ); pZone->init(); m_instanceContentIdToInstanceMap[ instanceContentId ][ pZone->getGuId() ] = pZone; @@ -402,13 +386,12 @@ Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::findOrCreateHousi auto& housingMgr = Common::Service< Manager::HousingMgr >::ref(); auto parentZone = std::dynamic_pointer_cast< HousingZone >( - getTerritoryByGuId( housingMgr.toLandSetId( static_cast< uint16_t >( landIdent.territoryTypeId ), - static_cast< uint8_t >( landIdent.wardNum ) ) ) ); + getTerritoryByGuId( housingMgr.toLandSetId( landIdent.territoryTypeId, landIdent.wardNum ) ) ); if( !parentZone ) return nullptr; - auto land = parentZone->getLand( landIdent.landId ); + auto land = parentZone->getLand( static_cast< uint8_t >( landIdent.landId ) ); if( !land ) return nullptr; @@ -447,7 +430,7 @@ Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::findOrCreateHousi if( !terriInfo ) return nullptr; - auto zone = World::Territory::Housing::make_HousingInteriorTerritory( landIdent, territoryTypeId, + auto zone = Territory::Housing::make_HousingInteriorTerritory( landIdent, territoryTypeId, getNextInstanceId(), terriInfo->getString( terriInfo->data().Name ), house->getHouseName() ); @@ -467,7 +450,6 @@ bool Sapphire::World::Manager::TerritoryMgr::removeTerritoryInstance( uint32_t g return false; m_guIdToTerritoryPtrMap.erase( pZone->getGuId() ); - m_instanceZoneSet.erase( pZone ); m_territorySet.erase( pZone ); @@ -617,17 +599,7 @@ bool Sapphire::World::Manager::TerritoryMgr::movePlayer( const TerritoryPtr& pZo player.initSpawnIdQueue(); player.setTerritoryTypeId( pZone->getTerritoryTypeId() ); - - if( isHousingTerritory( pZone->getTerritoryTypeId() ) ) - { - auto pHousing = std::dynamic_pointer_cast< HousingZone >( pZone ); - if( pHousing ) - player.setTerritoryId( pHousing->getLandSetId() ); - } - else - { - player.setTerritoryId( pZone->getGuId() ); - } + player.setTerritoryId( pZone->getGuId() ); bool playerLoaded = player.isLoadingComplete(); diff --git a/src/world/Manager/TerritoryMgr.h b/src/world/Manager/TerritoryMgr.h index b10501ac..031717a2 100644 --- a/src/world/Manager/TerritoryMgr.h +++ b/src/world/Manager/TerritoryMgr.h @@ -155,7 +155,6 @@ namespace Sapphire::World::Manager private: using TerritoryTypeDetailCache = std::unordered_map< uint16_t, std::shared_ptr< Component::Excel::ExcelStruct< Component::Excel::TerritoryType > > >; using InstanceIdToTerritoryPtrMap = std::unordered_map< uint32_t, TerritoryPtr >; - using LandSetIdToTerritoryPtrMap = std::unordered_map< uint32_t, TerritoryPtr >; using TerritoryTypeIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToTerritoryPtrMap >; using InstanceContentIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToTerritoryPtrMap >; using QuestBattleIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToTerritoryPtrMap >; diff --git a/src/world/Network/Handlers/HousingPacketHandlers.cpp b/src/world/Network/Handlers/HousingPacketHandlers.cpp index 6eac77dd..392206fa 100644 --- a/src/world/Network/Handlers/HousingPacketHandlers.cpp +++ b/src/world/Network/Handlers/HousingPacketHandlers.cpp @@ -44,7 +44,7 @@ void Sapphire::Network::GameConnection::landRenameHandler( const Packets::FFXIVA auto& housingMgr = Common::Service< HousingMgr >::ref(); auto& teriMgr = Common::Service< TerritoryMgr >::ref(); - auto landSetId = housingMgr.toLandSetId( packet.data().landId.territoryTypeId, static_cast< uint8_t >( packet.data().landId.wardNum ) ); + auto landSetId = housingMgr.toLandSetId( packet.data().landId.territoryTypeId, static_cast< int8_t >( packet.data().landId.wardNum ) ); auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri ); diff --git a/src/world/Territory/Housing/HousingInteriorTerritory.cpp b/src/world/Territory/Housing/HousingInteriorTerritory.cpp index 51a940f4..33c258b3 100644 --- a/src/world/Territory/Housing/HousingInteriorTerritory.cpp +++ b/src/world/Territory/Housing/HousingInteriorTerritory.cpp @@ -61,7 +61,7 @@ void Sapphire::World::Territory::Housing::HousingInteriorTerritory::onPlayerZone auto indoorInitPacket = makeZonePacket< FFXIVIpcInterior >( player.getId() ); - auto landSetId = housingMgr.toLandSetId( static_cast< uint16_t >( m_landIdent.territoryTypeId ), static_cast< uint8_t >( m_landIdent.wardNum ) ); + auto landSetId = housingMgr.toLandSetId( m_landIdent.territoryTypeId, m_landIdent.wardNum ); auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref(); auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); diff --git a/src/world/Territory/HousingZone.cpp b/src/world/Territory/HousingZone.cpp index 09d0af3d..0def7225 100644 --- a/src/world/Territory/HousingZone.cpp +++ b/src/world/Territory/HousingZone.cpp @@ -32,7 +32,6 @@ Sapphire::HousingZone::HousingZone( uint8_t wardNum, uint16_t territoryTypeId, const std::string& internalName, const std::string& contentName ) : Territory( territoryTypeId, ( static_cast< uint32_t >( territoryTypeId ) << 16 ) | wardNum, internalName, contentName ), m_wardNum( wardNum ), - m_territoryTypeId( territoryTypeId ), m_landSetId( ( static_cast< uint32_t >( territoryTypeId ) << 16 ) | wardNum ) { @@ -129,9 +128,7 @@ bool Sapphire::HousingZone::init() // setup house if( entry.m_houseId ) { - auto house = make_House( entry.m_houseId, m_landSetId, land->getLandIdent(), entry.m_estateName, - entry.m_estateComment ); - + auto house = make_House( entry.m_houseId, m_landSetId, land->getLandIdent(), entry.m_estateName, entry.m_estateComment ); housingMgr.updateHouseModels( house ); land->setHouse( house ); } @@ -185,7 +182,7 @@ void Sapphire::HousingZone::sendLandSet( Entity::Player& player ) landsetInitializePacket->data().LandSetId.landId = m_landSetId; landsetInitializePacket->data().LandSetId.territoryTypeId = m_territoryTypeId; //TODO: get current WorldId - landsetInitializePacket->data().LandSetId.worldId = 67; + landsetInitializePacket->data().LandSetId.worldId = server.getWorldId(); for( uint8_t i = 0, count = 0; i < 30; ++i, ++count ) { diff --git a/src/world/Territory/HousingZone.h b/src/world/Territory/HousingZone.h index 0408f22f..bb1f7be8 100644 --- a/src/world/Territory/HousingZone.h +++ b/src/world/Territory/HousingZone.h @@ -80,7 +80,6 @@ namespace Sapphire LandPtrMap m_landPtrMap; uint8_t m_wardNum; uint32_t m_landSetId; - uint32_t m_territoryTypeId; YardObjectArray m_yardObjects{}; YardObjectArrayBoundsArray m_yardObjectArrayBounds;