mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 14:57:44 +00:00
Merge pull request #455 from NotAdam/housing
Minor refactoring and bugfix
This commit is contained in:
commit
dbd6804d7d
5 changed files with 21 additions and 21 deletions
|
@ -8,7 +8,7 @@
|
|||
<script>
|
||||
function doLogin(){
|
||||
var url = "sapphire-api/lobby/insertSession";
|
||||
var params = "{\"sId\":\"" + document.getElementsByName('sid')[0].value + "\",\"secret\":\"" + document.getElementsByName('secret')[0].value + "\",\"accountId\":\"" + document.getElementsByName('accountId')[0].value + "\"}";
|
||||
var params = "{\"sId\":\"" + document.getElementsByName('sid')[0].value + "\",\"secret\":\"" + document.getElementsByName('secret')[0].value + "\",\"accountId\":" + document.getElementsByName('accountId')[0].value + "}";
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", url, true);
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ void Sapphire::World::Manager::HousingMgr::sendLandSignOwned( Entity::Player& pl
|
|||
std::strcpy( landInfoSignPacket->data().estateGreeting, house->getHouseGreeting().c_str() );
|
||||
}
|
||||
|
||||
uint32_t playerId = land->getPlayerOwner();
|
||||
uint32_t playerId = land->getOwnerId();
|
||||
std::string playerName = g_fw.get< Sapphire::ServerMgr >()->getPlayerNameFromDb( playerId );
|
||||
|
||||
memcpy( &landInfoSignPacket->data().ownerName, playerName.c_str(), playerName.size() );
|
||||
|
@ -160,7 +160,7 @@ Sapphire::LandPurchaseResult Sapphire::World::Manager::HousingMgr::purchaseLand(
|
|||
return LandPurchaseResult::ERR_NO_MORE_LANDS_FOR_CHAR;
|
||||
|
||||
player.removeCurrency( CurrencyType::Gil, plotPrice );
|
||||
pLand->setPlayerOwner( player.getId() );
|
||||
pLand->setOwnerId( player.getId() );
|
||||
pLand->setState( HouseState::sold );
|
||||
pLand->setLandType( Common::LandType::Private );
|
||||
|
||||
|
@ -190,7 +190,7 @@ bool Sapphire::World::Manager::HousingMgr::relinquishLand( Entity::Player& playe
|
|||
|
||||
auto pLand = pHousing->getLand( plot );
|
||||
auto plotMaxPrice = pLand->getCurrentPrice();
|
||||
auto landOwnerId = pLand->getPlayerOwner();
|
||||
auto landOwnerId = pLand->getOwnerId();
|
||||
|
||||
// can't relinquish when you are not the owner
|
||||
// TODO: actually use permissions here for FC houses
|
||||
|
@ -211,7 +211,7 @@ bool Sapphire::World::Manager::HousingMgr::relinquishLand( Entity::Player& playe
|
|||
}
|
||||
|
||||
pLand->setCurrentPrice( pLand->getMaxPrice() );
|
||||
pLand->setPlayerOwner( 0 );
|
||||
pLand->setOwnerId( 0 );
|
||||
pLand->setState( HouseState::forSale );
|
||||
pLand->setLandType( Common::LandType::none );
|
||||
pLand->updateLandDb();
|
||||
|
@ -275,7 +275,7 @@ void Sapphire::World::Manager::HousingMgr::sendWardLandInfo( Entity::Player& pla
|
|||
case LandType::Private:
|
||||
entry.infoFlags |= Common::WardlandFlags::IsEstateOwned;
|
||||
|
||||
auto owner = land->getPlayerOwner();
|
||||
auto owner = land->getOwnerId();
|
||||
auto playerName = g_fw.get< Sapphire::ServerMgr >()->getPlayerNameFromDb( owner );
|
||||
memcpy( &entry.estateOwnerName, playerName.c_str(), playerName.size() );
|
||||
|
||||
|
@ -327,7 +327,7 @@ void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& pl
|
|||
return;
|
||||
|
||||
// todo: when doing FC houses, look up the type from the original purchase and check perms from FC and set state accordingly
|
||||
if( pLand->getPlayerOwner() != player.getId() )
|
||||
if( pLand->getOwnerId() != player.getId() )
|
||||
return;
|
||||
|
||||
// todo: check if permit is in inventory and remove one
|
||||
|
@ -415,7 +415,7 @@ void Sapphire::World::Manager::HousingMgr::updateEstateGreeting( Entity::Player&
|
|||
return;
|
||||
|
||||
// todo: implement proper permissions checks
|
||||
if( land->getPlayerOwner() != player.getId() )
|
||||
if( land->getOwnerId() != player.getId() )
|
||||
return;
|
||||
|
||||
auto house = land->getHouse();
|
||||
|
@ -441,7 +441,7 @@ void Sapphire::World::Manager::HousingMgr::requestEstateEditGuestAccess( Entity:
|
|||
return;
|
||||
|
||||
// todo: add proper permission check
|
||||
if( land->getPlayerOwner() != player.getId() )
|
||||
if( land->getOwnerId() != player.getId() )
|
||||
return;
|
||||
|
||||
auto packet = makeZonePacket< FFXIVIpcHousingShowEstateGuestAccess >( player.getId() );
|
||||
|
@ -505,7 +505,7 @@ void Sapphire::World::Manager::HousingMgr::sendHousingInventory( Entity::Player&
|
|||
return;
|
||||
|
||||
// todo: add proper permissions checks
|
||||
if( targetLand->getPlayerOwner() != player.getId() )
|
||||
if( targetLand->getOwnerId() != player.getId() )
|
||||
return;
|
||||
|
||||
player.sendDebug( "got inventory for plot: " + targetLand->getHouse()->getHouseName() );
|
||||
|
|
|
@ -672,7 +672,7 @@ void Sapphire::Network::GameConnection::landRenameHandler( const Packets::FFXIVA
|
|||
return;
|
||||
|
||||
// todo: check perms for fc houses and shit
|
||||
if( pLand->getPlayerOwner() != player.getId() )
|
||||
if( pLand->getOwnerId() != player.getId() )
|
||||
return;
|
||||
|
||||
auto pHouse = pLand->getHouse();
|
||||
|
|
|
@ -34,7 +34,7 @@ Sapphire::Land::Land( uint16_t territoryTypeId, uint8_t wardNum, uint8_t landId,
|
|||
m_currentPrice( 0 ),
|
||||
m_minPrice( 0 ),
|
||||
m_nextDrop( static_cast< uint32_t >( Util::getTimeSeconds() ) + 21600 ),
|
||||
m_ownerPlayerId( 0 ),
|
||||
m_ownerId( 0 ),
|
||||
m_landSetId( landSetId ),
|
||||
m_landInfo( info ),
|
||||
m_type( Common::LandType::none ),
|
||||
|
@ -77,7 +77,7 @@ void Sapphire::Land::init()
|
|||
m_size = res->getUInt( "Size" );
|
||||
m_state = res->getUInt( "Status" );
|
||||
m_currentPrice = res->getUInt( "LandPrice" );
|
||||
m_ownerPlayerId = res->getUInt64( "OwnerId" );
|
||||
m_ownerId = res->getUInt64( "OwnerId" );
|
||||
m_minPrice = m_landInfo->minPrice[ m_landId ];
|
||||
m_maxPrice = m_landInfo->initialPrice[ m_landId ];
|
||||
|
||||
|
@ -240,14 +240,14 @@ uint32_t Sapphire::Land::getFcColor()
|
|||
}
|
||||
|
||||
//Player
|
||||
void Sapphire::Land::setPlayerOwner( uint64_t id )
|
||||
void Sapphire::Land::setOwnerId( uint64_t id )
|
||||
{
|
||||
m_ownerPlayerId = id;
|
||||
m_ownerId = id;
|
||||
}
|
||||
|
||||
uint64_t Sapphire::Land::getPlayerOwner()
|
||||
uint64_t Sapphire::Land::getOwnerId()
|
||||
{
|
||||
return m_ownerPlayerId;
|
||||
return m_ownerId;
|
||||
}
|
||||
|
||||
uint32_t Sapphire::Land::getDevaluationTime()
|
||||
|
@ -282,7 +282,7 @@ void Sapphire::Land::updateLandDb()
|
|||
pDb->directExecute( "UPDATE land SET status = " + std::to_string( m_state )
|
||||
+ ", LandPrice = " + std::to_string( getCurrentPrice() )
|
||||
+ ", UpdateTime = " + std::to_string( getDevaluationTime() )
|
||||
+ ", OwnerId = " + std::to_string( getPlayerOwner() )
|
||||
+ ", OwnerId = " + std::to_string( getOwnerId() )
|
||||
+ ", HouseId = " + std::to_string( houseId )
|
||||
+ ", Type = " + std::to_string( static_cast< uint32_t >( m_type ) ) //TODO: add house id
|
||||
+ " WHERE LandSetId = " + std::to_string( m_landSetId )
|
||||
|
|
|
@ -45,8 +45,8 @@ namespace Sapphire
|
|||
uint32_t getFcColor();
|
||||
|
||||
//Player
|
||||
void setPlayerOwner( uint64_t id );
|
||||
uint64_t getPlayerOwner();
|
||||
void setOwnerId( uint64_t id );
|
||||
uint64_t getOwnerId();
|
||||
//Housing Functions
|
||||
void setCurrentPrice( uint32_t currentPrice );
|
||||
bool setPreset( uint32_t itemId );
|
||||
|
@ -82,7 +82,7 @@ namespace Sapphire
|
|||
|
||||
Common::FFXIVARR_POSITION3 m_mapMarkerPosition;
|
||||
|
||||
uint64_t m_ownerPlayerId;
|
||||
uint64_t m_ownerId;
|
||||
Sapphire::Data::HousingLandSetPtr m_landInfo;
|
||||
|
||||
Sapphire::HousePtr m_pHouse;
|
||||
|
|
Loading…
Add table
Reference in a new issue