mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-08 11:47:45 +00:00
use HousingItem instead of Item for housing inventories
This commit is contained in:
parent
b77d4e6ff3
commit
b4e0c2a406
6 changed files with 72 additions and 16 deletions
|
@ -201,10 +201,13 @@ void Sapphire::Db::ZoneDbConnection::doPrepareStatements()
|
||||||
CONNECTION_BOTH );
|
CONNECTION_BOTH );
|
||||||
|
|
||||||
prepareStatement( LAND_INV_SEL_ALL,
|
prepareStatement( LAND_INV_SEL_ALL,
|
||||||
"SELECT houseiteminventory.*, charaglobalitem.catalogId, charaglobalitem.stain, charaglobalitem.CharacterId "
|
"SELECT houseiteminventory.*, charaglobalitem.catalogId, charaglobalitem.stain, charaglobalitem.CharacterId, "
|
||||||
|
"landplaceditems.PosX, landplaceditems.PosY, landplaceditems.PosZ, landplaceditems.Rotation "
|
||||||
"FROM houseiteminventory "
|
"FROM houseiteminventory "
|
||||||
"LEFT JOIN charaglobalitem "
|
"LEFT JOIN charaglobalitem "
|
||||||
"ON houseiteminventory.ItemId = charaglobalitem.itemId;",
|
"ON houseiteminventory.ItemId = charaglobalitem.itemId "
|
||||||
|
"LEFT JOIN landplaceditems "
|
||||||
|
"ON houseiteminventory.ItemId = landplaceditems.ItemId;",
|
||||||
CONNECTION_BOTH );
|
CONNECTION_BOTH );
|
||||||
|
|
||||||
prepareStatement( LAND_INV_SEL_HOUSE,
|
prepareStatement( LAND_INV_SEL_HOUSE,
|
||||||
|
|
|
@ -35,6 +35,11 @@ namespace World::Territory::Housing
|
||||||
TYPE_FORWARD( HousingInteriorTerritory );
|
TYPE_FORWARD( HousingInteriorTerritory );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Inventory
|
||||||
|
{
|
||||||
|
TYPE_FORWARD( HousingItem );
|
||||||
|
}
|
||||||
|
|
||||||
namespace World::Manager
|
namespace World::Manager
|
||||||
{
|
{
|
||||||
TYPE_FORWARD( HousingMgr );
|
TYPE_FORWARD( HousingMgr );
|
||||||
|
|
25
src/world/Inventory/HousingItem.cpp
Normal file
25
src/world/Inventory/HousingItem.cpp
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#include "HousingItem.h"
|
||||||
|
|
||||||
|
Sapphire::Inventory::HousingItem::HousingItem( uint64_t uId, uint32_t catalogId ) :
|
||||||
|
Sapphire::Item( uId, catalogId, 0, 0, false )
|
||||||
|
{ }
|
||||||
|
|
||||||
|
float Sapphire::Inventory::HousingItem::getRot() const
|
||||||
|
{
|
||||||
|
return m_rotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sapphire::Inventory::HousingItem::setRot( float rot )
|
||||||
|
{
|
||||||
|
m_rotation = rot;
|
||||||
|
}
|
||||||
|
|
||||||
|
Sapphire::Common::FFXIVARR_POSITION3 Sapphire::Inventory::HousingItem::getPos() const
|
||||||
|
{
|
||||||
|
return m_position;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sapphire::Inventory::HousingItem::setPos( Sapphire::Common::FFXIVARR_POSITION3 pos )
|
||||||
|
{
|
||||||
|
m_position = pos;
|
||||||
|
}
|
25
src/world/Inventory/HousingItem.h
Normal file
25
src/world/Inventory/HousingItem.h
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#ifndef SAPPHIRE_HOUSINGITEM_H
|
||||||
|
#define SAPPHIRE_HOUSINGITEM_H
|
||||||
|
|
||||||
|
#include "Item.h"
|
||||||
|
|
||||||
|
namespace Sapphire::Inventory
|
||||||
|
{
|
||||||
|
class HousingItem : public Item
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HousingItem( uint64_t uId, uint32_t catalogId );
|
||||||
|
|
||||||
|
void setRot( float rot );
|
||||||
|
float getRot() const;
|
||||||
|
|
||||||
|
void setPos( Common::FFXIVARR_POSITION3 pos );
|
||||||
|
Common::FFXIVARR_POSITION3 getPos() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Common::FFXIVARR_POSITION3 m_position;
|
||||||
|
float m_rotation;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //SAPPHIRE_HOUSINGITEM_H
|
|
@ -25,7 +25,7 @@
|
||||||
#include "ServerMgr.h"
|
#include "ServerMgr.h"
|
||||||
#include "Territory/House.h"
|
#include "Territory/House.h"
|
||||||
#include "InventoryMgr.h"
|
#include "InventoryMgr.h"
|
||||||
#include "Inventory/Item.h"
|
#include "Inventory/HousingItem.h"
|
||||||
#include "Inventory/ItemContainer.h"
|
#include "Inventory/ItemContainer.h"
|
||||||
|
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
|
@ -99,7 +99,7 @@ bool Sapphire::World::Manager::HousingMgr::loadEstateInventories()
|
||||||
auto stain = res->getUInt8( "stain" );
|
auto stain = res->getUInt8( "stain" );
|
||||||
auto characterId = res->getUInt64( "CharacterId" );
|
auto characterId = res->getUInt64( "CharacterId" );
|
||||||
|
|
||||||
auto item = make_Item( itemId, catalogId, 0, 0, 0 );
|
auto item = Inventory::make_HousingItem( itemId, catalogId );
|
||||||
item->setStain( stain );
|
item->setStain( stain );
|
||||||
// todo: need to set the owner character id on the item
|
// todo: need to set the owner character id on the item
|
||||||
|
|
||||||
|
@ -739,12 +739,10 @@ void Sapphire::World::Manager::HousingMgr::sendEstateInventory( Entity::Player&
|
||||||
if( targetLand->getOwnerId() != player.getId() )
|
if( targetLand->getOwnerId() != player.getId() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto container = getEstateInventory( targetLand->getLandIdent() )[ inventoryType ];
|
auto& containers = getEstateInventory( targetLand->getLandIdent() );
|
||||||
if( !container )
|
|
||||||
return;
|
|
||||||
|
|
||||||
auto invMgr = g_fw.get< Manager::InventoryMgr >();
|
auto invMgr = g_fw.get< Manager::InventoryMgr >();
|
||||||
invMgr->sendInventoryContainer( player, container );
|
invMgr->sendInventoryContainer( player, containers[ inventoryType ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
const Sapphire::World::Manager::HousingMgr::LandSetLandCacheMap&
|
const Sapphire::World::Manager::HousingMgr::LandSetLandCacheMap&
|
||||||
|
|
|
@ -83,7 +83,7 @@ Sapphire::ItemPtr Sapphire::World::Manager::InventoryMgr::createItem( Entity::Pl
|
||||||
auto stmt = pDb->getPreparedStatement( Db::CHARA_ITEMGLOBAL_INS );
|
auto stmt = pDb->getPreparedStatement( Db::CHARA_ITEMGLOBAL_INS );
|
||||||
|
|
||||||
stmt->setUInt( 1, player.getId() );
|
stmt->setUInt( 1, player.getId() );
|
||||||
stmt->setUInt( 2, item->getUId() );
|
stmt->setUInt64( 2, item->getUId() );
|
||||||
stmt->setUInt( 3, item->getId() );
|
stmt->setUInt( 3, item->getId() );
|
||||||
stmt->setUInt( 4, item->getStackSize() );
|
stmt->setUInt( 4, item->getStackSize() );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue