mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-01 16:37:45 +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 pTerritory = player.getCurrentZone();
|
||||||
auto pHousing = std::dynamic_pointer_cast< HousingZone >( pTerritory );
|
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,
|
LandPurchaseResult res = pHouMgr->purchseLand( player, activeLand.plot,
|
||||||
static_cast< uint8_t >( result.param2 ) );
|
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 ward = static_cast< uint8_t >( ( param12 & 0xFF00 ) >> 8 );
|
||||||
auto plot = static_cast< uint8_t >( param12 & 0xFF );
|
auto plot = static_cast< uint8_t >( param12 & 0xFF );
|
||||||
|
auto territoryId = static_cast< uint16_t >( param11 & 0xFFFF );
|
||||||
|
|
||||||
auto pHousingMgr = g_fw.get< HousingMgr >();
|
auto pHousingMgr = g_fw.get< HousingMgr >();
|
||||||
pHousingMgr->sendLandSignFree( player, ward, plot );
|
pHousingMgr->sendLandSignFree( player, ward, plot, territoryId );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ClientTriggerType::RequestLandSignOwned:
|
case ClientTriggerType::RequestLandSignOwned:
|
||||||
{
|
{
|
||||||
auto ward = static_cast< uint8_t >( ( param12 & 0xFF00 ) >> 8 );
|
auto ward = static_cast< uint8_t >( ( param12 & 0xFF00 ) >> 8 );
|
||||||
auto plot = static_cast< uint8_t >( param12 & 0xFF );
|
auto plot = static_cast< uint8_t >( param12 & 0xFF );
|
||||||
|
auto territoryId = static_cast< uint16_t >( param11 & 0xFFFF );
|
||||||
|
|
||||||
auto pHousingMgr = g_fw.get< HousingMgr >();
|
auto pHousingMgr = g_fw.get< HousingMgr >();
|
||||||
pHousingMgr->sendLandSignOwned( player, ward, plot );
|
pHousingMgr->sendLandSignOwned( player, ward, plot, territoryId );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ClientTriggerType::RequestLandRelinquish:
|
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 ward = static_cast< uint8_t >( ( param12 & 0xFF00 ) >> 8 );
|
||||||
auto plot = static_cast< uint8_t >( param12 & 0xFF );
|
auto plot = static_cast< uint8_t >( param12 & 0xFF );
|
||||||
auto pHousingMgr = g_fw.get< HousingMgr >();
|
auto pHousingMgr = g_fw.get< HousingMgr >();
|
||||||
|
|
||||||
pLog->debug( "Request to relinquish plot " + std::to_string( plot ) );
|
pLog->debug( "Request to relinquish plot " + std::to_string( plot ) );
|
||||||
// TODO: do stuff!
|
// TODO: do stuff!
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -48,6 +48,11 @@ uint16_t Core::HousingMgr::getNexLandId()
|
||||||
return ++m_lastLandId;
|
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 )
|
void Core::HousingMgr::insertHousingZone( Core::Data::HousingZonePtr hZone )
|
||||||
{
|
{
|
||||||
uint16_t id = getNexLandId();
|
uint16_t id = getNexLandId();
|
||||||
|
@ -95,18 +100,17 @@ Core::LandPtr Core::HousingMgr::getLandByOwnerId( uint32_t id )
|
||||||
return nullptr;
|
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 landSetId = toLandSetId( territoryTypeId, wardId );
|
||||||
|
auto hZone = getHousingZoneByLandSetId( landSetId );
|
||||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( zone );
|
|
||||||
|
|
||||||
if( !hZone )
|
if( !hZone )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto land = hZone->getLand( plot );
|
auto land = hZone->getLand( plotId );
|
||||||
if( !land )
|
if( !land )
|
||||||
{
|
{
|
||||||
land = getLandByOwnerId( player.getId() );
|
land = getLandByOwnerId( player.getId() );
|
||||||
|
@ -128,17 +132,17 @@ void Core::HousingMgr::sendLandSignOwned( Entity::Player& player, uint8_t ward,
|
||||||
player.queuePacket( landInfoSignPacket );
|
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 landSetId = toLandSetId( territoryTypeId, wardId );
|
||||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( zone );
|
auto hZone = getHousingZoneByLandSetId( landSetId );
|
||||||
|
|
||||||
if( !hZone )
|
if( !hZone )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto land = hZone->getLand( plot );
|
auto land = hZone->getLand( plotId );
|
||||||
auto plotPricePacket = makeZonePacket< Server::FFXIVIpcLandPriceUpdate >( player.getId() );
|
auto plotPricePacket = makeZonePacket< Server::FFXIVIpcLandPriceUpdate >( player.getId() );
|
||||||
plotPricePacket->data().price = land->getCurrentPrice();
|
plotPricePacket->data().price = land->getCurrentPrice();
|
||||||
plotPricePacket->data().timeLeft = land->getDevaluationTime();
|
plotPricePacket->data().timeLeft = land->getDevaluationTime();
|
||||||
|
|
|
@ -22,14 +22,15 @@ namespace Core
|
||||||
|
|
||||||
bool init();
|
bool init();
|
||||||
|
|
||||||
|
uint32_t toLandSetId( uint16_t territoryTypeId, uint8_t wardId ) const;
|
||||||
uint16_t getNexLandId();
|
uint16_t getNexLandId();
|
||||||
void insertHousingZone( Core::Data::HousingZonePtr hZone );
|
void insertHousingZone( Core::Data::HousingZonePtr hZone );
|
||||||
Core::Data::HousingZonePtr getHousingZone( uint16_t id );
|
Core::Data::HousingZonePtr getHousingZone( uint16_t id );
|
||||||
Core::Data::HousingZonePtr getHousingZoneByLandSetId( uint32_t id );
|
Core::Data::HousingZonePtr getHousingZoneByLandSetId( uint32_t id );
|
||||||
Core::LandPtr getLandByOwnerId( uint32_t id );
|
Core::LandPtr getLandByOwnerId( uint32_t id );
|
||||||
|
|
||||||
void sendLandSignOwned( 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 ward, uint8_t plot );
|
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 );
|
LandPurchaseResult purchseLand( Entity::Player& player, uint8_t plot, uint8_t state );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Add table
Reference in a new issue