[1992] | 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 | #ifndef _Quest_H__ |
---|
| 30 | #define _Quest_H__ |
---|
| 31 | |
---|
[2095] | 32 | #include "OrxonoxPrereqs.h" |
---|
| 33 | |
---|
[1992] | 34 | #include <list> |
---|
| 35 | #include <string> |
---|
| 36 | |
---|
[2076] | 37 | #include "core/XMLPort.h" |
---|
[1992] | 38 | #include "QuestItem.h" |
---|
| 39 | |
---|
[2021] | 40 | namespace questStatus |
---|
| 41 | { |
---|
| 42 | |
---|
| 43 | enum Enum |
---|
| 44 | { |
---|
| 45 | inactive, |
---|
| 46 | active, |
---|
| 47 | failed, |
---|
| 48 | completed |
---|
| 49 | }; |
---|
| 50 | |
---|
| 51 | } |
---|
| 52 | |
---|
[1992] | 53 | namespace orxonox { |
---|
| 54 | |
---|
[2021] | 55 | class Player; //Forward declaration, remove when fully integrated into the objecthirarchy. |
---|
| 56 | |
---|
[1992] | 57 | /** |
---|
| 58 | @brief |
---|
| 59 | Represents a quest in the game. |
---|
[2068] | 60 | A quest has a list of subquests and a parentquest (if it is not a rootquest). |
---|
| 61 | Each quest exists only once but it has a different status (inactive, active, failed or completed) for each player. |
---|
[1992] | 62 | @author |
---|
| 63 | Damian 'Mozork' Frick |
---|
| 64 | */ |
---|
[2095] | 65 | class _OrxonoxExport Quest : public QuestItem |
---|
[1992] | 66 | { |
---|
[2093] | 67 | public: |
---|
[2092] | 68 | Quest(BaseObject* creator); |
---|
[2093] | 69 | virtual ~Quest(); |
---|
[2092] | 70 | |
---|
[2093] | 71 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
[2092] | 72 | |
---|
[1992] | 73 | inline Quest* getParentQuest(void) const //!< Returns the parent quest of the quest. |
---|
| 74 | { return this->parentQuest_; } |
---|
[2093] | 75 | inline const std::list<Quest*> & getSubQuestList(void) const //!< Returns the list of sub quests. |
---|
[1992] | 76 | { return this->subQuests_; } |
---|
[2092] | 77 | |
---|
[2093] | 78 | bool isInactive(const Player* player) const; //!< Returns true if the quest status for the specific player is 'inactive'. |
---|
| 79 | bool isActive(const Player* player) const; //!< Returns true if the quest status for the specific player is 'active'. |
---|
| 80 | bool isFailed(const Player* player) const; //!< Returns true if the quest status for the specific player is 'failed'. |
---|
| 81 | bool isCompleted(const Player* player) const; //!< Returns true if the quest status for the specific player is 'completed'. |
---|
[2092] | 82 | |
---|
[2093] | 83 | bool start(Player* player); //!< Sets a quest to active. |
---|
| 84 | bool fail(Player* player); //!< Fails the quest. |
---|
| 85 | bool complete(Player* player); //!< Completes the quest. |
---|
[2092] | 86 | |
---|
[1992] | 87 | protected: |
---|
| 88 | void initialize(void); //!< Initialized the object. |
---|
[2092] | 89 | |
---|
[2043] | 90 | virtual bool isStartable(const Player* player) const = 0; //!< Checks whether the quest can be started. |
---|
| 91 | virtual bool isFailable(const Player* player) const = 0; //!< Checks whether the quest can be failed. |
---|
| 92 | virtual bool isCompletable(const Player* player) const = 0; //!< Checks whether the quest can be completed. |
---|
[2092] | 93 | |
---|
[2068] | 94 | bool setParentQuest(Quest* quest); //!< Sets the parent quest of the quest. |
---|
[2093] | 95 | bool addSubQuest(Quest* quest); //!< Adds a sub quest to the quest. |
---|
| 96 | bool addHint(QuestHint* hint); //!< Add a hint to the list of hints. |
---|
| 97 | bool addFailEffect(QuestEffect* effect); |
---|
| 98 | bool addCompleteEffect(QuestEffect* effect); |
---|
[2092] | 99 | |
---|
[2093] | 100 | const Quest* getParentQuest(void); |
---|
| 101 | const Quest* getSubQuests(unsigned int index) const; |
---|
| 102 | const QuestHint* getHints(unsigned int index) const; |
---|
| 103 | const QuestEffect* getFailEffects(unsigned int index) const; |
---|
| 104 | const QuestEffect* getCompleteEffects(unsigned int index) const; |
---|
[2092] | 105 | |
---|
[2043] | 106 | virtual questStatus::Enum getStatus(const Player* player) const = 0; //!< Returns the status of the quest for a specific player. |
---|
[2021] | 107 | virtual bool setStatus(Player* player, const questStatus::Enum & status) = 0; //!< Changes the status for a specific player. |
---|
[2092] | 108 | |
---|
[1992] | 109 | Quest* parentQuest_; //!< Pointer to the parent quest. |
---|
[2021] | 110 | std::list<Quest*> subQuests_; //!< List of all the sub quests. |
---|
[2092] | 111 | |
---|
[2021] | 112 | std::list<QuestHint*> hints_; //!< A list of all the hints tied to this quest. |
---|
[2092] | 113 | |
---|
[2021] | 114 | std::list<QuestEffect*> failEffects_; //!< A list of all effects to be invoked, when the quest has been failed. |
---|
| 115 | std::list<QuestEffect*> completeEffects_; //!< A list of effects to be invoked, when the quest has been completed. |
---|
[1992] | 116 | |
---|
| 117 | }; |
---|
| 118 | |
---|
| 119 | } |
---|
| 120 | |
---|
| 121 | #endif /* _Quest_H__ */ |
---|