00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef ITEMINFO_H
00023 #define ITEMINFO_H
00024
00025 #include "resources/spritedef.h"
00026
00027 #include "being.h"
00028
00029 #include <map>
00030 #include <string>
00031 #include <vector>
00032
00033 enum EquipmentSoundEvent
00034 {
00035 EQUIP_EVENT_STRIKE,
00036 EQUIP_EVENT_HIT
00037 };
00038
00039 enum EquipmentSlot
00040 {
00041
00042
00043 EQUIP_TORSO_SLOT = 0,
00044
00045 EQUIP_ARMS_SLOT = 1,
00046
00047 EQUIP_HEAD_SLOT = 2,
00048
00049 EQUIP_LEGS_SLOT = 3,
00050
00051 EQUIP_FEET_SLOT = 4,
00052
00053 EQUIP_RING1_SLOT = 5,
00054 EQUIP_RING2_SLOT = 6,
00055
00056 EQUIP_NECKLACE_SLOT = 7,
00057
00058
00059
00060
00061 EQUIP_FIGHT1_SLOT = 8,
00062 EQUIP_FIGHT2_SLOT = 9,
00063
00064
00065 EQUIP_PROJECTILE_SLOT = 10
00066 };
00067
00068
00072 enum ItemType
00073 {
00074 ITEM_UNUSABLE = 0,
00075 ITEM_USABLE,
00076 ITEM_EQUIPMENT_ONE_HAND_WEAPON,
00077 ITEM_EQUIPMENT_TWO_HANDS_WEAPON,
00078 ITEM_EQUIPMENT_TORSO,
00079 ITEM_EQUIPMENT_ARMS,
00080 ITEM_EQUIPMENT_HEAD,
00081 ITEM_EQUIPMENT_LEGS,
00082 ITEM_EQUIPMENT_SHIELD,
00083 ITEM_EQUIPMENT_RING,
00084 ITEM_EQUIPMENT_NECKLACE,
00085 ITEM_EQUIPMENT_FEET,
00086 ITEM_EQUIPMENT_AMMO
00087 };
00088
00092 enum WeaponType
00093 {
00094 WPNTYPE_NONE = 0,
00095 WPNTYPE_KNIFE,
00096 WPNTYPE_SWORD,
00097 WPNTYPE_POLEARM,
00098 WPNTYPE_STAFF,
00099 WPNTYPE_WHIP,
00100 WPNTYPE_BOW,
00101 WPNTYPE_SHOOTING,
00102 WPNTYPE_MACE,
00103 WPNTYPE_AXE,
00104 WPNTYPE_THROWN
00105 };
00106
00111 class ItemInfo
00112 {
00113 public:
00117 ItemInfo():
00118 mType(ITEM_UNUSABLE),
00119 mWeight(0),
00120 mView(0),
00121 mAttackType(ACTION_DEFAULT)
00122 {
00123 }
00124
00125 void setId(int id)
00126 { mId = id; }
00127
00128 int getId() const
00129 { return mId; }
00130
00131 void setName(const std::string &name)
00132 { mName = name; }
00133
00134 const std::string &getName() const
00135 { return mName; }
00136
00137 void setParticleEffect(const std::string &particleEffect)
00138 { mParticle = particleEffect; }
00139
00140 std::string getParticleEffect() const { return mParticle; }
00141
00142 void setImageName(const std::string &imageName)
00143 { mImageName = imageName; }
00144
00145 const std::string &getImageName() const
00146 { return mImageName; }
00147
00148 void setDescription(const std::string &description)
00149 { mDescription = description; }
00150
00151 const std::string &getDescription() const
00152 { return mDescription; }
00153
00154 void setEffect(const std::string &effect)
00155 { mEffect = effect; }
00156
00157 const std::string &getEffect() const { return mEffect; }
00158
00159 void setType(ItemType type)
00160 { mType = type; }
00161
00162 ItemType getType() const
00163 { return mType; }
00164
00165 void setWeight(short weight)
00166 { mWeight = weight; }
00167
00168 short getWeight() const
00169 { return mWeight; }
00170
00171 void setView(int view)
00172 { mView = view; }
00173
00174 void setSprite(const std::string &animationFile, Gender gender)
00175 { mAnimationFiles[gender] = animationFile; }
00176
00177 const std::string &getSprite(Gender gender) const;
00178
00179 void setWeaponType(int);
00180
00181 SpriteAction getAttackType() const
00182 { return mAttackType; }
00183
00184 int getAttackRange() const
00185 { return mAttackRange; }
00186
00187 void setAttackRange(int r)
00188 { mAttackRange = r; }
00189
00190 void addSound(EquipmentSoundEvent event, const std::string &filename);
00191
00192 const std::string &getSound(EquipmentSoundEvent event) const;
00193
00194 protected:
00195 std::string mImageName;
00196 std::string mName;
00197 std::string mDescription;
00198 std::string mEffect;
00199 ItemType mType;
00200 std::string mParticle;
00201 short mWeight;
00202 int mView;
00203 int mId;
00205
00206 SpriteAction mAttackType;
00207 int mAttackRange;
00210 std::map<int, std::string> mAnimationFiles;
00211
00213 std::map< EquipmentSoundEvent, std::vector<std::string> > mSounds;
00214 };
00215
00216 #endif