diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-12-25 09:39:36 -0500 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-12-25 09:39:36 -0500 |
| commit | 483f56aea5aa6efefa55f68b4e7e52c9f814baa0 (patch) | |
| tree | b2c06642b6bb1cfe4fe954cc8700405ed7b3162d | |
| parent | f3b3f21d3ba0fd48bc265684817cb38a70adf84b (diff) | |
Documented Item
| -rw-r--r-- | sigmod/Item.cpp | 4 | ||||
| -rw-r--r-- | sigmod/Item.h | 123 |
2 files changed, 127 insertions, 0 deletions
diff --git a/sigmod/Item.cpp b/sigmod/Item.cpp index af96cb60..07ce051c 100644 --- a/sigmod/Item.cpp +++ b/sigmod/Item.cpp @@ -15,6 +15,10 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +/** + * \file sigmod/Item.cpp + */ + // Header include #include "Item.h" diff --git a/sigmod/Item.h b/sigmod/Item.h index 49f340ac..e1e65542 100644 --- a/sigmod/Item.h +++ b/sigmod/Item.h @@ -33,38 +33,161 @@ namespace Sigmod // Forward declarations class Sigmod; +/** + * \class Sigmod::Item Item.h sigmod/Item.h + * \brief + */ class SIGMOD_EXPORT Item : public Object { Q_OBJECT public: + /** + * Copy constructor. + * + * \param item The item to copy. + */ Item(const Item& item); + /** + * Create a new item belonging to \p parent and id \p id. + * + * \param parent The parent of the item. + * \param id The id number for the item. + */ Item(const Sigmod* parent, const int id); + /** + * Data copy constructor. Copies the data from \p item as a child of \p parent with id \p id. + * + * \param item The item to copy the data from. + * \param parent The parent of the item. + * \param id The id number for the item. + */ Item(const Item& item, const Sigmod* parent, const int id); Item(const QDomElement& xml, const Sigmod* parent, const int id = -1); ~Item(); + /** + * Check to make sure the item's values are valid. + */ void validate(); + /** + * Load data from XML. + * + * \param xml The XML structure to extract data from. + */ void load(const QDomElement& xml); + /** + * Get the data for the item in XML format. + * + * \return The XML structure representing the item. + */ QDomElement save() const; + /** + * Sets the name of the item used in the game. + * + * \param name The name of the item. + */ void setName(const QString& name); + /** + * Sets whether the item is can be sold or not. If set to \p true, the item can be sold at a \link Store store \endlink. + * + * \param sellable Whether the item can be sold or not. + */ void setSellable(const bool sellable); + /** + * Sets the \link ItemType type \endlink of the item. + * + * \param type The id of the type the item is. + */ void setType(const int type); + /** + * Sets how much the item is sold for at a \link Store store \endlink. + * + * \param price The price of the item. + */ void setPrice(const int price); + /** + * Sets how much the item can be sold for at a \link Store store \endlink. + * + * \param sellPrice The selling price of the item. + */ void setSellPrice(const int sellPrice); + /** + * Sets the weight of the item. + * + * \param weight The weight of the item. + */ void setWeight(const int weight); + /** + * Set the description of the item. It should be describe the item to the player. + * + * \param description The description of the item. + */ void setDescription(const QString& description); + /** + * Set the script that determines the behavior of the item. The following objects are available to the script: + * + * - \b owner -- The \link Sigencore::TeamMember team member \endlink which owns the instance of the ability. + * - \b client -- The \link Sigencore::Client client \endlink which owns \b owner. + * - \b sigmod -- The \link Sigscript::SigmodWrapper wrapper \endlink for the \link Sigmod sigmod \endlink in use. + * - \b arena -- The \link Sigencore::Arena arena \endlink the ability is being used in. + * + * When used, the \p used function will be called. It should return a \p bool as to whether the item was consumed or not. + * If it is consumed, it is removed from the player's inventory. + * + * \param script + */ void setScript(const Sigcore::Script& script); + /** + * \sa setName + * + * \return The name of the item. + */ QString name() const; + /** + * \sa setSellable + * + * \return \p true if the item can be sold at a store, \p false otherwise. + */ bool sellable() const; + /** + * \sa setType + * + * \return The id of the \link ItemType type \endlink of the item. + */ int type() const; + /** + * \sa setPrice + * + * \return How much the item costs at a \link Store store \endlink. + */ int price() const; + /** + * \sa setSellPrice + * + * \return How much the item can be sold for at a \link Store store \endlink. + */ int sellPrice() const; + /** + * \sa setWeight + * + * \return How much the item weighs. + */ int weight() const; + /** + * \sa setDescription + * + * \return A short description of the item. + */ QString description() const; + /** + * \sa setScript + * + * \return The script that defines the behavior of the item. + */ Sigcore::Script script() const; Item& operator=(const Item& rhs); |
