#include <src/orxonox/objects/quest/LocalQuest.h>
Public Member Functions | |
virtual bool | complete (PlayerInfo *player) |
Completes the Quest. | |
virtual bool | fail (PlayerInfo *player) |
Fails the Quest. | |
LocalQuest (BaseObject *creator) | |
Constructor. Registers and initializes the object. | |
virtual void | XMLPort (Element &xmlelement, XMLPort::Mode mode) |
Method for creating a LocalQuest object through XML. | |
virtual | ~LocalQuest () |
Destructor. | |
Protected Member Functions | |
virtual QuestStatus::Value | getStatus (const PlayerInfo *player) const |
Returns the status of the Quest for a specific player. | |
virtual bool | isCompletable (const PlayerInfo *player) const |
Checks whether the Quest can be completed. | |
virtual bool | isFailable (const PlayerInfo *player) const |
Checks whether the Quest can be failed. | |
virtual bool | isStartable (const PlayerInfo *player) const |
Checks whether the Quest can be started. | |
virtual bool | setStatus (PlayerInfo *player, const QuestStatus::Value &status) |
Sets the status for a specific player. | |
Private Attributes | |
std::map< const PlayerInfo *, QuestStatus::Value > | playerStatus_ |
List of the status for each player, with the Player-pointer as key. |
Creating a LocalQuest through XML goes as follows:
<LocalQuest id="questId"> //Where questId is a GUID, see http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure for more information <QuestDescription title="Title" description="Description."> //The description of the quest. <subquests> <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. ... <Quest id="questIdn"> </subquests> <hints> <QuestHint id="hintId1"> //A list of n QuestHints, see QuestHint for the full XML representation of those. ... <QuestHint id="hintIdn"> </hints> <fail-effects> <QuestEffect> //A list of QuestEffects, invoked when the Quest is failed, see QuestEffect for the full XML representation. ... <QuestEffect> </fail-effects> <complete-effects> <QuestEffect> //A list of QuestEffects, invoked when the Quest is completed, see QuestEffect for the full XML representation. ... <QuestEffect> </complete-effects> </LocalQuest>
orxonox::LocalQuest::LocalQuest | ( | BaseObject * | creator | ) |
orxonox::LocalQuest::~LocalQuest | ( | ) | [virtual] |
Destructor.
bool orxonox::LocalQuest::complete | ( | PlayerInfo * | player | ) | [virtual] |
Completes the Quest.
Completes the Quest for a given player. Invokes all the complete QuestEffects on the player.
player | The player. |
< Checks whether the Quest can be completed.
< Invoke the complete QuestEffects.
Reimplemented from orxonox::Quest.
References orxonox::Quest::complete(), COUT, orxonox::Quest::getCompleteEffectList(), orxonox::QuestEffect::invokeEffects(), and isCompletable().
bool orxonox::LocalQuest::fail | ( | PlayerInfo * | player | ) | [virtual] |
Fails the Quest.
Fails the Quest for a given player. Invokes all the failEffects on the player.
player | The player. |
< Checks whether the quest can be failed.
< Invoke the failEffects.
Reimplemented from orxonox::Quest.
References COUT, orxonox::Quest::fail(), orxonox::Quest::getFailEffectList(), orxonox::QuestEffect::invokeEffects(), and isFailable().
QuestStatus::Value orxonox::LocalQuest::getStatus | ( | const PlayerInfo * | player | ) | const [protected, virtual] |
Returns the status of the Quest for a specific player.
player | The player. |
Throws | an Exception if player is NULL. |
< No player has no defined status.
< If there is a player in the map.
< If the player is not yet in the map, that means the status of the quest form him is 'inactive'.
Implements orxonox::Quest.
References orxonox::QuestStatus::Inactive, playerStatus_, and ThrowException.
bool orxonox::LocalQuest::isCompletable | ( | const PlayerInfo * | player | ) | const [protected, virtual] |
Checks whether the Quest can be completed.
player | The player for whom is to be checked. |
Throws | an exception if isInactive(PlayerInfo*) throws one. |
Implements orxonox::Quest.
References orxonox::BaseObject::isActive().
Referenced by complete().
bool orxonox::LocalQuest::isFailable | ( | const PlayerInfo * | player | ) | const [protected, virtual] |
Checks whether the Quest can be failed.
player | The player for whom is to be checked. |
Throws | an exception if isActive(PlayerInfo*) throws one. |
Implements orxonox::Quest.
References orxonox::BaseObject::isActive().
Referenced by fail().
bool orxonox::LocalQuest::isStartable | ( | const PlayerInfo * | player | ) | const [protected, virtual] |
Checks whether the Quest can be started.
player | The player for whom is to be checked. |
Throws | an exception if isInactive(PlayerInfo*) throws one. |
Implements orxonox::Quest.
References orxonox::Quest::getParentQuest(), orxonox::BaseObject::isActive(), and orxonox::Quest::isInactive().
bool orxonox::LocalQuest::setStatus | ( | PlayerInfo * | player, | |
const QuestStatus::Value & | status | |||
) | [protected, virtual] |
Sets the status for a specific player.
Sets the status for a specific player. But be careful wit this one, the status will just be set without checking for its validity. You have to know what you're doing. Really!
player | The player the status should be set for. | |
status | The status to be set. |
< We can't set a status for no player.
Implements orxonox::Quest.
References playerStatus_.
void orxonox::LocalQuest::XMLPort | ( | Element & | xmlelement, | |
XMLPort::Mode | mode | |||
) | [virtual] |
Method for creating a LocalQuest object through XML.
Reimplemented from orxonox::Quest.
References COUT, orxonox::QuestItem::getId(), and SUPER.
std::map<const PlayerInfo*, QuestStatus::Value> orxonox::LocalQuest::playerStatus_ [private] |
List of the status for each player, with the Player-pointer as key.
Referenced by getStatus(), and setStatus().