1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 14:37:44 +00:00

add internal/external estate remodelling menus

This commit is contained in:
NotAdam 2018-12-28 18:45:08 +11:00
parent e8d0ca63f5
commit 2232cdddc9
5 changed files with 96 additions and 2 deletions

View file

@ -780,6 +780,7 @@ namespace Sapphire::Common
enum HouseExteriorSlot
{
HousePermit,
ExteriorRoof,
ExteriorWall,
ExteriorWindow,

View file

@ -213,6 +213,11 @@ enum ActorControlType : uint16_t
// Housing
ShowHousingItemUI = 0x3F7,
ShowBuildPresetUI = 0x3E9,
/*!
* param1 = plot id
*/
ShowEstateExternalAppearanceUI = 0x3EA,
ShowEstateInternalAppearanceUI = 0x3EB,
BuildPresetResponse = 0x3ED,
/*!
@ -327,6 +332,8 @@ enum ActorControlType : uint16_t
SetEstateLightingLevel = 0x40B, // param1 = light level 0 - 5 maps to UI val 5-0
RequestHousingBuildPreset = 0x44C,
RequestEstateExteriorRemodel = 0x044D, // param11 = land id
RequestEstateInteriorRemodel = 0x44E,
RequestEstateHallRemoval = 0x44F,
RequestBuildPreset = 0x450, // no idea what this is, it gets sent with BuildPresetHandler and has the plot id in param1
RequestLandSignFree = 0x451,

View file

@ -264,7 +264,7 @@ void Sapphire::World::Manager::HousingMgr::initLandCache()
// fixed containers
makeContainer( InventoryType::HousingInteriorAppearance, 10 );
makeContainer( InventoryType::HousingExteriorAppearance, 8 );
makeContainer( InventoryType::HousingExteriorAppearance, 9 );
}
}
@ -896,7 +896,15 @@ void Sapphire::World::Manager::HousingMgr::updateHouseModels( Sapphire::HousePtr
{
for( auto& item : extContainer->second->getItemMap() )
{
house->setExteriorModel( static_cast< Common::HouseExteriorSlot >( item.first ),
// in the Slot array, the first slot is actually the permit
// but the models array starts from the 2nd entry of the enum
// so we skip the first one, and then any subsequent entries is slotid - 1
auto slotId = item.first - 1;
if( slotId < 0 )
continue;
house->setExteriorModel( static_cast< Common::HouseExteriorSlot >( slotId ),
getItemAdditionalData( item.second->getId() ), item.second->getStain() );
}
}
@ -1462,3 +1470,61 @@ Sapphire::ItemContainerPtr Sapphire::World::Manager::HousingMgr::getFreeEstateIn
return nullptr;
}
void Sapphire::World::Manager::HousingMgr::reqEstateExteriorRemodel( Sapphire::Entity::Player& player, uint16_t plot )
{
auto terri = std::dynamic_pointer_cast< HousingZone >( player.getCurrentZone() );
if( !terri )
return;
auto land = terri->getLand( plot );
if( !land )
return;
// todo: proper perms checks
if( land->getOwnerId() != player.getId() )
return;
auto& inv = getEstateInventory( land->getLandIdent() );
auto needle = inv.find( InventoryType::HousingExteriorAppearance );
if( needle == inv.end() )
return;
auto invMgr = g_fw.get< InventoryMgr >();
invMgr->sendInventoryContainer( player, needle->second );
auto pkt = Server::makeActorControl143( player.getId(), Network::ActorControl::ShowEstateExternalAppearanceUI, plot );
player.queuePacket( pkt );
}
void Sapphire::World::Manager::HousingMgr::reqEstateInteriorRemodel( Sapphire::Entity::Player& player )
{
auto terri = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentZone() );
if( !terri )
return;
auto ident = terri->getLandIdent();
auto landSet = toLandSetId( ident.territoryTypeId, ident.wardNum );
auto land = getHousingZoneByLandSetId( landSet )->getLand( ident.landId );
if( !land )
return;
// todo: proper perms checks
if( land->getOwnerId() != player.getId() )
return;
auto& inv = getEstateInventory( land->getLandIdent() );
auto needle = inv.find( InventoryType::HousingInteriorAppearance );
if( needle == inv.end() )
return;
auto invMgr = g_fw.get< InventoryMgr >();
invMgr->sendInventoryContainer( player, needle->second );
auto pkt = Server::makeActorControl143( player.getId(), Network::ActorControl::ShowEstateInternalAppearanceUI );
player.queuePacket( pkt );
}

View file

@ -172,6 +172,10 @@ namespace Sapphire::World::Manager
uint16_t containerId, uint16_t slot,
bool sendToStoreroom );
void reqEstateExteriorRemodel( Entity::Player& player, uint16_t plot );
void reqEstateInteriorRemodel( Entity::Player& player );
private:
ItemContainerPtr getFreeEstateInventorySlot( Common::LandIdent ident,

View file

@ -469,6 +469,22 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( const Packets::FFX
break;
}
case ClientTriggerType::RequestEstateExteriorRemodel:
{
auto housingMgr = g_fw.get< HousingMgr >();
housingMgr->reqEstateExteriorRemodel( player, param11 );
break;
}
case ClientTriggerType::RequestEstateInteriorRemodel:
{
auto housingMgr = g_fw.get< HousingMgr >();
housingMgr->reqEstateInteriorRemodel( player );
break;
}
default:
{