mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-25 19:17: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 >
|
FFXIVIpcBasePacket< HousingEditExterior >
|
||||||
{
|
{
|
||||||
uint16_t landId;
|
uint16_t landId;
|
||||||
uint8_t unknown[8];
|
uint8_t unknown[6];
|
||||||
|
uint8_t removeFlag;
|
||||||
|
uint8_t unknown2;
|
||||||
uint16_t container[9];
|
uint16_t container[9];
|
||||||
uint16_t slot[9];
|
uint16_t slot[9];
|
||||||
uint16_t padding;
|
uint16_t padding;
|
||||||
|
|
|
@ -1632,7 +1632,7 @@ Sapphire::Inventory::HousingItemPtr Sapphire::World::Manager::HousingMgr::getHou
|
||||||
return Inventory::make_HousingItem( tmpItem->getUId(), tmpItem->getId() );
|
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() );
|
auto terri = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
||||||
if( !terri )
|
if( !terri )
|
||||||
|
@ -1654,18 +1654,35 @@ void Sapphire::World::Manager::HousingMgr::editExterior( Sapphire::Entity::Playe
|
||||||
auto container = containerList.at( i );
|
auto container = containerList.at( i );
|
||||||
auto slot = slotList.at( i );
|
auto slot = slotList.at( i );
|
||||||
if( container == 0x270F || slot == 0xFF )
|
if( container == 0x270F || slot == 0xFF )
|
||||||
|
{
|
||||||
|
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;
|
continue;
|
||||||
|
}
|
||||||
auto item = getHousingItemFromPlayer( player, static_cast< Sapphire::Common::InventoryType >( container ), slot );
|
auto item = getHousingItemFromPlayer( player, static_cast< Sapphire::Common::InventoryType >( container ), slot );
|
||||||
if( item )
|
if( item )
|
||||||
{
|
{
|
||||||
auto oldItem = exteriorAppearenceContainer->getItem( i );
|
auto oldItem = exteriorAppearenceContainer->getItem( i );
|
||||||
|
exteriorAppearenceContainer->setItem( i, item );
|
||||||
if( oldItem )
|
if( oldItem )
|
||||||
{
|
{
|
||||||
player.addItem( oldItem, false, false, false );
|
player.insertInventoryItem( static_cast< Sapphire::Common::InventoryType >( container ), slot, oldItem );
|
||||||
}
|
}
|
||||||
exteriorAppearenceContainer->setItem( i, item );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
invMgr.sendInventoryContainer( player, exteriorAppearenceContainer );
|
||||||
invMgr.saveHousingContainer( land->getLandIdent(), exteriorAppearenceContainer );
|
invMgr.saveHousingContainer( land->getLandIdent(), exteriorAppearenceContainer );
|
||||||
updateHouseModels( land->getHouse() );
|
updateHouseModels( land->getHouse() );
|
||||||
std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() )->sendLandUpdate( plot );
|
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 );
|
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:
|
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 );
|
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,
|
void Sapphire::Network::GameConnection::marketBoardSearch( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||||
|
|
Loading…
Add table
Reference in a new issue