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

Use generated ItemUICategory; Check if field for item is valid;

This commit is contained in:
Maru 2017-11-24 18:13:42 -02:00
parent add49a250b
commit 7a2f83afb2
2 changed files with 21 additions and 20 deletions

View file

@ -439,27 +439,27 @@ bool Core::Inventory::removeCrystal( CrystalType type, uint32_t amount )
return true;
}
bool Core::Inventory::isOneHandedWeapon( ItemCategory weaponCategory )
bool Core::Inventory::isOneHandedWeapon( ItemUICategory weaponCategory )
{
switch ( weaponCategory )
{
case ItemCategory::AlcPri:
case ItemCategory::ArmPri:
case ItemCategory::BotPri:
case ItemCategory::ClnPri:
case ItemCategory::CnjWep:
case ItemCategory::CrpPri:
case ItemCategory::FshPri:
case ItemCategory::GlaWep:
case ItemCategory::GldPri: // Goldsmith
case ItemCategory::LtwPri:
case ItemCategory::MinPri:
case ItemCategory::ThmWep:
case ItemCategory::WvrPri:
case ItemCategory::BlmPri: // Blacksmith
return true;
default:
return false;
case ItemUICategory::AlchemistsPrimaryTool:
case ItemUICategory::ArmorersPrimaryTool:
case ItemUICategory::BotanistsPrimaryTool:
case ItemUICategory::CulinariansPrimaryTool:
case ItemUICategory::OnehandedConjurersArm:
case ItemUICategory::CarpentersPrimaryTool:
case ItemUICategory::FishersPrimaryTool:
case ItemUICategory::GladiatorsArm:
case ItemUICategory::GoldsmithsPrimaryTool:
case ItemUICategory::LeatherworkersPrimaryTool:
case ItemUICategory::MinersPrimaryTool:
case ItemUICategory::OnehandedThaumaturgesArm:
case ItemUICategory::WeaversPrimaryTool:
case ItemUICategory::BlacksmithsPrimaryTool:
return true;
default:
return false;
}
}
@ -475,7 +475,8 @@ int16_t Core::Inventory::addItem( uint16_t inventoryId, int8_t slotId, uint32_t
auto itemInfo = g_exdData.getItemInfo( catalogId );
if( !itemInfo )
// if item data doesn't exist or it's a blank field
if( !itemInfo || itemInfo->item_level == 0 )
{
return -1;
}

View file

@ -154,7 +154,7 @@ public:
bool updateContainer( uint16_t containerId, uint8_t slotId, ItemPtr pItem );
/*! heck if weapon category qualifies the weapon as onehanded */
bool isOneHandedWeapon( Common::ItemCategory weaponCategory );
bool isOneHandedWeapon( Common::ItemUICategory weaponCategory );
/*! calculate and return player ilvl based off equipped gear */
uint16_t calculateEquippedGearItemLevel();
/*! return the current amount of currency of type */