mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-30 16:17:46 +00:00
fix container handling issue where they were created incorrectly
This commit is contained in:
parent
6fb1f90b46
commit
8aed0e7979
7 changed files with 71 additions and 10 deletions
|
@ -314,7 +314,7 @@ namespace Sapphire::Network::Packets
|
|||
|
||||
LandRenameHandler = 0x0171, // updated 4.4
|
||||
HousingUpdateHouseGreeting = 0x0172, // updated 4.4
|
||||
HousingUpdateObjectRotation = 0x0173, // updated 4.4
|
||||
HousingUpdateObjectPosition = 0x0173, // updated 4.4
|
||||
|
||||
SetSharedEstateSettings = 0x0177, // updated 4.4
|
||||
|
||||
|
|
|
@ -256,6 +256,19 @@ struct FFXIVIpcReqPlaceHousingItem :
|
|||
/* 0020 */ uint32_t unknown4[2]; // always 0 it looks like
|
||||
};
|
||||
|
||||
struct FFXIVIpcHousingUpdateObjectPosition :
|
||||
FFXIVIpcBasePacket< HousingUpdateObjectPosition >
|
||||
{
|
||||
/* 0000 */ Common::LandIdent ident;
|
||||
/* 0008 */ uint16_t slot;
|
||||
/* 000A */ uint16_t containerId;
|
||||
|
||||
/* 000C */ Common::FFXIVARR_POSITION3 pos;
|
||||
/* 0018 */ float rotation;
|
||||
|
||||
/* 001C */ uint32_t padding;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,13 +39,13 @@ extern Sapphire::Framework g_fw;
|
|||
Sapphire::World::Manager::HousingMgr::HousingMgr()
|
||||
{
|
||||
m_containerMap[ 0 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems1, InventoryType::HousingInteriorStoreroom1 );
|
||||
m_containerMap[ 1 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems1, InventoryType::HousingInteriorStoreroom1 );
|
||||
m_containerMap[ 2 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems1, InventoryType::HousingInteriorStoreroom1 );
|
||||
m_containerMap[ 3 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems1, InventoryType::HousingInteriorStoreroom1 );
|
||||
m_containerMap[ 4 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems1, InventoryType::HousingInteriorStoreroom1 );
|
||||
m_containerMap[ 5 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems1, InventoryType::HousingInteriorStoreroom1 );
|
||||
m_containerMap[ 6 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems1, InventoryType::HousingInteriorStoreroom1 );
|
||||
m_containerMap[ 7 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems1, InventoryType::HousingInteriorStoreroom1 );
|
||||
m_containerMap[ 1 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems2, InventoryType::HousingInteriorStoreroom2 );
|
||||
m_containerMap[ 2 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems3, InventoryType::HousingInteriorStoreroom3 );
|
||||
m_containerMap[ 3 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems4, InventoryType::HousingInteriorStoreroom4 );
|
||||
m_containerMap[ 4 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems5, InventoryType::HousingInteriorStoreroom5 );
|
||||
m_containerMap[ 5 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems6, InventoryType::HousingInteriorStoreroom6 );
|
||||
m_containerMap[ 6 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems7, InventoryType::HousingInteriorStoreroom7 );
|
||||
m_containerMap[ 7 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems8, InventoryType::HousingInteriorStoreroom8 );
|
||||
|
||||
m_internalPlacedItemContainers =
|
||||
{
|
||||
|
@ -247,7 +247,7 @@ void Sapphire::World::Manager::HousingMgr::initLandCache()
|
|||
uint16_t count = 0;
|
||||
for( int i = 0; i < 8; ++i )
|
||||
{
|
||||
if( count >= entry.m_maxPlacedInternalItems )
|
||||
if( count > entry.m_maxPlacedInternalItems )
|
||||
break;
|
||||
|
||||
auto& pair = m_containerMap[ i ];
|
||||
|
@ -978,6 +978,9 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceHousingItem( Sapphire::Entity
|
|||
if( land->getOwnerId() != player.getId() )
|
||||
return;
|
||||
|
||||
// todo: check item position and make sure it's not outside the plot
|
||||
// retail uses a radius based check
|
||||
|
||||
// unlink item
|
||||
Inventory::HousingItemPtr item;
|
||||
|
||||
|
@ -1063,12 +1066,17 @@ bool Sapphire::World::Manager::HousingMgr::placeInteriorItem( Entity::Player& pl
|
|||
|
||||
auto ident = zone->getLandIdent();
|
||||
|
||||
auto& containers = getEstateInventory( ident );
|
||||
|
||||
// find first free container
|
||||
uint8_t containerIdx = 0;
|
||||
for( auto containerId : m_internalPlacedItemContainers )
|
||||
{
|
||||
auto& container = getEstateInventory( ident )[ containerId ];
|
||||
auto needle = containers.find( containerId );
|
||||
if( needle == containers.end() )
|
||||
continue;
|
||||
|
||||
auto container = needle->second;
|
||||
auto freeSlot = container->getFreeSlot();
|
||||
if( freeSlot == -1 )
|
||||
{
|
||||
|
@ -1137,4 +1145,23 @@ void Sapphire::World::Manager::HousingMgr::sendInternalEstateInventoryBatch( Sap
|
|||
|
||||
invMgr->sendInventoryContainer( player, container->second );
|
||||
}
|
||||
}
|
||||
|
||||
void Sapphire::World::Manager::HousingMgr::reqMoveHousingItem( Entity::Player& player,
|
||||
Common::LandIdent ident, uint16_t slot,
|
||||
uint16_t container,
|
||||
Common::FFXIVARR_POSITION3 pos, float rot )
|
||||
{
|
||||
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;
|
||||
|
||||
// update item in db
|
||||
|
||||
}
|
|
@ -165,6 +165,11 @@ namespace Sapphire::World::Manager
|
|||
*/
|
||||
Common::YardObject getYardObjectForItem( Inventory::HousingItemPtr item ) const;
|
||||
|
||||
|
||||
void reqMoveHousingItem( Entity::Player& player, Common::LandIdent ident, uint16_t slot,
|
||||
uint16_t container, Common::FFXIVARR_POSITION3 pos, float rot );
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/*!
|
||||
|
|
|
@ -89,6 +89,8 @@ Sapphire::Network::GameConnection::GameConnection( Sapphire::Network::HivePtr pH
|
|||
setZoneHandler( ClientZoneIpcType::HousingUpdateHouseGreeting, "HousingUpdateHouseGreeting",
|
||||
&GameConnection::housingUpdateGreetingHandler );
|
||||
setZoneHandler( ClientZoneIpcType::ReqPlaceHousingItem, "ReqPlaceHousingItem", &GameConnection::reqPlaceHousingItem );
|
||||
setZoneHandler( ClientZoneIpcType::HousingUpdateObjectPosition, "HousingUpdateObjectPosition",
|
||||
&GameConnection::reqMoveHousingItem );
|
||||
|
||||
setZoneHandler( ClientZoneIpcType::TalkEventHandler, "EventHandlerTalk", &GameConnection::eventHandlerTalk );
|
||||
setZoneHandler( ClientZoneIpcType::EmoteEventHandler, "EventHandlerEmote", &GameConnection::eventHandlerEmote );
|
||||
|
|
|
@ -173,6 +173,8 @@ namespace Sapphire::Network
|
|||
|
||||
DECLARE_HANDLER( reqPlaceHousingItem );
|
||||
|
||||
DECLARE_HANDLER( reqMoveHousingItem );
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -715,4 +715,16 @@ void Sapphire::Network::GameConnection::reqPlaceHousingItem( const Packets::FFXI
|
|||
|
||||
housingMgr->reqPlaceHousingItem( player, data.landId, data.sourceInvContainerId, data.sourceInvSlotId,
|
||||
data.position, data.rotation );
|
||||
}
|
||||
|
||||
void Sapphire::Network::GameConnection::reqMoveHousingItem( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||
Entity::Player& player )
|
||||
{
|
||||
auto housingMgr = g_fw.get< HousingMgr >();
|
||||
|
||||
const auto packet = ZoneChannelPacket< Client::FFXIVIpcHousingUpdateObjectPosition >( inPacket );
|
||||
const auto& data = packet.data();
|
||||
|
||||
housingMgr->reqMoveHousingItem( player, data.ident, data.slot, data.containerId, data.pos, data.rotation );
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue