mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-30 16:17:46 +00:00
add interior housing object movement updates
This commit is contained in:
parent
34e9ba131e
commit
0ca7b4815e
6 changed files with 26 additions and 7 deletions
|
@ -204,7 +204,7 @@ namespace Sapphire::Network::Packets
|
|||
HousingInternalObjectSpawn = 0x22D, // updated 4.4
|
||||
|
||||
HousingWardInfo = 0x022F, // updated 4.4
|
||||
YardObjectMove = 0x0230, // updated 4.4
|
||||
HousingObjectMove = 0x0230, // updated 4.4
|
||||
|
||||
SharedEstateSettingsResponse = 0x023C, // updated 4.4
|
||||
|
||||
|
|
|
@ -1687,7 +1687,7 @@ struct FFXIVIpcYardObjectSpawn : FFXIVIpcBasePacket< YardObjectSpawn >
|
|||
Common::HousingObject object;
|
||||
};
|
||||
|
||||
struct FFXIVIpcYardObjectMove : FFXIVIpcBasePacket< YardObjectMove >
|
||||
struct FFXIVIpcHousingObjectMove : FFXIVIpcBasePacket< HousingObjectMove >
|
||||
{
|
||||
uint16_t itemRotation;
|
||||
uint8_t objectArray;
|
||||
|
|
|
@ -1225,7 +1225,7 @@ bool Sapphire::World::Manager::HousingMgr::moveInternalItem( Entity::Player& pla
|
|||
auto invMgr = g_fw.get< InventoryMgr >();
|
||||
invMgr->updateHousingItemPosition( item );
|
||||
|
||||
terri.updateHousingObjectPosition( slot, item->getPos(), item->getRot() );
|
||||
terri.updateHousingObjectPosition( player, slot, item->getPos(), item->getRot() );
|
||||
|
||||
// send confirmation to player
|
||||
uint32_t param1 = ( ident.landId << 16 ) | containerId;
|
||||
|
|
|
@ -187,8 +187,9 @@ void Sapphire::World::Territory::Housing::HousingInteriorTerritory::spawnHousing
|
|||
}
|
||||
}
|
||||
|
||||
void Sapphire::World::Territory::Housing::HousingInteriorTerritory::updateHousingObjectPosition( uint16_t slot,
|
||||
Sapphire::Common::FFXIVARR_POSITION3_U16 pos,
|
||||
void Sapphire::World::Territory::Housing::HousingInteriorTerritory::updateHousingObjectPosition( Entity::Player& sourcePlayer,
|
||||
uint16_t slot,
|
||||
Common::FFXIVARR_POSITION3_U16 pos,
|
||||
uint16_t rot )
|
||||
{
|
||||
auto& obj = m_housingObjects[ slot ];
|
||||
|
@ -197,6 +198,23 @@ void Sapphire::World::Territory::Housing::HousingInteriorTerritory::updateHousin
|
|||
obj.itemRotation = rot;
|
||||
|
||||
// todo: how does this update on other clients?
|
||||
|
||||
for( const auto& player : m_playerMap )
|
||||
{
|
||||
if( player.second->getId() == sourcePlayer.getId() )
|
||||
continue;
|
||||
|
||||
auto moveObjPkt = makeZonePacket< Server::FFXIVIpcHousingObjectMove >( player.second->getId() );
|
||||
|
||||
moveObjPkt->data().itemRotation = obj.itemRotation;
|
||||
moveObjPkt->data().pos = obj.pos;
|
||||
|
||||
// todo: how does this work when an item is in a slot >50 or u8 max? my guess is landid is the container index, but not sure...
|
||||
moveObjPkt->data().objectArray = static_cast< uint8_t >( slot % 50 );
|
||||
moveObjPkt->data().landId = static_cast< uint8_t >( slot / 50 );
|
||||
|
||||
player.second->queuePacket( moveObjPkt );
|
||||
}
|
||||
}
|
||||
|
||||
void Sapphire::World::Territory::Housing::HousingInteriorTerritory::removeHousingObject( uint16_t slot )
|
||||
|
|
|
@ -27,7 +27,8 @@ namespace Sapphire::World::Territory::Housing
|
|||
void updateHousingObjects();
|
||||
void spawnHousingObject( uint8_t containerIdx, uint16_t slot, uint16_t containerType,
|
||||
Inventory::HousingItemPtr item );
|
||||
void updateHousingObjectPosition( uint16_t slot, Common::FFXIVARR_POSITION3_U16 pos, uint16_t rot );
|
||||
void updateHousingObjectPosition(
|
||||
Entity::Player& sourcePlayer, uint16_t slot, Sapphire::Common::FFXIVARR_POSITION3_U16 pos, uint16_t rot );
|
||||
void removeHousingObject( uint16_t slot );
|
||||
|
||||
private:
|
||||
|
|
|
@ -394,7 +394,7 @@ void Sapphire::HousingZone::updateYardObjectPos( Entity::Player& sourcePlayer, u
|
|||
if( player.second->getId() == sourcePlayer.getId() )
|
||||
continue;
|
||||
|
||||
auto packet = makeZonePacket< Server::FFXIVIpcYardObjectMove >( player.second->getId() );
|
||||
auto packet = makeZonePacket< Server::FFXIVIpcHousingObjectMove >( player.second->getId() );
|
||||
|
||||
packet->data().itemRotation = item.getRot();
|
||||
packet->data().pos = item.getPos();
|
||||
|
|
Loading…
Add table
Reference in a new issue