1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 14:37:44 +00:00

initial pass to fix housing issues

This commit is contained in:
NotAdam 2019-01-10 15:03:25 +11:00
parent cfabc721dd
commit da40b9e97f
8 changed files with 19 additions and 33 deletions

View file

@ -576,9 +576,9 @@ CREATE TABLE `zonepositions` (
CREATE TABLE `landplaceditems` ( CREATE TABLE `landplaceditems` (
`ItemId` INT(20) UNSIGNED NOT NULL, `ItemId` INT(20) UNSIGNED NOT NULL,
`PosX` INT(10) NOT NULL, `PosX` FLOAT NOT NULL,
`PosY` INT(10) NOT NULL, `PosY` FLOAT NOT NULL,
`PosZ` INT(10) NOT NULL, `PosZ` FLOAT NOT NULL,
`Rotation` INT(10) NOT NULL, `Rotation` INT(10) NOT NULL,
PRIMARY KEY (`ItemId`) PRIMARY KEY (`ItemId`)
) )

View file

@ -856,7 +856,7 @@ namespace Sapphire::Common
{ {
uint32_t itemId; uint32_t itemId;
uint16_t itemRotation; uint16_t itemRotation;
Common::FFXIVARR_POSITION3_U16 pos; Common::FFXIVARR_POSITION3 pos;
}; };
enum HouseSize : uint8_t enum HouseSize : uint8_t

View file

@ -1695,7 +1695,7 @@ struct FFXIVIpcHousingObjectMove : FFXIVIpcBasePacket< HousingObjectMove >
uint16_t itemRotation; uint16_t itemRotation;
uint8_t objectArray; uint8_t objectArray;
uint8_t landId; uint8_t landId;
Common::FFXIVARR_POSITION3_U16 pos; Common::FFXIVARR_POSITION3 pos;
uint16_t unknown1; uint16_t unknown1;
uint16_t unknown2; uint16_t unknown2;
uint16_t unknown3; uint16_t unknown3;
@ -1726,7 +1726,7 @@ struct FFXIVIpcHousingInternalObjectSpawn : FFXIVIpcBasePacket< HousingInternalO
uint8_t unk2; uint8_t unk2;
uint8_t pad2; uint8_t pad2;
uint16_t rotation; uint16_t rotation;
Common::FFXIVARR_POSITION3_U16 pos; Common::FFXIVARR_POSITION3 pos;
}; };
struct FFXIVIpcHousingIndoorInitialize : FFXIVIpcBasePacket< HousingIndoorInitialize > struct FFXIVIpcHousingIndoorInitialize : FFXIVIpcBasePacket< HousingIndoorInitialize >

View file

@ -18,12 +18,12 @@ void Sapphire::Inventory::HousingItem::setRot( uint16_t rot )
m_rotation = rot; m_rotation = rot;
} }
Sapphire::Common::FFXIVARR_POSITION3_U16 Sapphire::Inventory::HousingItem::getPos() const Sapphire::Common::FFXIVARR_POSITION3 Sapphire::Inventory::HousingItem::getPos() const
{ {
return m_position; return m_position;
} }
void Sapphire::Inventory::HousingItem::setPos( Sapphire::Common::FFXIVARR_POSITION3_U16 pos ) void Sapphire::Inventory::HousingItem::setPos( Sapphire::Common::FFXIVARR_POSITION3 pos )
{ {
m_position = pos; m_position = pos;
} }

View file

@ -14,11 +14,11 @@ namespace Sapphire::Inventory
void setRot( uint16_t rot ); void setRot( uint16_t rot );
uint16_t getRot() const; uint16_t getRot() const;
void setPos( Common::FFXIVARR_POSITION3_U16 pos ); void setPos( Common::FFXIVARR_POSITION3 pos );
Common::FFXIVARR_POSITION3_U16 getPos() const; Common::FFXIVARR_POSITION3 getPos() const;
private: private:
Common::FFXIVARR_POSITION3_U16 m_position; Common::FFXIVARR_POSITION3 m_position;
uint16_t m_rotation; uint16_t m_rotation;
}; };
} }

View file

@ -139,9 +139,9 @@ bool Sapphire::World::Manager::HousingMgr::loadEstateInventories()
if( isPlacedItemsInventory( static_cast< Common::InventoryType >( containerId ) ) ) if( isPlacedItemsInventory( static_cast< Common::InventoryType >( containerId ) ) )
{ {
item->setPos( { item->setPos( {
res->getUInt16( "PosX" ), res->getFloat( "PosX" ),
res->getUInt16( "PosY" ), res->getFloat( "PosY" ),
res->getUInt16( "PosZ" ) res->getFloat( "PosZ" )
} ); } );
item->setRot( res->getUInt16( "Rotation" ) ); item->setRot( res->getUInt16( "Rotation" ) );
@ -1007,12 +1007,7 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceHousingItem( Sapphire::Entity
return; return;
// set params // set params
item->setPos( { item->setPos( pos );
Util::floatToUInt16( pos.x ),
Util::floatToUInt16( pos.y ),
Util::floatToUInt16( pos.z )
} );
item->setRot( Util::floatToUInt16Rot( rotation ) ); item->setRot( Util::floatToUInt16Rot( rotation ) );
} }
else else
@ -1281,11 +1276,7 @@ bool Sapphire::World::Manager::HousingMgr::moveInternalItem( Entity::Player& pla
if( !item ) if( !item )
return false; return false;
item->setPos( { item->setPos( pos );
Util::floatToUInt16( pos.x ),
Util::floatToUInt16( pos.y ),
Util::floatToUInt16( pos.z )
} );
item->setRot( Util::floatToUInt16Rot( rot ) ); item->setRot( Util::floatToUInt16Rot( rot ) );
@ -1324,12 +1315,7 @@ bool Sapphire::World::Manager::HousingMgr::moveExternalItem( Entity::Player& pla
if( !item ) if( !item )
return false; return false;
item->setPos( { item->setPos( pos );
Util::floatToUInt16( pos.x ),
Util::floatToUInt16( pos.y ),
Util::floatToUInt16( pos.z )
} );
item->setRot( Util::floatToUInt16Rot( rot ) ); item->setRot( Util::floatToUInt16Rot( rot ) );
auto invMgr = framework()->get< InventoryMgr >(); auto invMgr = framework()->get< InventoryMgr >();

View file

@ -196,7 +196,7 @@ void Sapphire::World::Territory::Housing::HousingInteriorTerritory::spawnHousing
void Sapphire::World::Territory::Housing::HousingInteriorTerritory::updateHousingObjectPosition( Entity::Player& sourcePlayer, void Sapphire::World::Territory::Housing::HousingInteriorTerritory::updateHousingObjectPosition( Entity::Player& sourcePlayer,
uint16_t slot, uint16_t slot,
Common::FFXIVARR_POSITION3_U16 pos, Common::FFXIVARR_POSITION3 pos,
uint16_t rot ) uint16_t rot )
{ {
auto& obj = m_housingObjects[ slot ]; auto& obj = m_housingObjects[ slot ];

View file

@ -29,7 +29,7 @@ namespace Sapphire::World::Territory::Housing
void spawnHousingObject( uint8_t containerIdx, uint16_t slot, uint16_t containerType, void spawnHousingObject( uint8_t containerIdx, uint16_t slot, uint16_t containerType,
Inventory::HousingItemPtr item ); Inventory::HousingItemPtr item );
void updateHousingObjectPosition( void updateHousingObjectPosition(
Entity::Player& sourcePlayer, uint16_t slot, Sapphire::Common::FFXIVARR_POSITION3_U16 pos, uint16_t rot ); Entity::Player& sourcePlayer, uint16_t slot, Sapphire::Common::FFXIVARR_POSITION3 pos, uint16_t rot );
void removeHousingObject( uint16_t slot ); void removeHousingObject( uint16_t slot );
private: private: