diff options
author | Philipp Sehmisch <tmw@crushnet.org> | 2008-01-10 15:45:25 +0000 |
---|---|---|
committer | Philipp Sehmisch <tmw@crushnet.org> | 2008-01-10 15:45:25 +0000 |
commit | 9c9c105cd26a0b8349cd529c31c2a0800da697ce (patch) | |
tree | 2e317e6063693574d484b63cbb6fc2b81d05fde7 /src/resources/itemdb.cpp | |
parent | a94476cd4ea9895949ddc2f8a70f6cf29b08bd2d (diff) | |
download | mana-client-9c9c105cd26a0b8349cd529c31c2a0800da697ce.tar.gz mana-client-9c9c105cd26a0b8349cd529c31c2a0800da697ce.tar.bz2 mana-client-9c9c105cd26a0b8349cd529c31c2a0800da697ce.tar.xz mana-client-9c9c105cd26a0b8349cd529c31c2a0800da697ce.zip |
Item types and weapon types are now identified by name instead of numbers in the items.xml. Removed entries for eAthena compatiblity from items.xml (the database isn't eAthena compatible anymore), added item type and weapon-type properties to all items. All healing items now have a healing effect.
Diffstat (limited to 'src/resources/itemdb.cpp')
-rw-r--r-- | src/resources/itemdb.cpp | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index ff537bc3..6d7f5944 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -56,6 +56,42 @@ static char const *const fields[][2] = { "mp", N_("MP %+d") } }; +ItemType itemTypeFromString (std::string name, int id = 0) +{ + if (name=="generic") return ITEM_UNUSABLE; + else if (name=="usable") return ITEM_USABLE; + else if (name=="equip-1hand") return ITEM_EQUIPMENT_ONE_HAND_WEAPON; + else if (name=="equip-2hand") return ITEM_EQUIPMENT_TWO_HANDS_WEAPON; + else if (name=="equip-torso") return ITEM_EQUIPMENT_TORSO; + else if (name=="equip-arms") return ITEM_EQUIPMENT_ARMS; + else if (name=="equip-head") return ITEM_EQUIPMENT_HEAD; + else if (name=="equip-legs") return ITEM_EQUIPMENT_LEGS; + else if (name=="equip-shield") return ITEM_EQUIPMENT_SHIELD; + else if (name=="equip-ring") return ITEM_EQUIPMENT_RING; + else if (name=="equip-necklace") return ITEM_EQUIPMENT_NECKLACE; + else if (name=="equip-feet") return ITEM_EQUIPMENT_FEET; + else if (name=="equip-ammo") return ITEM_EQUIPMENT_AMMO; + else return ITEM_UNUSABLE; +} + +WeaponType weaponTypeFromString (std::string name, int id = 0) +{ + if (name=="knife") return WPNTYPE_KNIFE; + else if (name=="sword") return WPNTYPE_SWORD; + else if (name=="polearm") return WPNTYPE_POLEARM; + else if (name=="javelin") return WPNTYPE_JAVELIN; + else if (name=="staff") return WPNTYPE_STAFF; + else if (name=="whip") return WPNTYPE_WHIP; + else if (name=="boomerang") return WPNTYPE_BOOMERANG; + else if (name=="bow") return WPNTYPE_BOW; + else if (name=="sickle") return WPNTYPE_SICKLE; + else if (name=="crossbow") return WPNTYPE_CROSSBOW; + else if (name=="mace") return WPNTYPE_MACE; + else if (name=="axe") return WPNTYPE_AXE; + else if (name=="thrown") return WPNTYPE_THROWN; + else return WPNTYPE_NONE; +} + void ItemDB::load() { if (mLoaded) @@ -108,14 +144,14 @@ void ItemDB::load() logger->log("ItemDB: Redefinition of item ID %d", id); } - int type = XML::getProperty(node, "type", 0); + int type = itemTypeFromString(XML::getProperty(node, "type", "")); int weight = XML::getProperty(node, "weight", 0); int view = XML::getProperty(node, "view", 0); std::string name = XML::getProperty(node, "name", ""); std::string image = XML::getProperty(node, "image", ""); std::string description = XML::getProperty(node, "description", ""); - int weaponType = XML::getProperty(node, "weapon_type", 0); + int weaponType = itemTypeFromString(XML::getProperty(node, "weapon_type", "")); ItemInfo *itemInfo = new ItemInfo; itemInfo->setImageName(image); |