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:
parent
5839d12980
commit
f303cb3ebc
4 changed files with 15 additions and 30 deletions
|
@ -147,22 +147,18 @@ void InventoryMgr::updateHousingItemPosition( Inventory::HousingItemPtr item )
|
||||||
|
|
||||||
auto pos = item->getPos();
|
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() );
|
auto rot = static_cast< int32_t >( item->getRot() );
|
||||||
|
|
||||||
stmt->setUInt64( 1, item->getUId() );
|
stmt->setUInt64( 1, item->getUId() );
|
||||||
|
|
||||||
stmt->setUInt( 2, posX );
|
stmt->setDouble( 2, pos.x );
|
||||||
stmt->setUInt( 3, posY );
|
stmt->setDouble( 3, pos.y );
|
||||||
stmt->setUInt( 4, posZ );
|
stmt->setDouble( 4, pos.z );
|
||||||
stmt->setInt( 5, rot );
|
stmt->setInt( 5, rot );
|
||||||
|
|
||||||
stmt->setUInt( 6, posX );
|
stmt->setDouble( 6, pos.x );
|
||||||
stmt->setUInt( 7, posY );
|
stmt->setDouble( 7, pos.y );
|
||||||
stmt->setUInt( 8, posZ );
|
stmt->setDouble( 8, pos.z );
|
||||||
stmt->setInt( 9, rot );
|
stmt->setInt( 9, rot );
|
||||||
|
|
||||||
db.execute( stmt );
|
db.execute( stmt );
|
||||||
|
|
|
@ -166,17 +166,14 @@ void Sapphire::HousingZone::onPlayerZoneIn( Entity::Player& player )
|
||||||
|
|
||||||
sendLandSet( player );
|
sendLandSet( player );
|
||||||
|
|
||||||
|
auto yardObjectSize = sizeof( Common::Furniture );
|
||||||
for( yardPacketNum = 0; yardPacketNum < yardPacketTotal; yardPacketNum++ )
|
for( yardPacketNum = 0; yardPacketNum < yardPacketTotal; yardPacketNum++ )
|
||||||
{
|
{
|
||||||
auto housingObjectInit = makeZonePacket< FFXIVIpcYardObjectList >( player.getId() );
|
auto housingObjectInit = makeZonePacket< FFXIVIpcYardObjectList >( player.getId() );
|
||||||
housingObjectInit->data().PacketIndex = yardPacketNum;
|
housingObjectInit->data().PacketIndex = yardPacketNum;
|
||||||
auto yardObjectSize = sizeof( Common::Furniture );
|
auto& objects = m_yardObjects;
|
||||||
housingObjectInit->data().PacketIndex = yardPacketNum;
|
|
||||||
housingObjectInit->data().PacketEnd = yardPacketTotal;
|
|
||||||
|
|
||||||
auto& objects = m_yardObjects[ isInSubdivision ? 1 : 0 ];
|
memcpy( &housingObjectInit->data().YardObjects, &objects[ yardPacketNum * 400 ], yardObjectSize * 400 );
|
||||||
|
|
||||||
memcpy( &housingObjectInit->data().YardObjects, &objects + ( yardPacketNum * 100 ), yardObjectSize * 100 );
|
|
||||||
|
|
||||||
server.queueForPlayer( player.getCharacterId(), housingObjectInit );
|
server.queueForPlayer( player.getCharacterId(), housingObjectInit );
|
||||||
}
|
}
|
||||||
|
@ -363,11 +360,13 @@ void Sapphire::HousingZone::updateYardObjects( Sapphire::Common::LandIdent ident
|
||||||
|
|
||||||
for( const auto& item : yardContainer->getItemMap() )
|
for( const auto& item : yardContainer->getItemMap() )
|
||||||
{
|
{
|
||||||
|
|
||||||
auto housingItem = std::dynamic_pointer_cast< Inventory::HousingItem >( item.second );
|
auto housingItem = std::dynamic_pointer_cast< Inventory::HousingItem >( item.second );
|
||||||
assert( housingItem );
|
assert( housingItem );
|
||||||
|
|
||||||
auto idx = item.first + arrayBounds.first;
|
auto idx = item.first + arrayBounds.first;
|
||||||
m_yardObjects[ idx ] = housingMgr.getYardObjectForItem( housingItem );
|
m_yardObjects[ idx ] = housingMgr.getYardObjectForItem( housingItem );
|
||||||
|
Logger::debug( "Loading yard item {} {}", item.second->getId(), idx );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#ifndef SAPPHIRE_HOUSINGZONE_H
|
#pragma once
|
||||||
#define SAPPHIRE_HOUSINGZONE_H
|
|
||||||
|
|
||||||
#include "Territory.h"
|
#include "Territory.h"
|
||||||
#include "Forwards.h"
|
#include "Forwards.h"
|
||||||
|
@ -62,7 +61,9 @@ namespace Sapphire
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using LandPtrMap = std::unordered_map< uint8_t, Sapphire::LandPtr >;
|
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
|
* @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
|
|
||||||
|
|
|
@ -62,16 +62,6 @@ void Sapphire::Land::init( Common::LandType type, Common::HouseSize size, Common
|
||||||
m_state = state;
|
m_state = state;
|
||||||
m_currentPrice = currentPrice;
|
m_currentPrice = currentPrice;
|
||||||
m_ownerId = ownerId;
|
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
|
uint32_t Sapphire::Land::getCurrentPrice() const
|
||||||
|
|
Loading…
Add table
Reference in a new issue