diff --git a/src/world/Actor/Player.cpp b/src/world/Actor/Player.cpp index 8b94b238..49dfdb49 100644 --- a/src/world/Actor/Player.cpp +++ b/src/world/Actor/Player.cpp @@ -1618,8 +1618,7 @@ void Sapphire::Entity::Player::sendZonePackets() state |= HasAetheryte; } - auto ident = pLand->getLandIdent(); - setLandFlags( LandFlagsSlot::Private, state, ident.landId, ident.wardNum, ident.territoryTypeId ); + setLandFlags( LandFlagsSlot::Private, state, pLand->getLandIdent() ); } sendLandFlags(); @@ -1800,12 +1799,10 @@ bool Sapphire::Entity::Player::isOnEnterEventDone() const return m_onEnterEventDone; } -void Sapphire::Entity::Player::setLandFlags( uint8_t flagSlot, uint32_t landFlags, - int16_t landId, int16_t wardNum, int16_t zoneId ) +void Sapphire::Entity::Player::setLandFlags( uint8_t flagSlot, uint32_t landFlags, Common::LandIdent ident ) { - m_landFlags[ flagSlot ].landIdent.landId = landId; - m_landFlags[ flagSlot ].landIdent.wardNum = wardNum; - m_landFlags[ flagSlot ].landIdent.territoryTypeId = zoneId; + m_landFlags[ flagSlot ].landIdent = ident; + // todo: leave this in for now but we really need to handle this world id shit properly m_landFlags[ flagSlot ].landIdent.worldId = 67; m_landFlags[ flagSlot ].landFlags = landFlags; m_landFlags[ flagSlot ].unkown1 = 0; diff --git a/src/world/Actor/Player.h b/src/world/Actor/Player.h index 34ea3204..b0c8b1cf 100644 --- a/src/world/Actor/Player.h +++ b/src/world/Actor/Player.h @@ -765,7 +765,7 @@ namespace Sapphire::Entity // Housing Handling ////////////////////////////////////////////////////////////////////////////////////////////////////// - void setLandFlags( uint8_t permissionSet, uint32_t landFlags, int16_t landId, int16_t wardNum, int16_t zoneId ); + void setLandFlags( uint8_t permissionSet, uint32_t landFlags, Common::LandIdent ident ); void sendLandFlags(); void sendLandFlagsSlot( Common::LandFlagsSlot slot ); diff --git a/src/world/DebugCommand/DebugCommandHandler.cpp b/src/world/DebugCommand/DebugCommandHandler.cpp index 2eaa57ed..b3898656 100644 --- a/src/world/DebugCommand/DebugCommandHandler.cpp +++ b/src/world/DebugCommand/DebugCommandHandler.cpp @@ -1006,29 +1006,34 @@ void Sapphire::DebugCommandHandler::housing( char* data, Entity::Player& player, subCommand = params; } - if( subCommand == "permission" || subCommand == "perm" ) - { - uint8_t permissionSet; - sscanf( params.c_str(), "%hhu", &permissionSet ); - - if ( permissionSet < 5 ) - { - auto pZone = player.getCurrentZone(); - if( pTeriMgr->isHousingTerritory( pZone->getTerritoryTypeId() ) ) - { - auto pHousing = std::dynamic_pointer_cast< HousingZone >( pZone ); - if( pHousing ) - { - player.setLandFlags( permissionSet, 0, pHousing->getLandSetId(), pHousing->getWardNum(), pHousing->getTerritoryTypeId() ); - player.sendLandFlags(); - } - else - player.sendDebug( "You aren't in a housing Zone." ); - } - } - else - player.sendDebug( "PermissionSet out of range." ); - } +// if( subCommand == "permission" || subCommand == "perm" ) +// { +// uint8_t permissionSet; +// sscanf( params.c_str(), "%hhu", &permissionSet ); +// +// if ( permissionSet < 5 ) +// { +// auto pZone = player.getCurrentZone(); +// if( pTeriMgr->isHousingTerritory( pZone->getTerritoryTypeId() ) ) +// { +// auto pHousing = std::dynamic_pointer_cast< HousingZone >( pZone ); +// if( pHousing ) +// { +// // todo: wat? +// Common::LandIdent ident {}; +// ident.wardNum = pHousing->getWardNum(); +// ident.territoryTypeId = pHousing->getTerritoryTypeId(); +// +// player.setLandFlags( permissionSet, 0, pHousing->getLandSetId(), ident ); +// player.sendLandFlags(); +// } +// else +// player.sendDebug( "You aren't in a housing Zone." ); +// } +// } +// else +// player.sendDebug( "PermissionSet out of range." ); +// } else { player.sendDebug( "Unknown sub command." ); diff --git a/src/world/Manager/HousingMgr.cpp b/src/world/Manager/HousingMgr.cpp index 02efb7de..44846d0e 100644 --- a/src/world/Manager/HousingMgr.cpp +++ b/src/world/Manager/HousingMgr.cpp @@ -165,8 +165,7 @@ Sapphire::LandPurchaseResult Sapphire::World::Manager::HousingMgr::purchaseLand( pLand->setState( HouseState::sold ); pLand->setLandType( Common::LandType::Private ); - player.setLandFlags( LandFlagsSlot::Private, 0x00, plot, - pHousing->getWardNum(), pHousing->getTerritoryTypeId() ); + player.setLandFlags( LandFlagsSlot::Private, 0x00, pLand->getLandIdent() ); player.sendLandFlagsSlot( LandFlagsSlot::Private ); @@ -217,7 +216,9 @@ bool Sapphire::World::Manager::HousingMgr::relinquishLand( Entity::Player& playe pLand->setLandType( Common::LandType::none ); pLand->updateLandDb(); - player.setLandFlags( LandFlagsSlot::Private, 0x00, 0xFF, 0xFF, 0xFF ); + Common::LandIdent ident { 0xFF, 0xFF, 0xFF, 0xFF }; + + player.setLandFlags( LandFlagsSlot::Private, 0x00, ident ); player.sendLandFlagsSlot( LandFlagsSlot::Private ); @@ -351,9 +352,7 @@ void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& pl player.eventStart( player.getId(), 0x000B0095, Event::EventHandler::EventType::Housing, 1, 1 ); player.playScene( 0x000B0095, 0, SET_BASE | HIDE_HOTBAR , 0, 1, plotNum, nullptr ); - auto ident = pLand->getLandIdent(); - - player.setLandFlags( LandFlagsSlot::Private, EstateBuilt, ident.landId, ident.wardNum, ident.territoryTypeId ); + player.setLandFlags( LandFlagsSlot::Private, EstateBuilt, pLand->getLandIdent() ); player.sendLandFlagsSlot( LandFlagsSlot::Private ); hZone->registerHouseEntranceEObj( plotNum );