1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-28 07:07:45 +00:00

fix added items having incorrect data

This commit is contained in:
NotAdam 2018-06-30 12:45:41 +10:00
parent 0bd352b50b
commit a2caccb2ee
2 changed files with 11 additions and 8 deletions

View file

@ -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 pDb = g_fw.get< Db::DbWorkerPool< Db::CharaDbConnection > >();
auto itemInfo = pExdData->get< Core::Data::Item >( catalogId ); auto itemInfo = pExdData->get< Core::Data::Item >( catalogId );
if( !itemInfo )
return nullptr;
uint16_t itemAmount = quantity; uint16_t itemAmount = quantity;
if( itemInfo->stackSize == 1 ) if( itemInfo->stackSize == 1 )
@ -144,14 +147,14 @@ Core::ItemPtr Core::Inventory::createItem( uint32_t catalogId, uint16_t quantity
uint8_t flags = 0; uint8_t flags = 0;
// std::string itemName( itemInfo->name ); ItemPtr pItem = make_Item( getNextUId(),
catalogId,
ItemPtr pItem = make_Item( catalogId ); itemInfo->modelMain,
itemInfo->modelSub,
static_cast< ItemUICategory >( itemInfo->itemUICategory ),
false );
pItem->setStackSize( itemAmount ); 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 ( " + pDb->execute( "INSERT INTO charaglobalitem ( CharacterId, itemId, catalogId, stack, flags ) VALUES ( " +
std::to_string( m_pOwner->getId() ) + ", " + 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 ) + ");" ); std::to_string( flags ) + ");" );
return pItem; return pItem;
} }
@ -739,7 +741,7 @@ Core::ItemPtr Core::Inventory::loadItem( uint64_t uId )
try try
{ {
auto itemInfo = pExdData->get< Core::Data::Item >( itemRes->getUInt( 1 ) ); 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, ItemPtr pItem( new Item( uId,
itemRes->getUInt( 1 ), itemRes->getUInt( 1 ),
itemInfo->modelMain, itemInfo->modelMain,

View file

@ -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 pExdData = g_fw.get< Data::ExdDataGenerated >();
auto itemInfo = pExdData->get< Core::Data::Item >( catalogId ); auto itemInfo = pExdData->get< Core::Data::Item >( catalogId );
m_delayMs = itemInfo->delayms; m_delayMs = itemInfo->delayms;
m_physicalDmg = itemInfo->damagePhys; m_physicalDmg = itemInfo->damagePhys;
m_magicalDmg = itemInfo->damageMag; m_magicalDmg = itemInfo->damageMag;