summaryrefslogtreecommitdiff
path: root/src/resources/iteminfo.cpp
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.cpp
parent2b1c0dcf269d617de1f6c203df547166661f089e (diff)
downloadmana-ae898aa1a5175b2b08f7248e4cd89bf61bc8e4be.tar.gz
mana-ae898aa1a5175b2b08f7248e4cd89bf61bc8e4be.tar.bz2
mana-ae898aa1a5175b2b08f7248e4cd89bf61bc8e4be.tar.xz
mana-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.cpp')
-rw-r--r--src/resources/iteminfo.cpp28
1 files changed, 5 insertions, 23 deletions
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index 9c275f96..1cd3c546 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -41,30 +41,12 @@ const std::string &ItemInfo::getSprite(Gender gender) const
}
}
-void ItemInfo::setWeaponType(int type)
+void ItemInfo::setAttackAction(std::string attackAction)
{
- // See server item.hpp file for type values.
- switch (type)
- {
- case WPNTYPE_NONE:
- mWeaponAttackType = ACTION_DEFAULT;
- break;
- case WPNTYPE_KNIFE:
- case WPNTYPE_SWORD:
- mWeaponAttackType = ACTION_ATTACK_STAB;
- break;
- case WPNTYPE_THROWN:
- mWeaponAttackType = ACTION_ATTACK_THROW;
- break;
- case WPNTYPE_BOW:
- mWeaponAttackType = ACTION_ATTACK_BOW;
- break;
- case WPNTYPE_POLEARM:
- mWeaponAttackType = ACTION_ATTACK_SWING;
- break;
- default:
- mWeaponAttackType = ACTION_ATTACK;
- }
+ if (attackAction.empty())
+ mAttackAction = SpriteAction::ATTACK; // (Equal to unarmed animation)
+ else
+ mAttackAction = attackAction;
}
void ItemInfo::addSound(EquipmentSoundEvent event, const std::string &filename)