mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 14:57:44 +00:00
fix added items having incorrect data
This commit is contained in:
parent
0bd352b50b
commit
a2caccb2ee
2 changed files with 11 additions and 8 deletions
|
@ -134,6 +134,9 @@ Core::ItemPtr Core::Inventory::createItem( uint32_t catalogId, uint16_t quantity
|
|||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::CharaDbConnection > >();
|
||||
auto itemInfo = pExdData->get< Core::Data::Item >( catalogId );
|
||||
|
||||
if( !itemInfo )
|
||||
return nullptr;
|
||||
|
||||
uint16_t itemAmount = quantity;
|
||||
|
||||
if( itemInfo->stackSize == 1 )
|
||||
|
@ -144,14 +147,14 @@ Core::ItemPtr Core::Inventory::createItem( uint32_t catalogId, uint16_t quantity
|
|||
|
||||
uint8_t flags = 0;
|
||||
|
||||
// std::string itemName( itemInfo->name );
|
||||
|
||||
ItemPtr pItem = make_Item( catalogId );
|
||||
ItemPtr pItem = make_Item( getNextUId(),
|
||||
catalogId,
|
||||
itemInfo->modelMain,
|
||||
itemInfo->modelSub,
|
||||
static_cast< ItemUICategory >( itemInfo->itemUICategory ),
|
||||
false );
|
||||
|
||||
pItem->setStackSize( itemAmount );
|
||||
pItem->setUId( getNextUId() );
|
||||
pItem->setModelIds( itemInfo->modelMain, itemInfo->modelSub );
|
||||
pItem->setCategory( static_cast< ItemUICategory >( itemInfo->itemUICategory ) );
|
||||
|
||||
pDb->execute( "INSERT INTO charaglobalitem ( CharacterId, itemId, catalogId, stack, flags ) VALUES ( " +
|
||||
std::to_string( m_pOwner->getId() ) + ", " +
|
||||
|
@ -161,7 +164,6 @@ Core::ItemPtr Core::Inventory::createItem( uint32_t catalogId, uint16_t quantity
|
|||
std::to_string( flags ) + ");" );
|
||||
|
||||
return pItem;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -739,7 +741,7 @@ Core::ItemPtr Core::Inventory::loadItem( uint64_t uId )
|
|||
try
|
||||
{
|
||||
auto itemInfo = pExdData->get< Core::Data::Item >( itemRes->getUInt( 1 ) );
|
||||
bool isHq = itemRes->getUInt( 3 ) == 1 ? true : false;
|
||||
bool isHq = itemRes->getUInt( 3 ) == 1;
|
||||
ItemPtr pItem( new Item( uId,
|
||||
itemRes->getUInt( 1 ),
|
||||
itemInfo->modelMain,
|
||||
|
|
|
@ -28,6 +28,7 @@ Core::Item::Item( uint64_t uId, uint32_t catalogId, uint64_t model1, uint64_t mo
|
|||
{
|
||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
||||
auto itemInfo = pExdData->get< Core::Data::Item >( catalogId );
|
||||
|
||||
m_delayMs = itemInfo->delayms;
|
||||
m_physicalDmg = itemInfo->damagePhys;
|
||||
m_magicalDmg = itemInfo->damageMag;
|
||||
|
|
Loading…
Add table
Reference in a new issue