summaryrefslogtreecommitdiff
path: root/src/resources/iteminfo.h
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2010-07-29 20:20:51 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2010-07-29 20:20:51 +0200
commitae898aa1a5175b2b08f7248e4cd89bf61bc8e4be (patch)
tree041646a78229772ae7bb55222659fc4826325c43 /src/resources/iteminfo.h
parent2b1c0dcf269d617de1f6c203df547166661f089e (diff)
downloadmana-client-ae898aa1a5175b2b08f7248e4cd89bf61bc8e4be.tar.gz
mana-client-ae898aa1a5175b2b08f7248e4cd89bf61bc8e4be.tar.bz2
mana-client-ae898aa1a5175b2b08f7248e4cd89bf61bc8e4be.tar.xz
mana-client-ae898aa1a5175b2b08f7248e4cd89bf61bc8e4be.zip
Changed the items loading to handle a new 'attack-action' parameter.
The old behaviour was to load the weapon-type value and do many unnecessary checks and transformation on it: The weapon-type was transformed using hard-coded values into an integer enum value. The exact same thing was done on the opposite side in the animation files before comparing the two. As both data were string values, I simplified all of it by using the value taken in items.xml to call the corresponding action. This now also permit to set up new attack animation in items.xml and in the playerset.xml without having the need to modify the client code. Last but not least, the weapon-type value was used by both the skills and the actions and avoided the possibility to set up a definite action for a weapon-type. Note: The weapon-type parameter will become deprecated for the server in favor of a 'skill' parameter to reflect more it's actual use. This patch is the first step to fix Manasource issue: #157.
Diffstat (limited to 'src/resources/iteminfo.h')
-rw-r--r--src/resources/iteminfo.h34
1 files changed, 10 insertions, 24 deletions
diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h
index 1f27ae66..ac747e33 100644
--- a/src/resources/iteminfo.h
+++ b/src/resources/iteminfo.h
@@ -90,24 +90,6 @@ enum ItemType
};
/**
- * Enumeration of available weapon's types.
- */
-enum WeaponType
-{
- WPNTYPE_NONE = 0,
- WPNTYPE_KNIFE,
- WPNTYPE_SWORD,
- WPNTYPE_POLEARM,
- WPNTYPE_STAFF,
- WPNTYPE_WHIP,
- WPNTYPE_BOW,
- WPNTYPE_SHOOTING,
- WPNTYPE_MACE,
- WPNTYPE_AXE,
- WPNTYPE_THROWN
-};
-
-/**
* Defines a class for storing item infos. This includes information used when
* the item is equipped.
*/
@@ -122,7 +104,7 @@ class ItemInfo
mWeight(0),
mView(0),
mId(0),
- mWeaponAttackType(ACTION_DEFAULT)
+ mAttackAction(SpriteAction::INVALID)
{
}
@@ -180,15 +162,15 @@ class ItemInfo
const std::string &getSprite(Gender gender) const;
- void setWeaponType(int);
+ void setAttackAction(std::string attackAction);
// Handlers for seting and getting the string used for particles when attacking
void setMissileParticle(std::string s) { mMissileParticle = s; }
std::string getMissileParticle() const { return mMissileParticle; }
- SpriteAction getWeaponAttackType() const
- { return mWeaponAttackType; }
+ std::string getAttackAction() const
+ { return mAttackAction; }
int getAttackRange() const
{ return mAttackRange; }
@@ -211,8 +193,12 @@ class ItemInfo
int mView; /**< Item ID of how this item looks. */
int mId; /**< Item ID */
- // Equipment related members
- SpriteAction mWeaponAttackType; /**< Attack type, in case of weapon. */
+ // Equipment related members.
+ /** Attack type, in case of weapon.
+ * See SpriteAction in spritedef.h for more info.
+ * Attack action sub-types (bow, sword, ...) are defined in items.xml.
+ */
+ std::string mAttackAction;
int mAttackRange; /**< Attack range, will be zero if non weapon. */
// Particle to be shown when weapon attacks