Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 25, 2008, 11:56:40 PM (15 years ago)
Author:
landauf
Message:

merged questsystem2 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/objects/quest/GlobalQuest.h

    r2096 r2261  
    2626 *
    2727 */
     28 
     29/**
     30    @file GlobalQuest.h
     31    @brief
     32    Definition of the GlobalQuest class.
     33*/
    2834
    2935#ifndef _GlobalQuest_H__
     
    3339
    3440#include <set>
     41#include <list>
    3542
    3643#include "core/XMLPort.h"
     
    3946namespace orxonox {
    4047
    41     class Player; //Forward declaration, remove when fully integrated into the objecthirarchy.
    42 
    4348    /**
    4449    @brief
    45         Global quests are quests, that have the same status for all players.
    46         This means, that when a player successfully completes this quest, it is completed for all players that have it.
     50        GlobalQuests are Quests, that have the same status for all players.
     51        This means, that when a player successfully completes a GlobalQuest, it is completed for all players that have it.
     52       
     53        Creating a GlobalQuest through XML goes as follows:
     54       
     55        <GlobalQuest id="questId"> //Where questId is a GUID, see http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure for more information
     56            <QuestDescription title="Title" description="Description." /> //The description of the quest.
     57            <subquests>
     58        <Quest id ="questId1" /> //A list of n subquest, be aware, each of the <Quest /> tags must have a description and so on and so forth as well.
     59        ...
     60        <Quest id="questIdn" />
     61        </subquests>
     62        <hints>
     63        <QuestHint id="hintId1" /> //A list of n QuestHints, see QuestHint for the full XML representation of those.
     64        ...
     65        <QuestHint id="hintIdn" />
     66        </hints>
     67            <fail-effects>
     68                <QuestEffect /> //A list of QuestEffects, invoked on all players possessing this quest, when the Quest is failed, see QuestEffect for the full XML representation.
     69                ...
     70                <QuestEffect />
     71            </fail-effects>
     72            <complete-effects>
     73                <QuestEffect /> //A list of QuestEffects, invoked on all players possessing this quest, when the Quest is completed, see QuestEffect for the full XML representation.
     74                ...
     75                <QuestEffect />
     76            </complete-effects>
     77            <reward-effects>
     78                <QuestEffect /> //A list of QuestEffects, invoked on the player completing this quest. See QuestEffect for the full XML representation.
     79                ...
     80                <QuestEffect />
     81            </reward-effects>
     82        </GlobalQuest>
    4783    @author
    4884        Damian 'Mozork' Frick
     
    5490            virtual ~GlobalQuest();
    5591
    56             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     92            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a GlobalQuest object through XML.
     93           
     94            virtual bool fail(PlayerInfo* player); //!< Fails the Quest.
     95            virtual bool complete(PlayerInfo* player); //!< Completes the Quest.
    5796
    5897        protected:
    59             virtual bool isStartable(const Player* player) const; //!< Checks whether the quest can be started.
    60             virtual bool isFailable(const Player* player) const; //!< Checks whether the quest can be failed.
    61             virtual bool isCompletable(const Player* player) const; //!< Checks whether the quest can be completed.
     98            virtual bool isStartable(const PlayerInfo* player) const; //!< Checks whether the Quest can be started.
     99            virtual bool isFailable(const PlayerInfo* player) const; //!< Checks whether the Quest can be failed.
     100            virtual bool isCompletable(const PlayerInfo* player) const; //!< Checks whether the Quest can be completed.
    62101
    63             virtual questStatus::Enum getStatus(const Player* player) const; //!< Returns the status of the quest for a specific player.
    64             virtual bool setStatus(Player* player, const questStatus::Enum & status); //!< Sets the status for a specific player.
     102            virtual questStatus::Enum getStatus(const PlayerInfo* player) const; //!< Returns the status of the Quest for a specific player.
     103           
     104            virtual bool setStatus(PlayerInfo* player, const questStatus::Enum & status); //!< Sets the status for a specific player.
    65105
    66106        private:
    67             std::set<Player*> players_; //!< The set of players which possess this quest.
    68             questStatus::Enum status_; //!< The status of this quest.
    69 
    70             void initialize(void);
     107            std::set<PlayerInfo*> players_; //!< The set of players which possess this Quest.
     108            questStatus::Enum status_; //!< The status of this Quest.
     109            std::list<QuestEffect*> rewards_; //!< Reward QuestEffects only invoked on the player completing the Quest.
     110           
     111            bool addRewardEffect(QuestEffect* effect); //!< Adds a reward QuestEffect to the list of reward QuestEffects.
     112            const QuestEffect* getRewardEffects(unsigned int index) const; //!< Returns the reward QuestEffect at the given index.
    71113
    72114    };
Note: See TracChangeset for help on using the changeset viewer.