1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-30 08:07:46 +00:00

Fixing placement and storage of yard items

This commit is contained in:
Mordred 2023-01-29 12:35:43 +01:00
parent 5839d12980
commit f303cb3ebc
4 changed files with 15 additions and 30 deletions

View file

@ -147,22 +147,18 @@ void InventoryMgr::updateHousingItemPosition( Inventory::HousingItemPtr item )
auto pos = item->getPos();
auto posX = static_cast< uint32_t >( pos.x );
auto posY = static_cast< uint32_t >( pos.y );
auto posZ = static_cast< uint32_t >( pos.z );
auto rot = static_cast< int32_t >( item->getRot() );
stmt->setUInt64( 1, item->getUId() );
stmt->setUInt( 2, posX );
stmt->setUInt( 3, posY );
stmt->setUInt( 4, posZ );
stmt->setDouble( 2, pos.x );
stmt->setDouble( 3, pos.y );
stmt->setDouble( 4, pos.z );
stmt->setInt( 5, rot );
stmt->setUInt( 6, posX );
stmt->setUInt( 7, posY );
stmt->setUInt( 8, posZ );
stmt->setDouble( 6, pos.x );
stmt->setDouble( 7, pos.y );
stmt->setDouble( 8, pos.z );
stmt->setInt( 9, rot );
db.execute( stmt );

View file

@ -166,17 +166,14 @@ void Sapphire::HousingZone::onPlayerZoneIn( Entity::Player& player )
sendLandSet( player );
auto yardObjectSize = sizeof( Common::Furniture );
for( yardPacketNum = 0; yardPacketNum < yardPacketTotal; yardPacketNum++ )
{
auto housingObjectInit = makeZonePacket< FFXIVIpcYardObjectList >( player.getId() );
housingObjectInit->data().PacketIndex = yardPacketNum;
auto yardObjectSize = sizeof( Common::Furniture );
housingObjectInit->data().PacketIndex = yardPacketNum;
housingObjectInit->data().PacketEnd = yardPacketTotal;
auto& objects = m_yardObjects;
auto& objects = m_yardObjects[ isInSubdivision ? 1 : 0 ];
memcpy( &housingObjectInit->data().YardObjects, &objects + ( yardPacketNum * 100 ), yardObjectSize * 100 );
memcpy( &housingObjectInit->data().YardObjects, &objects[ yardPacketNum * 400 ], yardObjectSize * 400 );
server.queueForPlayer( player.getCharacterId(), housingObjectInit );
}
@ -363,11 +360,13 @@ void Sapphire::HousingZone::updateYardObjects( Sapphire::Common::LandIdent ident
for( const auto& item : yardContainer->getItemMap() )
{
auto housingItem = std::dynamic_pointer_cast< Inventory::HousingItem >( item.second );
assert( housingItem );
auto idx = item.first + arrayBounds.first;
m_yardObjects[ idx ] = housingMgr.getYardObjectForItem( housingItem );
Logger::debug( "Loading yard item {} {}", item.second->getId(), idx );
}
}

View file

@ -1,5 +1,4 @@
#ifndef SAPPHIRE_HOUSINGZONE_H
#define SAPPHIRE_HOUSINGZONE_H
#pragma once
#include "Territory.h"
#include "Forwards.h"
@ -62,7 +61,9 @@ namespace Sapphire
private:
using LandPtrMap = std::unordered_map< uint8_t, Sapphire::LandPtr >;
using YardObjectArray = std::array< Common::Furniture, 800 >;
/*! @brief global storage for all yard items in the ward */
using YardObjectArray = std::array< Common::Furniture, 1200 >;
/*!
* @brief Maps the start and end index of the yard object array for a specific plot
@ -87,4 +88,3 @@ namespace Sapphire
};
}
#endif //SAPPHIRE_HOUSINGZONE_H

View file

@ -62,16 +62,6 @@ void Sapphire::Land::init( Common::LandType type, Common::HouseSize size, Common
m_state = state;
m_currentPrice = currentPrice;
m_ownerId = ownerId;
auto& exdData = Common::Service< Data::ExdData >::ref();
// EXD TODO: This does not exist in 2.3
/*auto info = exdData.getRow< Excel::HousingMapMarkerInfo >( m_landIdent.territoryTypeId, m_landIdent.landId );
if( info )
{
m_mapMarkerPosition.x = info->x;
m_mapMarkerPosition.y = info->y;
m_mapMarkerPosition.z = info->z;
}*/
}
uint32_t Sapphire::Land::getCurrentPrice() const