mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-01 16:37:45 +00:00
Merge pull request #361 from NotAdam/inventory_rework
currency & crystals are now stored in charaiteminventory instead of isolated tables
This commit is contained in:
commit
e10a998f4e
8 changed files with 27 additions and 284 deletions
|
@ -1,74 +0,0 @@
|
|||
-- MySQL dump 10.13 Distrib 5.7.13, for Win64 (x86_64)
|
||||
--
|
||||
-- Host: localhost Database: sapphire
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 5.7.13-log
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
--
|
||||
-- Table structure for table `charaitemcrystal`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `charaitemcrystal`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `charaitemcrystal` (
|
||||
`CharacterId` int(20) DEFAULT '0',
|
||||
`storageId` int(10) DEFAULT '2001',
|
||||
`type` int(5) DEFAULT '0',
|
||||
`idx` int(5) NOT NULL AUTO_INCREMENT,
|
||||
`container_0` int(20) DEFAULT '0',
|
||||
`container_1` int(20) DEFAULT '0',
|
||||
`container_2` int(20) DEFAULT '0',
|
||||
`container_3` int(20) DEFAULT '0',
|
||||
`container_4` int(20) DEFAULT '0',
|
||||
`container_5` int(20) DEFAULT '0',
|
||||
`container_6` int(20) DEFAULT '0',
|
||||
`container_7` int(20) DEFAULT '0',
|
||||
`container_8` int(20) DEFAULT '0',
|
||||
`container_9` int(20) DEFAULT '0',
|
||||
`container_10` int(20) DEFAULT '0',
|
||||
`container_11` int(20) DEFAULT '0',
|
||||
`container_12` int(20) DEFAULT '0',
|
||||
`container_13` int(20) DEFAULT '0',
|
||||
`container_14` int(20) DEFAULT '0',
|
||||
`container_15` int(20) DEFAULT '0',
|
||||
`container_16` int(20) DEFAULT '0',
|
||||
`container_17` int(20) DEFAULT '0',
|
||||
`IS_DELETE` int(3) DEFAULT '0',
|
||||
`IS_NOT_ACTIVE_FLG` int(3) DEFAULT '0',
|
||||
`UPDATE_DATE` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`idx`),
|
||||
KEY `CharacterId` (`CharacterId`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `charaitemcrystal`
|
||||
--
|
||||
|
||||
LOCK TABLES `charaitemcrystal` WRITE;
|
||||
/*!40000 ALTER TABLE `charaitemcrystal` DISABLE KEYS */;
|
||||
/*!40000 ALTER TABLE `charaitemcrystal` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2016-12-09 17:37:10
|
|
@ -1,68 +0,0 @@
|
|||
-- MySQL dump 10.13 Distrib 5.7.13, for Win64 (x86_64)
|
||||
--
|
||||
-- Host: localhost Database: sapphire
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 5.7.13-log
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
--
|
||||
-- Table structure for table `charaitemcurrency`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `charaitemcurrency`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `charaitemcurrency` (
|
||||
`CharacterId` int(20) NOT NULL,
|
||||
`storageId` int(10) DEFAULT '2000',
|
||||
`type` int(5) DEFAULT '0',
|
||||
`idx` int(5) NOT NULL AUTO_INCREMENT,
|
||||
`container_0` int(20) DEFAULT '0',
|
||||
`container_1` int(20) DEFAULT '0',
|
||||
`container_2` int(20) DEFAULT '0',
|
||||
`container_3` int(20) DEFAULT '0',
|
||||
`container_4` int(20) DEFAULT '0',
|
||||
`container_5` int(20) DEFAULT '0',
|
||||
`container_6` int(20) DEFAULT '0',
|
||||
`container_7` int(20) DEFAULT '0',
|
||||
`container_8` int(20) NOT NULL DEFAULT '0',
|
||||
`container_9` int(20) NOT NULL DEFAULT '0',
|
||||
`container_10` int(20) NOT NULL DEFAULT '0',
|
||||
`container_11` int(20) NOT NULL DEFAULT '0',
|
||||
`IS_DELETE` int(3) DEFAULT '0',
|
||||
`IS_NOT_ACTIVE_FLG` int(3) DEFAULT '0',
|
||||
`UPDATE_DATE` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `CharacterId` (`CharacterId`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `charaitemcurrency`
|
||||
--
|
||||
|
||||
LOCK TABLES `charaitemcurrency` WRITE;
|
||||
/*!40000 ALTER TABLE `charaitemcurrency` DISABLE KEYS */;
|
||||
/*!40000 ALTER TABLE `charaitemcurrency` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2016-12-09 17:37:11
|
|
@ -130,8 +130,8 @@ namespace Packets {
|
|||
ContainerInfo = 0x0192, // updated 4.3
|
||||
InventoryTransactionFinish = 0x0193, // updated 4.3
|
||||
InventoryTransaction = 0x0194, // updated 4.3
|
||||
CurrencyCrystalInfo = 0x0195, // updated 4.3
|
||||
InventoryActionAck = 0x0197, // updated 4.3
|
||||
CurrencyCrystalInfo = 0xFFFF, // updated 4.3 - wrong opcode
|
||||
|
||||
UpdateInventorySlot = 0x0198, // updated 4.3
|
||||
|
||||
|
|
|
@ -605,7 +605,7 @@ public:
|
|||
using InvSlotPair = std::pair< uint16_t, int8_t >;
|
||||
using InvSlotPairVec = std::vector< InvSlotPair >;
|
||||
|
||||
ItemPtr createItem( uint32_t catalogId, uint16_t quantity = 1 );
|
||||
ItemPtr createItem( uint32_t catalogId, uint32_t quantity = 1 );
|
||||
bool loadInventory();
|
||||
InvSlotPairVec getSlotsOfItemsInInventory( uint32_t catalogId );
|
||||
InvSlotPair getFreeBagSlot();
|
||||
|
@ -625,7 +625,6 @@ public:
|
|||
/*! return the current amount of currency of type */
|
||||
uint32_t getCurrency( Common::CurrencyType type );
|
||||
|
||||
void updateCurrencyDb();
|
||||
void updateBagDb( Common::InventoryType type );
|
||||
void updateMannequinDb( Common::InventoryType type );
|
||||
void updateItemDb( ItemPtr pItem ) const;
|
||||
|
@ -639,8 +638,6 @@ public:
|
|||
void removeCrystal( Common::CrystalType type, uint32_t amount );
|
||||
bool isObtainable( uint32_t catalogId, uint8_t quantity );
|
||||
|
||||
void updateCrystalDb();
|
||||
|
||||
void send();
|
||||
|
||||
uint8_t getFreeSlotsInBags();
|
||||
|
|
|
@ -58,10 +58,10 @@ void Core::Entity::Player::initInventory()
|
|||
setupContainer( GearSet0, 13, "charaitemgearset", true );
|
||||
|
||||
// gil contianer
|
||||
setupContainer( Currency, 11, "charaitemcurrency", false );
|
||||
setupContainer( Currency, 11, "charaiteminventory", true );
|
||||
|
||||
// crystals??
|
||||
setupContainer( Crystal, 11, "charaitemcrystal", false );
|
||||
setupContainer( Crystal, 11, "charaiteminventory", true );
|
||||
|
||||
// armory weapons - 0
|
||||
setupContainer( ArmoryMain, 34, "charaiteminventory", true );
|
||||
|
@ -219,20 +219,22 @@ void Core::Entity::Player::unequipItem( Common::EquipSlot equipSlotId, ItemPtr p
|
|||
// TODO: these next functions are so similar that they could likely be simplified
|
||||
void Core::Entity::Player::addCurrency( CurrencyType type, uint32_t amount )
|
||||
{
|
||||
auto currItem = m_inventoryMap[Currency]->getItem( static_cast< uint8_t >( type ) - 1 );
|
||||
auto slot = static_cast< uint8_t >( static_cast< uint8_t >( type ) - 1 );
|
||||
auto currItem = m_inventoryMap[Currency]->getItem( slot );
|
||||
|
||||
if( !currItem )
|
||||
{
|
||||
// TODO: map currency type to itemid
|
||||
currItem = createItem( 1 );
|
||||
m_inventoryMap[Currency]->setItem( static_cast< uint8_t >( type ) - 1, currItem );
|
||||
updateCurrencyDb();
|
||||
m_inventoryMap[Currency]->setItem( slot, currItem );
|
||||
}
|
||||
|
||||
uint32_t currentAmount = currItem->getStackSize();
|
||||
currItem->setStackSize( currentAmount + amount );
|
||||
updateItemDb( currItem );
|
||||
|
||||
updateContainer( Currency, slot, currItem );
|
||||
|
||||
auto invUpdate = boost::make_shared< UpdateInventorySlotPacket >( getId(),
|
||||
static_cast< uint8_t >( type ) - 1,
|
||||
Common::InventoryType::Currency,
|
||||
|
@ -272,7 +274,6 @@ void Core::Entity::Player::addCrystal( Common::CrystalType type, uint32_t amount
|
|||
// TODO: map currency type to itemid
|
||||
currItem = createItem( static_cast< uint8_t >( type ) + 1 );
|
||||
m_inventoryMap[Crystal]->setItem( static_cast< uint8_t >( type ) - 1, currItem );
|
||||
updateCrystalDb();
|
||||
}
|
||||
|
||||
uint32_t currentAmount = currItem->getStackSize();
|
||||
|
@ -281,6 +282,8 @@ void Core::Entity::Player::addCrystal( Common::CrystalType type, uint32_t amount
|
|||
|
||||
updateItemDb( currItem );
|
||||
|
||||
updateBagDb( Crystal );
|
||||
|
||||
|
||||
auto invUpdate = boost::make_shared< UpdateInventorySlotPacket >( getId(),
|
||||
static_cast< uint8_t >( type ) - 1,
|
||||
|
@ -435,69 +438,16 @@ uint32_t Core::Entity::Player::getCrystal( CrystalType type )
|
|||
|
||||
}
|
||||
|
||||
void Core::Entity::Player::updateCurrencyDb()
|
||||
{
|
||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::CharaDbConnection > >();
|
||||
int32_t firstItemPos = -1;
|
||||
std::string query = "UPDATE charaitemcurrency SET ";
|
||||
|
||||
for( int32_t i = 0; i <= 11; i++ )
|
||||
{
|
||||
auto currItem = m_inventoryMap[Currency]->getItem( i );
|
||||
|
||||
if( currItem )
|
||||
{
|
||||
if( firstItemPos == -1 )
|
||||
firstItemPos = i;
|
||||
|
||||
if( i > firstItemPos )
|
||||
query += ", ";
|
||||
|
||||
query += "container_" + std::to_string( i ) + " = " + std::to_string( currItem->getUId() );
|
||||
}
|
||||
}
|
||||
|
||||
query += " WHERE CharacterId = " + std::to_string( getId() );
|
||||
|
||||
pDb->execute( query );
|
||||
}
|
||||
|
||||
|
||||
void Core::Entity::Player::updateCrystalDb()
|
||||
{
|
||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::CharaDbConnection > >();
|
||||
int32_t firstItemPos = -1;
|
||||
std::string query = "UPDATE charaitemcrystal SET ";
|
||||
|
||||
for( int32_t i = 0; i <= 11; i++ )
|
||||
{
|
||||
auto currItem = m_inventoryMap[Crystal]->getItem( i );
|
||||
|
||||
if( currItem )
|
||||
{
|
||||
if( firstItemPos == -1 )
|
||||
firstItemPos = i;
|
||||
|
||||
if( i > firstItemPos )
|
||||
query += ", ";
|
||||
|
||||
query += "container_" + std::to_string( i ) + " = " + std::to_string( currItem->getUId() );
|
||||
}
|
||||
}
|
||||
|
||||
query += " WHERE CharacterId = " + std::to_string( getId() );
|
||||
|
||||
pDb->execute( query );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::updateBagDb( InventoryType type )
|
||||
{
|
||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::CharaDbConnection > >();
|
||||
std::string query = "UPDATE charaiteminventory SET ";
|
||||
|
||||
for( int32_t i = 0; i <= 34; i++ )
|
||||
auto container = m_inventoryMap[type];
|
||||
|
||||
for( int32_t i = 0; i <= container->getMaxSize(); i++ )
|
||||
{
|
||||
auto currItem = m_inventoryMap[type]->getItem( i );
|
||||
auto currItem = container->getItem( i );
|
||||
|
||||
if( i > 0 )
|
||||
query += ", ";
|
||||
|
@ -518,9 +468,11 @@ void Core::Entity::Player::updateMannequinDb( InventoryType type )
|
|||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::CharaDbConnection > >();
|
||||
std::string query = "UPDATE charaitemgearset SET ";
|
||||
|
||||
for( int32_t i = 0; i <= 13; i++ )
|
||||
auto container = m_inventoryMap[type];
|
||||
|
||||
for( int32_t i = 0; i <= container->getMaxSize(); i++ )
|
||||
{
|
||||
auto currItem = m_inventoryMap[type]->getItem( i );
|
||||
auto currItem = container->getItem( i );
|
||||
|
||||
if( i > 0 )
|
||||
query += ", ";
|
||||
|
@ -661,8 +613,8 @@ bool Core::Entity::Player::updateContainer( uint16_t containerId, uint8_t slotId
|
|||
switch( containerType )
|
||||
{
|
||||
case Armory:
|
||||
case CurrencyCrystal:
|
||||
case Bag:
|
||||
case CurrencyCrystal:
|
||||
{
|
||||
updateBagDb( static_cast< InventoryType >( containerId ) );
|
||||
break;
|
||||
|
|
|
@ -557,7 +557,7 @@ void Core::Entity::Player::insertQuest( uint16_t questId, uint8_t index, uint8_t
|
|||
pDb->execute( stmt );
|
||||
}
|
||||
|
||||
Core::ItemPtr Core::Entity::Player::createItem( uint32_t catalogId, uint16_t quantity )
|
||||
Core::ItemPtr Core::Entity::Player::createItem( uint32_t catalogId, uint32_t quantity )
|
||||
{
|
||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::CharaDbConnection > >();
|
||||
|
@ -566,11 +566,6 @@ Core::ItemPtr Core::Entity::Player::createItem( uint32_t catalogId, uint16_t qua
|
|||
if( !itemInfo )
|
||||
return nullptr;
|
||||
|
||||
uint16_t itemAmount = quantity;
|
||||
|
||||
if( itemInfo->stackSize == 1 )
|
||||
itemAmount = 1;
|
||||
|
||||
if( !itemInfo )
|
||||
return nullptr;
|
||||
|
||||
|
@ -581,13 +576,13 @@ Core::ItemPtr Core::Entity::Player::createItem( uint32_t catalogId, uint16_t qua
|
|||
itemInfo->modelMain,
|
||||
itemInfo->modelSub );
|
||||
|
||||
pItem->setStackSize( itemAmount );
|
||||
pItem->setStackSize( quantity );
|
||||
|
||||
pDb->execute( "INSERT INTO charaglobalitem ( CharacterId, itemId, catalogId, stack, flags ) VALUES ( " +
|
||||
std::to_string( getId() ) + ", " +
|
||||
std::to_string( pItem->getUId() ) + ", " +
|
||||
std::to_string( pItem->getId() ) + ", " +
|
||||
std::to_string( itemAmount ) + ", " +
|
||||
std::to_string( quantity ) + ", " +
|
||||
std::to_string( flags ) + ");" );
|
||||
|
||||
return pItem;
|
||||
|
@ -627,7 +622,7 @@ bool Core::Entity::Player::loadInventory()
|
|||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Load Bags
|
||||
// Load everything
|
||||
auto bagRes = pDb->query( "SELECT storageId, "
|
||||
"container_0, container_1, container_2, container_3, container_4, "
|
||||
"container_5, container_6, container_7, container_8, container_9, "
|
||||
|
@ -643,7 +638,7 @@ bool Core::Entity::Player::loadInventory()
|
|||
while( bagRes->next() )
|
||||
{
|
||||
uint16_t storageId = bagRes->getUInt16( 1 );
|
||||
for( uint32_t i = 1; i <= 35; i++ )
|
||||
for( uint32_t i = 1; i <= m_inventoryMap[storageId]->getMaxSize(); i++ )
|
||||
{
|
||||
uint64_t uItemId = bagRes->getUInt64( i + 1 );
|
||||
if( uItemId == 0 )
|
||||
|
@ -658,64 +653,5 @@ bool Core::Entity::Player::loadInventory()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Load Currency
|
||||
auto curRes = pDb->query( "SELECT storageId, "
|
||||
"container_0, container_1, container_2, container_3, container_4, "
|
||||
"container_5, container_6, container_7, container_8, container_9, "
|
||||
"container_10, container_11 "
|
||||
"FROM charaitemcurrency " \
|
||||
"WHERE CharacterId = " + std::to_string( getId() ) + " " \
|
||||
"ORDER BY storageId ASC;" );
|
||||
|
||||
while( curRes->next() )
|
||||
{
|
||||
uint16_t storageId = curRes->getUInt16( 1 );
|
||||
for( uint32_t i = 1; i <= 12; i++ )
|
||||
{
|
||||
uint64_t uItemId = curRes->getUInt64( i + 1 );
|
||||
if( uItemId == 0 )
|
||||
continue;
|
||||
|
||||
ItemPtr pItem = Items::Util::loadItem( uItemId );
|
||||
|
||||
if( pItem == nullptr )
|
||||
continue;
|
||||
|
||||
m_inventoryMap[storageId]->getItemMap()[i - 1] = pItem;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Load Crystals
|
||||
auto crystalRes = pDb->query( "SELECT storageId, "
|
||||
"container_0, container_1, container_2, container_3, container_4, "
|
||||
"container_5, container_6, container_7, container_8, container_9, "
|
||||
"container_10, container_11, container_12, container_13, container_14, "
|
||||
"container_15, container_16, container_17 "
|
||||
"FROM charaitemcrystal " \
|
||||
"WHERE CharacterId = " + std::to_string( getId() ) + " " \
|
||||
"ORDER BY storageId ASC;" );
|
||||
|
||||
while( crystalRes->next() )
|
||||
{
|
||||
uint16_t storageId = crystalRes->getUInt16( 1 );
|
||||
for( int32_t i = 1; i <= 17; i++ )
|
||||
{
|
||||
uint64_t uItemId = crystalRes->getUInt64( i + 1 );
|
||||
if( uItemId == 0 )
|
||||
continue;
|
||||
|
||||
ItemPtr pItem = Items::Util::loadItem( uItemId );
|
||||
|
||||
if( pItem == nullptr )
|
||||
continue;
|
||||
|
||||
m_inventoryMap[storageId]->getItemMap()[i - 1] = pItem;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ void Core::Item::setUId( uint64_t id )
|
|||
|
||||
void Core::Item::setStackSize( uint32_t size )
|
||||
{
|
||||
m_stackSize = size;
|
||||
m_stackSize = std::min< uint32_t >( size, m_maxStackSize );
|
||||
}
|
||||
|
||||
uint32_t Core::Item::getStackSize() const
|
||||
|
|
Loading…
Add table
Reference in a new issue