mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 14:57:44 +00:00
Clean up of move logic for housing territories, potentially some breakage. Needs to be tested still
This commit is contained in:
parent
7402327d26
commit
00f0c1b431
14 changed files with 114 additions and 89 deletions
|
@ -509,18 +509,15 @@ bool Sapphire::Entity::Player::exitInstance()
|
|||
resetHp();
|
||||
resetMp();
|
||||
|
||||
TerritoryPtr pTeri = nullptr;
|
||||
// check if housing zone
|
||||
if( teriMgr.isHousingTerritory( m_prevTerritoryTypeId ) )
|
||||
{
|
||||
if( !teriMgr.movePlayer( teriMgr.getZoneByLandSetId( m_prevTerritoryId ), *this ) )
|
||||
return false;
|
||||
}
|
||||
pTeri = teriMgr.getTerritoryByGuId( m_prevTerritoryId );
|
||||
else
|
||||
{
|
||||
auto pPrevZone = teriMgr.getZoneByTerritoryTypeId( m_prevTerritoryTypeId );
|
||||
if( !teriMgr.movePlayer( pPrevZone, *this ) )
|
||||
pTeri = teriMgr.getZoneByTerritoryTypeId( m_prevTerritoryTypeId );
|
||||
|
||||
if( !teriMgr.movePlayer( pTeri, *this ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
m_pos = m_prevPos;
|
||||
m_rot = m_prevRot;
|
||||
|
|
|
@ -49,7 +49,7 @@ const uint64_t World::Manager::ChatChannelMgr::createChatChannel( Common::ChatCh
|
|||
return cId.ChannelID;
|
||||
}
|
||||
|
||||
void World::Manager::ChatChannelMgr::addPlayerToChannel( uint64_t channelId, Entity::Player& player )
|
||||
void World::Manager::ChatChannelMgr::addToChannel( uint64_t channelId, Entity::Player& player )
|
||||
{
|
||||
if( !isChannelValid( channelId ) )
|
||||
{
|
||||
|
@ -71,7 +71,7 @@ void World::Manager::ChatChannelMgr::addPlayerToChannel( uint64_t channelId, Ent
|
|||
m_channels[ channelId ].emplace_back( player.getAsPlayer() );
|
||||
}
|
||||
|
||||
void World::Manager::ChatChannelMgr::removePlayerFromChannel( uint64_t channelId, Entity::Player& player )
|
||||
void World::Manager::ChatChannelMgr::removeFromChannel( uint64_t channelId, Entity::Player& player )
|
||||
{
|
||||
if( !isChannelValid( channelId ) )
|
||||
{
|
||||
|
|
|
@ -30,8 +30,8 @@ namespace Sapphire::World::Manager
|
|||
|
||||
const uint64_t createChatChannel( Common::ChatChannelType type );
|
||||
|
||||
void addPlayerToChannel( uint64_t channelId, Entity::Player& player );
|
||||
void removePlayerFromChannel( uint64_t channelId, Entity::Player& player );
|
||||
void addToChannel( uint64_t channelId, Entity::Player& player );
|
||||
void removeFromChannel( uint64_t channelId, Entity::Player& player );
|
||||
|
||||
void sendMessageToChannel( uint64_t channelId, Entity::Player& sender, const std::string& message );
|
||||
|
||||
|
|
|
@ -290,22 +290,19 @@ uint32_t Sapphire::World::Manager::HousingMgr::toLandSetId( uint16_t territoryTy
|
|||
return ( static_cast< uint32_t >( territoryTypeId ) << 16 ) | wardId;
|
||||
}
|
||||
|
||||
Sapphire::Data::HousingZonePtr Sapphire::World::Manager::HousingMgr::getHousingZoneByLandSetId( uint32_t id )
|
||||
{
|
||||
auto& terriMgr = Common::Service< TerritoryMgr >::ref();
|
||||
return std::dynamic_pointer_cast< HousingZone >( terriMgr.getZoneByLandSetId( id ) );
|
||||
}
|
||||
|
||||
Sapphire::LandPtr Sapphire::World::Manager::HousingMgr::getLandByOwnerId( uint64_t id )
|
||||
{
|
||||
|
||||
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
|
||||
auto res = db.query( "SELECT LandSetId, LandId FROM land WHERE OwnerId = " + std::to_string( id ) );
|
||||
|
||||
if( !res->next() )
|
||||
return nullptr;
|
||||
|
||||
auto hZone = getHousingZoneByLandSetId( res->getUInt( 1 ) );
|
||||
|
||||
auto teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||
auto pTeri = teriMgr.getTerritoryByGuId( res->getUInt( 1 ) );
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri );
|
||||
if( !hZone )
|
||||
return nullptr;
|
||||
|
||||
|
@ -319,7 +316,10 @@ 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 hZone = getHousingZoneByLandSetId( landSetId );
|
||||
|
||||
auto teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||
auto pTeri = teriMgr.getTerritoryByGuId( landSetId );
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri );
|
||||
|
||||
if( !hZone )
|
||||
return;
|
||||
|
@ -357,7 +357,9 @@ void Sapphire::World::Manager::HousingMgr::sendLandSignFree( Entity::Player& pla
|
|||
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 hZone = getHousingZoneByLandSetId( landSetId );
|
||||
auto teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||
auto pTeri = teriMgr.getTerritoryByGuId( landSetId );
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri );
|
||||
|
||||
if( !hZone )
|
||||
return;
|
||||
|
@ -479,7 +481,10 @@ void Sapphire::World::Manager::HousingMgr::sendWardLandInfo( Entity::Player& pla
|
|||
auto pSession = server.getSession( player.getCharacterId() );
|
||||
|
||||
auto landSetId = toLandSetId( territoryTypeId, wardId );
|
||||
auto hZone = getHousingZoneByLandSetId( landSetId );
|
||||
|
||||
auto teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||
auto pTeri = teriMgr.getTerritoryByGuId( landSetId );
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri );
|
||||
|
||||
if( !hZone )
|
||||
return;
|
||||
|
@ -492,7 +497,6 @@ void Sapphire::World::Manager::HousingMgr::sendWardLandInfo( Entity::Player& pla
|
|||
wardInfoPacket->data().LandSetId.worldId = 67;
|
||||
|
||||
for( int i = 0; i < 30; i++ )
|
||||
for( int i = 0; i < 60; i++ )
|
||||
{
|
||||
auto land = hZone->getLand( i );
|
||||
assert( land );
|
||||
|
@ -542,7 +546,9 @@ void Sapphire::World::Manager::HousingMgr::sendEstateGreeting( Entity::Player& p
|
|||
{
|
||||
auto& server = Common::Service< World::WorldServer >::ref();
|
||||
auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
|
||||
auto hZone = getHousingZoneByLandSetId( landSetId );
|
||||
auto teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||
auto pTeri = teriMgr.getTerritoryByGuId( landSetId );
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri );
|
||||
|
||||
if( !hZone )
|
||||
return;
|
||||
|
@ -733,7 +739,9 @@ void Sapphire::World::Manager::HousingMgr::requestEstateRename( Entity::Player&
|
|||
auto pSession = server.getSession( player.getCharacterId() );
|
||||
|
||||
auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
|
||||
auto hZone = getHousingZoneByLandSetId( landSetId );
|
||||
auto teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||
auto pTeri = teriMgr.getTerritoryByGuId( landSetId );
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri );
|
||||
|
||||
if( !hZone )
|
||||
return;
|
||||
|
@ -758,7 +766,9 @@ void Sapphire::World::Manager::HousingMgr::requestEstateEditGreeting( Entity::Pl
|
|||
auto pSession = server.getSession( player.getCharacterId() );
|
||||
|
||||
auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
|
||||
auto hZone = getHousingZoneByLandSetId( landSetId );
|
||||
auto teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||
auto pTeri = teriMgr.getTerritoryByGuId( landSetId );
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri );
|
||||
|
||||
if( !hZone )
|
||||
return;
|
||||
|
@ -782,12 +792,14 @@ 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 zone = getHousingZoneByLandSetId( landSetId );
|
||||
auto teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||
auto pTeri = teriMgr.getTerritoryByGuId( landSetId );
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri );
|
||||
|
||||
if( !zone )
|
||||
if( !hZone )
|
||||
return;
|
||||
|
||||
auto land = zone->getLand( static_cast< uint8_t >( ident.landId ) );
|
||||
auto land = hZone->getLand( static_cast< uint8_t >( ident.landId ) );
|
||||
if( !land )
|
||||
return;
|
||||
|
||||
|
@ -810,7 +822,9 @@ void Sapphire::World::Manager::HousingMgr::requestEstateEditGuestAccess( Entity:
|
|||
auto pSession = server.getSession( player.getCharacterId() );
|
||||
|
||||
auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
|
||||
auto hZone = getHousingZoneByLandSetId( landSetId );
|
||||
auto teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||
auto pTeri = teriMgr.getTerritoryByGuId( landSetId );
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri );
|
||||
|
||||
if( !hZone )
|
||||
return;
|
||||
|
@ -866,12 +880,14 @@ 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 exteriorZone = getHousingZoneByLandSetId( landSetId );
|
||||
auto teriMgr = Common::Service< TerritoryMgr >::ref();
|
||||
auto pTeri = teriMgr.getTerritoryByGuId( landSetId );
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri );
|
||||
|
||||
if( !exteriorZone )
|
||||
if( !hZone )
|
||||
return;
|
||||
|
||||
targetLand = exteriorZone->getLand( static_cast< uint8_t >( ident.landId ) );
|
||||
targetLand = hZone->getLand( static_cast< uint8_t >( ident.landId ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1012,9 +1028,13 @@ 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 landSet = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
|
||||
auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
|
||||
|
||||
land = getHousingZoneByLandSetId( landSet )->getLand( static_cast< uint8_t >( ident.landId ) );
|
||||
auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||
auto pTeri = teriMgr.getTerritoryByGuId( landSetId );
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri );
|
||||
|
||||
land = hZone->getLand( static_cast< uint8_t >( ident.landId ) );
|
||||
}
|
||||
// wtf?
|
||||
else
|
||||
|
@ -1084,9 +1104,13 @@ 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 landSet = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
|
||||
auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
|
||||
|
||||
land = getHousingZoneByLandSetId( landSet )->getLand( static_cast< uint8_t >( ident.landId ) );
|
||||
auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||
auto pTeri = teriMgr.getTerritoryByGuId( landSetId );
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri );
|
||||
|
||||
land = hZone->getLand( static_cast< uint8_t >( ident.landId ) );
|
||||
}
|
||||
|
||||
if( !hasPermission( player, *land, 0 ) )
|
||||
|
@ -1269,8 +1293,12 @@ 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 landSet = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
|
||||
auto land = getHousingZoneByLandSetId( landSet )->getLand( static_cast< uint8_t >( ident.landId ) );
|
||||
auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
|
||||
|
||||
auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||
auto pTeri = teriMgr.getTerritoryByGuId( landSetId );
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri );
|
||||
auto land = hZone->getLand( static_cast< uint8_t >( ident.landId ) );
|
||||
|
||||
if( !land )
|
||||
return;
|
||||
|
@ -1278,7 +1306,6 @@ void Sapphire::World::Manager::HousingMgr::reqMoveHousingItem( Entity::Player& p
|
|||
if( !hasPermission( player, *land, 0 ) )
|
||||
return;
|
||||
|
||||
auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||
auto pZone = teriMgr.getTerritoryByGuId( player.getTerritoryId() );
|
||||
|
||||
// todo: what happens when either of these fail? how does the server let the client know that the moment failed
|
||||
|
@ -1391,8 +1418,13 @@ void Sapphire::World::Manager::HousingMgr::reqRemoveHousingItem( Sapphire::Entit
|
|||
if( auto terri = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( pZone ) )
|
||||
{
|
||||
auto ident = terri->getLandIdent();
|
||||
auto landSet = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
|
||||
auto land = getHousingZoneByLandSetId( landSet )->getLand( static_cast< uint8_t >( ident.landId ) );
|
||||
auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
|
||||
|
||||
auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||
auto pTeri = teriMgr.getTerritoryByGuId( landSetId );
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri );
|
||||
|
||||
auto land = hZone->getLand( static_cast< uint8_t >( ident.landId ) );
|
||||
|
||||
if( !land )
|
||||
return;
|
||||
|
@ -1635,8 +1667,12 @@ void Sapphire::World::Manager::HousingMgr::reqEstateInteriorRemodel( Sapphire::E
|
|||
return;
|
||||
|
||||
auto ident = terri->getLandIdent();
|
||||
auto landSet = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
|
||||
auto land = getHousingZoneByLandSetId( landSet )->getLand( static_cast< uint8_t >( ident.landId ) );
|
||||
auto landSetId = toLandSetId( static_cast< uint16_t >( ident.territoryTypeId ), static_cast< uint8_t >( ident.wardNum ) );
|
||||
|
||||
auto pTeri = teriMgr.getTerritoryByGuId( landSetId );
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri );
|
||||
|
||||
auto land = hZone->getLand( static_cast< uint8_t >( ident.landId ) );
|
||||
|
||||
if( !land )
|
||||
return;
|
||||
|
|
|
@ -72,7 +72,6 @@ namespace Sapphire::World::Manager
|
|||
bool init();
|
||||
|
||||
uint32_t toLandSetId( uint16_t territoryTypeId, uint8_t wardId ) const;
|
||||
Sapphire::Data::HousingZonePtr getHousingZoneByLandSetId( uint32_t id );
|
||||
Sapphire::LandPtr getLandByOwnerId( uint64_t id );
|
||||
|
||||
void sendLandSignOwned( Entity::Player& player, const Common::LandIdent ident );
|
||||
|
|
|
@ -168,7 +168,7 @@ Sapphire::LinkshellPtr Sapphire::World::Manager::LinkshellMgr::createLinkshell(
|
|||
|
||||
auto& chatChannelMgr = Common::Service< Manager::ChatChannelMgr >::ref();
|
||||
auto chatChannelId = chatChannelMgr.createChatChannel( Common::ChatChannelType::LinkshellChat );
|
||||
chatChannelMgr.addPlayerToChannel( chatChannelId, player );
|
||||
chatChannelMgr.addToChannel( chatChannelId, player );
|
||||
|
||||
uint64_t masterId = player.getCharacterId();
|
||||
|
||||
|
@ -305,7 +305,7 @@ void LinkshellMgr::kickPlayer( Entity::Player& sourcePlayer, Entity::Player& kic
|
|||
lsPtr->getName(), kickedPlayer.getName() );
|
||||
|
||||
server.queueForPlayer( sourcePlayer.getCharacterId(), linkshellKickResult1 );
|
||||
chatChannelMgr.removePlayerFromChannel( lsPtr->getChatChannel(), kickedPlayer );
|
||||
chatChannelMgr.removeFromChannel( lsPtr->getChatChannel(), kickedPlayer );
|
||||
}
|
||||
|
||||
void LinkshellMgr::sendLinkshellList( Entity::Player& player )
|
||||
|
@ -355,7 +355,7 @@ void LinkshellMgr::leaveLinkshell( uint64_t lsId, uint64_t characterId )
|
|||
lsPtr->removeMember( characterId );
|
||||
writeLinkshell( lsId );
|
||||
|
||||
chatChannelMgr.removePlayerFromChannel( lsPtr->getChatChannel(), *leavingPlayer );
|
||||
chatChannelMgr.removeFromChannel( lsPtr->getChatChannel(), *leavingPlayer );
|
||||
sendLinkshellList( *leavingPlayer );
|
||||
}
|
||||
|
||||
|
@ -372,7 +372,7 @@ void LinkshellMgr::joinLinkshell( uint64_t lsId, uint64_t characterId )
|
|||
lsPtr->removeInvite( characterId );
|
||||
writeLinkshell( lsId );
|
||||
|
||||
chatChannelMgr.addPlayerToChannel( lsPtr->getChatChannel(), *joiningPlayer );
|
||||
chatChannelMgr.addToChannel( lsPtr->getChatChannel(), *joiningPlayer );
|
||||
|
||||
sendLinkshellList( *joiningPlayer );
|
||||
}
|
||||
|
|
|
@ -59,8 +59,8 @@ void Sapphire::World::Manager::PartyMgr::onJoin( uint32_t joinerId, uint32_t inv
|
|||
invitingPlayer.setPartyId( partyId );
|
||||
invitingPlayer.addOnlineStatus( Common::OnlineStatus::PartyLeader );
|
||||
|
||||
ccMgr.addPlayerToChannel( party->ChatChannel, invitingPlayer );
|
||||
ccMgr.addPlayerToChannel( party->ChatChannel, inviteePlayer );
|
||||
ccMgr.addToChannel( party->ChatChannel, invitingPlayer );
|
||||
ccMgr.addToChannel( party->ChatChannel, inviteePlayer );
|
||||
|
||||
party->MemberId.push_back( invitingPlayer.getId() );
|
||||
party->MemberId.push_back( inviteePlayer.getId() );
|
||||
|
@ -75,7 +75,7 @@ void Sapphire::World::Manager::PartyMgr::onJoin( uint32_t joinerId, uint32_t inv
|
|||
inviteePlayer.setPartyId( partyId );
|
||||
inviteePlayer.addOnlineStatus( Common::OnlineStatus::PartyMember );
|
||||
|
||||
ccMgr.addPlayerToChannel( party->ChatChannel, inviteePlayer );
|
||||
ccMgr.addToChannel( party->ChatChannel, inviteePlayer );
|
||||
|
||||
party->MemberId.push_back( inviteePlayer.getId() );
|
||||
party->PartyCount++;
|
||||
|
@ -440,6 +440,6 @@ void Sapphire::World::Manager::PartyMgr::removeMember( Sapphire::World::Manager:
|
|||
{
|
||||
auto& ccMgr = Common::Service< World::Manager::ChatChannelMgr >::ref();
|
||||
pMember->setPartyId( 0 );
|
||||
ccMgr.removePlayerFromChannel( party.ChatChannel, *pMember );
|
||||
ccMgr.removeFromChannel( party.ChatChannel, *pMember );
|
||||
party.MemberId.erase( std::remove( party.MemberId.begin(), party.MemberId.end(), pMember->getId() ), party.MemberId.end() );
|
||||
}
|
||||
|
|
|
@ -254,24 +254,22 @@ bool Sapphire::World::Manager::TerritoryMgr::createHousingTerritories()
|
|||
|
||||
for( wardNum = 0; wardNum < wardMaxNum; wardNum++ )
|
||||
{
|
||||
uint32_t guid = getNextInstanceId();
|
||||
|
||||
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}",
|
||||
territoryTypeId,
|
||||
guid,
|
||||
pHousingZone->getLandSetId(),
|
||||
territoryInfo->data().IntendedUse,
|
||||
territoryInfo->getString( territoryInfo->data().Name ),
|
||||
pPlaceName->getString( pPlaceName->data().Text.SGL ),
|
||||
wardNum );
|
||||
|
||||
auto pHousingZone = make_HousingZone( wardNum, territoryTypeId, guid, territoryInfo->getString( territoryInfo->data().Name ), pPlaceName->getString( pPlaceName->data().Text.SGL ) );
|
||||
pHousingZone->init();
|
||||
|
||||
InstanceIdToTerritoryPtrMap instanceMap;
|
||||
instanceMap[ guid ] = pHousingZone;
|
||||
m_guIdToTerritoryPtrMap[ guid ] = pHousingZone;
|
||||
m_territoryTypeIdToInstanceGuidMap[ territoryTypeId ][ guid ] = pHousingZone;
|
||||
m_landSetIdToTerritoryPtrMap[ pHousingZone->getLandSetId() ] = pHousingZone;
|
||||
instanceMap[ pHousingZone->getLandSetId() ] = pHousingZone;
|
||||
m_guIdToTerritoryPtrMap[ pHousingZone->getLandSetId() ] = pHousingZone;
|
||||
m_territoryTypeIdToInstanceGuidMap[ territoryTypeId ][ pHousingZone->getLandSetId() ] = pHousingZone;
|
||||
m_territorySet.insert( { pHousingZone } );
|
||||
}
|
||||
|
||||
|
@ -404,7 +402,7 @@ Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::findOrCreateHousi
|
|||
auto& housingMgr = Common::Service< Manager::HousingMgr >::ref();
|
||||
|
||||
auto parentZone = std::dynamic_pointer_cast< HousingZone >(
|
||||
getZoneByLandSetId( housingMgr.toLandSetId( static_cast< uint16_t >( landIdent.territoryTypeId ),
|
||||
getTerritoryByGuId( housingMgr.toLandSetId( static_cast< uint16_t >( landIdent.territoryTypeId ),
|
||||
static_cast< uint8_t >( landIdent.wardNum ) ) ) );
|
||||
|
||||
if( !parentZone )
|
||||
|
@ -503,14 +501,6 @@ Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::getZoneByTerritor
|
|||
return zoneMap->second.begin()->second;
|
||||
}
|
||||
|
||||
Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::getZoneByLandSetId( uint32_t landSetId ) const
|
||||
{
|
||||
auto zoneMap = m_landSetIdToTerritoryPtrMap.find( landSetId );
|
||||
if( zoneMap == m_landSetIdToTerritoryPtrMap.end() )
|
||||
return nullptr;
|
||||
|
||||
return zoneMap->second;
|
||||
}
|
||||
|
||||
void Sapphire::World::Manager::TerritoryMgr::updateTerritoryInstances( uint64_t tickCount )
|
||||
{
|
||||
|
@ -728,7 +718,7 @@ bool Sapphire::World::Manager::TerritoryMgr::joinWorld( Sapphire::Entity::Player
|
|||
else if( isInternalEstateTerritory( zoneId ) )
|
||||
{
|
||||
// todo: this needs to go to the area just outside of the plot door
|
||||
pCurrZone = getZoneByLandSetId( player.getPrevTerritoryId() );
|
||||
pCurrZone = getTerritoryByGuId( player.getPrevTerritoryId() );
|
||||
|
||||
zoneId = player.getPrevTerritoryTypeId();
|
||||
auto prevPos = player.getPrevPos();
|
||||
|
@ -737,7 +727,7 @@ bool Sapphire::World::Manager::TerritoryMgr::joinWorld( Sapphire::Entity::Player
|
|||
}
|
||||
else if( isHousingTerritory( zoneId ) )
|
||||
{
|
||||
pCurrZone = getZoneByLandSetId( player.getTerritoryId() );
|
||||
pCurrZone = getTerritoryByGuId( player.getTerritoryId() );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -127,9 +127,6 @@ namespace Sapphire::World::Manager
|
|||
TODO: Mind multiple instances?! */
|
||||
TerritoryPtr getZoneByTerritoryTypeId( uint32_t territoryTypeId ) const;
|
||||
|
||||
/*! returns a Zone by landSetId */
|
||||
TerritoryPtr getZoneByLandSetId( uint32_t landSetId ) const;
|
||||
|
||||
bool movePlayer( const TerritoryPtr&, Entity::Player& player );
|
||||
|
||||
/*! returns an instancePtr if the player is still bound to an isntance */
|
||||
|
@ -173,9 +170,6 @@ namespace Sapphire::World::Manager
|
|||
/*! map holding actual instances of default territories */
|
||||
TerritoryTypeIdToInstanceMap m_territoryTypeIdToInstanceGuidMap;
|
||||
|
||||
/*! map holding actual instances of default territories */
|
||||
LandSetIdToTerritoryPtrMap m_landSetIdToTerritoryPtrMap;
|
||||
|
||||
/*! map holding actual instances of InstanceContent */
|
||||
InstanceContentIdToInstanceMap m_instanceContentIdToInstanceMap;
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "Network/PacketWrappers/PlayerSetupPacket.h"
|
||||
|
||||
#include "Manager/HousingMgr.h"
|
||||
#include "Manager/TerritoryMgr.h"
|
||||
|
||||
#include "Action/Action.h"
|
||||
|
||||
|
@ -41,14 +42,17 @@ void Sapphire::Network::GameConnection::landRenameHandler( const Packets::FFXIVA
|
|||
const auto packet = ZoneChannelPacket< Client::FFXIVIpcHousingHouseName >( inPacket );
|
||||
|
||||
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 pZone = housingMgr.getHousingZoneByLandSetId( landSetId );
|
||||
if( !pZone )
|
||||
auto pTeri = teriMgr.getTerritoryByGuId( landSetId );
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri );
|
||||
|
||||
if( !hZone )
|
||||
return;
|
||||
|
||||
auto pLand = pZone->getLand( static_cast< uint8_t >( packet.data().landId.landId ) );
|
||||
auto pLand = hZone->getLand( static_cast< uint8_t >( packet.data().landId.landId ) );
|
||||
if( !pLand )
|
||||
return;
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ void Sapphire::Network::GameConnection::joinChatChannelHandler( const Packets::F
|
|||
if( !chatChannelMgr.isChannelValid( joinChannelPacket.data().ChannelID ) )
|
||||
return Logger::warn( "Failed to join chat channel - Invalid chat channel specified!" );
|
||||
|
||||
chatChannelMgr.addPlayerToChannel( joinChannelPacket.data().ChannelID, player );
|
||||
chatChannelMgr.addToChannel( joinChannelPacket.data().ChannelID, player );
|
||||
|
||||
auto chatChannelResultPacket = makeZonePacket< FFXIVIpcChatChannelResult >( player.getId() );
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "Actor/GameObject.h"
|
||||
#include "Actor/EventObject.h"
|
||||
#include "Manager/HousingMgr.h"
|
||||
#include "Manager/TerritoryMgr.h"
|
||||
#include "WorldServer.h"
|
||||
#include "Territory/Land.h"
|
||||
#include "Territory/House.h"
|
||||
|
@ -61,7 +62,12 @@ 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 pLand = housingMgr.getHousingZoneByLandSetId( landSetId )->getLand( static_cast< uint8_t >( m_landIdent.landId ) );
|
||||
|
||||
auto teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||
auto pTeri = teriMgr.getTerritoryByGuId( landSetId );
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri );
|
||||
auto pLand = hZone->getLand( static_cast< uint8_t >( m_landIdent.landId ) );
|
||||
|
||||
auto pHouse = pLand->getHouse();
|
||||
|
||||
for( auto i = 0; i < 10; i++ )
|
||||
|
|
|
@ -28,9 +28,9 @@ using namespace Sapphire::Network::Packets;
|
|||
using namespace Sapphire::Network::Packets::WorldPackets::Server;
|
||||
using namespace Sapphire::World::Manager;
|
||||
|
||||
Sapphire::HousingZone::HousingZone( uint8_t wardNum, uint16_t territoryTypeId, uint32_t guId,
|
||||
Sapphire::HousingZone::HousingZone( uint8_t wardNum, uint16_t territoryTypeId,
|
||||
const std::string& internalName, const std::string& contentName ) :
|
||||
Territory( territoryTypeId, guId, internalName, 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 )
|
||||
|
|
|
@ -29,7 +29,6 @@ namespace Sapphire
|
|||
public:
|
||||
HousingZone( uint8_t landSetId,
|
||||
uint16_t territoryTypeId,
|
||||
uint32_t guId,
|
||||
const std::string& internalName,
|
||||
const std::string& contentName );
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue