Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 7498 was 7474, checked in by dafrick, 14 years ago

Synchronizing Notifications.
In the course of that, notifications are not longer sent by creating a Notification and the calling notification.send() bur by letting the NotificationManager handle all this: NotificationManager::getInstance().sendNotification(message)
This made QuestNotification obsolete, thus it was removde.

Also did some work on synchronizing the Script class. It should work properly most of the time, but the current solution is unreliable and unsatisfactory. So this will change as soon as I know how.

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