[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 | |
---|
[5722] | 37 | #include "questsystem/QuestsystemPrereqs.h" |
---|
[2095] | 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. |
---|
[5693] | 49 | |
---|
[2261] | 50 | Creating a QuestDescription through XML goes as follows: |
---|
[5693] | 51 | |
---|
[2662] | 52 | <QuestDescription title="Title" description="Description Text" failMessage="You fail." completeMessage="You win!" /> |
---|
[1996] | 53 | @author |
---|
| 54 | Damian 'Mozork' Frick |
---|
| 55 | */ |
---|
[5722] | 56 | class _QuestsystemExport QuestDescription : public BaseObject |
---|
[3370] | 57 | { |
---|
[2963] | 58 | // tolua_end |
---|
[2093] | 59 | public: |
---|
[2092] | 60 | QuestDescription(BaseObject* creator); |
---|
[2093] | 61 | virtual ~QuestDescription(); |
---|
[2092] | 62 | |
---|
[2261] | 63 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestDescription object through XML. |
---|
[2092] | 64 | |
---|
[2963] | 65 | // tolua_begin |
---|
[2662] | 66 | /** |
---|
| 67 | @brief Returns the title. |
---|
| 68 | @return Returns a string containing the title of the QuestDescription. |
---|
| 69 | */ |
---|
[2261] | 70 | inline const std::string & getTitle(void) const |
---|
[1996] | 71 | { return this->title_; } |
---|
[5693] | 72 | |
---|
[2662] | 73 | /** |
---|
| 74 | @brief Returns the description text. |
---|
| 75 | @return Returns a string containing the description text of the QuestDescription. |
---|
| 76 | */ |
---|
[2261] | 77 | inline const std::string & getDescription(void) const |
---|
[1996] | 78 | { return this->description_; } |
---|
[2963] | 79 | // tolua_end |
---|
[5693] | 80 | |
---|
[2662] | 81 | /** |
---|
| 82 | @brief Returns the fail message. |
---|
| 83 | @return Returns a string containing the fail message of the QuestDescription. |
---|
| 84 | */ |
---|
| 85 | inline const std::string & getFailMessage(void) const |
---|
| 86 | { return this->failMessage_; } |
---|
[5693] | 87 | |
---|
[2662] | 88 | /** |
---|
| 89 | @brief Returns the complete message. |
---|
| 90 | @return Returns a string containing the complete message of the QuestDescription. |
---|
| 91 | */ |
---|
| 92 | inline const std::string & getCompleteMessage(void) const |
---|
| 93 | { return this->completeMessage_; } |
---|
[5693] | 94 | |
---|
[2662] | 95 | /** |
---|
| 96 | @brief Sends a Notification displaying that a QuestHint was added. |
---|
| 97 | @return Returns true if successful. |
---|
| 98 | */ |
---|
| 99 | inline bool sendAddHintNotification(void) const |
---|
| 100 | { return notificationHelper("hint", ""); } |
---|
[5693] | 101 | |
---|
[2662] | 102 | /** |
---|
| 103 | @brief Sends a Notification displaying that a Quest was added. |
---|
| 104 | @return Returns true if successful. |
---|
| 105 | */ |
---|
| 106 | inline bool sendAddQuestNotification(void) const |
---|
| 107 | { return notificationHelper("quest", "start"); } |
---|
[5693] | 108 | |
---|
[2662] | 109 | /** |
---|
| 110 | @brief Sends a Notification displaying that a Quest was failed. |
---|
| 111 | @return Returns true if successful. |
---|
| 112 | */ |
---|
| 113 | inline bool sendFailQuestNotification(void) const |
---|
| 114 | { return notificationHelper("quest", "fail"); } |
---|
[5693] | 115 | |
---|
[2662] | 116 | /** |
---|
| 117 | @brief Sends a Notification displaying that a Quest was completed. |
---|
| 118 | @return Returns true if successful. |
---|
| 119 | */ |
---|
| 120 | inline bool sendCompleteQuestNotification(void) const |
---|
| 121 | { return notificationHelper("quest", "complete"); } |
---|
[2092] | 122 | |
---|
[2093] | 123 | private: |
---|
[2261] | 124 | std::string title_; //!< The title. |
---|
| 125 | std::string description_; //!< The description. |
---|
[2662] | 126 | std::string failMessage_; //!< The message displayed when the Quest is failed. |
---|
| 127 | std::string completeMessage_; //!< The message displayed when the Quest is completed. |
---|
[2092] | 128 | |
---|
[2662] | 129 | bool notificationHelper(const std::string & item, const std::string & status) const; //!< Helper for sending QuestDescriptions as Notifications. |
---|
| 130 | |
---|
[2261] | 131 | /** |
---|
| 132 | @brief Sets the title. |
---|
| 133 | @param title The title to be set. |
---|
| 134 | */ |
---|
| 135 | inline void setTitle(const std::string & title) |
---|
[2068] | 136 | { this->title_ = title; } |
---|
[5693] | 137 | |
---|
[2662] | 138 | /** |
---|
[2261] | 139 | @brief Sets the description text. |
---|
| 140 | @param description The description text to be set. |
---|
| 141 | */ |
---|
| 142 | inline void setDescription(const std::string & description) |
---|
[2068] | 143 | { this->description_ = description; } |
---|
[2092] | 144 | |
---|
[2662] | 145 | /** |
---|
| 146 | @brief Sets the fail message. |
---|
| 147 | @param message The fail message to be set. |
---|
| 148 | */ |
---|
| 149 | inline void setFailMessage(const std::string & message) |
---|
| 150 | { this->failMessage_ = message; } |
---|
[5693] | 151 | |
---|
[2662] | 152 | /** |
---|
| 153 | @brief Sets the complete message. |
---|
| 154 | @param message The complete message to be set. |
---|
| 155 | */ |
---|
| 156 | inline void setCompleteMessage(const std::string & message) |
---|
| 157 | { this->completeMessage_ = message; } |
---|
| 158 | |
---|
[2963] | 159 | }; // tolua_export |
---|
[1996] | 160 | |
---|
[2963] | 161 | } // tolua_export |
---|
[1996] | 162 | |
---|
| 163 | #endif /* _QuestDescription_H__ */ |
---|