Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/questsystem/QuestDescription.h @ 11178

Last change on this file since 11178 was 11071, checked in by landauf, 9 years ago

merged branch cpp11_v3 back to trunk

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