summaryrefslogtreecommitdiff
path: root/src/game-server/item.hpp
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-08-19 08:05:45 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-08-19 08:05:45 +0000
commit31232e3a5702a7618fe40dc74f5d987a662cb081 (patch)
tree170b799b14dc950201eb7eec63c957e542e4c96d /src/game-server/item.hpp
parent2ae3f3a3ef5caee193138a3e5c1613403302089c (diff)
downloadmanaserv-31232e3a5702a7618fe40dc74f5d987a662cb081.tar.gz
manaserv-31232e3a5702a7618fe40dc74f5d987a662cb081.tar.bz2
manaserv-31232e3a5702a7618fe40dc74f5d987a662cb081.tar.xz
manaserv-31232e3a5702a7618fe40dc74f5d987a662cb081.zip
Added support for protective equipment.
Diffstat (limited to 'src/game-server/item.hpp')
-rw-r--r--src/game-server/item.hpp34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/game-server/item.hpp b/src/game-server/item.hpp
index 83706b9c..b2bbd303 100644
--- a/src/game-server/item.hpp
+++ b/src/game-server/item.hpp
@@ -24,9 +24,12 @@
#ifndef _TMWSERV_ITEM
#define _TMWSERV_ITEM
+#include <string>
#include <vector>
-#include "game-server/character.hpp"
+#include "game-server/object.hpp"
+
+class Being;
/**
* Enumeration of available Item types.
@@ -119,7 +122,7 @@ enum
struct ItemModifier
{
unsigned char type;
- signed short value;
+ short value;
};
/**
@@ -128,11 +131,38 @@ struct ItemModifier
class ItemModifiers
{
public:
+
+ /**
+ * Gets the value associated to a modifier type, or zero if none.
+ */
int getValue(int type) const;
+
+ /**
+ * Sets the value associated to a modifier type.
+ */
void setValue(int type, int amount);
+
+ /**
+ * Gets the value associated to a MOD_ATTRIBUTE class, or zero if none.
+ */
int getAttributeValue(int attr) const;
+
+ /**
+ * Sets the value associated to a MOD_ATTRIBUTE class.
+ */
void setAttributeValue(int attr, int amount);
+ /**
+ * Applies all the attribute modifiers to a given Being.
+ */
+ void applyAttributes(Being *) const;
+
+ /**
+ * Cancels all the applied modifiers to a given Being.
+ * Only meant for equipment.
+ */
+ void cancelAttributes(Being *) const;
+
private:
std::vector< ItemModifier > mModifiers;
};