summaryrefslogtreecommitdiff
path: root/src/net/eathena/npchandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-24 23:29:04 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-24 23:29:04 +0300
commit4e97da8e138b21a5f5bea75e6a8d3211e4f28594 (patch)
treec10d3cad963066a908ebd42041723e110a0c9bf0 /src/net/eathena/npchandler.cpp
parentca0ca278d0c4aed9a6d50bb9a8982f5261151ab8 (diff)
downloadmanaverse-4e97da8e138b21a5f5bea75e6a8d3211e4f28594.tar.gz
manaverse-4e97da8e138b21a5f5bea75e6a8d3211e4f28594.tar.bz2
manaverse-4e97da8e138b21a5f5bea75e6a8d3211e4f28594.tar.xz
manaverse-4e97da8e138b21a5f5bea75e6a8d3211e4f28594.zip
Add enum for item types.
Diffstat (limited to 'src/net/eathena/npchandler.cpp')
-rw-r--r--src/net/eathena/npchandler.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/net/eathena/npchandler.cpp b/src/net/eathena/npchandler.cpp
index 7d0a65abc..2e5175253 100644
--- a/src/net/eathena/npchandler.cpp
+++ b/src/net/eathena/npchandler.cpp
@@ -142,13 +142,20 @@ void NpcHandler::buyItems(std::vector<ShopItem*> &items) const
{
ShopItem *const item = *it;
const int usedQuantity = item->getUsedQuantity();
- const int type = item->getType();
+ const ItemTypeT type = item->getType();
if (!usedQuantity)
continue;
- if (type == 4 || type == 5 || type == 7 || type == 8)
+ if (type == ItemType::Weapon ||
+ type == ItemType::Armor ||
+ type == ItemType::PetEgg ||
+ type == ItemType::PetArmor)
+ {
cnt += item->getUsedQuantity();
+ }
else
+ {
cnt ++;
+ }
}
if (cnt > 100)
@@ -164,8 +171,11 @@ void NpcHandler::buyItems(std::vector<ShopItem*> &items) const
continue;
item->increaseUsedQuantity(-usedQuantity);
item->update();
- const int type = item->getType();
- if (type == 4 || type == 5 || type == 7 || type == 8)
+ const ItemTypeT type = item->getType();
+ if (type == ItemType::Weapon ||
+ type == ItemType::Armor ||
+ type == ItemType::PetEgg ||
+ type == ItemType::PetArmor)
{
for (int f = 0; f < usedQuantity; f ++)
{