mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-24 13:47:46 +00:00
inventory item creation cleanup
This commit is contained in:
parent
820f755f17
commit
200232ceed
3 changed files with 11 additions and 30 deletions
|
@ -150,9 +150,7 @@ Core::ItemPtr Core::Inventory::createItem( uint32_t catalogId, uint16_t quantity
|
|||
ItemPtr pItem = make_Item( getNextUId(),
|
||||
catalogId,
|
||||
itemInfo->modelMain,
|
||||
itemInfo->modelSub,
|
||||
static_cast< ItemUICategory >( itemInfo->itemUICategory ),
|
||||
false );
|
||||
itemInfo->modelSub );
|
||||
|
||||
pItem->setStackSize( itemAmount );
|
||||
|
||||
|
@ -742,12 +740,13 @@ Core::ItemPtr Core::Inventory::loadItem( uint64_t uId )
|
|||
{
|
||||
auto itemInfo = pExdData->get< Core::Data::Item >( itemRes->getUInt( 1 ) );
|
||||
bool isHq = itemRes->getUInt( 3 ) == 1;
|
||||
ItemPtr pItem( new Item( uId,
|
||||
|
||||
ItemPtr pItem = make_Item( uId,
|
||||
itemRes->getUInt( 1 ),
|
||||
itemInfo->modelMain,
|
||||
itemInfo->modelSub,
|
||||
static_cast< ItemUICategory >( itemInfo->itemUICategory ),
|
||||
isHq ) );
|
||||
isHq );
|
||||
|
||||
pItem->setStackSize( itemRes->getUInt( 2 ) );
|
||||
|
||||
return pItem;
|
||||
|
|
|
@ -1,27 +1,15 @@
|
|||
#include <Common.h>
|
||||
#include <Exd/ExdDataGenerated.h>
|
||||
#include <CommonGen.h>
|
||||
|
||||
#include "Framework.h"
|
||||
#include "Item.h"
|
||||
|
||||
extern Core::Framework g_fw;
|
||||
|
||||
Core::Item::Item()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Core::Item::Item( uint32_t catalogId ) :
|
||||
m_id( catalogId ),
|
||||
m_isHq( false )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Core::Item::Item( uint64_t uId, uint32_t catalogId, uint64_t model1, uint64_t model2, Common::ItemUICategory categoryId, bool isHq ) :
|
||||
Core::Item::Item( uint64_t uId, uint32_t catalogId, uint64_t model1, uint64_t model2, bool isHq ) :
|
||||
m_id( catalogId ),
|
||||
m_uId( uId ),
|
||||
m_category( categoryId ),
|
||||
m_model1( model1 ),
|
||||
m_model2( model2 ),
|
||||
m_isHq( isHq )
|
||||
|
@ -34,14 +22,10 @@ Core::Item::Item( uint64_t uId, uint32_t catalogId, uint64_t model1, uint64_t mo
|
|||
m_magicalDmg = itemInfo->damageMag;
|
||||
m_weaponDmg = ( m_physicalDmg != 0 ) ? m_physicalDmg : m_magicalDmg;
|
||||
m_autoAttackDmg = static_cast< float >( m_weaponDmg * m_delayMs ) / 3000;
|
||||
m_category = static_cast< Common::ItemUICategory >( itemInfo->itemUICategory );
|
||||
m_itemLevel = itemInfo->levelItem;
|
||||
}
|
||||
|
||||
Core::Item::~Item()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
float Core::Item::getAutoAttackDmg() const
|
||||
{
|
||||
return m_autoAttackDmg;
|
||||
|
|
|
@ -9,10 +9,8 @@ class Item
|
|||
{
|
||||
|
||||
public:
|
||||
Item();
|
||||
Item( uint32_t catalogId );
|
||||
Item( uint64_t uId, uint32_t catalogId, uint64_t model1, uint64_t model2, Common::ItemUICategory categoryId, bool isHq = false );
|
||||
~Item();
|
||||
Item( uint64_t uId, uint32_t catalogId, uint64_t model1, uint64_t model2, bool isHq = false );
|
||||
~Item() = default;
|
||||
|
||||
uint32_t getId() const;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue