From 7a2f83afb2c6e608d7ec8afcbdabd9e10b38e69f Mon Sep 17 00:00:00 2001 From: Maru Date: Fri, 24 Nov 2017 18:13:42 -0200 Subject: [PATCH] Use generated ItemUICategory; Check if field for item is valid; --- .../Server_Zone/Inventory/Inventory.cpp | 39 ++++++++++--------- src/servers/Server_Zone/Inventory/Inventory.h | 2 +- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/servers/Server_Zone/Inventory/Inventory.cpp b/src/servers/Server_Zone/Inventory/Inventory.cpp index c0f482cb..a4274e97 100644 --- a/src/servers/Server_Zone/Inventory/Inventory.cpp +++ b/src/servers/Server_Zone/Inventory/Inventory.cpp @@ -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; } diff --git a/src/servers/Server_Zone/Inventory/Inventory.h b/src/servers/Server_Zone/Inventory/Inventory.h index df9f5725..bd2051f0 100644 --- a/src/servers/Server_Zone/Inventory/Inventory.h +++ b/src/servers/Server_Zone/Inventory/Inventory.h @@ -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 */