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