[1996] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 3 | * > www.orxonox.net < |
---|
| 4 | * |
---|
| 5 | * |
---|
| 6 | * License notice: |
---|
| 7 | * |
---|
| 8 | * This program is free software; you can redistribute it and/or |
---|
| 9 | * modify it under the terms of the GNU General Public License |
---|
| 10 | * as published by the Free Software Foundation; either version 2 |
---|
| 11 | * of the License, or (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * This program is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 21 | * |
---|
| 22 | * Author: |
---|
| 23 | * Damian 'Mozork' Frick |
---|
| 24 | * Co-authors: |
---|
| 25 | * ... |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
[2261] | 29 | /** |
---|
[3196] | 30 | @file |
---|
[2662] | 31 | @brief Definition of the QuestDescription class. |
---|
[2261] | 32 | */ |
---|
| 33 | |
---|
[1996] | 34 | #ifndef _QuestDescription_H__ |
---|
| 35 | #define _QuestDescription_H__ |
---|
| 36 | |
---|
[2095] | 37 | #include "OrxonoxPrereqs.h" |
---|
| 38 | |
---|
[1996] | 39 | #include <string> |
---|
| 40 | #include "core/BaseObject.h" |
---|
| 41 | |
---|
[2963] | 42 | // tolua_begin |
---|
[2662] | 43 | namespace orxonox |
---|
| 44 | { |
---|
[1996] | 45 | /** |
---|
| 46 | @brief |
---|
| 47 | This class is a description of a QuestItem. |
---|
| 48 | It holds a title and a description. |
---|
[2261] | 49 | |
---|
| 50 | Creating a QuestDescription through XML goes as follows: |
---|
| 51 | |
---|
[2662] | 52 | <QuestDescription title="Title" description="Description Text" failMessage="You fail." completeMessage="You win!" /> |
---|
[1996] | 53 | @author |
---|
| 54 | Damian 'Mozork' Frick |
---|
| 55 | */ |
---|
[2963] | 56 | class _OrxonoxExport QuestDescription |
---|
| 57 | // tolua_end |
---|
| 58 | : public BaseObject |
---|
| 59 | { // tolua_export |
---|
[2093] | 60 | public: |
---|
[2092] | 61 | QuestDescription(BaseObject* creator); |
---|
[2093] | 62 | virtual ~QuestDescription(); |
---|
[2092] | 63 | |
---|
[2261] | 64 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestDescription object through XML. |
---|
[2092] | 65 | |
---|
[2963] | 66 | // tolua_begin |
---|
[2662] | 67 | /** |
---|
| 68 | @brief Returns the title. |
---|
| 69 | @return Returns a string containing the title of the QuestDescription. |
---|
| 70 | */ |
---|
[2261] | 71 | inline const std::string & getTitle(void) const |
---|
[1996] | 72 | { return this->title_; } |
---|
[2261] | 73 | |
---|
[2662] | 74 | /** |
---|
| 75 | @brief Returns the description text. |
---|
| 76 | @return Returns a string containing the description text of the QuestDescription. |
---|
| 77 | */ |
---|
[2261] | 78 | inline const std::string & getDescription(void) const |
---|
[1996] | 79 | { return this->description_; } |
---|
[2963] | 80 | // tolua_end |
---|
[2662] | 81 | |
---|
| 82 | /** |
---|
| 83 | @brief Returns the fail message. |
---|
| 84 | @return Returns a string containing the fail message of the QuestDescription. |
---|
| 85 | */ |
---|
| 86 | inline const std::string & getFailMessage(void) const |
---|
| 87 | { return this->failMessage_; } |
---|
| 88 | |
---|
| 89 | /** |
---|
| 90 | @brief Returns the complete message. |
---|
| 91 | @return Returns a string containing the complete message of the QuestDescription. |
---|
| 92 | */ |
---|
| 93 | inline const std::string & getCompleteMessage(void) const |
---|
| 94 | { return this->completeMessage_; } |
---|
| 95 | |
---|
| 96 | /** |
---|
| 97 | @brief Sends a Notification displaying that a QuestHint was added. |
---|
| 98 | @return Returns true if successful. |
---|
| 99 | */ |
---|
| 100 | inline bool sendAddHintNotification(void) const |
---|
| 101 | { return notificationHelper("hint", ""); } |
---|
| 102 | |
---|
| 103 | /** |
---|
| 104 | @brief Sends a Notification displaying that a Quest was added. |
---|
| 105 | @return Returns true if successful. |
---|
| 106 | */ |
---|
| 107 | inline bool sendAddQuestNotification(void) const |
---|
| 108 | { return notificationHelper("quest", "start"); } |
---|
| 109 | |
---|
| 110 | /** |
---|
| 111 | @brief Sends a Notification displaying that a Quest was failed. |
---|
| 112 | @return Returns true if successful. |
---|
| 113 | */ |
---|
| 114 | inline bool sendFailQuestNotification(void) const |
---|
| 115 | { return notificationHelper("quest", "fail"); } |
---|
| 116 | |
---|
| 117 | /** |
---|
| 118 | @brief Sends a Notification displaying that a Quest was completed. |
---|
| 119 | @return Returns true if successful. |
---|
| 120 | */ |
---|
| 121 | inline bool sendCompleteQuestNotification(void) const |
---|
| 122 | { return notificationHelper("quest", "complete"); } |
---|
[2092] | 123 | |
---|
[2093] | 124 | private: |
---|
[2261] | 125 | std::string title_; //!< The title. |
---|
| 126 | std::string description_; //!< The description. |
---|
[2662] | 127 | std::string failMessage_; //!< The message displayed when the Quest is failed. |
---|
| 128 | std::string completeMessage_; //!< The message displayed when the Quest is completed. |
---|
[2092] | 129 | |
---|
[2662] | 130 | bool notificationHelper(const std::string & item, const std::string & status) const; //!< Helper for sending QuestDescriptions as Notifications. |
---|
| 131 | |
---|
[2261] | 132 | /** |
---|
| 133 | @brief Sets the title. |
---|
| 134 | @param title The title to be set. |
---|
| 135 | */ |
---|
| 136 | inline void setTitle(const std::string & title) |
---|
[2068] | 137 | { this->title_ = title; } |
---|
[2261] | 138 | |
---|
[2662] | 139 | /** |
---|
[2261] | 140 | @brief Sets the description text. |
---|
| 141 | @param description The description text to be set. |
---|
| 142 | */ |
---|
| 143 | inline void setDescription(const std::string & description) |
---|
[2068] | 144 | { this->description_ = description; } |
---|
[2092] | 145 | |
---|
[2662] | 146 | /** |
---|
| 147 | @brief Sets the fail message. |
---|
| 148 | @param message The fail message to be set. |
---|
| 149 | */ |
---|
| 150 | inline void setFailMessage(const std::string & message) |
---|
| 151 | { this->failMessage_ = message; } |
---|
| 152 | |
---|
| 153 | /** |
---|
| 154 | @brief Sets the complete message. |
---|
| 155 | @param message The complete message to be set. |
---|
| 156 | */ |
---|
| 157 | inline void setCompleteMessage(const std::string & message) |
---|
| 158 | { this->completeMessage_ = message; } |
---|
| 159 | |
---|
[2963] | 160 | }; // tolua_export |
---|
[1996] | 161 | |
---|
[2963] | 162 | } // tolua_export |
---|
[1996] | 163 | |
---|
| 164 | #endif /* _QuestDescription_H__ */ |
---|