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 | |
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')
-rw-r--r-- | src/resources/itemdb.cpp | 40 | ||||
-rw-r--r-- | src/resources/iteminfo.cpp | 13 | ||||
-rw-r--r-- | src/resources/iteminfo.h | 43 |
3 files changed, 86 insertions, 10 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); diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index f1ebd0a9..ade7f685 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -45,23 +45,22 @@ ItemInfo::getSprite(int gender) const void ItemInfo::setWeaponType(int type) { - // See server item.hpp file for type values. switch (type) { - case 0: // none + case WPNTYPE_NONE: mAttackType = ACTION_DEFAULT; break; - case 1: // knife - case 2: // sword + case WPNTYPE_KNIFE: + case WPNTYPE_SWORD: mAttackType = ACTION_ATTACK_STAB; break; - case 8: // projectile + case WPNTYPE_THROWN: mAttackType = ACTION_ATTACK_THROW; break; - case 10: // bow + case WPNTYPE_BOW: mAttackType = ACTION_ATTACK_BOW; break; - case 11: // sickle + case WPNTYPE_SICKLE: mAttackType = ACTION_ATTACK_SWING; break; default: diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h index 680c8d61..c637b010 100644 --- a/src/resources/iteminfo.h +++ b/src/resources/iteminfo.h @@ -37,6 +37,47 @@ enum EquipmentSoundEvent }; /** + * Enumeration of available Item types. + */ +enum ItemType +{ + ITEM_UNUSABLE = 0, + ITEM_USABLE, // 1 + ITEM_EQUIPMENT_ONE_HAND_WEAPON, // 2 + ITEM_EQUIPMENT_TWO_HANDS_WEAPON,// 3 + ITEM_EQUIPMENT_TORSO,// 4 + ITEM_EQUIPMENT_ARMS,// 5 + ITEM_EQUIPMENT_HEAD,// 6 + ITEM_EQUIPMENT_LEGS,// 7 + ITEM_EQUIPMENT_SHIELD,// 8 + ITEM_EQUIPMENT_RING,// 9 + ITEM_EQUIPMENT_NECKLACE,// 10 + ITEM_EQUIPMENT_FEET,// 11 + ITEM_EQUIPMENT_AMMO// 12 +}; + +/** + * Enumeration of available weapon's types. + */ +enum WeaponType +{ + WPNTYPE_NONE = 0, + WPNTYPE_KNIFE,// 1 + WPNTYPE_SWORD,// 2 + WPNTYPE_POLEARM,// 3 + WPNTYPE_JAVELIN,// 4 + WPNTYPE_STAFF,// 5 + WPNTYPE_WHIP,// 6 + WPNTYPE_BOOMERANG,// 7 + WPNTYPE_BOW,// 8 + WPNTYPE_SICKLE,// 9 + WPNTYPE_CROSSBOW,// 10 + WPNTYPE_MACE,// 11 + WPNTYPE_AXE,// 12 + WPNTYPE_THROWN// 13 +}; + +/** * Defines a class for storing item infos. This includes information used when * the item is equipped. */ @@ -47,7 +88,7 @@ class ItemInfo * Constructor. */ ItemInfo(): - mType(0), + mType(ITEM_UNUSABLE), mWeight(0), mView(0), mAttackType(ACTION_DEFAULT) |