mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-01 08:27:46 +00:00
Do not use the current zone for landdetail lookup but the provided territoryId
This commit is contained in:
parent
32fae0c986
commit
4915b62d7b
4 changed files with 26 additions and 16 deletions
|
@ -35,7 +35,7 @@ public:
|
|||
|
||||
auto pTerritory = player.getCurrentZone();
|
||||
auto pHousing = std::dynamic_pointer_cast< HousingZone >( pTerritory );
|
||||
auto pHouMgr = pFw->get< Core::HousingMgr >();
|
||||
auto pHouMgr = pFw->get< Core::HousingMgr >();
|
||||
|
||||
LandPurchaseResult res = pHouMgr->purchseLand( player, activeLand.plot,
|
||||
static_cast< uint8_t >( result.param2 ) );
|
||||
|
|
|
@ -328,16 +328,20 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
|
|||
{
|
||||
auto ward = static_cast< uint8_t >( ( param12 & 0xFF00 ) >> 8 );
|
||||
auto plot = static_cast< uint8_t >( param12 & 0xFF );
|
||||
auto territoryId = static_cast< uint16_t >( param11 & 0xFFFF );
|
||||
|
||||
auto pHousingMgr = g_fw.get< HousingMgr >();
|
||||
pHousingMgr->sendLandSignFree( player, ward, plot );
|
||||
pHousingMgr->sendLandSignFree( player, ward, plot, territoryId );
|
||||
break;
|
||||
}
|
||||
case ClientTriggerType::RequestLandSignOwned:
|
||||
{
|
||||
auto ward = static_cast< uint8_t >( ( param12 & 0xFF00 ) >> 8 );
|
||||
auto plot = static_cast< uint8_t >( param12 & 0xFF );
|
||||
auto territoryId = static_cast< uint16_t >( param11 & 0xFFFF );
|
||||
|
||||
auto pHousingMgr = g_fw.get< HousingMgr >();
|
||||
pHousingMgr->sendLandSignOwned( player, ward, plot );
|
||||
pHousingMgr->sendLandSignOwned( player, ward, plot, territoryId );
|
||||
break;
|
||||
}
|
||||
case ClientTriggerType::RequestLandRelinquish:
|
||||
|
@ -345,6 +349,7 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
|
|||
auto ward = static_cast< uint8_t >( ( param12 & 0xFF00 ) >> 8 );
|
||||
auto plot = static_cast< uint8_t >( param12 & 0xFF );
|
||||
auto pHousingMgr = g_fw.get< HousingMgr >();
|
||||
|
||||
pLog->debug( "Request to relinquish plot " + std::to_string( plot ) );
|
||||
// TODO: do stuff!
|
||||
break;
|
||||
|
|
|
@ -48,6 +48,11 @@ uint16_t Core::HousingMgr::getNexLandId()
|
|||
return ++m_lastLandId;
|
||||
}
|
||||
|
||||
uint32_t Core::HousingMgr::toLandSetId( uint16_t territoryTypeId, uint8_t wardId ) const
|
||||
{
|
||||
return ( static_cast< uint32_t >( territoryTypeId ) << 16 ) | wardId;
|
||||
}
|
||||
|
||||
void Core::HousingMgr::insertHousingZone( Core::Data::HousingZonePtr hZone )
|
||||
{
|
||||
uint16_t id = getNexLandId();
|
||||
|
@ -95,18 +100,17 @@ Core::LandPtr Core::HousingMgr::getLandByOwnerId( uint32_t id )
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void Core::HousingMgr::sendLandSignOwned( Entity::Player& player, uint8_t ward, uint8_t plot )
|
||||
void Core::HousingMgr::sendLandSignOwned( Entity::Player& player, uint8_t wardId, uint8_t plotId, uint16_t territoryTypeId )
|
||||
{
|
||||
player.setActiveLand( plot, ward );
|
||||
player.setActiveLand( plotId, wardId );
|
||||
|
||||
auto zone = player.getCurrentZone();
|
||||
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( zone );
|
||||
auto landSetId = toLandSetId( territoryTypeId, wardId );
|
||||
auto hZone = getHousingZoneByLandSetId( landSetId );
|
||||
|
||||
if( !hZone )
|
||||
return;
|
||||
|
||||
auto land = hZone->getLand( plot );
|
||||
auto land = hZone->getLand( plotId );
|
||||
if( !land )
|
||||
{
|
||||
land = getLandByOwnerId( player.getId() );
|
||||
|
@ -128,17 +132,17 @@ void Core::HousingMgr::sendLandSignOwned( Entity::Player& player, uint8_t ward,
|
|||
player.queuePacket( landInfoSignPacket );
|
||||
}
|
||||
|
||||
void Core::HousingMgr::sendLandSignFree( Entity::Player& player, uint8_t ward, uint8_t plot )
|
||||
void Core::HousingMgr::sendLandSignFree( Entity::Player& player, uint8_t wardId, uint8_t plotId, uint16_t territoryTypeId )
|
||||
{
|
||||
player.setActiveLand( plot, ward );
|
||||
player.setActiveLand( plotId, wardId );
|
||||
|
||||
auto zone = player.getCurrentZone();
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( zone );
|
||||
auto landSetId = toLandSetId( territoryTypeId, wardId );
|
||||
auto hZone = getHousingZoneByLandSetId( landSetId );
|
||||
|
||||
if( !hZone )
|
||||
return;
|
||||
|
||||
auto land = hZone->getLand( plot );
|
||||
auto land = hZone->getLand( plotId );
|
||||
auto plotPricePacket = makeZonePacket< Server::FFXIVIpcLandPriceUpdate >( player.getId() );
|
||||
plotPricePacket->data().price = land->getCurrentPrice();
|
||||
plotPricePacket->data().timeLeft = land->getDevaluationTime();
|
||||
|
|
|
@ -22,14 +22,15 @@ namespace Core
|
|||
|
||||
bool init();
|
||||
|
||||
uint32_t toLandSetId( uint16_t territoryTypeId, uint8_t wardId ) const;
|
||||
uint16_t getNexLandId();
|
||||
void insertHousingZone( Core::Data::HousingZonePtr hZone );
|
||||
Core::Data::HousingZonePtr getHousingZone( uint16_t id );
|
||||
Core::Data::HousingZonePtr getHousingZoneByLandSetId( uint32_t id );
|
||||
Core::LandPtr getLandByOwnerId( uint32_t id );
|
||||
|
||||
void sendLandSignOwned( Entity::Player& player, uint8_t ward, uint8_t plot );
|
||||
void sendLandSignFree( Entity::Player& player, uint8_t ward, uint8_t plot );
|
||||
void sendLandSignOwned( Entity::Player& player, uint8_t wardId, uint8_t plotId, uint16_t territoryTypeId );
|
||||
void sendLandSignFree( Entity::Player& player, uint8_t wardId, uint8_t plotId, uint16_t territoryTypeId );
|
||||
LandPurchaseResult purchseLand( Entity::Player& player, uint8_t plot, uint8_t state );
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Reference in a new issue