mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-04 17:57:47 +00:00
#448 - remove deed on build
This commit is contained in:
parent
c4f0623b62
commit
79ed3d63d9
8 changed files with 56 additions and 22 deletions
|
@ -791,7 +791,7 @@ namespace Sapphire::Common
|
||||||
ExteriorFence
|
ExteriorFence
|
||||||
};
|
};
|
||||||
|
|
||||||
enum HousingInteriorSlot
|
enum HouseInteriorSlot
|
||||||
{
|
{
|
||||||
InteriorWall,
|
InteriorWall,
|
||||||
InteriorFloor,
|
InteriorFloor,
|
||||||
|
|
|
@ -916,7 +916,7 @@ namespace Sapphire::Entity
|
||||||
|
|
||||||
uint32_t getNextInventorySequence();
|
uint32_t getNextInventorySequence();
|
||||||
|
|
||||||
void send();
|
bool findFirstItemWithId( uint32_t catalogId, Inventory::InventoryContainerPair& location );
|
||||||
|
|
||||||
uint8_t getFreeSlotsInBags();
|
uint8_t getFreeSlotsInBags();
|
||||||
|
|
||||||
|
|
|
@ -933,3 +933,24 @@ void Sapphire::Entity::Player::insertInventoryItem( Sapphire::Common::InventoryT
|
||||||
queuePacket( slotUpdate );
|
queuePacket( slotUpdate );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Sapphire::Entity::Player::findFirstItemWithId( uint32_t catalogId,
|
||||||
|
Inventory::InventoryContainerPair& location )
|
||||||
|
{
|
||||||
|
for( auto bagId : { Bag0, Bag1, Bag2, Bag3 } )
|
||||||
|
{
|
||||||
|
auto& container = m_storageMap[ bagId ];
|
||||||
|
|
||||||
|
for( const auto& item : container->getItemMap() )
|
||||||
|
{
|
||||||
|
if( item.second->getId() != catalogId )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
location = std::make_pair( bagId, item.first );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
|
@ -564,6 +564,18 @@ bool Sapphire::World::Manager::HousingMgr::initHouseModels( Entity::Player& play
|
||||||
if( !preset )
|
if( !preset )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// remove preset item
|
||||||
|
Inventory::InventoryContainerPair foundItem;
|
||||||
|
if( !player.findFirstItemWithId( presetCatalogId, foundItem ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
auto item = player.dropInventoryItem( foundItem.first, foundItem.second );
|
||||||
|
if( !item )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// move preset item into ext appearance container
|
||||||
|
houseInventory[ InventoryType::HousingExteriorAppearance ]->setItem( HouseExteriorSlot::HousePermit, item );
|
||||||
|
|
||||||
// high iq shit
|
// high iq shit
|
||||||
auto invMap = std::map< uint16_t, std::map< uint32_t, int32_t > >
|
auto invMap = std::map< uint16_t, std::map< uint32_t, int32_t > >
|
||||||
{
|
{
|
||||||
|
@ -583,19 +595,19 @@ bool Sapphire::World::Manager::HousingMgr::initHouseModels( Entity::Player& play
|
||||||
InventoryType::HousingInteriorAppearance,
|
InventoryType::HousingInteriorAppearance,
|
||||||
{
|
{
|
||||||
// lobby/middle floor
|
// lobby/middle floor
|
||||||
{ HousingInteriorSlot::InteriorWall, preset->interiorWall },
|
{ HouseInteriorSlot::InteriorWall, preset->interiorWall },
|
||||||
{ HousingInteriorSlot::InteriorFloor, preset->interiorFlooring },
|
{ HouseInteriorSlot::InteriorFloor, preset->interiorFlooring },
|
||||||
{ HousingInteriorSlot::InteriorLight, preset->interiorLighting },
|
{ HouseInteriorSlot::InteriorLight, preset->interiorLighting },
|
||||||
|
|
||||||
// attic
|
// attic
|
||||||
{ HousingInteriorSlot::InteriorWall_Attic, preset->otherFloorWall },
|
{ HouseInteriorSlot::InteriorWall_Attic, preset->otherFloorWall },
|
||||||
{ HousingInteriorSlot::InteriorFloor_Attic, preset->otherFloorFlooring },
|
{ HouseInteriorSlot::InteriorFloor_Attic, preset->otherFloorFlooring },
|
||||||
{ HousingInteriorSlot::InteriorLight_Attic, preset->otherFloorLighting },
|
{ HouseInteriorSlot::InteriorLight_Attic, preset->otherFloorLighting },
|
||||||
|
|
||||||
// basement
|
// basement
|
||||||
{ HousingInteriorSlot::InteriorWall_Basement, preset->basementWall },
|
{ HouseInteriorSlot::InteriorWall_Basement, preset->basementWall },
|
||||||
{ HousingInteriorSlot::InteriorFloor_Basement, preset->basementFlooring },
|
{ HouseInteriorSlot::InteriorFloor_Basement, preset->basementFlooring },
|
||||||
{ HousingInteriorSlot::InteriorLight_Basement, preset->basementLighting },
|
{ HouseInteriorSlot::InteriorLight_Basement, preset->basementLighting },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -641,7 +653,7 @@ void Sapphire::World::Manager::HousingMgr::createHouse( Sapphire::HousePtr house
|
||||||
pDb->execute( stmt );
|
pDb->execute( stmt );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& player, uint8_t plotNum, uint32_t presetItem )
|
void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& player, uint8_t plotNum, uint32_t presetCatalogId )
|
||||||
{
|
{
|
||||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentZone() );
|
auto hZone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentZone() );
|
||||||
|
|
||||||
|
@ -656,8 +668,6 @@ void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& pl
|
||||||
if( pLand->getOwnerId() != player.getId() )
|
if( pLand->getOwnerId() != player.getId() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// todo: check if permit is in inventory and remove one
|
|
||||||
|
|
||||||
// create house
|
// create house
|
||||||
auto ident = pLand->getLandIdent();
|
auto ident = pLand->getLandIdent();
|
||||||
auto house = make_House( getNextHouseId(), pLand->getLandSetId(), ident,
|
auto house = make_House( getNextHouseId(), pLand->getLandSetId(), ident,
|
||||||
|
@ -666,8 +676,11 @@ void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& pl
|
||||||
pLand->setHouse( house );
|
pLand->setHouse( house );
|
||||||
|
|
||||||
// create inventory items
|
// create inventory items
|
||||||
if( !initHouseModels( player, pLand, presetItem ) )
|
if( !initHouseModels( player, pLand, presetCatalogId ) )
|
||||||
|
{
|
||||||
|
pLand->setHouse( nullptr );
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
createHouse( house );
|
createHouse( house );
|
||||||
|
|
||||||
|
@ -913,7 +926,7 @@ void Sapphire::World::Manager::HousingMgr::updateHouseModels( Sapphire::HousePtr
|
||||||
{
|
{
|
||||||
for( auto& item : intContainer->second->getItemMap() )
|
for( auto& item : intContainer->second->getItemMap() )
|
||||||
{
|
{
|
||||||
house->setInteriorModel( static_cast< Common::HousingInteriorSlot >( item.first ),
|
house->setInteriorModel( static_cast< Common::HouseInteriorSlot >( item.first ),
|
||||||
getItemAdditionalData( item.second->getId() ) );
|
getItemAdditionalData( item.second->getId() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ namespace Sapphire::World::Manager
|
||||||
|
|
||||||
bool relinquishLand( Entity::Player& player, uint8_t plot );
|
bool relinquishLand( Entity::Player& player, uint8_t plot );
|
||||||
|
|
||||||
void buildPresetEstate( Entity::Player& player, uint8_t plotNum, uint32_t presetItem );
|
void buildPresetEstate( Entity::Player& player, uint8_t plotNum, uint32_t presetCatalogId );
|
||||||
|
|
||||||
void requestEstateRename( Entity::Player& player, const Common::LandIdent ident );
|
void requestEstateRename( Entity::Player& player, const Common::LandIdent ident );
|
||||||
|
|
||||||
|
|
|
@ -96,12 +96,12 @@ Sapphire::House::HousePart Sapphire::House::getExteriorModel( Sapphire::Common::
|
||||||
return m_exteriorModelCache[ slot ];
|
return m_exteriorModelCache[ slot ];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::House::setInteriorModel( Sapphire::Common::HousingInteriorSlot slot, uint32_t modelId )
|
void Sapphire::House::setInteriorModel( Sapphire::Common::HouseInteriorSlot slot, uint32_t modelId )
|
||||||
{
|
{
|
||||||
m_interiorModelCache[ slot ] = modelId;
|
m_interiorModelCache[ slot ] = modelId;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Sapphire::House::getInteriorModel( Sapphire::Common::HousingInteriorSlot slot )
|
uint32_t Sapphire::House::getInteriorModel( Sapphire::Common::HouseInteriorSlot slot )
|
||||||
{
|
{
|
||||||
return m_interiorModelCache[ slot ];
|
return m_interiorModelCache[ slot ];
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,8 +34,8 @@ namespace Sapphire
|
||||||
void setExteriorModel( Common::HouseExteriorSlot slot, uint32_t modelId, uint16_t stain );
|
void setExteriorModel( Common::HouseExteriorSlot slot, uint32_t modelId, uint16_t stain );
|
||||||
HousePart getExteriorModel( Common::HouseExteriorSlot slot );
|
HousePart getExteriorModel( Common::HouseExteriorSlot slot );
|
||||||
|
|
||||||
void setInteriorModel( Common::HousingInteriorSlot slot, uint32_t modelId );
|
void setInteriorModel( Common::HouseInteriorSlot slot, uint32_t modelId );
|
||||||
uint32_t getInteriorModel( Common::HousingInteriorSlot slot );
|
uint32_t getInteriorModel( Common::HouseInteriorSlot slot );
|
||||||
|
|
||||||
HouseModelsArray const& getHouseModels() const;
|
HouseModelsArray const& getHouseModels() const;
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ void Sapphire::World::Territory::Housing::HousingInteriorTerritory::onPlayerZone
|
||||||
for( auto i = 0; i < 10; i++ )
|
for( auto i = 0; i < 10; i++ )
|
||||||
{
|
{
|
||||||
indoorInitPacket->data().indoorItems[ i ] = pHouse->getInteriorModel(
|
indoorInitPacket->data().indoorItems[ i ] = pHouse->getInteriorModel(
|
||||||
static_cast< Common::HousingInteriorSlot >( i ) );
|
static_cast< Common::HouseInteriorSlot >( i ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
player.queuePacket( indoorInitPacket );
|
player.queuePacket( indoorInitPacket );
|
||||||
|
|
Loading…
Add table
Reference in a new issue