mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-25 11:07:45 +00:00
allow removing items out as well
This commit is contained in:
parent
6b95c00d29
commit
05b7ca341e
4 changed files with 25 additions and 6 deletions
|
@ -430,7 +430,9 @@ struct FFXIVIpcHousingEditExterior :
|
|||
FFXIVIpcBasePacket< HousingEditExterior >
|
||||
{
|
||||
uint16_t landId;
|
||||
uint8_t unknown[8];
|
||||
uint8_t unknown[6];
|
||||
uint8_t removeFlag;
|
||||
uint8_t unknown2;
|
||||
uint16_t container[9];
|
||||
uint16_t slot[9];
|
||||
uint16_t padding;
|
||||
|
|
|
@ -1632,7 +1632,7 @@ Sapphire::Inventory::HousingItemPtr Sapphire::World::Manager::HousingMgr::getHou
|
|||
return Inventory::make_HousingItem( tmpItem->getUId(), tmpItem->getId() );
|
||||
}
|
||||
|
||||
void Sapphire::World::Manager::HousingMgr::editExterior( Sapphire::Entity::Player& player, uint16_t plot, std::vector< uint16_t > containerList, std::vector< uint8_t> slotList )
|
||||
void Sapphire::World::Manager::HousingMgr::editExterior( Sapphire::Entity::Player& player, uint16_t plot, std::vector< uint16_t > containerList, std::vector< uint8_t> slotList, uint8_t removeFlag )
|
||||
{
|
||||
auto terri = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
||||
if( !terri )
|
||||
|
@ -1654,18 +1654,35 @@ void Sapphire::World::Manager::HousingMgr::editExterior( Sapphire::Entity::Playe
|
|||
auto container = containerList.at( i );
|
||||
auto slot = slotList.at( i );
|
||||
if( container == 0x270F || slot == 0xFF )
|
||||
continue;
|
||||
auto item = getHousingItemFromPlayer( player, static_cast< Sapphire::Common::InventoryType >( container ), slot );
|
||||
if( item )
|
||||
{
|
||||
if( i >= 5 )
|
||||
{
|
||||
auto removed = ( ( removeFlag >> ( i - 5 ) ) & 1 ) > 0;
|
||||
if( removed )
|
||||
{
|
||||
auto oldItem = exteriorAppearenceContainer->getItem( i );
|
||||
if( oldItem )
|
||||
{
|
||||
exteriorAppearenceContainer->removeItem( i );
|
||||
invMgr.removeItemFromHousingContainer( land->getLandIdent(), exteriorAppearenceContainer->getId(), i );
|
||||
player.addItem( oldItem, false, false, false );
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
auto item = getHousingItemFromPlayer( player, static_cast< Sapphire::Common::InventoryType >( container ), slot );
|
||||
if( item )
|
||||
{
|
||||
auto oldItem = exteriorAppearenceContainer->getItem( i );
|
||||
exteriorAppearenceContainer->setItem( i, item );
|
||||
if( oldItem )
|
||||
{
|
||||
player.insertInventoryItem( static_cast< Sapphire::Common::InventoryType >( container ), slot, oldItem );
|
||||
}
|
||||
}
|
||||
}
|
||||
invMgr.sendInventoryContainer( player, exteriorAppearenceContainer );
|
||||
invMgr.saveHousingContainer( land->getLandIdent(), exteriorAppearenceContainer );
|
||||
updateHouseModels( land->getHouse() );
|
||||
std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() )->sendLandUpdate( plot );
|
||||
|
|
|
@ -181,7 +181,7 @@ namespace Sapphire::World::Manager
|
|||
|
||||
bool hasPermission( Entity::Player& player, Land& land, uint32_t permission );
|
||||
|
||||
void editExterior( Sapphire::Entity::Player& player, uint16_t plot, std::vector< uint16_t > containerList, std::vector< uint8_t> slotList );
|
||||
void editExterior( Sapphire::Entity::Player& player, uint16_t plot, std::vector< uint16_t > containerList, std::vector< uint8_t> slotList, uint8_t removeFlag );
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -743,7 +743,7 @@ void Sapphire::Network::GameConnection::housingEditExterior( const Packets::FFXI
|
|||
slotList.push_back( container != 0x270F ? static_cast< uint8_t >( packet.data().slot[i] ) : 0xFF );
|
||||
}
|
||||
|
||||
housingMgr.editExterior( player, packet.data().landId, containerList, slotList );
|
||||
housingMgr.editExterior( player, packet.data().landId, containerList, slotList, packet.data().removeFlag );
|
||||
}
|
||||
|
||||
void Sapphire::Network::GameConnection::marketBoardSearch( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||
|
|
Loading…
Add table
Reference in a new issue