1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-25 14:07:46 +00:00

Added checks to relinquishing land

This commit is contained in:
Mordred 2018-11-20 21:21:22 +01:00
parent 035edebfb4
commit b723e092f9

View file

@ -184,6 +184,25 @@ bool Core::HousingMgr::relinquishLand( Entity::Player& player, uint8_t plot )
auto pLand = pHousing->getLand( plot ); auto pLand = pHousing->getLand( plot );
auto plotMaxPrice = pLand->getCurrentPrice(); auto plotMaxPrice = pLand->getCurrentPrice();
auto landOwnerId = pLand->getPlayerOwner();
// can't relinquish when you are not the owner
// TODO: actually use permissions here for FC houses
if( landOwnerId != player.getId() )
{
auto msgPkt = makeActorControl143( player.getId(), ActorControl::LogMsg, 3304, 0 );
player.queuePacket( msgPkt );
return false;
}
// unable to relinquish if there is a house built
// TODO: additionally check for yard items
if( pLand->getHouse() )
{
auto msgPkt = makeActorControl143( player.getId(), ActorControl::LogMsg, 3315, 0 );
player.queuePacket( msgPkt );
return false;
}
pLand->setCurrentPrice( pLand->getMaxPrice() ); pLand->setCurrentPrice( pLand->getMaxPrice() );
pLand->setPlayerOwner( 0 ); pLand->setPlayerOwner( 0 );