1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-03 17:27:47 +00:00

add internal housing item placement

This commit is contained in:
NotAdam 2018-12-27 00:36:47 +11:00
parent 9c7d0262e0
commit 9f4648efa8
6 changed files with 36 additions and 20 deletions

View file

@ -201,6 +201,7 @@ namespace Sapphire::Network::Packets
HousingShowEstateGuestAccess = 0x022A, // updated 4.4 HousingShowEstateGuestAccess = 0x022A, // updated 4.4
HousingObjectInitialize = 0x022C, // updated 4.4 HousingObjectInitialize = 0x022C, // updated 4.4
HousingInternalObjectSpawn = 0x22D, // updated 4.4
HousingWardInfo = 0x022F, // updated 4.4 HousingWardInfo = 0x022F, // updated 4.4
YardObjectMove = 0x0230, // updated 4.4 YardObjectMove = 0x0230, // updated 4.4

View file

@ -1711,6 +1711,19 @@ struct FFXIVIpcHousingObjectInitialize : FFXIVIpcBasePacket< HousingObjectInitia
uint32_t unknown4; //unused uint32_t unknown4; //unused
}; };
struct FFXIVIpcHousingInternalObjectSpawn : FFXIVIpcBasePacket< HousingInternalObjectSpawn >
{
uint16_t containerId;
uint8_t containerOffset;
uint8_t pad1;
uint16_t itemId;
uint8_t unk2;
uint8_t pad2;
uint16_t rotation;
Common::FFXIVARR_POSITION3_U16 pos;
};
struct FFXIVIpcHousingIndoorInitialize : FFXIVIpcBasePacket< HousingIndoorInitialize > struct FFXIVIpcHousingIndoorInitialize : FFXIVIpcBasePacket< HousingIndoorInitialize >
{ {
uint16_t u1; uint16_t u1;

View file

@ -934,18 +934,14 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceHousingItem( Sapphire::Entity
isOutside = true; isOutside = true;
} }
// otherwise, inside a house. landId is 0 when inside a plot // otherwise, inside a house. landId is 0 when inside a plot
else if( landId == 0 ) else if( auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentZone() ) )
{ {
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentZone() );
if( !zone )
return;
// todo: this whole process is retarded and needs to be fixed // todo: this whole process is retarded and needs to be fixed
// perhaps maintain a list of estates by ident inside housingmgr? // perhaps maintain a list of estates by ident inside housingmgr?
auto ident = zone->getLandIdent(); auto ident = zone->getLandIdent();
auto landSet = toLandSetId( ident.territoryTypeId, ident.wardNum ); auto landSet = toLandSetId( ident.territoryTypeId, ident.wardNum );
land = getHousingZoneByLandSetId( landSet )->getLand( landId ); land = getHousingZoneByLandSetId( landSet )->getLand( ident.landId );
} }
// wtf? // wtf?
else else
@ -994,8 +990,8 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceHousingItem( Sapphire::Entity
} }
else else
{ {
player.sendUrgent( "you can't place internal items (yet)" ); if( !placeInteriorItem( player, item ) )
return; player.sendUrgent( "An internal error occurred when placing the item." );
} }
} }
@ -1082,7 +1078,7 @@ bool Sapphire::World::Manager::HousingMgr::placeInteriorItem( Entity::Player& pl
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentZone() ); auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentZone() );
assert( zone ); assert( zone );
zone->spawnYardObject( containerIdx, freeSlot, item ); zone->spawnYardObject( containerIdx, freeSlot, containerId, item );
return true; return true;
} }

View file

@ -448,6 +448,8 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( const Packets::FFX
if( !housingMgr ) if( !housingMgr )
break; break;
// housingMgr->sendHousingInventory( player, Common::InventoryType::HousingInd, 255 ); // housingMgr->sendHousingInventory( player, Common::InventoryType::HousingInd, 255 );
break; break;

View file

@ -160,6 +160,7 @@ void Sapphire::World::Territory::Housing::HousingInteriorTerritory::updateYardOb
void Sapphire::World::Territory::Housing::HousingInteriorTerritory::spawnYardObject( uint8_t containerIdx, void Sapphire::World::Territory::Housing::HousingInteriorTerritory::spawnYardObject( uint8_t containerIdx,
uint16_t slot, uint16_t slot,
uint16_t containerType,
Inventory::HousingItemPtr item ) Inventory::HousingItemPtr item )
{ {
auto housingMgr = g_fw.get< Manager::HousingMgr >(); auto housingMgr = g_fw.get< Manager::HousingMgr >();
@ -169,14 +170,17 @@ void Sapphire::World::Territory::Housing::HousingInteriorTerritory::spawnYardObj
m_yardObjects[ offset ] = obj; m_yardObjects[ offset ] = obj;
// for( const auto& player : m_playerMap ) for( const auto& player : m_playerMap )
// { {
// auto packet = makeZonePacket< Server::FFXIVIpcYardObjectSpawn >( player.second->getId() ); auto objectSpawnPkt = makeZonePacket< Server::FFXIVIpcHousingInternalObjectSpawn >( player.second->getId() );
//
// packet->data().landSetId = 0; objectSpawnPkt->data().containerId = containerType;
// packet->data().objectArray = static_cast< uint8_t >( offset ); objectSpawnPkt->data().containerOffset = slot;
// packet->data().object = obj;
// objectSpawnPkt->data().itemId = item->getAdditionalData() & 0xFFFF;
// player.second->queuePacket( packet ); objectSpawnPkt->data().rotation = item->getRot();
// } objectSpawnPkt->data().pos = item->getPos();
player.second->queuePacket( objectSpawnPkt );
}
} }

View file

@ -25,7 +25,7 @@ namespace Sapphire::World::Territory::Housing
const Common::LandIdent getLandIdent() const; const Common::LandIdent getLandIdent() const;
void updateYardObjects(); void updateYardObjects();
void spawnYardObject( uint8_t containerIdx, uint16_t slot, Inventory::HousingItemPtr item ); void spawnYardObject( uint8_t containerIdx, uint16_t slot, uint16_t containerType, Inventory::HousingItemPtr item );
private: private:
Common::LandIdent m_landIdent; Common::LandIdent m_landIdent;