summaryrefslogtreecommitdiff
path: root/src/resources/iteminfo.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/iteminfo.h')
-rw-r--r--src/resources/iteminfo.h116
1 files changed, 41 insertions, 75 deletions
diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h
index a7c0ddca..48a14667 100644
--- a/src/resources/iteminfo.h
+++ b/src/resources/iteminfo.h
@@ -22,7 +22,7 @@
#ifndef ITEMINFO_H
#define ITEMINFO_H
-#include "player.h"
+#include "being.h"
#include "resources/spritedef.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,98 +104,79 @@ class ItemInfo
mWeight(0),
mView(0),
mId(0),
- mAttackType(ACTION_DEFAULT)
+ mAttackAction(SpriteAction::INVALID)
{
}
- void setId(int id)
- { mId = id; }
-
int getId() const
{ return mId; }
- void setName(const std::string &name)
- { mName = name; }
-
const std::string &getName() const
{ return mName; }
- void setParticleEffect(const std::string &particleEffect)
- { mParticle = particleEffect; }
-
std::string getParticleEffect() const { return mParticle; }
- void setImageName(const std::string &imageName)
- { mImageName = imageName; }
-
- const std::string &getImageName() const
- { return mImageName; }
-
- void setDescription(const std::string &description)
- { mDescription = description; }
+ const SpriteDisplay &getDisplay() const
+ { return mDisplay; }
const std::string &getDescription() const
{ return mDescription; }
- void setEffect(const std::string &effect)
- { mEffect = effect; }
-
- const std::string &getEffect() const { return mEffect; }
-
- void setType(ItemType type)
- { mType = type; }
-
- ItemType getType() const
- { return mType; }
-
- void setWeight(int weight)
- { mWeight = weight; }
+ const std::vector<std::string> &getEffect() const { return mEffect; }
int getWeight() const
{ return mWeight; }
- void setView(int view)
- { mView = view; }
-
- void setSprite(const std::string &animationFile, Gender gender)
- { mAnimationFiles[gender] = animationFile; }
-
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 getAttackType() const
- { return mAttackType; }
+ std::string getAttackAction() const
+ { return mAttackAction; }
int getAttackRange() const
{ return mAttackRange; }
- void setAttackRange(int r)
- { mAttackRange = r; }
+ const std::string &getSound(EquipmentSoundEvent event) const;
+
+ bool getEquippable() const { return mEquippable; }
+
+ bool getActivatable() const { return mActivatable; }
+
+ private:
+
+ void setSprite(const std::string &animationFile, Gender gender)
+ { mAnimationFiles[gender] = animationFile; }
void addSound(EquipmentSoundEvent event, const std::string &filename);
- const std::string &getSound(EquipmentSoundEvent event) const;
+ void setWeaponType(int);
- protected:
- std::string mImageName; /**< The filename of the icon image. */
+ SpriteDisplay mDisplay; /**< Display info (like icon) */
std::string mName;
- std::string mDescription; /**< Short description. */
- std::string mEffect; /**< Description of effects. */
- ItemType mType; /**< Item type. */
- std::string mParticle; /**< Particle effect used with this item */
- int mWeight; /**< Weight in grams. */
- int mView; /**< Item ID of how this item looks. */
- int mId; /**< Item ID */
-
- // Equipment related members
- SpriteAction mAttackType; /**< Attack type, in case of weapon. */
- int mAttackRange; /**< Attack range, will be zero if non weapon. */
+ std::string mDescription; /**< Short description. */
+ std::vector<std::string> mEffect; /**< Description of effects. */
+ ItemType mType; /**< Item type. */
+ std::string mParticle; /**< Particle effect used with this item */
+ int mWeight; /**< Weight in grams. */
+ int mView; /**< Item ID of how this item looks. */
+ int mId; /**< Item ID */
+
+ bool mEquippable; /**< Whether this item can be equipped. */
+ bool mActivatable; /**< Whether this item can be activated. */
+
+ // 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
std::string mMissileParticle;
@@ -223,6 +186,9 @@ class ItemInfo
/** Stores the names of sounds to be played at certain event. */
std::map< EquipmentSoundEvent, std::vector<std::string> > mSounds;
+
+ friend class ItemDB;
+ friend void loadSpriteRef(ItemInfo *itemInfo, xmlNodePtr node);
};
#endif