From c86371ac56e664834c9fbb4828ffaab6d3936dbc Mon Sep 17 00:00:00 2001 From: NotAdam Date: Thu, 27 Dec 2018 23:48:55 +1100 Subject: [PATCH] fix issue where yard items couldn't be moved properly --- src/common/Network/CommonActorControl.h | 5 +++++ src/world/Manager/HousingMgr.cpp | 6 +++--- src/world/Territory/HousingZone.cpp | 7 ++++++- src/world/Territory/HousingZone.h | 3 ++- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/common/Network/CommonActorControl.h b/src/common/Network/CommonActorControl.h index 6873140c..965d816a 100644 --- a/src/common/Network/CommonActorControl.h +++ b/src/common/Network/CommonActorControl.h @@ -215,6 +215,11 @@ enum ActorControlType : uint16_t ShowBuildPresetUI = 0x3E9, BuildPresetResponse = 0x3ED, + /*! + * param1 = object array index + */ + RemoveExteriorHousingItem = 0x3EF, + /*! * param1 = object array index */ diff --git a/src/world/Manager/HousingMgr.cpp b/src/world/Manager/HousingMgr.cpp index aea73e84..1fe8071f 100644 --- a/src/world/Manager/HousingMgr.cpp +++ b/src/world/Manager/HousingMgr.cpp @@ -1260,10 +1260,10 @@ bool Sapphire::World::Manager::HousingMgr::moveExternalItem( Entity::Player& pla auto invMgr = g_fw.get< InventoryMgr >(); invMgr->updateHousingItemPosition( item ); - terri.updateYardObjectPos( slot, ident.landId, *item ); + terri.updateYardObjectPos( player, slot, ident.landId, *item ); - // todo: something is sent to the player here to indicate the move has finished successfully - // currently they can move one item and then can't move any more + uint32_t param1 = ( ident.landId << 16 ) | InventoryType::HousingExteriorPlacedItems; + player.queuePacket( Server::makeActorControl143( player.getId(), ActorControl::HousingItemMoveConfirm, param1, slot ) ); return true; diff --git a/src/world/Territory/HousingZone.cpp b/src/world/Territory/HousingZone.cpp index 07bac271..2aaa3b90 100644 --- a/src/world/Territory/HousingZone.cpp +++ b/src/world/Territory/HousingZone.cpp @@ -374,7 +374,8 @@ void Sapphire::HousingZone::spawnYardObject( uint8_t landId, uint16_t slotId, In } } -void Sapphire::HousingZone::updateYardObjectPos( uint16_t slot, uint16_t landId, Inventory::HousingItem& item ) +void Sapphire::HousingZone::updateYardObjectPos( Entity::Player& sourcePlayer, uint16_t slot, uint16_t landId, + Inventory::HousingItem& item ) { auto bounds = m_yardObjectArrayBounds[ landId ]; auto offset = bounds.first + slot; @@ -387,6 +388,10 @@ void Sapphire::HousingZone::updateYardObjectPos( uint16_t slot, uint16_t landId, for( const auto& player : m_playerMap ) { + // don't send it from the origin player, it already has the position from the move request + if( player.second->getId() == sourcePlayer.getId() ) + continue; + auto packet = makeZonePacket< Server::FFXIVIpcYardObjectMove >( player.second->getId() ); packet->data().itemRotation = item.getRot(); diff --git a/src/world/Territory/HousingZone.h b/src/world/Territory/HousingZone.h index b8295afe..aac75ca0 100644 --- a/src/world/Territory/HousingZone.h +++ b/src/world/Territory/HousingZone.h @@ -56,7 +56,8 @@ namespace Sapphire void updateYardObjects( Common::LandIdent ident ); void spawnYardObject( uint8_t landId, uint16_t slotId, Sapphire::Inventory::HousingItem& item ); - void updateYardObjectPos( uint16_t slot, uint16_t landId, Inventory::HousingItem& item ); + void updateYardObjectPos( Entity::Player& sourcePlayer, uint16_t slot, uint16_t landId, + Inventory::HousingItem& item ); private: using LandPtrMap = std::unordered_map< uint8_t, Sapphire::LandPtr >;