summaryrefslogtreecommitdiff
path: root/src/resources/iteminfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/iteminfo.cpp')
-rw-r--r--src/resources/iteminfo.cpp45
1 files changed, 21 insertions, 24 deletions
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index b5b25ac0..6654ccca 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -71,32 +71,29 @@ ItemInfo::getSprite(int gender) const
}
}
-void
-ItemInfo::setAttackType(const std::string &attackType)
+void ItemInfo::setWeaponType(int type)
{
- if (attackType == "swing")
- {
- mAttackType = ACTION_ATTACK_SWING;
- }
- else if (attackType == "stab")
- {
- mAttackType = ACTION_ATTACK_STAB;
- }
- else if (attackType == "bow")
- {
- mAttackType = ACTION_ATTACK_BOW;
- }
- else if (attackType == "throw")
- {
- mAttackType = ACTION_ATTACK_THROW;
- }
- else if (attackType == "none")
- {
- mAttackType = ACTION_DEFAULT;
- }
- else
+ // See server item.hpp file for type values.
+ switch (type)
{
- mAttackType = ACTION_ATTACK;
+ case 0: // none
+ mAttackType = ACTION_DEFAULT;
+ break;
+ case 1: // knife
+ case 2: // sword
+ mAttackType = ACTION_ATTACK_STAB;
+ break;
+ case 8: // projectile
+ mAttackType = ACTION_ATTACK_THROW;
+ break;
+ case 10: // bow
+ mAttackType = ACTION_ATTACK_BOW;
+ break;
+ case 11: // sickle
+ mAttackType = ACTION_ATTACK_SWING;
+ break;
+ default:
+ mAttackType = ACTION_ATTACK;
}
}