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:
parent
e8d0ca63f5
commit
2232cdddc9
5 changed files with 96 additions and 2 deletions
|
@ -780,6 +780,7 @@ namespace Sapphire::Common
|
||||||
|
|
||||||
enum HouseExteriorSlot
|
enum HouseExteriorSlot
|
||||||
{
|
{
|
||||||
|
HousePermit,
|
||||||
ExteriorRoof,
|
ExteriorRoof,
|
||||||
ExteriorWall,
|
ExteriorWall,
|
||||||
ExteriorWindow,
|
ExteriorWindow,
|
||||||
|
|
|
@ -213,6 +213,11 @@ enum ActorControlType : uint16_t
|
||||||
// Housing
|
// Housing
|
||||||
ShowHousingItemUI = 0x3F7,
|
ShowHousingItemUI = 0x3F7,
|
||||||
ShowBuildPresetUI = 0x3E9,
|
ShowBuildPresetUI = 0x3E9,
|
||||||
|
/*!
|
||||||
|
* param1 = plot id
|
||||||
|
*/
|
||||||
|
ShowEstateExternalAppearanceUI = 0x3EA,
|
||||||
|
ShowEstateInternalAppearanceUI = 0x3EB,
|
||||||
BuildPresetResponse = 0x3ED,
|
BuildPresetResponse = 0x3ED,
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -327,6 +332,8 @@ enum ActorControlType : uint16_t
|
||||||
|
|
||||||
SetEstateLightingLevel = 0x40B, // param1 = light level 0 - 5 maps to UI val 5-0
|
SetEstateLightingLevel = 0x40B, // param1 = light level 0 - 5 maps to UI val 5-0
|
||||||
RequestHousingBuildPreset = 0x44C,
|
RequestHousingBuildPreset = 0x44C,
|
||||||
|
RequestEstateExteriorRemodel = 0x044D, // param11 = land id
|
||||||
|
RequestEstateInteriorRemodel = 0x44E,
|
||||||
RequestEstateHallRemoval = 0x44F,
|
RequestEstateHallRemoval = 0x44F,
|
||||||
RequestBuildPreset = 0x450, // no idea what this is, it gets sent with BuildPresetHandler and has the plot id in param1
|
RequestBuildPreset = 0x450, // no idea what this is, it gets sent with BuildPresetHandler and has the plot id in param1
|
||||||
RequestLandSignFree = 0x451,
|
RequestLandSignFree = 0x451,
|
||||||
|
|
|
@ -264,7 +264,7 @@ void Sapphire::World::Manager::HousingMgr::initLandCache()
|
||||||
|
|
||||||
// fixed containers
|
// fixed containers
|
||||||
makeContainer( InventoryType::HousingInteriorAppearance, 10 );
|
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() )
|
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() );
|
getItemAdditionalData( item.second->getId() ), item.second->getStain() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1461,4 +1469,62 @@ Sapphire::ItemContainerPtr Sapphire::World::Manager::HousingMgr::getFreeEstateIn
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
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 );
|
||||||
}
|
}
|
|
@ -172,6 +172,10 @@ namespace Sapphire::World::Manager
|
||||||
uint16_t containerId, uint16_t slot,
|
uint16_t containerId, uint16_t slot,
|
||||||
bool sendToStoreroom );
|
bool sendToStoreroom );
|
||||||
|
|
||||||
|
void reqEstateExteriorRemodel( Entity::Player& player, uint16_t plot );
|
||||||
|
|
||||||
|
void reqEstateInteriorRemodel( Entity::Player& player );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
ItemContainerPtr getFreeEstateInventorySlot( Common::LandIdent ident,
|
ItemContainerPtr getFreeEstateInventorySlot( Common::LandIdent ident,
|
||||||
|
|
|
@ -469,6 +469,22 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( const Packets::FFX
|
||||||
|
|
||||||
break;
|
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:
|
default:
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue