mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-28 07:07:45 +00:00
Merge pull request #456 from NotAdam/housing
housing inventory storage, now with proper container IDs
This commit is contained in:
commit
a2a05f4b39
13 changed files with 77 additions and 32 deletions
|
@ -13,9 +13,7 @@ matrix:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
- llvm-toolchain-trusty-6.0
|
|
||||||
packages:
|
packages:
|
||||||
- clang-6.0
|
|
||||||
- g++-7
|
- g++-7
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
|
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
|
||||||
|
@ -29,8 +27,7 @@ cache:
|
||||||
# Setup build matrix and dependencies
|
# Setup build matrix and dependencies
|
||||||
before_install:
|
before_install:
|
||||||
- eval "${MATRIX_EVAL}"
|
- eval "${MATRIX_EVAL}"
|
||||||
- gem install --no-ri --no-rdoc mtime_cache
|
- gem install mtime_cache --no-document
|
||||||
- sudo add-apt-repository -y ppa:rexut/recoil
|
|
||||||
- sudo apt-get update
|
- sudo apt-get update
|
||||||
- sudo apt-get install -y libmysqlclient-dev
|
- sudo apt-get install -y libmysqlclient-dev
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
[](https://discord.gg/xxcdCER)
|
[](https://discord.gg/xxcdCER)
|
||||||
[](https://travis-ci.org/SapphireMordred/Sapphire)
|
[](https://travis-ci.org/SapphireServer/Sapphire)
|
||||||
[](https://ci.appveyor.com/project/SapphireMordred/Sapphire)
|
[](https://ci.appveyor.com/project/SapphireMordred/Sapphire)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -530,9 +530,10 @@ CREATE TABLE `landset` (
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||||
|
|
||||||
CREATE TABLE `houseiteminventory` (
|
CREATE TABLE `houseiteminventory` (
|
||||||
`landIdent` BIGINT(20) UNSIGNED NOT NULL,
|
`LandIdent` BIGINT(20) UNSIGNED NOT NULL,
|
||||||
`containerId` INT(10) UNSIGNED NOT NULL,
|
`ContainerId` INT(10) UNSIGNED NOT NULL,
|
||||||
`itemId` INT(20) NOT NULL,
|
`ItemId` INT(20) NOT NULL,
|
||||||
|
`SlotId` INT(10) UNSIGNED NOT NULL,
|
||||||
INDEX `landIdent` (`landIdent`)
|
INDEX `landIdent` (`landIdent`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||||
|
|
||||||
|
|
|
@ -222,10 +222,36 @@ namespace Sapphire::Common
|
||||||
FreeCompanyGil = 22000,
|
FreeCompanyGil = 22000,
|
||||||
FreeCompanyCrystal = 22001,
|
FreeCompanyCrystal = 22001,
|
||||||
|
|
||||||
HousingExternalAppearance = 25000,
|
// housing interior containers
|
||||||
HousingOutdoorItemStoreroom = 25001,
|
HousingInteriorAppearance = 25002,
|
||||||
HousingInternalAppearance = 25002,
|
|
||||||
HousingIndoorItemStoreroom = 25003,
|
// 50 in each container max, 300 slots max
|
||||||
|
HousingInteriorPlacedItems1 = 25003,
|
||||||
|
HousingInteriorPlacedItems2 = 25004,
|
||||||
|
HousingInteriorPlacedItems3 = 25005,
|
||||||
|
HousingInteriorPlacedItems4 = 25006,
|
||||||
|
HousingInteriorPlacedItems5 = 25007,
|
||||||
|
HousingInteriorPlacedItems6 = 25008,
|
||||||
|
|
||||||
|
// 50 max per container, 400 slots max
|
||||||
|
// slot limit increased 'temporarily' for relocation for all estates
|
||||||
|
// see: https://na.finalfantasyxiv.com/lodestone/topics/detail/d781e0d538428aef93b8bed4b50dd62c3c50fc74
|
||||||
|
HousingInteriorStoreroom1 = 27001,
|
||||||
|
HousingInteriorStoreroom2 = 27002,
|
||||||
|
HousingInteriorStoreroom3 = 27003,
|
||||||
|
HousingInteriorStoreroom4 = 27004,
|
||||||
|
HousingInteriorStoreroom5 = 27005,
|
||||||
|
HousingInteriorStoreroom6 = 27006,
|
||||||
|
HousingInteriorStoreroom7 = 27007,
|
||||||
|
HousingInteriorStoreroom8 = 27008,
|
||||||
|
|
||||||
|
|
||||||
|
// housing exterior containers
|
||||||
|
HousingOutdoorPlacedItems = 25001,
|
||||||
|
HousingOutdoorAppearance = 25000,
|
||||||
|
HousingOutdoorStoreroom = 27000,
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ContainerType : uint16_t
|
enum ContainerType : uint16_t
|
||||||
|
|
|
@ -304,6 +304,7 @@ enum ActorControlType : uint16_t
|
||||||
AchievementCritReq = 0x3E8,
|
AchievementCritReq = 0x3E8,
|
||||||
AchievementList = 0x3E9,
|
AchievementList = 0x3E9,
|
||||||
|
|
||||||
|
SetEstateLightingLevel = 0x40B, // param1 = light level 0 - 5 maps to UI val 5-0
|
||||||
RequestHousingBuildPreset = 0x44C,
|
RequestHousingBuildPreset = 0x44C,
|
||||||
RequestEstateHallRemoval = 0x44F,
|
RequestEstateHallRemoval = 0x44F,
|
||||||
RequestBuildPreset = 0x450, // no idea what this is, it gets sent with BuildPresetHandler and has the plot id in param1
|
RequestBuildPreset = 0x450, // no idea what this is, it gets sent with BuildPresetHandler and has the plot id in param1
|
||||||
|
|
|
@ -910,6 +910,8 @@ namespace Sapphire::Entity
|
||||||
|
|
||||||
bool isObtainable( uint32_t catalogId, uint8_t quantity );
|
bool isObtainable( uint32_t catalogId, uint8_t quantity );
|
||||||
|
|
||||||
|
uint32_t getNextInventorySequence();
|
||||||
|
|
||||||
void send();
|
void send();
|
||||||
|
|
||||||
uint8_t getFreeSlotsInBags();
|
uint8_t getFreeSlotsInBags();
|
||||||
|
@ -939,6 +941,8 @@ namespace Sapphire::Entity
|
||||||
|
|
||||||
bool m_onEnterEventDone;
|
bool m_onEnterEventDone;
|
||||||
|
|
||||||
|
uint32_t m_inventorySequence;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using InventoryMap = std::map< uint16_t, Sapphire::ItemContainerPtr >;
|
using InventoryMap = std::map< uint16_t, Sapphire::ItemContainerPtr >;
|
||||||
|
|
||||||
|
|
|
@ -357,14 +357,11 @@ void Sapphire::Entity::Player::removeCrystal( Common::CrystalType type, uint32_t
|
||||||
|
|
||||||
void Sapphire::Entity::Player::sendInventory()
|
void Sapphire::Entity::Player::sendInventory()
|
||||||
{
|
{
|
||||||
InventoryMap::iterator it;
|
|
||||||
|
|
||||||
auto pInvMgr = g_fw.get< World::Manager::InventoryMgr >();
|
auto pInvMgr = g_fw.get< World::Manager::InventoryMgr >();
|
||||||
|
|
||||||
uint32_t count = 0;
|
for( auto it = m_storageMap.begin(); it != m_storageMap.end(); ++it )
|
||||||
for( it = m_storageMap.begin(); it != m_storageMap.end(); ++it, ++count )
|
|
||||||
{
|
{
|
||||||
pInvMgr->sendInventoryContainer( *this, it->second, count );
|
pInvMgr->sendInventoryContainer( *this, it->second );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -867,3 +864,8 @@ bool Sapphire::Entity::Player::collectHandInItems( std::vector< uint32_t > itemI
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t Sapphire::Entity::Player::getNextInventorySequence()
|
||||||
|
{
|
||||||
|
return m_inventorySequence++;
|
||||||
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "Framework.h"
|
#include "Framework.h"
|
||||||
#include "ServerMgr.h"
|
#include "ServerMgr.h"
|
||||||
#include "Territory/House.h"
|
#include "Territory/House.h"
|
||||||
|
#include "InventoryMgr.h"
|
||||||
|
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
using namespace Sapphire::Network;
|
using namespace Sapphire::Network;
|
||||||
|
@ -508,5 +509,10 @@ void Sapphire::World::Manager::HousingMgr::sendHousingInventory( Entity::Player&
|
||||||
if( targetLand->getOwnerId() != player.getId() )
|
if( targetLand->getOwnerId() != player.getId() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player.sendDebug( "got inventory for plot: " + targetLand->getHouse()->getHouseName() );
|
auto container = targetLand->getItemContainer( inventoryType );
|
||||||
|
if( !container )
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto invMgr = g_fw.get< Manager::InventoryMgr >();
|
||||||
|
invMgr->sendInventoryContainer( player, container );
|
||||||
}
|
}
|
|
@ -10,9 +10,9 @@
|
||||||
using namespace Sapphire::Network::Packets;
|
using namespace Sapphire::Network::Packets;
|
||||||
|
|
||||||
void Sapphire::World::Manager::InventoryMgr::sendInventoryContainer( Sapphire::Entity::Player& player,
|
void Sapphire::World::Manager::InventoryMgr::sendInventoryContainer( Sapphire::Entity::Player& player,
|
||||||
Sapphire::ItemContainerPtr container,
|
Sapphire::ItemContainerPtr container )
|
||||||
uint32_t sequence )
|
|
||||||
{
|
{
|
||||||
|
auto sequence = player.getNextInventorySequence();
|
||||||
auto pMap = container->getItemMap();
|
auto pMap = container->getItemMap();
|
||||||
|
|
||||||
for( auto itM = pMap.begin(); itM != pMap.end(); ++itM )
|
for( auto itM = pMap.begin(); itM != pMap.end(); ++itM )
|
||||||
|
|
|
@ -9,8 +9,7 @@ namespace Sapphire::World::Manager
|
||||||
class InventoryMgr
|
class InventoryMgr
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void sendInventoryContainer( Sapphire::Entity::Player& player, Sapphire::ItemContainerPtr container,
|
void sendInventoryContainer( Sapphire::Entity::Player& player, Sapphire::ItemContainerPtr container );
|
||||||
uint32_t sequence = 0 );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -423,16 +423,18 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( const Packets::FFX
|
||||||
}
|
}
|
||||||
case ClientTriggerType::RequestLandInventory:
|
case ClientTriggerType::RequestLandInventory:
|
||||||
{
|
{
|
||||||
if( param2 != 1 )
|
|
||||||
return;
|
|
||||||
|
|
||||||
uint8_t plot = ( param12 & 0xFF );
|
uint8_t plot = ( param12 & 0xFF );
|
||||||
|
|
||||||
|
|
||||||
auto housingMgr = g_fw.get< HousingMgr >();
|
auto housingMgr = g_fw.get< HousingMgr >();
|
||||||
if( !housingMgr )
|
if( !housingMgr )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
housingMgr->sendHousingInventory( player, Common::InventoryType::HousingOutdoorItemStoreroom, plot );
|
uint16_t inventoryType = Common::InventoryType::HousingOutdoorPlacedItems;
|
||||||
|
if( param2 == 1 )
|
||||||
|
inventoryType = Common::InventoryType::HousingOutdoorStoreroom;
|
||||||
|
|
||||||
|
housingMgr->sendHousingInventory( player, inventoryType, plot );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -446,7 +448,7 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( const Packets::FFX
|
||||||
if( !housingMgr )
|
if( !housingMgr )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
housingMgr->sendHousingInventory( player, Common::InventoryType::HousingIndoorItemStoreroom, 255 );
|
// housingMgr->sendHousingInventory( player, Common::InventoryType::HousingInd, 255 );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,15 +117,21 @@ void Sapphire::Land::init()
|
||||||
}
|
}
|
||||||
|
|
||||||
// init item containers
|
// init item containers
|
||||||
auto setupContainer = [ this ]( InventoryType type, uint8_t maxSize )
|
auto setupContainer = [ this ]( InventoryType type, uint16_t maxSize )
|
||||||
{
|
{
|
||||||
m_landInventoryMap[ type ] = make_ItemContainer( type, maxSize, "houseiteminventory", true, true );
|
m_landInventoryMap[ type ] = make_ItemContainer( type, maxSize, "houseiteminventory", true, true );
|
||||||
};
|
};
|
||||||
|
|
||||||
setupContainer( InventoryType::HousingExternalAppearance, 8 );
|
setupContainer( InventoryType::HousingOutdoorAppearance, 8 );
|
||||||
setupContainer( InventoryType::HousingInternalAppearance, 8 );
|
setupContainer( InventoryType::HousingOutdoorPlacedItems, m_maxPlacedExternalItems );
|
||||||
setupContainer( InventoryType::HousingOutdoorItemStoreroom, m_maxPlacedExternalItems );
|
setupContainer( InventoryType::HousingOutdoorStoreroom, m_maxPlacedExternalItems );
|
||||||
setupContainer( InventoryType::HousingIndoorItemStoreroom, m_maxPlacedInternalItems );
|
|
||||||
|
setupContainer( InventoryType::HousingInteriorAppearance, 9 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sapphire::Land::loadItemContainerContents()
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Sapphire::Land::convertItemIdToHousingItemId( uint32_t itemId )
|
uint32_t Sapphire::Land::convertItemIdToHousingItemId( uint32_t itemId )
|
||||||
|
|
|
@ -62,6 +62,7 @@ namespace Sapphire
|
||||||
uint8_t getLandTag( uint8_t slot );
|
uint8_t getLandTag( uint8_t slot );
|
||||||
|
|
||||||
ItemContainerPtr getItemContainer( uint16_t inventoryType ) const;
|
ItemContainerPtr getItemContainer( uint16_t inventoryType ) const;
|
||||||
|
void loadItemContainerContents();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t convertItemIdToHousingItemId( uint32_t itemId );
|
uint32_t convertItemIdToHousingItemId( uint32_t itemId );
|
||||||
|
|
Loading…
Add table
Reference in a new issue