Index: /code/branches/libraries2/src/modules/questsystem/AddQuest.cc
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/AddQuest.cc	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/AddQuest.cc	(revision 5721)
@@ -0,0 +1,110 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the AddQuest class.
+*/
+
+#include "AddQuest.h"
+
+#include "util/Exception.h"
+#include "core/CoreIncludes.h"
+#include "QuestManager.h"
+#include "Quest.h"
+
+namespace orxonox
+{
+    CreateFactory(AddQuest);
+
+    /**
+    @brief
+        Constructor. Registers the object.
+    */
+    AddQuest::AddQuest(BaseObject* creator) : ChangeQuestStatus(creator)
+    {
+        RegisterObject(AddQuest);
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    AddQuest::~AddQuest()
+    {
+    }
+
+    /**
+    @brief
+        Method for creating a AddQuest object through XML.
+    */
+    void AddQuest::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(AddQuest, XMLPort, xmlelement, mode);
+
+        COUT(3) << "New AddQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
+    }
+
+    /**
+    @brief
+        Invokes the QuestEffect.
+    @param player
+        The player the QuestEffect is invoked on.
+    @return
+        Returns true if the QuestEffect was successfully invoked.
+    */
+    bool AddQuest::invoke(PlayerInfo* player)
+    {
+        if(player == NULL) //!< Null-pointers are badass.
+        {
+            COUT(2) << "Input player is NULL." << std::endl;
+            return false;
+        }
+
+        COUT(3) << "AddQuest on player: " << player << " ." << std::endl;
+
+        try
+        {
+            Quest* quest = QuestManager::getInstance().findQuest(this->getQuestId());
+            if(quest == NULL || !quest->start(player))
+            {
+               return false;
+            }
+        }
+        catch(const orxonox::Exception& ex)
+        {
+            COUT(2) << ex.getFullDescription() << std::endl;
+            return false;
+        }
+
+        COUT(3) << "Quest {" << this->getQuestId() << "} successfully added to player: " << player << " ." << std::endl;
+        return true;
+    }
+
+
+}
Index: /code/branches/libraries2/src/modules/questsystem/AddQuest.h
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/AddQuest.h	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/AddQuest.h	(revision 5721)
@@ -0,0 +1,66 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the AddQuest class.
+*/
+
+#ifndef _AddQuest_H__
+#define _AddQuest_H__
+
+#include "objects/quest/QuestPrereqs.h"
+#include "ChangeQuestStatus.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        Adds a Quest, resp. changes the quests status to active for the player invoking the Quest.
+
+        Creating a AddQuest through XML goes as follows:
+
+        <AddQuest questId="id" />  //Where id is a GUID, see http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure for more information, and identifies the Quest that should be added.
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _QuestExport AddQuest : public ChangeQuestStatus
+    {
+        public:
+        AddQuest(BaseObject* creator);
+        virtual ~AddQuest();
+
+        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a AddQuest object through XML.
+
+        virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect.
+
+    };
+
+}
+
+#endif /* _AddQuest_H__ */
Index: /code/branches/libraries2/src/modules/questsystem/AddQuestHint.cc
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/AddQuestHint.cc	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/AddQuestHint.cc	(revision 5721)
@@ -0,0 +1,133 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the AddQuestHint class.
+*/
+
+#include "AddQuestHint.h"
+
+#include "util/Exception.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "QuestManager.h"
+#include "QuestItem.h"
+#include "QuestHint.h"
+
+namespace orxonox
+{
+    CreateFactory(AddQuestHint);
+
+    /**
+    @brief
+        Constructor. Registers the object.
+    */
+    AddQuestHint::AddQuestHint(BaseObject* creator) : QuestEffect(creator)
+    {
+        RegisterObject(AddQuestHint);
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    AddQuestHint::~AddQuestHint()
+    {
+    }
+
+    /**
+    @brief
+        Method for creating a AddQuestHint object through XML.
+    */
+    void AddQuestHint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(AddQuestHint, XMLPort, xmlelement, mode);
+
+        XMLPortParam(AddQuestHint, "hintId", setHintId, getHintId, xmlelement, mode);
+        
+        COUT(3) << "New AddQuestHint, with target QuestHint {" << this->getHintId() << "}, created." << std::endl;
+    }
+
+    /**
+    @brief
+        Sets the id of the QuestHint to be added to the player the QuestEffect is invoked on.
+    @param id
+        The QuestHint id.
+    @param
+        Returns true if successful.
+    */
+    bool AddQuestHint::setHintId(const std::string & id)
+    {
+        if(!QuestItem::isId(id))
+        {
+            COUT(2) << "Invalid id. QuestItem id {" << id << "} could not be set." << std::endl;
+            return false;
+        }
+        
+        this->hintId_ = id;
+        return true;
+    }
+
+    /**
+    @brief
+        Invokes the QuestEffect.
+    @param player
+        The player.
+    @return
+        Returns true if the QuestEffect was successfully invoked.
+    */
+    bool AddQuestHint::invoke(PlayerInfo* player)
+    {
+        if(player == NULL) //!< NULL-pointers are evil!
+        {
+            COUT(2) << "The input player is NULL." << std::endl;
+            return false;
+        }
+
+        COUT(3) << "AddQuestHint on player: " << player << " ." << std::endl;
+
+        try
+        {
+            QuestHint* hint = QuestManager::getInstance().findHint(this->hintId_);
+            if(hint == NULL || !hint->setActive(player))
+            {
+                return false;
+            }
+        }
+        catch(const Exception& e)
+        {
+           COUT(2) << e.getFullDescription() << std::endl;
+           return false;
+        }
+
+        COUT(3) << "QuestHint {" << this->getHintId() << "} successfully added to player: " << player << " ." << std::endl;
+        return true;
+
+    }
+}
Index: /code/branches/libraries2/src/modules/questsystem/AddQuestHint.h
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/AddQuestHint.h	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/AddQuestHint.h	(revision 5721)
@@ -0,0 +1,80 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the AddQuestHint class.
+*/
+
+#ifndef _AddQuestHint_H__
+#define _AddQuestHint_H__
+
+#include "objects/quest/QuestPrereqs.h"
+
+#include <string>
+#include "QuestEffect.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        Adds a QuestHint, resp. activates the QuestHint of the given id for the player the QuestEffect is invoked on.
+
+    Creating a AddQuestHint through XML goes as follows:
+
+        <AddQuestHint hintId="id" />  //Where id is a GUID, see http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure for more information, and identifies the QuestHint that should be added.
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _QuestExport AddQuestHint : public QuestEffect
+    {
+        public:
+            AddQuestHint(BaseObject* creator);
+            virtual ~AddQuestHint();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a AddQuestHint object through XML.
+
+            virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect.
+
+        private:
+            std::string hintId_; //!< The id of the QuestHint.
+
+            /**
+            @brief Returns the id of the QuestHint.
+            @return Returns the id of the QuestHint.
+            */
+            inline const std::string & getHintId(void) const
+                { return this->hintId_; }
+
+            bool setHintId(const std::string & id); //!< Sets the id of the QuestHint.
+
+    };
+
+}
+
+#endif /* _AddQuestHint_H__ */
Index: /code/branches/libraries2/src/modules/questsystem/AddReward.cc
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/AddReward.cc	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/AddReward.cc	(revision 5721)
@@ -0,0 +1,118 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the AddReward class.
+*/
+
+#include "AddReward.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "interfaces/Rewardable.h"
+
+namespace orxonox
+{
+    CreateFactory(AddReward);
+
+    /**
+    @brief
+        Constructor. Registers the object.
+    */
+    AddReward::AddReward(BaseObject* creator) : QuestEffect(creator)
+    {
+        RegisterObject(AddReward);
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    AddReward::~AddReward()
+    {
+    }
+
+    /**
+        Method for creating a AddReward object through XML.
+    */
+    void AddReward::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(AddReward, XMLPort, xmlelement, mode);
+
+        XMLPortObject(AddReward, Rewardable, "", addRewardable, getRewardables, xmlelement, mode);
+        
+        COUT(3) << "New AddReward, with " << this->rewards_.size() << " Rewardables created." << std::endl;
+    }
+
+    /**
+    @brief
+        Returns the Rewardable object at the given index.
+    @param index
+        The index.
+    @return
+        Returns a pointer to the Rewardable object at the given index.
+    */
+    const Rewardable* AddReward::getRewardables(unsigned int index) const
+    {
+        int i = index;
+        for (std::list<Rewardable*>::const_iterator reward = this->rewards_.begin(); reward != this->rewards_.end(); ++reward)
+        {
+            if(i == 0)
+            {
+               return *reward;
+            }
+            i--;
+        }
+        return NULL;
+    }
+
+    /**
+    @brief
+        Invokes the QuestEffect.
+    @param player
+        The player.
+    @return
+        Returns true if the QuestEffect was invoked successfully.
+    */
+    bool AddReward::invoke(PlayerInfo* player)
+    {
+        COUT(3) << "AddReward on player: " << player << " ." << std::endl;
+        
+        bool check = true;
+        for ( std::list<Rewardable*>::iterator reward = this->rewards_.begin(); reward != this->rewards_.end(); ++reward )
+        {
+            check = check && (*reward)->reward(player);
+        }
+        
+        COUT(3) << "Rewardable successfully added to player." << player << " ." << std::endl;
+
+        return check;
+    }
+
+}
Index: /code/branches/libraries2/src/modules/questsystem/AddReward.h
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/AddReward.h	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/AddReward.h	(revision 5721)
@@ -0,0 +1,84 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the AddReward class.
+*/
+
+#ifndef _AddReward_H__
+#define _AddReward_H__
+
+#include "objects/quest/QuestPrereqs.h"
+
+#include <list>
+#include "QuestEffect.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        Adds a list of Rewardables to a player.
+
+        Creating a AddReward through XML goes as follows:
+
+        <AddReward>
+            <Rewardable /> //A list of Rewardable objects to be rewarded the player, see the specific Rewardables for their respective XML representations.
+            ...
+            <Rewardable />
+        </AddReward>
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _QuestExport AddReward : public QuestEffect
+    {
+        public:
+            AddReward(BaseObject* creator);
+            virtual ~AddReward();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a AddReward object through XML.
+
+            virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect.
+
+        private:
+            std::list<Rewardable*> rewards_; //!< A list of Rewardables to be added to the player invoking the QuestEffect.
+
+            /**
+            @brief Add a Rewardable object to the list of objects to be awarded to the player invoking the QuestEffect.
+            @param reward Pointer to the Rewardable to be added.
+            */
+            inline void addRewardable(Rewardable* reward)
+                { this->rewards_.push_back(reward); }
+
+            const Rewardable* getRewardables(unsigned int index) const; //!< Returns the Rewardable object at the given index.
+
+    };
+
+}
+
+#endif /* _AddReward_H__ */
Index: /code/branches/libraries2/src/modules/questsystem/CMakeLists.txt
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/CMakeLists.txt	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/CMakeLists.txt	(revision 5721)
@@ -0,0 +1,37 @@
+SET_SOURCE_FILES(QUEST_SRC_FILES
+  AddQuest.cc
+  AddQuestHint.cc
+  AddReward.cc
+  ChangeQuestStatus.cc
+  CompleteQuest.cc
+  FailQuest.cc
+  GlobalQuest.cc
+  LocalQuest.cc
+  Quest.cc
+  QuestDescription.cc
+  QuestEffect.cc
+  QuestEffectBeacon.cc
+  QuestHint.cc
+  QuestItem.cc
+  QuestListener.cc
+  QuestManager.cc
+  QuestNotification.cc
+)
+
+ADD_SUBDIRECTORY(notifications)
+
+# add the parent directory for tolua (TODO: remove this if the quest module is moved somewhere else)
+INCLUDE_DIRECTORIES(..)
+
+ORXONOX_ADD_LIBRARY(quest
+  MODULE
+  TOLUA_FILES
+    QuestDescription.h
+    QuestManager.h
+  DEFINE_SYMBOL
+    "QUEST_SHARED_BUILD"
+  LINK_LIBRARIES
+    orxonox
+    overlays
+  SOURCE_FILES ${QUEST_SRC_FILES}
+)
Index: /code/branches/libraries2/src/modules/questsystem/ChangeQuestStatus.cc
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/ChangeQuestStatus.cc	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/ChangeQuestStatus.cc	(revision 5721)
@@ -0,0 +1,90 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the ChangeQuestStatus class.
+*/
+
+#include "ChangeQuestStatus.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "QuestItem.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        Constructor. Registers the object.
+    */
+    ChangeQuestStatus::ChangeQuestStatus(BaseObject* creator) : QuestEffect(creator)
+    {
+        RegisterObject(ChangeQuestStatus);
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    ChangeQuestStatus::~ChangeQuestStatus()
+    {
+    }
+
+    /**
+    @brief
+        Method for creating a ChangeQuestStatus object through XML.
+    */
+    void ChangeQuestStatus::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(ChangeQuestStatus, XMLPort, xmlelement, mode);
+
+        XMLPortParam(ChangeQuestStatus, "questId", setQuestId, getQuestId, xmlelement, mode);
+    }
+
+    /**
+    @brief
+        Sets the id of the Quest the Questffect changes the status of.
+    @param id
+        The id of the Quest.
+    @return
+        Returns true if successful.
+    */
+    bool ChangeQuestStatus::setQuestId(const std::string & id)
+    {
+        if(!QuestItem::isId(id))
+        {
+            COUT(2) << "Invalid id. QuestItem id {" << id << "} could not be set." << std::endl;
+            return false;
+        }
+        
+        this->questId_ = id;
+        return true;
+    }
+
+}
Index: /code/branches/libraries2/src/modules/questsystem/ChangeQuestStatus.h
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/ChangeQuestStatus.h	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/ChangeQuestStatus.h	(revision 5721)
@@ -0,0 +1,77 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the ChangeQuestStatus class.
+*/
+
+#ifndef _ChangeQuestStatus_H__
+#define _ChangeQuestStatus_H__
+
+#include "objects/quest/QuestPrereqs.h"
+
+#include <string>
+#include "QuestEffect.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        A QuestEffect which changes the status of a specified Quest for the player invoking the QuestEffect.
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _QuestExport ChangeQuestStatus : public QuestEffect
+    {
+        public:
+            ChangeQuestStatus(BaseObject* creator);
+            virtual ~ChangeQuestStatus();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a ChangeQuestStatus object through XML.
+
+            virtual bool invoke(PlayerInfo* player) = 0; //!< Invokes the QuestEffect.
+
+        protected:
+            /**
+            @brief Returns the id of the Quest.
+            @return Returns the id of the Quest.
+            */
+            inline const std::string & getQuestId(void) const
+                { return this->questId_; }
+
+        private:
+            std::string questId_; //!< The id of the Quest the status should be changed of.
+
+            bool setQuestId(const std::string & id); //!< Sets the id of the Quest.
+
+    };
+
+}
+
+#endif /* _ChangeQuestStatus_H__ */
Index: /code/branches/libraries2/src/modules/questsystem/CompleteQuest.cc
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/CompleteQuest.cc	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/CompleteQuest.cc	(revision 5721)
@@ -0,0 +1,112 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+ 
+/**
+    @file
+    @brief Implementation of the CompleteQuest class.
+*/
+
+#include "CompleteQuest.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "QuestManager.h"
+#include "Quest.h"
+
+namespace orxonox
+{
+    CreateFactory(CompleteQuest);
+
+    /**
+    @brief
+        Constructor. Registers the object.
+    */
+    CompleteQuest::CompleteQuest(BaseObject* creator) : ChangeQuestStatus(creator)
+    {
+        RegisterObject(CompleteQuest);
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    CompleteQuest::~CompleteQuest()
+    {
+    }
+
+    /**
+    @brief
+        Method for creating a CompleteQuest object through XML.
+    */
+    void CompleteQuest::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(CompleteQuest, XMLPort, xmlelement, mode);
+        
+        COUT(3) << "New CompleteQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
+    }
+
+    /**
+    @brief
+        Invokes the QuestEffect.
+    @param player
+        The player the QuestEffect is invoked on.
+    @return
+        Returns true if the QuestEffect was invoked successfully.
+    */
+    bool CompleteQuest::invoke(PlayerInfo* player)
+    {
+        if(player == NULL) //!< You know, what we think of NULL-pointers...
+        {
+            COUT(2) << "Input player is NULL." << std::endl;
+            return false;
+        }
+
+        COUT(3) << "CompleteQuest on player: " << player << " ." << std::endl;
+
+        Quest* quest;
+
+        try
+        {
+            quest = QuestManager::getInstance().findQuest(this->getQuestId());
+            if(quest == NULL || !quest->complete(player))
+            {
+               return false;
+            }
+        }
+        catch(const Exception& e)
+        {
+            COUT(2) << e.getFullDescription() << std::endl;
+            return false;
+        }
+
+        COUT(3) << "Quest {" << quest->getId() << "} successfully completed by player: " << player << " ." << std::endl;
+        return true;
+    }
+
+
+}
Index: /code/branches/libraries2/src/modules/questsystem/CompleteQuest.h
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/CompleteQuest.h	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/CompleteQuest.h	(revision 5721)
@@ -0,0 +1,66 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the CompleteQuest class.
+*/
+
+#ifndef _CompleteQuest_H__
+#define _CompleteQuest_H__
+
+#include "objects/quest/QuestPrereqs.h"
+#include "ChangeQuestStatus.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        Completes a Quest (with a specified id) for the player invoking the QuestEffect.
+
+        Creating a CompleteQuest through XML goes as follows:
+
+        <CompleteQuest questId="id" />  //Where id is a GUID, see http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure for more information, and identifies the Quest that should be completed.
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _QuestExport CompleteQuest : public ChangeQuestStatus
+    {
+        public:
+            CompleteQuest(BaseObject* creator);
+            virtual ~CompleteQuest();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a CompleteQuest object through XML.
+
+            virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect.
+
+    };
+
+}
+
+#endif /* _CompleteQuest_H__ */
Index: /code/branches/libraries2/src/modules/questsystem/FailQuest.cc
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/FailQuest.cc	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/FailQuest.cc	(revision 5721)
@@ -0,0 +1,111 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+ 
+/**
+    @file
+    @brief Implementation of the FailQuest class.
+*/
+
+#include "FailQuest.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "QuestManager.h"
+#include "Quest.h"
+
+namespace orxonox
+{
+    CreateFactory(FailQuest);
+
+    /**
+    @brief
+        Constructor. Registers the object.
+    */
+    FailQuest::FailQuest(BaseObject* creator) : ChangeQuestStatus(creator)
+    {
+        RegisterObject(FailQuest);
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    FailQuest::~FailQuest()
+    {
+    }
+
+    /**
+    @brief
+        Method for creating a FailQuest object through XML.
+    */
+    void FailQuest::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(FailQuest, XMLPort, xmlelement, mode);
+        
+        COUT(3) << "New FailQUest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
+    }
+
+    /**
+    @brief
+        Invokes the QuestEffect.
+    @param player
+        The player the QuestEffect is invoked on.
+    @return
+        Returns true if the QuestEffect was invoked successfully.
+    */
+    bool FailQuest::invoke(PlayerInfo* player)
+    {
+        if(player == NULL) //!< We don't know what to do with no player.
+        {
+            COUT(2) << "Input player is NULL." << std::endl;
+            return false;
+        }
+
+        COUT(3) << "FailQuest on player: " << player << " ." << std::endl;
+
+        Quest* quest;
+        try
+        {
+            quest = QuestManager::getInstance().findQuest(this->getQuestId());
+            if(quest == NULL || !quest->fail(player))
+            {
+               return false;
+            }
+        }
+        catch(const Exception& e)
+        {
+            COUT(2) << e.getFullDescription() << std::endl;
+            return false;
+        }
+        
+        COUT(3) << "Quest {" << quest->getId() << "} failed by player: " << player << " ." << std::endl;
+        return true;
+    }
+
+
+}
Index: /code/branches/libraries2/src/modules/questsystem/FailQuest.h
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/FailQuest.h	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/FailQuest.h	(revision 5721)
@@ -0,0 +1,66 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the FailQuest class.
+*/
+
+#ifndef _FailQuest_H__
+#define _FailQuest_H__
+
+#include "objects/quest/QuestPrereqs.h"
+#include "ChangeQuestStatus.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        Fails a quest (with a specified id) for the player invoking the QuestEffect.
+
+        Creating a FailQuest through XML goes as follows:
+
+        <FailQuest questId="id" />  //Where id is a GUID, see http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure for more information, and identifies the Quest that should be failed.
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _QuestExport FailQuest : public ChangeQuestStatus
+    {
+        public:
+            FailQuest(BaseObject* creator);
+            virtual ~FailQuest();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a FailQuest object through XML.
+
+            virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect.
+
+    };
+
+}
+
+#endif /* _FailQuest_H__ */
Index: /code/branches/libraries2/src/modules/questsystem/GlobalQuest.cc
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/GlobalQuest.cc	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/GlobalQuest.cc	(revision 5721)
@@ -0,0 +1,282 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+ 
+/**
+    @file
+    @brief Implementation of the GlobalQuest class.
+*/
+
+#include "GlobalQuest.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "QuestEffect.h"
+
+namespace orxonox
+{
+    CreateFactory(GlobalQuest);
+
+    /**
+    @brief
+        Constructor. Registers the object.
+    */
+    GlobalQuest::GlobalQuest(BaseObject* creator) : Quest(creator)
+    {
+        RegisterObject(GlobalQuest);
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    GlobalQuest::~GlobalQuest()
+    {
+
+    }
+    
+    /**
+    @brief
+        Method for creating a GlobalQuest object through XML.
+    */
+    void GlobalQuest::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(GlobalQuest, XMLPort, xmlelement, mode);
+        
+        XMLPortObject(GlobalQuest, QuestEffect, "reward-effects", addRewardEffect, getRewardEffects, xmlelement, mode);
+
+        COUT(3) << "New GlobalQuest {" << this->getId() << "} created." << std::endl;
+    }
+    
+    /**
+    @brief
+        Fails the Quest for all players.
+        Invokes the fail QuestEffects on all the players possessing this Quest.
+    @param player
+        The player failing it.
+    @return
+        Returns true if the Quest could be failed, false if not.
+    */
+    bool GlobalQuest::fail(PlayerInfo* player)
+    {
+        if(!this->isFailable(player)) //!< Check whether the Quest can be failed.
+        {
+            COUT(4) << "A non-completable quest was trying to be failed." << std::endl;
+            return false;
+        }
+        
+        Quest::fail(player);
+    
+    //! Iterate through all players possessing this Quest.
+    for(std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++)
+    {
+        QuestEffect::invokeEffects(*it, this->getFailEffectList());
+    }
+
+    return true;
+    }
+
+    /**
+    @brief
+        Completes the Quest for all players.
+        Invokes the complete QuestEffects on all the players possessing this Quest.
+        Invokes the reward QuestEffects on the player completing the Quest.
+    @param player
+        The player completing it.
+    @return
+        Returns true if the Quest could be completed, false if not.
+    */
+    bool GlobalQuest::complete(PlayerInfo* player)
+    {
+        if(!this->isCompletable(player)) //!< Check whether the Quest can be completed.
+        {
+            COUT(4) << "A non-completable quest was trying to be completed." << std::endl;
+            return false;
+        }
+        
+        //! Iterate through all players possessing the Quest.
+        for(std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++)
+        {
+            QuestEffect::invokeEffects(*it, this->getCompleteEffectList());
+        }
+    
+        Quest::complete(player);
+    
+        QuestEffect::invokeEffects(player, this->rewards_); //!< Invoke reward QuestEffects on the player completing the Quest.
+        return true;
+    }
+
+    /**
+    @brief
+        Checks whether the Quest can be started.
+    @param player
+        The player for whom is to be checked.
+    @return
+        Returns true if the quest can be started, false if not.
+    @throws
+        Throws an exception if either isInactive() of isActive() throws one.
+    */
+    bool GlobalQuest::isStartable(const PlayerInfo* player) const
+    {
+        if(!(this->getParentQuest() == NULL || this->getParentQuest()->isActive(player)))
+        {
+            return false;
+        }
+        return (this->isInactive(player) && !(this->status_ == QuestStatus::Completed || this->status_ == QuestStatus::Failed));
+    }
+
+    /**
+    @brief
+        Checks whether the Quest can be failed.
+    @param player
+        The player for whom is to be checked.
+    @return
+        Returns true if the Quest can be failed, false if not.
+    @throws
+        Throws an Exception if isActive() throws one.
+    */
+    bool GlobalQuest::isFailable(const PlayerInfo* player) const
+    {
+        return this->isActive(player);
+
+    }
+
+    /**
+    @brief
+        Checks whether the Quest can be completed.
+    @param player
+        The player for whom is to be checked.
+    @return
+        Returns true if the Quest can be completed, false if not.
+    @throws
+        Throws an Exception if isActive() throws one.
+    */
+    bool GlobalQuest::isCompletable(const PlayerInfo* player) const
+    {
+        return this->isActive(player);
+    }
+
+    /**
+    @brief
+        Returns the status of the Quest for a specific player.
+    @param player
+        The player.
+    @throws
+        Throws an Exception if player is NULL.
+    */
+    QuestStatus::Value GlobalQuest::getStatus(const PlayerInfo* player) const
+    {
+        if(player == NULL) //!< We don't want NULL-Pointers!
+        {
+            ThrowException(Argument, "The input PlayerInfo* is NULL.");
+        }
+
+        //! Find the player.
+        std::set<PlayerInfo*>::const_iterator it = this->players_.find((PlayerInfo*)(void*)player);
+        if (it != this->players_.end()) //!< If the player was found.
+        {
+            return this->status_;
+        }
+
+        return QuestStatus::Inactive;
+    }
+
+    /**
+    @brief
+        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.
+    @param player
+        The player.
+    @param status
+        The status to be set.
+    @return
+        Returns false if player is NULL.
+    */
+    bool GlobalQuest::setStatus(PlayerInfo* player, const QuestStatus::Value & status)
+    {
+        if(player == NULL) //!< We don't want NULL-Pointers!
+        {
+            return false;
+        }
+
+        //! Find the player.
+        std::set<PlayerInfo*>::const_iterator it = this->players_.find(player);
+        if (it == this->players_.end()) //!< Player is not yet in the list.
+        {
+            this->players_.insert(player); //!< Add the player to the set.
+        }
+        
+        this->status_ = status; //!< Set the status, which is global, remember...?
+        return true;
+    }
+    
+    /**
+    @brief
+        Adds a reward QuestEffect to the list of reward QuestEffects.
+    @param effect
+        The QuestEffect to be added.
+    @return
+        Returns true if successful.
+    */
+    bool GlobalQuest::addRewardEffect(QuestEffect* effect)
+    {
+        if(effect == NULL) //!< We don't want NULL-Pointers!
+        {
+            COUT(2) << "The reward effect to be added to quest {" << this->getId() << "} was NULL." << std::endl;
+            return false;
+        }
+
+        this->rewards_.push_back(effect); //!< Add the QuestEffect to the list.
+
+        COUT(3) << "Reward effect was added to Quest {" << this->getId() << "}." << std::endl;
+        return true;
+    }
+    
+    /**
+    @brief
+        Returns the reward QuestEffect at the given index.
+    @param index
+        The index.
+    @return
+        Returns the QuestEffect at the given index.
+    */
+    const QuestEffect* GlobalQuest::getRewardEffects(unsigned int index) const
+    {
+        int i = index;
+        for (std::list<QuestEffect*>::const_iterator effect = this->rewards_.begin(); effect != this->rewards_.end(); ++effect)
+        {
+            if(i == 0)
+            {
+               return *effect;
+            }
+            i--;
+        }
+        return NULL;
+    }
+
+
+}
Index: /code/branches/libraries2/src/modules/questsystem/GlobalQuest.h
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/GlobalQuest.h	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/GlobalQuest.h	(revision 5721)
@@ -0,0 +1,115 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the GlobalQuest class.
+*/
+
+#ifndef _GlobalQuest_H__
+#define _GlobalQuest_H__
+
+#include "objects/quest/QuestPrereqs.h"
+
+#include <list>
+#include <set>
+#include "Quest.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        GlobalQuests are Quests, that have the same status for all players.
+        This means, that when a player successfully completes a GlobalQuest, it is completed for all players that have it.
+
+        Creating a GlobalQuest through XML goes as follows:
+
+        <GlobalQuest 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 on all players possessing this quest, when the Quest is failed, see QuestEffect for the full XML representation.
+                ...
+                <QuestEffect />
+            </fail-effects>
+            <complete-effects>
+                <QuestEffect /> //A list of QuestEffects, invoked on all players possessing this quest, when the Quest is completed, see QuestEffect for the full XML representation.
+                ...
+                <QuestEffect />
+            </complete-effects>
+            <reward-effects>
+                <QuestEffect /> //A list of QuestEffects, invoked on the player completing this quest. See QuestEffect for the full XML representation.
+                ...
+                <QuestEffect />
+            </reward-effects>
+        </GlobalQuest>
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _QuestExport GlobalQuest : public Quest
+    {
+        public:
+            GlobalQuest(BaseObject* creator);
+            virtual ~GlobalQuest();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a GlobalQuest object through XML.
+
+            virtual bool fail(PlayerInfo* player); //!< Fails the Quest.
+            virtual bool complete(PlayerInfo* player); //!< Completes the Quest.
+
+        protected:
+            virtual bool isStartable(const PlayerInfo* player) const; //!< Checks whether the Quest can be started.
+            virtual bool isFailable(const PlayerInfo* player) const; //!< Checks whether the Quest can be failed.
+            virtual bool isCompletable(const PlayerInfo* player) const; //!< Checks whether the Quest can be completed.
+
+            virtual QuestStatus::Value getStatus(const PlayerInfo* player) const; //!< Returns the status of the Quest for a specific player.
+
+            virtual bool setStatus(PlayerInfo* player, const QuestStatus::Value & status); //!< Sets the status for a specific player.
+
+        private:
+            std::set<PlayerInfo*> players_; //!< The set of players which possess this Quest.
+            QuestStatus::Value status_; //!< The status of this Quest.
+            std::list<QuestEffect*> rewards_; //!< Reward QuestEffects only invoked on the player completing the Quest.
+
+            bool addRewardEffect(QuestEffect* effect); //!< Adds a reward QuestEffect to the list of reward QuestEffects.
+            const QuestEffect* getRewardEffects(unsigned int index) const; //!< Returns the reward QuestEffect at the given index.
+
+    };
+
+}
+
+#endif /* _GlobalQuest_H__ */
Index: /code/branches/libraries2/src/modules/questsystem/LocalQuest.cc
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/LocalQuest.cc	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/LocalQuest.cc	(revision 5721)
@@ -0,0 +1,216 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the LocalQuest class.
+*/
+
+#include "LocalQuest.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "QuestEffect.h"
+
+namespace orxonox
+{
+    CreateFactory(LocalQuest);
+
+    /**
+    @brief
+        Constructor. Registers and initializes the object.
+    */
+    LocalQuest::LocalQuest(BaseObject* creator) : Quest(creator)
+    {
+        RegisterObject(LocalQuest);
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    LocalQuest::~LocalQuest()
+    {
+
+    }
+
+    /**
+    @brief
+        Method for creating a LocalQuest object through XML.
+    */
+    void LocalQuest::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(LocalQuest, XMLPort, xmlelement, mode);
+
+        COUT(3) << "New LocalQuest {" << this->getId() << "} created." << std::endl;
+    }
+
+    /**
+    @brief
+        Fails the Quest for a given player.
+        Invokes all the failEffects on the player.
+    @param player
+        The player.
+    @return
+        Returns true if the Quest could be failed, false if not.
+    */
+    bool LocalQuest::fail(PlayerInfo* player)
+    {
+        if(!this->isFailable(player)) //!< Checks whether the quest can be failed.
+        {
+            COUT(4) << "A non-failable quest was trying to be failed." << std::endl;
+            return false;
+        }
+        
+        Quest::fail(player);
+        
+        QuestEffect::invokeEffects(player, this->getFailEffectList()); //!< Invoke the failEffects.
+        return true;
+    }
+
+    /**
+    @brief
+        Completes the Quest for a given player.
+    Invokes all the complete QuestEffects on the player.
+    @param player
+        The player.
+    @return
+        Returns true if the Quest could be completed, false if not.
+    */
+    bool LocalQuest::complete(PlayerInfo* player)
+    {
+        if(!this->isCompletable(player)) //!< Checks whether the Quest can be completed.
+        {
+            COUT(4) << "A non-completable quest was trying to be completed." << std::endl;
+            return false;
+        }
+        
+        Quest::complete(player);
+        
+        QuestEffect::invokeEffects(player, this->getCompleteEffectList()); //!< Invoke the complete QuestEffects.
+        return true;
+    }
+
+    /**
+    @brief
+        Checks whether the Quest can be started.
+    @param player
+        The player for whom is to be checked.
+    @return
+        Returns true if the Quest can be started, false if not.
+    @throws
+        Throws an exception if isInactive(PlayerInfo*) throws one.
+    */
+    bool LocalQuest::isStartable(const PlayerInfo* player) const
+    {
+        if(!(this->getParentQuest() == NULL || this->getParentQuest()->isActive(player)))
+        {
+            return false;
+        }
+        return this->isInactive(player);
+    }
+
+    /**
+    @brief
+        Checks whether the Quest can be failed.
+    @param player
+        The player for whom is to be checked.
+    @return
+        Returns true if the Quest can be failed, false if not.
+    @throws
+        Throws an exception if isActive(PlayerInfo*) throws one.
+    */
+    bool LocalQuest::isFailable(const PlayerInfo* player) const
+    {
+        return this->isActive(player);
+    }
+
+    /**
+    @brief
+        Checks whether the Quest can be completed.
+    @param player
+        The player for whom is to be checked.
+    @return
+        Returns true if the Quest can be completed, false if not.
+    @throws
+        Throws an exception if isInactive(PlayerInfo*) throws one.
+    */
+    bool LocalQuest::isCompletable(const PlayerInfo* player) const
+    {
+        return this->isActive(player);
+    }
+
+    /**
+    @brief
+        Returns the status of the Quest for a specific player.
+    @param player
+        The player.
+    @return
+        Returns the status of the Quest for the input player.
+    @throws
+        Throws an Exception if player is NULL.
+    */
+    QuestStatus::Value LocalQuest::getStatus(const PlayerInfo* player) const
+    {
+        if(player == NULL) //!< No player has no defined status.
+        {
+            ThrowException(Argument, "The input PlayerInfo* is NULL.");
+        }
+
+        std::map<const PlayerInfo*, QuestStatus::Value>::const_iterator it = this->playerStatus_.find(player);
+        if (it != this->playerStatus_.end()) //!< If there is a player in the map.
+        {
+            return it->second;
+        }
+        
+        return QuestStatus::Inactive; //!< If the player is not yet in the map, that means the status of the quest form him is 'inactive'.
+    }
+
+    /**
+    @brief
+        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!
+    @param player
+        The player the status should be set for.
+    @param status
+        The status to be set.
+    @return
+        Returns false if player is NULL.
+    */
+    bool LocalQuest::setStatus(PlayerInfo* player, const QuestStatus::Value & status)
+    {
+        if(player == NULL) //!< We can't set a status for no player.
+        {
+            return false;
+        }
+        
+        this->playerStatus_[player] = status;
+        return true;
+    }
+
+}
Index: /code/branches/libraries2/src/modules/questsystem/LocalQuest.h
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/LocalQuest.h	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/LocalQuest.h	(revision 5721)
@@ -0,0 +1,103 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the LocalQuest class.
+*/
+
+#ifndef _LocalQuest_H__
+#define _LocalQuest_H__
+
+#include "objects/quest/QuestPrereqs.h"
+
+#include <map>
+#include "Quest.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        Handles Quests which have different states for different players.
+        LocalQuests have (as opposed to GlobalQuests) a different state for each player, that means if for one player the status of the Quest changes it does not for all the other players which also possess this quest.
+
+        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>
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _QuestExport LocalQuest : public Quest
+    {
+        public:
+            LocalQuest(BaseObject* creator);
+            virtual ~LocalQuest();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a LocalQuest object through XML.
+
+            virtual bool fail(PlayerInfo* player); //!< Fails the Quest.
+            virtual bool complete(PlayerInfo* player); //!< Completes the Quest.
+
+        protected:
+            virtual bool isStartable(const PlayerInfo* player) const; //!< Checks whether the Quest can be started.
+            virtual bool isFailable(const PlayerInfo* player) const; //!< Checks whether the Quest can be failed.
+            virtual bool isCompletable(const PlayerInfo* player) const; //!< Checks whether the Quest can be completed.
+
+            virtual QuestStatus::Value getStatus(const PlayerInfo* player) const; //!< Returns the status of the Quest for a specific player.
+            virtual bool setStatus(PlayerInfo* player, const QuestStatus::Value & status); //!< Sets the status for a specific player.
+
+        private:
+            std::map<const PlayerInfo*, QuestStatus::Value> playerStatus_; //!< List of the status for each player, with the Player-pointer as key.
+
+    };
+
+}
+
+#endif /* _LocalQuest_H__ */
Index: /code/branches/libraries2/src/modules/questsystem/Quest.cc
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/Quest.cc	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/Quest.cc	(revision 5721)
@@ -0,0 +1,437 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+ 
+/**
+    @file
+    @brief Implementation of the Quest class.
+*/
+
+#include "Quest.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "QuestManager.h"
+#include "QuestDescription.h"
+#include "QuestHint.h"
+#include "QuestEffect.h"
+#include "QuestListener.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        Constructor. Registers and initializes object.
+    */
+    Quest::Quest(BaseObject* creator) : QuestItem(creator)
+    {
+        RegisterObject(Quest);
+
+        this->parentQuest_ = NULL;
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    Quest::~Quest()
+    {
+
+    }
+
+    /**
+    @brief
+        Method for creating a Quest object through XML.
+    */
+    void Quest::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(Quest, XMLPort, xmlelement, mode);
+
+        XMLPortObject(Quest, Quest, "subquests", addSubQuest, getSubQuest, xmlelement, mode);
+        XMLPortObject(Quest, QuestHint, "hints", addHint, getHint, xmlelement, mode);
+        XMLPortObject(Quest, QuestEffect, "fail-effects", addFailEffect, getFailEffect, xmlelement, mode);
+        XMLPortObject(Quest, QuestEffect, "complete-effects", addCompleteEffect, getCompleteEffect, xmlelement, mode);
+
+        QuestManager::getInstance().registerQuest(this); //!<Registers the Quest with the QuestManager.
+    }
+
+    /**
+    @brief
+        Sets the parentquest of the Quest.
+    @param quest
+        A pointer to the Quest to be set as parentquest.
+    @return
+        Returns true if the parentquest could be set.
+    */
+    bool Quest::setParentQuest(Quest* quest)
+    {
+        if(quest == NULL) //!< We don't want to set NULL-Pointers.
+        {
+            COUT(2) << "The parentquest to be added to quest {" << this->getId() << "} was NULL." << std::endl;
+            return false;
+        }
+
+        this->parentQuest_ = quest;
+
+        COUT(3) << "Parent Quest {" << quest->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl;
+        return true;
+    }
+
+    /**
+    @brief
+        Adds a subquest to the Quest.
+    @param quest
+        A pointer to the Quest to be set as subquest.
+    @return
+        Returns true if the subquest could be set.
+    */
+    bool Quest::addSubQuest(Quest* quest)
+    {
+        if(quest == NULL) //!< We don't want to set NULL-Pointers.
+        {
+            COUT(2) << "The subquest to be added to quest {" << this->getId() << "} was NULL." << std::endl;
+            return false;
+        }
+
+        quest->setParentQuest(this); //!< Sets the currentQuest (this) as parentquest for the added subquest.
+        this->subQuests_.push_back(quest); //!< Adds the Quest to the end of the list of subquests.
+
+        COUT(3) << "Sub Quest {" << quest->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl;
+        return true;
+    }
+
+
+    /**
+    @brief
+        Adds a QuestHint to the list of QuestHints
+    @param hint
+        The QuestHint that should be added to the list of QuestHints.
+    @return
+        Returns true if the hint was successfully added.
+    */
+    bool Quest::addHint(QuestHint* hint)
+    {
+        if(hint == NULL) //!< We don't want to set NULL-Pointers. Seriously!
+        {
+            COUT(2) << "A NULL-QuestHint was trying to be added." << std::endl;
+            return false;
+        }
+
+        hint->setQuest(this); //!< Sets the current Quest (this) as Quest for the added QuestHint.
+        this->hints_.push_back(hint); //!< Adds the QuestHint to the end of the list of QuestHints.
+
+        COUT(3) << "QuestHint {" << hint->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl;
+        return true;
+    }
+
+    /**
+    @brief
+        Adds an QuestEffect to the list of fail QuestEffects.
+    @param effect
+        The QuestEffect to be added.
+    @return
+        Returns true if successful.
+    */
+    bool Quest::addFailEffect(QuestEffect* effect)
+    {
+        if(effect == NULL) //!< We don't want to set NULL-Pointers.
+        {
+            COUT(2) << "A NULL-QuestEffect was trying to be added" << std::endl;
+            return false;
+        }
+
+        this->failEffects_.push_back(effect); //!< Adds the QuestEffect to the end of the list of fail QuestEffects.
+
+        COUT(3) << "A FailEffect was added to Quest {" << this->getId() << "}." << std::endl;
+        return true;
+    }
+
+    /**
+    @brief
+        Adds an QuestEffect to the list of complete QuestEffects.
+    @param effect
+        The QuestEffect to be added.
+    @return
+        Returns true if successful.
+    */
+    bool Quest::addCompleteEffect(QuestEffect* effect)
+    {
+        if(effect == NULL) //!< We don't want to set NULL-Pointers.
+        {
+            COUT(2) << "A NULL-QuestEffect was trying to be added" << std::endl;
+            return false;
+        }
+
+        this->completeEffects_.push_back(effect); //!< Adds the QuestEffect to the end of the list of complete QuestEffects.
+
+        COUT(3) << "A CompleteEffect was added to Quest {" << this->getId() << "}." << std::endl;
+        return true;
+    }
+
+    /**
+    @brief
+        Returns the subquest at the given index.
+    @param
+        The index.
+    @return
+        Returns a pointer to the subquest at the given index. NULL if there is no element at the given index.
+    */
+    const Quest* Quest::getSubQuest(unsigned int index) const
+    {
+        int i = index;
+        
+        //! Iterate through all subquests.
+        for (std::list<Quest*>::const_iterator subQuest = this->subQuests_.begin(); subQuest != this->subQuests_.end(); ++subQuest)
+        {
+            if(i == 0) //!< We're counting down...
+            {
+               return *subQuest;
+            }
+            i--;
+        }
+        
+        return NULL; //!< If the index is greater than the number of elements in the list.
+    }
+
+    /**
+    @brief
+        Returns the QuestHint at the given index.
+    @param
+        The index.
+    @return
+        Returns a pointer to the QuestHint at the given index. NULL if there is no element at the given index.
+    */
+    const QuestHint* Quest::getHint(unsigned int index) const
+    {
+        int i = index;
+        
+        //! Iterate through all QuestHints.
+        for (std::list<QuestHint*>::const_iterator hint = this->hints_.begin(); hint != this->hints_.end(); ++hint)
+        {
+            if(i == 0) //!< We're counting down...
+            {
+               return *hint;
+            }
+            i--;
+        }
+        return NULL; //!< If the index is greater than the number of elements in the list.
+    }
+
+    /**
+    @brief
+        Returns the fail QuestEffect at the given index.
+    @param
+        The index.
+    @return
+        Returns a pointer to the fail QuestEffect at the given index. NULL if there is no element at the given index.
+    */
+    const QuestEffect* Quest::getFailEffect(unsigned int index) const
+    {
+        int i = index;
+        
+        //! Iterate through all fail QuestEffects.
+        for (std::list<QuestEffect*>::const_iterator effect = this->failEffects_.begin(); effect != this->failEffects_.end(); ++effect)
+        {
+            if(i == 0) //!< We're counting down...
+            {
+               return *effect;
+            }
+            i--;
+        }
+        return NULL; //!< If the index is greater than the number of elements in the list.
+    }
+
+    /**
+    @brief
+        Returns the complete QuestEffect at the given index.
+    @param
+        The index.
+    @return
+        Returns a pointer to the complete QuestEffect at the given index. NULL if there is no element at the given index.
+    */
+    const QuestEffect* Quest::getCompleteEffect(unsigned int index) const
+    {
+        int i = index;
+        
+        //! Iterate through all complete QuestEffects.
+        for (std::list<QuestEffect*>::const_iterator effect = this->completeEffects_.begin(); effect != this->completeEffects_.end(); ++effect)
+        {
+            if(i == 0) //!< We're counting down...
+            {
+               return *effect;
+            }
+            i--;
+        }
+        return NULL; //!< If the index is greater than the number of elements in the list.
+    }
+
+    /**
+    @brief
+        Returns true if the quest status for the specific player is 'inactive'.
+    @param player
+        The player.
+    @return
+        Returns true if the quest status for the specific player is 'inactive'.
+    @throws
+        Throws an exception if getStatus throws one.
+    */
+    bool Quest::isInactive(const PlayerInfo* player) const
+    {
+        return this->getStatus(player) == QuestStatus::Inactive;
+    }
+
+    /**
+    @brief
+        Returns true if the quest status for the specific player is 'active'.
+    @param player
+        The player.
+    @return
+        Returns true if the quest status for the specific player is 'active'.
+    @throws
+        Throws an exception if getStatus throws one.
+    */
+    bool Quest::isActive(const PlayerInfo* player) const
+    {
+
+        return this->getStatus(player) == QuestStatus::Active;
+    }
+
+    /**
+    @brief
+        Returns true if the quest status for the specific player is 'failed'.
+    @param player
+        The player.
+    @return
+        Returns true if the quest status for the specific player is 'failed'.
+    @throws
+        Throws an exception if getStatus throws one.
+    */
+    bool Quest::isFailed(const PlayerInfo* player) const
+    {
+        return this->getStatus(player) == QuestStatus::Failed;
+    }
+
+    /**
+    @brief
+        Returns true if the quest status for the specific player is 'completed'.
+    @param player
+        The player.
+    @return
+        Returns true if the quest status for the specific player is 'completed'.
+    @throws
+        Throws an exception if getStatus throws one.
+    */
+    bool Quest::isCompleted(const PlayerInfo* player) const
+    {
+        return this->getStatus(player) == QuestStatus::Completed;
+    }
+    
+    /**
+    @brief
+        Fails the Quest for an input player.
+    @param player
+        The player.
+    @return
+        Returns true if the Quest could be failed, false if not.
+    */
+    bool Quest::fail(PlayerInfo* player)
+    {
+        QuestListener::advertiseStatusChange(this->listeners_, "fail"); //!< Tells the QuestListeners, that the status has changed to failed.
+        this->setStatus(player, QuestStatus::Failed);
+        
+        COUT(4) << "Quest {" << this->getId() << "} is failed for player: " << player << " ." <<std::endl;
+        
+        this->getDescription()->sendFailQuestNotification();
+        return true;
+    }
+    
+    /**
+    @brief
+        Completes the Quest for an input player.
+    @param player
+        The player.
+    @return
+        Returns true if the Quest could be completed, false if not.
+    */
+    bool Quest::complete(PlayerInfo* player)
+    {
+        QuestListener::advertiseStatusChange(this->listeners_, "complete"); //!< Tells the QuestListeners, that the status has changed to completed.
+        this->setStatus(player, QuestStatus::Completed);
+        
+        COUT(4) << "Quest {" << this->getId() << "} is completed for player: " << player << " ." <<std::endl;
+        
+        this->getDescription()->sendCompleteQuestNotification();
+        return true;
+    }
+
+    /**
+    @brief
+        Starts the Quest for an input player.
+    @param player
+        The player.
+    @return
+        Returns true if the Quest could be started, false if not.
+    */
+    bool Quest::start(PlayerInfo* player)
+    {
+        if(!this->isStartable(player)) //!< Checks whether the quest can be started.
+        {
+            COUT(4) << "A non-startable quest was trying to be started." << std::endl;
+            return false;
+        }
+        
+        COUT(4) << "Quest {" << this->getId() << "} is started for player: " << player << " ." <<std::endl;
+        
+        QuestListener::advertiseStatusChange(this->listeners_, "start"); //!< Tells the QuestListeners, that the status has changed to active.
+        
+        this->setStatus(player, QuestStatus::Active);
+        
+        this->getDescription()->sendAddQuestNotification();
+        return true;
+    }
+    
+    /**
+    @brief
+        Adds a QuestListener to the list of QuestListeners listening to this Quest.
+    @param listener
+        The QuestListener to be added.
+    @return
+        Returns true if successful, false if not.
+    */
+    bool Quest::addListener(QuestListener* listener)
+    {
+        if(listener == NULL)
+        {
+            COUT(2) << "A NULL-QuestListener was trying to be added to a Quests listeners." << std::endl;
+            return false;
+        }
+        
+        this->listeners_.push_back(listener);
+        return true;
+    }
+
+}
Index: /code/branches/libraries2/src/modules/questsystem/Quest.h
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/Quest.h	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/Quest.h	(revision 5721)
@@ -0,0 +1,157 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the Quest class.
+        The Quest is the parent class of LocalQuest and GlobalQuest.
+*/
+
+#ifndef _Quest_H__
+#define _Quest_H__
+
+#include "objects/quest/QuestPrereqs.h"
+
+#include <list>
+#include "QuestItem.h"
+
+namespace orxonox
+{
+    namespace QuestStatus
+    {
+        //!Different states of a Quest.
+        enum Value
+        {
+            Inactive,
+            Active,
+            Failed,
+            Completed
+        };
+    }
+
+    /**
+    @brief
+        Represents a Quest in the game.
+        A Quest has a list of subquests and a parentquest (if it is not a rootquest).
+        Each Quest exists only once but it has a different status (inactive, active, failed or completed) for each player.
+        A Quest has several hints (QuestHint) that can be unlocked through QuestEffects and then display aid in solving the Quest.
+        A Quest has a list of QuestEffects that are invoked when the quest is failed and also a list of QuestEffects that are invoked, when the Quest is completed.
+
+        Quest itself should not be instantiated, if you want to create a quest either go for LocalQuest or GlobalQuest, whichever suits you needs better.
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _QuestExport Quest : public QuestItem
+    {
+        public:
+            Quest(BaseObject* creator);
+            virtual ~Quest();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a Quest object through XML.
+
+            /**
+            @brief Returns the parentquest of the Quest.
+            @return Returns a pointer to the parentquest of the Quest.
+            */
+            inline Quest* getParentQuest(void) const
+                { return this->parentQuest_; }
+
+            /**
+            @brief Returns the list of subquests.
+            @return Returns a reference to the list of subquests of the quest.
+            */
+            inline const std::list<Quest*> & getSubQuestList(void) const
+                { return this->subQuests_; }
+
+            /**
+            @brief Returns the list of all QuestHints of this Quest.
+            @return Returns a reference to the list of QuestHints of the Quest.
+            */
+            inline const std::list<QuestHint*> & getHintsList(void) const
+                { return this->hints_; }
+
+            bool isInactive(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'inactive'.
+            bool isActive(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'active'.
+            bool isFailed(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'failed'.
+            bool isCompleted(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'completed'.
+
+            bool start(PlayerInfo* player); //!< Sets a Quest to active.
+            virtual bool fail(PlayerInfo* player); //!< Fails the Quest.
+            virtual bool complete(PlayerInfo* player); //!< Completes the Quest.
+
+            bool addListener(QuestListener* listener); //!< Adds a QuestListener to the list of QuestListeners listening to this Quest.
+
+        protected:
+            virtual bool isStartable(const PlayerInfo* player) const = 0; //!< Checks whether the Quest can be started.
+            virtual bool isFailable(const PlayerInfo* player) const = 0; //!< Checks whether the Quest can be failed.
+            virtual bool isCompletable(const PlayerInfo* player) const = 0; //!< Checks whether the Quest can be completed.
+
+            const Quest* getSubQuest(unsigned int index) const; //!<Returns the subquest at the given index.
+            const QuestHint* getHint(unsigned int index) const; //!< Returns the QuestHint at the given index.
+            const QuestEffect* getFailEffect(unsigned int index) const; //!< Returns the fail QuestEffect at the given index.
+            const QuestEffect* getCompleteEffect(unsigned int index) const; //!< Returns the complete QuestEffect at the given index.
+
+            /**
+            @brief Returns the list of fail QuestEffects.
+            @return Returns a reference to the list of fail QuestEffects.
+            */
+            inline std::list<QuestEffect*> & getFailEffectList(void)
+                { return this->failEffects_; }
+
+            /**
+            @brief Returns the list of complete QuestEffects.
+            @return Returns a reference to the list of complete QuestEffects.
+            */
+            inline std::list<QuestEffect*> & getCompleteEffectList(void)
+                { return this->completeEffects_; }
+
+            virtual QuestStatus::Value getStatus(const PlayerInfo* player) const = 0; //!< Returns the status of the Quest for a specific player.
+            virtual bool setStatus(PlayerInfo* player, const QuestStatus::Value & status) = 0; //!< Changes the status for a specific player.
+
+        private:
+            Quest* parentQuest_; //!< Pointer to the parentquest.
+            std::list<Quest*> subQuests_; //!< List of all the subquests.
+
+            std::list<QuestHint*> hints_; //!< A list of all the QuestHints tied to this Quest.
+
+            std::list<QuestEffect*> failEffects_; //!< A list of all QuestEffects to be invoked, when the Quest has been failed.
+            std::list<QuestEffect*> completeEffects_; //!< A list of QuestEffects to be invoked, when the Quest has been completed.
+
+            std::list<QuestListener*> listeners_; //!< A list of QuestListeners, that listen to what exactly happens with this Quest.
+
+            bool setParentQuest(Quest* quest); //!< Sets the parentquest of the Quest.
+            bool addSubQuest(Quest* quest); //!< Adds a subquest to the Quest.
+            bool addHint(QuestHint* hint); //!< Add a QuestHint to the list of QuestHints.
+            bool addFailEffect(QuestEffect* effect); //!< Adds an QuestEffect to the list of fail QuestEffects.
+            bool addCompleteEffect(QuestEffect* effect); //!< Adds an QuestEffect to the list of complete QuestEffects.
+
+    };
+
+}
+
+#endif /* _Quest_H__ */
Index: /code/branches/libraries2/src/modules/questsystem/QuestDescription.cc
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/QuestDescription.cc	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/QuestDescription.cc	(revision 5721)
@@ -0,0 +1,133 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the QuestDescription class.
+*/
+
+
+#include "QuestDescription.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "QuestNotification.h"
+
+namespace orxonox
+{
+    CreateFactory(QuestDescription);
+
+    /**
+    @brief
+        Constructor. Registers and initializes the object.
+    */
+    QuestDescription::QuestDescription(BaseObject* creator) : BaseObject(creator)
+    {
+        RegisterObject(QuestDescription);
+        
+        this->title_ = "";
+        this->description_ = "";
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    QuestDescription::~QuestDescription()
+    {
+
+    }
+
+    /**
+    @brief
+        Method for creating a QuestDescription object through XML.
+    */
+    void QuestDescription::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(QuestDescription, XMLPort, xmlelement, mode);
+
+        XMLPortParam(QuestDescription, "title", setTitle, getTitle, xmlelement, mode);
+        XMLPortParam(QuestDescription, "description", setDescription, getDescription, xmlelement, mode);
+        XMLPortParam(QuestDescription, "failMessage", setFailMessage, getFailMessage, xmlelement, mode);
+        XMLPortParam(QuestDescription, "completeMessage", setCompleteMessage, getCompleteMessage, xmlelement, mode);
+
+        COUT(3) << "New QuestDescription with title '" << this->getTitle() << "' created." << std::endl;
+    }
+    
+    /**
+    @brief
+        This method is a helper for sending QuestDescriptions as Notifications.
+    @param item
+        The item the QuestDescription is for.
+    @param status
+        The status the QuestDescription us for.
+    @return
+        Returns true if successful.
+    @todo
+        Make sure the messages meet the conditions.
+    */
+    bool QuestDescription::notificationHelper(const std::string & item, const std::string & status) const
+    {
+        std::string message = "";
+        if(item == "hint")
+        {
+            message = "You received a hint: '" + this->title_ + "'";
+        }
+        else if(item == "quest")
+        {
+            if(status == "start")
+            {
+                message = "You received a new quest: '" + this->title_ + "'";
+            }
+            else if(status == "fail")
+            {
+                message = "You failed the quest: '" + this->title_ + "'";
+            }
+            else if(status == "complete")
+            {
+                message = "You successfully completed the quest: '" + this->title_ + "'";
+            }
+            else
+            {
+                COUT(2) << "Bad input in notificationHelper, this should not be happening!" << std::endl;
+                return false;
+            }
+        }
+        else
+        {
+            COUT(2) << "Bad input in notificationHelper, this should not be happening!" << std::endl;
+            return false;
+        }
+        
+        QuestNotification* notification = new QuestNotification(message);
+        notification->send();
+        return true;
+    }
+
+
+}
Index: /code/branches/libraries2/src/modules/questsystem/QuestDescription.h
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/QuestDescription.h	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/QuestDescription.h	(revision 5721)
@@ -0,0 +1,163 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the QuestDescription class.
+*/
+
+#ifndef _QuestDescription_H__
+#define _QuestDescription_H__
+
+#include "objects/quest/QuestPrereqs.h"
+
+#include <string>
+#include "core/BaseObject.h"
+
+// tolua_begin
+namespace orxonox
+{
+    /**
+    @brief
+        This class is a description of a QuestItem.
+        It holds a title and a description.
+
+        Creating a QuestDescription through XML goes as follows:
+
+        <QuestDescription title="Title" description="Description Text" failMessage="You fail." completeMessage="You win!" />
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _QuestExport QuestDescription : public BaseObject
+    {
+// tolua_end
+        public:
+            QuestDescription(BaseObject* creator);
+            virtual ~QuestDescription();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestDescription object through XML.
+
+// tolua_begin
+            /**
+            @brief Returns the title.
+            @return Returns a string containing the title of the QuestDescription.
+            */
+            inline const std::string & getTitle(void) const
+                { return this->title_; }
+
+            /**
+            @brief Returns the description text.
+            @return Returns a string containing the description text of the QuestDescription.
+            */
+            inline const std::string & getDescription(void) const
+                { return this->description_; }
+// tolua_end
+
+            /**
+            @brief Returns the fail message.
+            @return Returns a string containing the fail message of the QuestDescription.
+            */
+            inline const std::string & getFailMessage(void) const
+                { return this->failMessage_; }
+
+            /**
+            @brief Returns the complete message.
+            @return Returns a string containing the complete message of the QuestDescription.
+            */
+            inline const std::string & getCompleteMessage(void) const
+                { return this->completeMessage_; }
+
+            /**
+            @brief Sends a Notification displaying that a QuestHint was added.
+            @return Returns true if successful.
+            */
+            inline bool sendAddHintNotification(void) const
+                { return notificationHelper("hint", ""); }
+
+            /**
+            @brief Sends a Notification displaying that a Quest was added.
+            @return Returns true if successful.
+            */
+            inline bool sendAddQuestNotification(void) const
+                { return notificationHelper("quest", "start"); }
+
+            /**
+            @brief Sends a Notification displaying that a Quest was failed.
+            @return Returns true if successful.
+            */
+            inline bool sendFailQuestNotification(void) const
+                { return notificationHelper("quest", "fail"); }
+
+            /**
+            @brief Sends a Notification displaying that a Quest was completed.
+            @return Returns true if successful.
+            */
+            inline bool sendCompleteQuestNotification(void) const
+                { return notificationHelper("quest", "complete"); }
+
+        private:
+            std::string title_; //!< The title.
+            std::string description_; //!< The description.
+            std::string failMessage_; //!< The message displayed when the Quest is failed.
+            std::string completeMessage_; //!< The message displayed when the Quest is completed.
+
+            bool notificationHelper(const std::string & item, const std::string & status) const; //!< Helper for sending QuestDescriptions as Notifications.
+
+            /**
+            @brief Sets the title.
+            @param title The title to be set.
+            */
+            inline void setTitle(const std::string & title)
+                { this->title_ = title; }
+
+            /**
+            @brief Sets the description text.
+            @param description The description text to be set.
+            */
+            inline void setDescription(const std::string & description)
+                { this->description_ = description; }
+
+            /**
+            @brief Sets the fail message.
+            @param message The fail message to be set.
+            */
+            inline void setFailMessage(const std::string & message)
+                { this->failMessage_ = message; }
+
+            /**
+            @brief Sets the complete message.
+            @param message The complete message to be set.
+            */
+            inline void setCompleteMessage(const std::string & message)
+                { this->completeMessage_ = message; }
+
+    }; // tolua_export
+
+} // tolua_export
+
+#endif /* _QuestDescription_H__ */
Index: /code/branches/libraries2/src/modules/questsystem/QuestEffect.cc
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/QuestEffect.cc	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/QuestEffect.cc	(revision 5721)
@@ -0,0 +1,81 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the QuestEffect class.
+*/
+
+#include "QuestEffect.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        Constructor. Creates a new QuestEffect.
+        Is not meant to be invoked directly, since this is only an interface.
+    */
+    QuestEffect::QuestEffect(BaseObject* creator) : BaseObject(creator)
+    {
+        RegisterObject(QuestEffect);
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    QuestEffect::~QuestEffect()
+    {
+
+    }
+
+    /**
+    @brief
+        Static method. Invoke all QuestEffects in an QuestEffect-list on a given player.
+    @param player
+        The player the QuestEffects are invoked on.
+    @param effects
+        A list of all the QuestEffects to be invoked.
+    @return
+        Returns false if there was an error, view console of log for further detail.
+    */
+    /*static*/ bool QuestEffect::invokeEffects(PlayerInfo* player, std::list<QuestEffect*> & effects)
+    {
+        bool check = true;
+        
+        COUT(4) << "Invoking QuestEffects on player: " << player << " ."  << std::endl;
+
+        for (std::list<QuestEffect*>::iterator effect = effects.begin(); effect != effects.end(); effect++)
+        {
+            check = check && (*effect)->invoke(player);
+        }
+        return check;
+    }
+
+}
Index: /code/branches/libraries2/src/modules/questsystem/QuestEffect.h
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/QuestEffect.h	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/QuestEffect.h	(revision 5721)
@@ -0,0 +1,65 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the QuestEffect class.
+*/
+
+#ifndef _QuestEffect_H__
+#define _QuestEffect_H__
+
+#include "objects/quest/QuestPrereqs.h"
+
+#include <list>
+#include "core/BaseObject.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        Handles QuestEffects for Quests.
+        QuestEffects are the only way for Quests to have any sideeffects in the game world. They are also the only way for a player to gain, complete or fail Quests.
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _QuestExport QuestEffect : public BaseObject
+    {
+        public:
+            QuestEffect(BaseObject* creator);
+            virtual ~QuestEffect();
+
+            virtual bool invoke(PlayerInfo* player) = 0; //!< Invokes the QuestEffect.
+            static bool invokeEffects(PlayerInfo* player, std::list<QuestEffect*> & effects); //!< Invokes all QuestEffects in the list.
+
+
+    };
+
+}
+
+#endif /* _QuestEffect_H__ */
Index: /code/branches/libraries2/src/modules/questsystem/QuestEffectBeacon.cc
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/QuestEffectBeacon.cc	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/QuestEffectBeacon.cc	(revision 5721)
@@ -0,0 +1,263 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the QuestEffectBeacon class.
+*/
+
+#include "QuestEffectBeacon.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "core/EventIncludes.h"
+#include "objects/worldentities/pawns/Pawn.h"
+#include "objects/worldentities/triggers/PlayerTrigger.h"
+#include "QuestEffect.h"
+
+namespace orxonox
+{
+    CreateFactory(QuestEffectBeacon);
+
+    /**
+    @brief
+        Constructor. Registers the object and initializes defaults.
+    */
+    QuestEffectBeacon::QuestEffectBeacon(BaseObject* creator) : StaticEntity(creator)
+    {
+        RegisterObject(QuestEffectBeacon);
+
+        this->status_ = QuestEffectBeaconStatus::Active;
+        this->times_ = INFINITE_TIME;
+    }
+
+    /**
+        Destructor.
+    */
+    QuestEffectBeacon::~QuestEffectBeacon()
+    {
+    }
+
+    /**
+    @brief
+        Method for creating a QuestEffectBeacon object through XML.
+    */
+    void QuestEffectBeacon::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(QuestEffectBeacon, XMLPort, xmlelement, mode);
+
+        XMLPortParam(QuestEffectBeacon, "times", setTimes, getTimes, xmlelement, mode);
+        XMLPortObject(QuestEffectBeacon, QuestEffect, "effects", addEffect, getEffect, xmlelement, mode);
+
+        COUT(3) << "New QuestEffectBeacon created." << std::endl;
+    }
+
+    /**
+    @brief
+        Processes an event for this QuestEffectBeacon.
+    */
+    void QuestEffectBeacon::processEvent(Event& event)
+    {
+        SUPER(QuestEffectBeacon, processEvent, event);
+
+        ORXONOX_SET_SUBCLASS_EVENT(QuestEffectBeacon, "execute", execute, event, PlayerTrigger);
+    }
+
+    /**
+    @brief
+        Executes the QuestEffectBeacon.
+        This means extracting the ControllableEntity from the PlayerTrigger, provided by the Event causing the execution, and the extracting the PlayerInfo from the received ControllableEntity and invoking the QuestEffectbeacon's QuestEffects on the received PlayerInfo.
+    @param trigger
+        Apointer to the PlayerTrigger that threw the Event.
+    @return
+        Returns true if successfully executed, false if not.
+    */
+    bool QuestEffectBeacon::execute(bool b, PlayerTrigger* trigger)
+    {
+        if(!b)
+        {
+            return false;
+        }
+        if(!(this->isActive())) //!< If the QuestEffectBeacon is inactive it cannot be executed.
+        {
+            COUT(3) << "The QuestEffectBeacon is inactive." << std::endl;
+            return false;
+        }
+
+        if(!trigger->isForPlayer()) //!< The PlayerTrigger is not exclusively for ControllableEntities which means we cannot extract one.
+        {
+            return false;
+        }
+
+        //! Extracting the ControllableEntity form the PlayerTrigger.
+        Pawn* pawn = trigger->getTriggeringPlayer();
+
+        if(pawn == NULL)
+        {
+            COUT(2) << "The QuestEffectBeacon was triggered by an entity other than a Pawn." << std::endl;
+            return false;
+        }
+
+        //! Extract the PlayerInfo from the ControllableEntity.
+        PlayerInfo* player = pawn->getPlayer();
+
+        if(player == NULL)
+        {
+            COUT(3) << "The PlayerInfo* is NULL." << std::endl;
+            return false;
+        }
+
+        COUT(3) << "QuestEffectBeacon executed on player: " << player << " ." << std::endl;
+
+        bool check = QuestEffect::invokeEffects(player, this->effects_); //!< Invoke the QuestEffects on the PlayerInfo.
+        if(check)
+        {
+            this->decrementTimes(); //!< Decrement the number of times the beacon can be used.
+            return true;
+        }
+
+        return false;
+    }
+
+    /**
+    @brief
+        Set the status of the QuestEffectBeacon.
+    @param activate
+        If true the QuestEffectBeacon is activated, if false it is deactivated.
+    @return
+        Returns whether the activation/deactivation was successful.
+    */
+    bool QuestEffectBeacon::setActive(bool activate)
+    {
+        if(this->getTimes() == 0 && activate) //!< A QuestEffectBeacon that can be executed only 0 times is always inactive.
+        {
+            return false;
+        }
+
+        if(activate)
+        {
+        this->status_ = QuestEffectBeaconStatus::Active;
+        return true;
+        }
+
+        this->status_ = QuestEffectBeaconStatus::Inactive;
+        return true;
+    }
+
+    /**
+    @brief
+        Decrement the number of times the QuestEffectBeacon can be executed.
+    @return
+        Returns true if successful.
+    */
+    bool QuestEffectBeacon::decrementTimes(void)
+    {
+        if(!(this->isActive())) //!< The QuestEffectBeacon mus be active to decrement the number of times it can be executed.
+        {
+            return false;
+        }
+        if(this->getTimes() == INFINITE_TIME) //!< If times is infinity the QuestEffectBeacon can be executed an infinite number fo times.
+        {
+            return true;
+        }
+
+        this->times_ = this->times_ - 1; //!< Decrement number of times the QuestEffectBeacon can be executed.
+        if(this->getTimes() == 0) //!< Set the QuestEffectBeacon to inactive when the number of times it can be executed is reduced to 0.
+        {
+            this->status_ = QuestEffectBeaconStatus::Inactive;
+        }
+
+        return true;
+    }
+
+    /**
+    @brief
+        Set the number of times the QuestEffectBeacon can be executed.
+        The number must be eighter <= 0, or INFINITY which is '-1'.
+    @param n
+        The number of times the QuestEffectBeacon can be executed.
+        The number must be eighter <= 0, or INFINITY which is '-1'.
+    @return
+        Returns true if successful.
+    */
+    bool QuestEffectBeacon::setTimes(const int & n)
+    {
+        if(n < 0 && n != INFINITE_TIME)
+        {
+            return false;
+        }
+
+        this->times_ = n;
+        return true;
+    }
+
+    /**
+    @brief
+        Adds a QuestEffect to the QuestEffectBeacon.
+    @param effect
+        A pointer to the QuestEffect to be added.
+    @return
+        Returns true if successful.
+    */
+    bool QuestEffectBeacon::addEffect(QuestEffect* effect)
+    {
+        if(effect == NULL) //!< NULL-pointers are not well liked here...
+        {
+            COUT(2) << "A NULL-QuestEffect was trying to be added" << std::endl;
+            return false;
+        }
+
+        this->effects_.push_back(effect);
+
+        COUT(3) << "A QuestEffect was added to a QuestEffectBeacon." << std::endl;
+        return true;
+    }
+
+    /**
+    @brief
+        Returns the QuestEffect at the given index.
+    @param index
+        The index.
+    @return
+        Returns a pointer to the QuestEffect at the given index.
+    */
+    const QuestEffect* QuestEffectBeacon::getEffect(unsigned int index) const
+    {
+        int i = index;
+        for (std::list<QuestEffect*>::const_iterator effect = this->effects_.begin(); effect != this->effects_.end(); ++effect)
+        {
+            if(i == 0)
+            {
+               return *effect;
+            }
+            i--;
+        }
+        return NULL;
+    }
+
+}
Index: /code/branches/libraries2/src/modules/questsystem/QuestEffectBeacon.h
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/QuestEffectBeacon.h	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/QuestEffectBeacon.h	(revision 5721)
@@ -0,0 +1,128 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the QuestEffectBeacon class.
+*/
+
+#ifndef _QuestEffectBeacon_H__
+#define _QuestEffectBeacon_H__
+
+#include "objects/quest/QuestPrereqs.h"
+
+#include <list>
+#include "objects/worldentities/StaticEntity.h"
+
+namespace orxonox
+{
+    namespace QuestEffectBeaconStatus
+    {
+        //! The status of the beacon, can be either active or inactive.
+        enum Value
+        {
+            Inactive,
+            Active
+        };
+    }
+
+    /**
+    @brief
+        A QuestEffectBeacon is a physical entity in the game which can (under some condition(s)) invoke a number QuestEffects on players meeting the condition(s).
+        The conditions under which the QuestEffects are invoked on the player are defined by Triggers.
+        A QuestEffectBeacon can be executed a defined number of times.
+        A QuestEffectBeacon can be inactive or active.
+
+        Creating a QuestEffectBeacon through XML goes as follows:
+
+        <QuestEffectBeacon times=n> //Where 'n' is eighter a number >= 0, which means the QuestEffectBeacon can be executed n times. Or n = -1, which means the QuestEffectBeacon can be executed an infinite number of times.
+            <effects>
+                <QuestEffect /> //A list of QuestEffects, invoked when the QuestEffectBeacon is executed, see QuestEffect for the full XML representation.
+                ...
+                <QuestEffect />
+            </effects>
+            <events>
+                <execute>
+                    <EventListener event=eventIdString />
+                </execute>
+            </events>
+            <attached>
+                <PlayerTrigger name=eventIdString /> //A PlayerTrigger triggering the execution of the QuestEffectBeacon.
+            </attached>
+        </QuestEffectBeacon>
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _QuestExport QuestEffectBeacon : public StaticEntity
+    {
+        public:
+            QuestEffectBeacon(BaseObject* creator);
+            virtual ~QuestEffectBeacon();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestEffectBeacon object through XML.
+
+            virtual void processEvent(Event& event); //!< Processes an event for this QuestEffectBeacon.
+
+            bool execute(bool b, PlayerTrigger* trigger); //!< Executes the QuestEffects of the QuestEffectBeacon.
+
+            /**
+            @brief Tests whether the QuestEffectBeacon is active.
+            @return Returns true if the QuestEffectBeacon is active, fals if not.
+            */
+            inline bool isActive(void)
+            { return this->status_ == QuestEffectBeaconStatus::Active; }
+
+            bool setActive(bool activate); //!< Set the status of the QuestEffectBeacon.
+
+        protected:
+            bool decrementTimes(void); //!< Decrement the number of times the QuestEffectBeacon can still be executed.
+
+            /**
+            @brief Returns the number of times the QUestEffectBeacon can still be executed.
+            @return Returns the number of times the QUestEffectBeacon can still be executed.
+            */
+            inline const int & getTimes(void) const
+                { return this->times_; }
+
+        private:
+            static const int INFINITE_TIME = -1; //!< Constant to avoid using magic numbers.
+
+            std::list<QuestEffect*> effects_; //!< The list of QuestEffects to be invoked on the executing player.
+            int times_; //!< Number of times the beacon can be exectued.
+            QuestEffectBeaconStatus::Value status_; //!< The status of the QUestEffectBeacon, Can be eighter active or inactive.
+
+            bool setTimes(const int & n); //!< Set the number of times the QuestEffectBeacon can be executed.
+            bool addEffect(QuestEffect* effect); //!< Add a QuestEffect to the QuestEffectBeacon.
+
+            const QuestEffect* getEffect(unsigned int index) const; //!< Get the QuestEffect at a given index.
+
+    };
+
+}
+
+#endif /* _QuestEffectBeacon_H__ */
Index: /code/branches/libraries2/src/modules/questsystem/QuestHint.cc
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/QuestHint.cc	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/QuestHint.cc	(revision 5721)
@@ -0,0 +1,156 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+ 
+/**
+    @file
+    @brief Implementation of the QuestHint class.
+*/
+
+#include "QuestHint.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "QuestManager.h"
+#include "QuestDescription.h"
+#include "Quest.h"
+
+namespace orxonox
+{
+    CreateFactory(QuestHint);
+
+    /**
+    @brief
+        Constructor. Registers the object.
+    */
+    QuestHint::QuestHint(BaseObject* creator) : QuestItem(creator)
+    {
+        RegisterObject(QuestHint);
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    QuestHint::~QuestHint()
+    {
+
+    }
+
+    /**
+    @brief
+        Method for creating a QuestHint object through XML.
+    */
+    void QuestHint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(QuestHint, XMLPort, xmlelement, mode);
+
+        QuestManager::getInstance().registerHint(this); //!< Registers the QuestHint with the QuestManager.
+        
+        COUT(3) << "New QuestHint {" << this->getId() << "} created." << std::endl;
+    }
+
+
+    /**
+    @brief
+        Checks whether the QuestHint is active for a specific player.
+    @param player
+        The player.
+    @throws
+        Throws an Argument Exception if the input Player-pointer is NULL.
+    @return
+        Returns true if the QuestHint is active for the specified player.
+    */
+    bool QuestHint::isActive(const PlayerInfo* player) const
+    {
+        if(player == NULL) //!< NULL-Pointers are ugly!
+        {
+            ThrowException(Argument, "The input PlayerInfo* is NULL.");
+            return false;
+        }
+
+        //! Find the player.
+        std::map<const PlayerInfo*, QuestHintStatus::Value>::const_iterator it = this->playerStatus_.find(player);
+        if (it != this->playerStatus_.end()) //!< If the player is in the map.
+        {
+            return it->second;
+        }
+        
+        return QuestStatus::Inactive;
+    }
+
+    /**
+    @brief
+        Activates a QuestHint for a given player.
+    @param player
+        The player.
+    @return
+        Returns true if the activation was successful, false if there were problems.
+    */
+    bool QuestHint::setActive(PlayerInfo* player)
+    {
+        if(this->quest_->isActive(player)) //!< For a hint to get activated the quest must be active.
+        {
+            if(!(this->isActive(player)))  //!< If the hint is already active, activation is pointless.
+            {
+                this->playerStatus_[player] = QuestHintStatus::Active;
+                
+                this->getDescription()->sendAddHintNotification();
+                return true;
+            }
+            else
+            {
+                COUT(2) << "An already active questHint was trying to get activated." << std::endl;
+                return false;
+            }
+        }
+        
+        COUT(2) << "A hint of a non-active quest was trying to get activated." << std::endl;
+        return false;
+    }
+
+    /**
+    @brief
+        Sets the Quest the QuestHint belongs to.
+    @param quest
+        The Quest to be set as Quest the QuestHint is attached to.
+    @return
+        Returns true if successful.
+    */
+    bool QuestHint::setQuest(Quest* quest)
+    {
+        if(quest == NULL) //!< NULL-Pointer. Again..?
+        {
+            COUT(2) << "The input Quest* is NULL." << std::endl;
+            return false;
+        }
+
+        this->quest_ = quest;
+        return true;
+    }
+
+}
Index: /code/branches/libraries2/src/modules/questsystem/QuestHint.h
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/QuestHint.h	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/QuestHint.h	(revision 5721)
@@ -0,0 +1,97 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the QuestHint class.
+*/
+
+#ifndef _QuestHint_H__
+#define _QuestHint_H__
+
+#include "objects/quest/QuestPrereqs.h"
+
+#include <map>
+#include "QuestItem.h"
+
+namespace orxonox
+{
+    namespace QuestHintStatus
+    {
+        //! The state of the hint.
+        enum Value
+        {
+            Inactive,
+            Active
+        };
+    }
+
+    /**
+    @brief
+        Represents a hint in the game towards completing a Quest.
+        Consists of title and description (which is stored in a QuestDescription object) in textual form and must belong to a quest.
+        A QuestHint has a defined status (inactive or active, where inactive is default) for each player, which means each a QuestHint exists only once for all players, it doesn't belong to a player, it just has different states for each of them.
+
+        Creating a QuestHint through XML goes as follows:
+
+        <QuestHint id="hintId">  //Where hintId is a GUID, see http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure for more information
+            <QuestDesctription title="" description="" />
+        </QuestHint>
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _QuestExport QuestHint : public QuestItem
+    {
+
+        public:
+            QuestHint(BaseObject* creator);
+            virtual ~QuestHint();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestHint object through XML.
+
+            bool isActive(const PlayerInfo* player) const; //!< Returns true if the QuestHint is active for the input player.
+
+            bool setActive(PlayerInfo* player); //!< Activates the QuestHint for the input player.
+            bool setQuest(Quest* quest); //!< Sets the Quest the QuestHint belongs to.
+
+            /**
+            @brief Returns the Quest the QuestHint is attached to.
+            @return  Returns a pointer to the Quest the QuestHint is attached to.
+            */
+            inline Quest* getQuest(void)
+               { return this->quest_; }
+
+        private:
+            Quest* quest_; //!< The Quest the QuestHint belongs to.
+            std::map<const PlayerInfo*, QuestHintStatus::Value> playerStatus_; //!< List of the states for each player, with the Player-pointer as key.
+
+    };
+
+}
+
+#endif /* _QuestHint_H__ */
Index: /code/branches/libraries2/src/modules/questsystem/QuestItem.cc
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/QuestItem.cc	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/QuestItem.cc	(revision 5721)
@@ -0,0 +1,105 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+ 
+/**
+    @file
+    @brief Implementation of the QuestItem class.
+*/
+
+#include "QuestItem.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "QuestDescription.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        Constructor. Registers and initializes the object.
+    */
+    QuestItem::QuestItem(BaseObject* creator) : BaseObject(creator)
+    {
+        RegisterObject(QuestItem);
+
+        this->id_ = "";
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    QuestItem::~QuestItem()
+    {
+
+    }
+
+    /**
+    @brief
+        Method for creating a QuestItem object through XML.
+    */
+    void QuestItem::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(QuestItem, XMLPort, xmlelement, mode);
+
+        XMLPortParam(QuestItem, "id", setId, getId, xmlelement, mode);
+        XMLPortObject(QuestItem, QuestDescription, "", setDescription, getDescription, xmlelement, mode);
+    }
+
+    /**
+    @brief
+        Sets the id of the QuestItem.
+    The id must be of GUID form. See 'http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure' for more information.
+    @param id
+        The id to be set.
+    */
+    void QuestItem::setId(const std::string & id)
+    {
+        if(!isId(id)) //!< Checks whether the id is a valid id.
+        {
+            COUT(2) << "Invalid id. QuestItem id {" << id << "} could not be set." << std::endl;
+            return;
+        }
+        
+        this->id_ = id;
+    }
+
+    /**
+    @brief
+        Checks whether an input id is of the required form.
+    @param id
+        The id to be checked.
+    @return
+        Returns true if the string is likely to be of the required form.
+    */
+    /*static*/ bool QuestItem::isId(const std::string & id)
+    {
+        return id.size() >= 32;
+    }
+
+}
Index: /code/branches/libraries2/src/modules/questsystem/QuestItem.h
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/QuestItem.h	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/QuestItem.h	(revision 5721)
@@ -0,0 +1,96 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the QuestItem class.
+        The QuestItem is the parent class of Quest and QuestHint.
+*/
+
+
+#ifndef _QuestItem_H__
+#define _QuestItem_H__
+
+#include "objects/quest/QuestPrereqs.h"
+
+#include <string>
+#include "core/BaseObject.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        Functions as a base class for quest classes such as Quest or QuestHint.
+        Has a unique identifier and a description.
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _QuestExport QuestItem : public BaseObject
+    {
+
+        public:
+            QuestItem(BaseObject* creator);
+            virtual ~QuestItem();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestItem object through XML.
+
+            /**
+            @brief Returns the id of this QuestItem.
+            @return Returns the id of the QuestItem.
+            */
+            inline const std::string & getId(void) const
+                { return this->id_; }
+
+            /**
+            @brief Returns the QuestDescription of the QuestItem.
+            @return Returns a pointer to the QuestDescription object of the QuestItem.
+            */
+            inline const QuestDescription* getDescription(void) const
+                { return this->description_; }
+
+            static bool isId(const std::string & id); //!< Checks whether a given id is valid.
+
+        protected:
+            void setId(const std::string & id); //!< Sets the id of the QuestItem.
+
+            /**
+            @brief Sets the description of the QuestItem.
+            @param description The QuestDescription to be set.
+            */
+            inline void setDescription(QuestDescription* description)
+                { this->description_ = description; }
+
+        private:
+            std::string id_; //!< Identifier. Should be of GUID form: http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure
+            QuestDescription* description_; //!< The QuestDescription of the QuestItem.
+
+    };
+
+}
+
+#endif /* _QuestItem_H__ */
Index: /code/branches/libraries2/src/modules/questsystem/QuestListener.cc
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/QuestListener.cc	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/QuestListener.cc	(revision 5721)
@@ -0,0 +1,212 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the QuestListener class.
+*/
+
+#include "QuestListener.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "Quest.h"
+#include "QuestManager.h"
+
+namespace orxonox
+{
+    CreateFactory(QuestListener);
+
+    /**
+    @brief
+        Constructor. Registers the object and initializes variables.
+    */
+    QuestListener::QuestListener(BaseObject* creator) : BaseObject(creator)
+    {
+        RegisterObject(QuestListener);
+        
+        this->mode_ = QuestListenerMode::All;
+        this->quest_ = NULL;
+    }
+    
+    /**
+    @brief
+        Destructor.
+    */
+    QuestListener::~QuestListener()
+    {
+    }
+    
+    /**
+    @brief
+        Method for creating a Quest object through XML.
+    */
+    void QuestListener::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(QuestListener, XMLPort, xmlelement, mode);
+
+        XMLPortParam(QuestListener, "questId", setQuestId, getQuestId, xmlelement, mode);
+        XMLPortParam(QuestListener, "mode", setMode, getMode, xmlelement, mode);
+
+        this->quest_->addListener(this); //!< Adds the QuestListener to the Quests list of listeners.
+        
+        COUT(3) << "QuestListener created for quest: {" << this->quest_->getId() << "} with mode '" << this->getMode() << "'." << std::endl;
+    }
+    
+    /**
+    @brief
+        Makes all QuestListener in the list aware that a certain status change has occurred and executes them if the status change affects them.
+    @param listeners
+        The list of QuestListeners that have to be made aware of the status change.
+    @param status
+        The status that has changed. Can be 'start' (if the Quest was started), 'complete' (if the Quest was completed) or 'fail' (if the Quest was failed).
+    */
+    /* static */ void QuestListener::advertiseStatusChange(std::list<QuestListener*> & listeners, const std::string & status)
+    {
+        for (std::list<QuestListener*>::iterator it = listeners.begin(); it != listeners.end(); ++it) //!< Iterate through all QuestListeners
+        {
+            QuestListener* listener = *it;
+            if(listener->getMode() == status || listener->getMode() == "all") //!< Check whether the status change affects the give QuestListener.
+            {
+                listener->execute();
+            }
+        }
+    }
+    
+    /**
+    @brief
+        Sets the questId of the Quest the QuestListener reacts to.
+    @param id
+        The questId of the Quest the QUestListener reacts to.
+    @return
+        Returns true if successful.
+    */
+    bool QuestListener::setQuestId(const std::string & id)
+    {
+        this->quest_ = QuestManager::getInstance().findQuest(id); //!< Find the Quest corresponding to the given questId.
+        
+        if(this->quest_ == NULL) //!< If there is no such Quest.
+        {
+            ThrowException(Argument, "This is bad! The QuestListener has not found a Quest with a corresponding id..");
+            return false;
+        }
+        
+        return true;
+    }
+    
+    /**
+    @brief
+        Sets the mode of the QuestListener.
+    @param mode
+        The mode to be set. Can be eighter 'all', 'start', 'fail' or 'complete'.
+    @return
+        Returns true if successful.
+    */
+    bool QuestListener::setMode(const std::string & mode)
+    {
+        if(mode == "all")
+        {
+            this->mode_ = QuestListenerMode::All;
+        }
+        else if(mode == "start")
+        {
+            this->mode_ = QuestListenerMode::Start;
+        }
+        else if(mode == "fail")
+        {
+            this->mode_ = QuestListenerMode::Fail;
+        }
+        else if(mode == "complete")
+        {
+            this->mode_ = QuestListenerMode::Complete;
+        }
+        else
+        {
+            COUT(2) << "QuestListener with invalid mode '" << mode << "' created. Mode set to 'all'." << std::endl;
+        this->mode_ = QuestListenerMode::All;
+        return false;
+        }
+        
+        return true;
+    }
+    
+    /**
+    @brief
+        Get the mode of the QuestListener.
+    @return
+        Return the mode of the QuestListener. Can be eighter 'all', 'start', 'fail' or 'complete'.
+    */
+    std::string QuestListener::getMode(void)
+    {
+        if(this->mode_ == QuestListenerMode::All)
+        {
+            return "all";
+        }
+        else if(this->mode_ == QuestListenerMode::Start)
+        {
+            return "start";
+        }
+        else if(this->mode_ == QuestListenerMode::Fail)
+        {
+            return "fail";
+        }
+        else if(this->mode_ == QuestListenerMode::Complete)
+        {
+            return "complete";
+        }
+        else
+        {
+            COUT(1) << "An unforseen, never to happen, Error has occurred. This is impossible!" << std::endl;
+        return "";
+        }
+    }
+
+    /**
+    @brief
+        Get the questId of the Quest the QuestListener reacts to.
+    @return
+        Returns the questId of the Quest the QuestListener reacts to.
+    */
+    const std::string & QuestListener::getQuestId(void)    
+    {
+        return this->quest_->getId();
+    }
+
+    /**
+    @brief
+        Executes the QuestListener, resp. fires an Event.
+    @return
+        Returns true if successful.
+    */
+    bool QuestListener::execute()
+    {
+        this->fireEvent(true);
+        return true;
+    }
+
+}
Index: /code/branches/libraries2/src/modules/questsystem/QuestListener.h
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/QuestListener.h	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/QuestListener.h	(revision 5721)
@@ -0,0 +1,100 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the QuestListener class.
+*/
+
+#ifndef _QuestListener_H__
+#define _QuestListener_H__
+
+#include "objects/quest/QuestPrereqs.h"
+
+#include <string>
+#include <list>
+#include "core/BaseObject.h"
+
+namespace orxonox
+{
+    namespace QuestListenerMode
+    {
+        //! The mode of the QuestListener.
+        enum Value
+        {
+            All,
+            Start,
+            Fail,
+            Complete
+        };
+    }
+
+    /**
+    @brief
+        Provides a way to react to the starting, completing and failing of Quests.
+
+        The XML representation goes as follows:
+        You can use the QuestListener as if it were a Trigger or EventListener, that fires an Event when the status (depending on the set mode) of the given Quest changes.
+
+        <BaseObject> // The object that should react to the status change of a Quest.
+            <events>
+                <function> // Where function is the method of the object that should be executed. Normally this would be visibility or activity.
+                    <QuestListener questId="someQuestId" mode="someMode" /> // Where someQuestId is the identifier for the Quest the QuestListener is reacting to, and someMode is the kind of status change the QUestListener reacts to (all, start, complete or fail).
+                </function>
+            </events>
+        </BaseObject>
+    @author
+    Damian 'Mozork' Frick
+    */
+    class _QuestExport QuestListener : public BaseObject
+    {
+    public:
+        QuestListener(BaseObject* creator);
+        virtual ~QuestListener();
+
+        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestListener object through XML.
+
+        static void advertiseStatusChange(std::list<QuestListener*> & listeners, const std::string & status); //!< Makes all QuestListener in the list aware that a certain status change has occured.
+
+        bool setQuestId(const std::string & id); //!< Sets the questId of the Quest the QuestListener reacts to.
+        bool setMode(const std::string & mode); //!< Sets the mode of the QuestListener.
+
+        std::string getMode(void); //!< Get the mode of the QuestListener.
+
+        const std::string & getQuestId(void);
+        bool execute(void); //!< Executes the QuestListener, resp. fires an Event.
+
+    private:
+        QuestListenerMode::Value mode_; //!< The mode of the QuestListener.
+        Quest* quest_; //!< A pointer to the Quest the QuestListener is reacting to.
+
+    };
+
+}
+
+#endif /* _QuestListener_H__ */
Index: /code/branches/libraries2/src/modules/questsystem/QuestManager.cc
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/QuestManager.cc	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/QuestManager.cc	(revision 5721)
@@ -0,0 +1,367 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the QuestManager class.
+*/
+
+#include "QuestManager.h"
+
+#include "util/Exception.h"
+#include "core/CoreIncludes.h"
+#include "core/GUIManager.h"
+
+#include "objects/infos/PlayerInfo.h"
+#include "Quest.h"
+#include "QuestHint.h"
+#include "QuestItem.h"
+
+namespace orxonox
+{
+    //! Pointer to the current (and single) instance of this class.
+    /*static*/ QuestManager* QuestManager::singletonPtr_s = NULL;
+
+    /**
+    @brief
+        Constructor. Registers the object.
+    @todo
+        Is inheriting from BaseObject proper?
+    */
+    QuestManager::QuestManager()
+    {
+        RegisterRootObject(QuestManager);
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    QuestManager::~QuestManager()
+    {
+    }
+
+    /**
+    @brief
+        Registers a Quest with the QuestManager to make it globally accessable.
+        Uses it's id to make sure to be able to be identify and retrieve it later.
+    @param quest
+        The Quest that is to be registered.
+    @return
+        Returns true if successful, false if not.
+    */
+    bool QuestManager::registerQuest(Quest* quest)
+    {
+        if(quest == NULL) //!< Doh! Just as if there were actual quests behind NULL-pointers.
+        {
+            COUT(2) << "Registration of Quest in QuestManager failed, because inserted Quest-pointer was NULL." << std::endl;
+            return false;
+        }
+
+        std::pair<std::map<std::string, Quest*>::iterator,bool> result;
+        result = this->questMap_.insert( std::pair<std::string,Quest*>(quest->getId(),quest) ); //!< Inserting the Quest.
+
+        if(result.second) //!< If inserting was a success.
+        {
+            COUT(3) << "Quest with questId {" << quest->getId() << "} successfully inserted." << std::endl;
+            return true;
+        }
+        else
+        {
+           COUT(2) << "Quest with the same id was already present." << std::endl;
+           return false;
+        }
+    }
+
+    /**
+    @brief
+        Registers a QuestHint with the QuestManager to make it globally accessable.
+        Uses it's id to make sure to be able to be identify and retrieve it later.
+    @param hint
+        The QuestHint to be registered.
+    @return
+        Returns true if successful, false if not.
+    */
+    bool QuestManager::registerHint(QuestHint* hint)
+    {
+        if(hint == NULL) //!< Still not liking NULL-pointers.
+        {
+            COUT(2) << "Registration of QuestHint in QuestManager failed, because inserted QuestHint-pointer was NULL." << std::endl;
+            return false;
+        }
+
+        std::pair<std::map<std::string, QuestHint*>::iterator,bool> result;
+        result = this->hintMap_.insert ( std::pair<std::string,QuestHint*>(hint->getId(),hint) ); //!< Inserting the QuestHSint.
+
+        if(result.second) //!< If inserting was a success.
+        {
+            COUT(3) << "QuestHint with hintId {" << hint->getId() << "} successfully inserted." << std::endl;
+            return true;
+        }
+        else
+        {
+           COUT(2) << "QuestHint with the same id was already present." << std::endl;
+           return false;
+        }
+    }
+
+    /**
+    @brief
+        Finds a Quest with the given id.
+    @param questId
+        The id of the Quest sought for.
+    @return
+        Returns a pointer to the Quest with the input id.
+        Returns NULL if there is no Quest with the given questId.
+    @throws
+        Throws an exception if the given questId is invalid.
+    */
+    Quest* QuestManager::findQuest(const std::string & questId)
+    {
+        if(!QuestItem::isId(questId)) //!< Check vor validity of the given id.
+        {
+            ThrowException(Argument, "Invalid questId.");
+        }
+
+        Quest* quest;
+        std::map<std::string, Quest*>::iterator it = this->questMap_.find(questId);
+        if (it != this->questMap_.end()) //!< If the Quest is registered.
+        {
+            quest = it->second;
+        }
+        else
+        {
+           quest = NULL;
+           COUT(2) << "The quest with id {" << questId << "} is nowhere to be found." << std::endl;
+        }
+
+        return quest;
+
+    }
+
+    /**
+    @brief
+        Finds a QuestHint with the given id.
+    @param hintId
+        The id of the QuestHint sought for.
+    @return
+        Returns a pointer to the QuestHint with the input id.
+        Returns NULL if there is no QuestHint with the given hintId.
+    @throws
+        Throws an exception if the given hintId is invalid.
+    */
+    QuestHint* QuestManager::findHint(const std::string & hintId)
+    {
+        if(!QuestItem::isId(hintId)) //!< Check vor validity of the given id.
+        {
+            ThrowException(Argument, "Invalid hintId.");
+        }
+
+        QuestHint* hint;
+        std::map<std::string, QuestHint*>::iterator it = this->hintMap_.find(hintId);
+        if (it != this->hintMap_.end()) //!< If the QuestHint is registered.
+        {
+            hint = it->second;
+        }
+        else
+        {
+           hint = NULL;
+           COUT(2) << "The hint with id {" << hintId << "} is nowhere to be found." << std::endl;
+        }
+
+        return hint;
+
+    }
+
+    /**
+    @brief
+
+    @param name
+    @return
+    */
+    QuestContainer* QuestManager::getQuestTree(std::string & name)
+    {
+        PlayerInfo* player = GUIManager::getInstance().getPlayer(name);
+        if(player == NULL)
+        {
+            COUT(1) << "Error: GUIOverlay with name '" << name << "' has no player." << std::endl;
+            return NULL;
+        }
+
+        QuestContainer* root = NULL;
+        QuestContainer* current = NULL;
+
+        std::list<Quest*>* rootQuests = new std::list<Quest*>();
+        getRootQuests(player, *rootQuests);
+
+        for(std::list<Quest*>::iterator it = rootQuests->begin(); it != rootQuests->end(); it++)
+        {
+            QuestContainer* container = addSubQuest(*it, player);
+
+            if(root == NULL)
+            {
+                root = container;
+            }
+            else
+            {
+                current->next = container;
+            }
+
+            current = container;
+
+        }
+        if(current != NULL)
+            current->next = NULL;
+
+        delete rootQuests;
+
+        return root;
+    }
+
+    /**
+    @brief
+
+    @param player
+    @param list
+    @return
+    */
+    void QuestManager::getRootQuests(const PlayerInfo* player, std::list<Quest*> & list)
+    {
+        for(std::map<std::string, Quest*>::iterator it=this->questMap_.begin(); it!=this->questMap_.end(); it++)
+        {
+            Quest* quest = (*it).second;
+            if(quest->getParentQuest() == NULL && !quest->isInactive(player))
+            {
+                list.push_back(quest);
+            }
+        }
+    }
+
+    /**
+    @brief
+
+    @param quest
+    @param player
+    @return
+    */
+    QuestContainer* QuestManager::addSubQuest(Quest* quest, const PlayerInfo* player)
+    {
+        if(quest == NULL)
+            return NULL;
+
+        QuestContainer* container = new QuestContainer;
+        container->description = quest->getDescription();
+        container->hint = addHints(quest, player);
+
+        if(quest->isActive(player))
+        {
+            container->status = "active";
+        }
+        else if(quest->isCompleted(player))
+        {
+            container->status = "completed";
+        }
+        else if(quest->isFailed(player))
+        {
+            container->status = "failed";
+        }
+        else
+        {
+            container->status = "";
+            COUT(1) << "An error occurred. A Quest of un-specified status wanted to be displayed." << std::endl;
+        }
+
+        std::list<Quest*> quests = quest->getSubQuestList();
+        QuestContainer* current = NULL;
+        QuestContainer* first = NULL;
+        for(std::list<Quest*>::iterator it = quests.begin(); it != quests.end(); it++)
+        {
+            Quest* subQuest = *it;
+            if(!subQuest->isInactive(player))
+            {
+                QuestContainer* subContainer = addSubQuest(subQuest, player);
+
+                if(first == NULL)
+                {
+                    first = subContainer;
+                }
+                else
+                {
+                    current->next = subContainer;
+                }
+
+                current = subContainer;
+            }
+        }
+        if(current != NULL)
+            current->next = NULL;
+        container->subQuests = first;
+
+        return container;
+    }
+
+    /**
+    @brief
+
+    @param quest
+    @param player
+    @return
+    */
+    HintContainer* QuestManager::addHints(Quest* quest, const PlayerInfo* player)
+    {
+        HintContainer* current = NULL;
+        HintContainer* first = NULL;
+
+        std::list<QuestHint*> hints = quest->getHintsList();
+        for(std::list<QuestHint*>::iterator it = hints.begin(); it != hints.end(); it++)
+        {
+            if((*it)->isActive(player))
+            {
+                HintContainer* hint = new HintContainer;
+                hint->description = (*it)->getDescription();
+
+                if(first == NULL)
+                {
+                    first = hint;
+                }
+                else
+                {
+                    current->next = hint;
+                }
+
+                current = hint;
+            }
+        }
+
+        if(current != NULL)
+            current->next = NULL;
+        return first;
+    }
+
+
+}
Index: /code/branches/libraries2/src/modules/questsystem/QuestManager.h
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/QuestManager.h	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/QuestManager.h	(revision 5721)
@@ -0,0 +1,110 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the QuestManager class.
+*/
+
+#ifndef _QuestManager_H__
+#define _QuestManager_H__
+
+#include "objects/quest/QuestPrereqs.h"
+
+#include <list>
+#include <map>
+#include <string>
+
+#include "util/ScopedSingleton.h"
+#include "core/OrxonoxClass.h"
+
+// tolua_begin
+namespace orxonox
+{
+
+    struct QuestContainer;
+    struct HintContainer;
+
+    struct QuestContainer
+    {
+        const QuestDescription* description;
+        std::string status;
+        HintContainer* hint;
+        QuestContainer* subQuests;
+        QuestContainer* next;
+    };
+
+    struct HintContainer
+    {
+        const QuestDescription* description;
+        HintContainer* next;
+    };
+
+    typedef ScopedSingleton<QuestManager, ScopeID::GSLevel> ScopedSingletonQuestManagerGSLevel; // workaround for tolua
+
+    /**
+    @brief
+        Is a Singleton and manages Quests, by registering every Quest/QuestHint (through registerX()) and making them globally accessable (through findX()).
+        Quests (and QuestHints) are registered in the QuestManager with their id, and can be accessed in the same way.
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _QuestExport QuestManager : public ScopedSingletonQuestManagerGSLevel, public orxonox::OrxonoxClass
+    {
+// tolua_end
+            friend class ScopedSingleton<QuestManager, ScopeID::GSLevel>;
+        public:
+            QuestManager();
+            virtual ~QuestManager();
+
+            //! Returns a reference to the single instance of the Quest Manager.
+            static QuestManager& getInstance() { return ScopedSingleton<QuestManager, ScopeID::GSLevel>::getInstance(); } // tolua_export
+
+            bool registerQuest(Quest* quest); //!< Registers a Quest in the QuestManager.
+            bool registerHint(QuestHint* quest); //!< Registers a QuestHint in the QuestManager.
+
+            Quest* findQuest(const std::string & questId); //!< Returns the Quest with the input id.
+            QuestHint* findHint(const std::string & hintId); //!< Returns the QuestHint with the input id.
+
+            QuestContainer* getQuestTree(std::string & name); // tolua_export
+
+        private:
+            static QuestManager* singletonPtr_s;
+
+            std::map<std::string, Quest*> questMap_; //!< All Quests registered by their id's.
+            std::map<std::string, QuestHint*> hintMap_; //!< All QuestHints registered by their id's.
+
+            void getRootQuests(const PlayerInfo* player, std::list<Quest*> & list);
+            HintContainer* addHints(Quest* quest, const PlayerInfo* player);
+            QuestContainer* addSubQuest(Quest* quest, const PlayerInfo* player);
+
+    }; // tolua_export
+
+} // tolua_export
+
+#endif /* _QuestManager_H__ */
Index: /code/branches/libraries2/src/modules/questsystem/QuestNotification.cc
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/QuestNotification.cc	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/QuestNotification.cc	(revision 5721)
@@ -0,0 +1,62 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See thes
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "QuestNotification.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox {
+
+    const std::string QuestNotification::SENDER = "questsystem";
+
+    QuestNotification::QuestNotification(BaseObject* creator) : Notification(creator)
+    {
+        this->initialize();
+    }
+    
+    QuestNotification::QuestNotification(const std::string & message) : Notification(message)
+    {
+        this->initialize();
+    }
+    
+    QuestNotification::~QuestNotification()
+    {
+        
+    }
+
+    bool QuestNotification::send(void)
+    {
+        return this->Notification::send(QuestNotification::SENDER);
+    }
+
+    void QuestNotification::initialize(void)
+    {
+        RegisterObject(QuestNotification);
+    }
+
+
+}
Index: /code/branches/libraries2/src/modules/questsystem/QuestNotification.h
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/QuestNotification.h	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/QuestNotification.h	(revision 5721)
@@ -0,0 +1,63 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See thes
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _QuestNotification_H__
+#define _QuestNotification_H__
+
+#include "objects/quest/QuestPrereqs.h"
+
+#include <string>
+#include "notifications/Notification.h"
+
+namespace orxonox {
+
+    /**
+    @brief
+
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _QuestExport QuestNotification : public Notification
+    {
+        public:
+            QuestNotification(BaseObject* creator);
+            QuestNotification(const std::string & message);
+            virtual ~QuestNotification();
+
+            bool send(void);
+
+        private:
+            static const std::string SENDER;
+
+            void initialize(void);
+
+    };
+
+}
+
+#endif /* _QuestNotification_H__ */
Index: /code/branches/libraries2/src/modules/questsystem/QuestPrereqs.h
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/QuestPrereqs.h	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/QuestPrereqs.h	(revision 5721)
@@ -0,0 +1,92 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+  @file
+  @brief Contains all the necessary forward declarations for all classes and structs.
+*/
+
+#ifndef _QuestsystemPrereqs_H__
+#define _QuestsystemPrereqs_H__
+
+#include "OrxonoxConfig.h"
+
+#include "OrxonoxPrereqs.h"
+
+//-----------------------------------------------------------------------
+// Shared library settings
+//-----------------------------------------------------------------------
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(ORXONOX_STATIC_BUILD)
+#  ifdef QUEST_SHARED_BUILD
+#    define _QuestExport __declspec(dllexport)
+#  else
+#    if defined( __MINGW32__ )
+#      define _QuestExport
+#    else
+#      define _QuestExport __declspec(dllimport)
+#    endif
+#  endif
+#elif defined ( ORXONOX_GCC_VISIBILITY )
+#  define _QuestExport  __attribute__ ((visibility("default")))
+#else
+#  define _QuestExport
+#endif
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+    class AddQuest;
+    class AddQuestHint;
+    class AddReward;
+    class ChangeQuestStatus;
+    class CompleteQuest;
+    class FailQuest;
+    class GlobalQuest;
+    class LocalQuest;
+    class Quest;
+    class QuestDescription;
+    class QuestEffect;
+    class QuestEffectBeacon;
+    class QuestHint;
+    class QuestItem;
+    class QuestListener;
+    class QuestManager;
+    class QuestNotification;
+    class Rewardable;
+
+    class Notification;
+    class NotificationListener;
+    class NotificationManager;
+    class NotificationOverlay;
+    class NotificationQueue;
+}
+
+#endif /* _QuestsystemPrereqs_H__ */
Index: /code/branches/libraries2/src/modules/questsystem/notifications/CMakeLists.txt
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/notifications/CMakeLists.txt	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/notifications/CMakeLists.txt	(revision 5721)
@@ -0,0 +1,6 @@
+ADD_SOURCE_FILES(QUEST_SRC_FILES
+  Notification.cc
+  NotificationManager.cc
+  NotificationOverlay.cc
+  NotificationQueue.cc
+)
Index: /code/branches/libraries2/src/modules/questsystem/notifications/Notification.cc
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/notifications/Notification.cc	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/notifications/Notification.cc	(revision 5721)
@@ -0,0 +1,130 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See thes
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the Notification class.
+*/
+
+#include "Notification.h"
+
+#include "core/CoreIncludes.h"
+#include "NotificationManager.h"
+
+namespace orxonox
+{
+
+    /**
+    @brief
+        Default constructor. Initializes the object.
+    */
+    Notification::Notification(BaseObject* creator) : BaseObject(creator)
+    {
+        RegisterObject(Notification);
+        this->initialize();
+    }
+    
+    /**
+    @brief
+        Constructor. Creates a Notification with the input message.
+    @param message
+        The message of the Notification.
+    */
+    Notification::Notification(const std::string & message) : BaseObject(NULL)
+    {
+        this->message_ = message;
+    }
+    
+    /**
+    @brief
+        Destructor.
+    */
+    Notification::~Notification()
+    {
+    }
+    
+    /**
+    @brief
+        Registers the object and sets some default values.
+    */
+    void Notification::initialize(void)
+    {
+        this->message_ = "";
+        this->sender_ = NotificationManager::NONE;
+        this->sent_ = false;
+    }
+    
+    /**
+    @brief
+        Sends the Notification to the Notificationmanager, with sender NetificationManager::NONE.
+    @return
+        Returns true if successful.
+    */
+    bool Notification::send(void)
+    {
+        return this->send(NotificationManager::NONE);
+    }
+    
+    /**
+    @brief
+        Sends the Notification to the Notificationmanager, which then in turn distributes it to the different NotificationQueues.
+    @param sender
+        The sender the Notification was sent by. Used by the NotificationManager to distributes the notification to the correct NotificationQueues.
+    @return
+        Returns true if successful.
+    */
+    bool Notification::send(const std::string & sender)
+    {
+        this->sender_ = sender;
+        bool successful = NotificationManager::getInstance().registerNotification(this);
+        if(!successful)
+            return false;
+        this->sent_ = true;
+        
+        COUT(3) << "Notification \"" << this->getMessage() << "\" sent." << std::endl;
+        
+        return true;
+    }
+    
+    /**
+    @brief
+        Sets the message of the notification.
+    @param message
+        The message to be set.
+    @return
+        Returns true if successful.
+    */
+    bool Notification::setMessage(const std::string & message)
+    {
+        if(this->isSent()) //!< The message cannot be changed if the message has already been sent.
+            return false;
+        this->message_ = message;
+        return true;
+    }
+
+}
Index: /code/branches/libraries2/src/modules/questsystem/notifications/Notification.h
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/notifications/Notification.h	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/notifications/Notification.h	(revision 5721)
@@ -0,0 +1,90 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the Notification class.
+*/
+
+#ifndef _Notification_H__
+#define _Notification_H__
+
+#include "objects/quest/QuestPrereqs.h"
+
+#include <string>
+#include "core/BaseObject.h"
+
+namespace orxonox
+{
+
+    /**
+    @brief
+        A Notification is a short message used to inform the player about something that just happened. A Notification can be sent from any part of orxonox and is then displayed in the proper NotificationQueue (depending on which senders the specific NotificationQueue accepts).
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _QuestExport Notification : public BaseObject
+    {
+        public:
+            Notification(BaseObject* creator);
+            Notification(const std::string & message);
+            virtual ~Notification();
+
+            bool send(void); //!< Sends the Notification to the Notificationmanager, with sender NotificationManager::NONE;
+            bool send(const std::string & sender); //!< Sends the Notification to the Notificationmanager.
+
+            /**
+            @brief Checks whether the Notification was sent.
+            @return Returns true if the Notification was sent already.
+            */
+            inline bool isSent(void) const
+                { return this->sent_; }
+            /**
+            @brief Returns the message of the Notification.
+            @return Returns the message of the Notification.
+            */
+            inline const std::string & getMessage(void) const
+                { return this->message_; }
+
+            inline const std::string & getSender(void) const
+                { return this->sender_; }
+
+            bool setMessage(const std::string & message); //!< Sets the message of the notification.
+
+        private:
+            std::string message_; //!< The Notification message.
+            std::string sender_; //!< The sender of the notification.
+            bool sent_; //!< Whether Notification has been sent, if so it cannot be changed.
+
+            void initialize(void);
+
+    };
+
+}
+
+#endif /* _Notification_H__ */
Index: /code/branches/libraries2/src/modules/questsystem/notifications/NotificationManager.cc
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/notifications/NotificationManager.cc	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/notifications/NotificationManager.cc	(revision 5721)
@@ -0,0 +1,190 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the NotificationManager class.
+*/
+
+#include "NotificationManager.h"
+
+#include <set>
+
+#include "core/CoreIncludes.h"
+#include "Notification.h"
+#include "interfaces/NotificationListener.h"
+
+namespace orxonox
+{
+
+    const std::string NotificationManager::ALL = "all";
+    const std::string NotificationManager::NONE = "none";
+
+    NotificationManager* NotificationManager::singletonPtr_s = NULL;
+
+    /**
+    @brief
+        Constructor. Registers the Object.
+    */
+    NotificationManager::NotificationManager()
+    {
+        RegisterRootObject(NotificationManager);
+
+        this->highestIndex_ = 0;
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    NotificationManager::~NotificationManager()
+    {
+    }
+
+    /**
+    @brief
+        Registers a Notification within the NotificationManager and makes sure that the Notification is sent to all the NotificationListeners associated with its sender.
+    @param notification
+        The Notification to be registered.
+    @return
+        Returns true if successful.
+    */
+    bool NotificationManager::registerNotification(Notification* notification)
+    {
+
+        if(notification == NULL) //!< A NULL-Notification cannot be registered.
+            return false;
+
+        std::time_t time = std::time(0); //TDO: Doesn't this expire? //!< Get current time.
+
+        this->allNotificationsList_.insert(std::pair<std::time_t,Notification*>(time,notification));
+
+        if(notification->getSender() == NONE) //!< If the sender has no specific name, then the Notification is only added to the list of all Notifications.
+            return true;
+
+        bool all = false;
+        if(notification->getSender() == ALL) //!< If all are the sender, then the Notifications is added to every NotificationListener.
+            all = true;
+
+        //!< Insert the notification in all listeners that have its sender as target.
+        for(std::map<NotificationListener*,int>::iterator it = this->listenerList_.begin(); it != this->listenerList_.end(); it++) //!< Iterate through all listeners.
+        {
+            std::set<std::string> set = it->first->getTargetsSet();
+            if(all || set.find(notification->getSender()) != set.end() || set.find(ALL) != set.end()) //TDO: Make sure this works.
+            {
+                this->notificationLists_[it->second]->insert(std::pair<std::time_t,Notification*>(time,notification)); //!< Insert the Notification in the Notifications list of the current NotificationListener.
+                it->first->update(notification, time); //!< Update the listener.
+            }
+        }
+
+        COUT(3) << "Notification registered with the NotificationManager." << std::endl;
+
+        return true;
+    }
+
+    /**
+    @brief
+        Registers a NotificationListener within the NotificationManager.
+    @param listener
+        The NotificationListener to be registered.
+    @return
+        Returns true if successful.
+    */
+    bool NotificationManager::registerListener(NotificationListener* listener)
+    {
+        this->highestIndex_ += 1;
+        int index = this->highestIndex_;
+
+        this->listenerList_[listener] = index; //!< Add the NotificationListener to the list of listeners.
+
+        std::set<std::string> set = listener->getTargetsSet(); //TDO: Works this?
+
+        //! If all senders are the target of the listener, then the list of notification for that specific listener is te same as the list of all Notifications.
+        if(set.find(ALL) != set.end())
+        {
+            this->notificationLists_[index] = &this->allNotificationsList_;
+            COUT(3) << "NotificationListener registered with the NotificationManager." << std::endl;
+            return true;
+        }
+
+        this->notificationLists_[index] = new std::multimap<std::time_t,Notification*>;
+        std::multimap<std::time_t,Notification*> map = *this->notificationLists_[index];
+
+        //! Iterate through all Notifications to determine whether any of them should belong to the newly registered NotificationListener.
+        for(std::multimap<std::time_t,Notification*>::iterator it = this->allNotificationsList_.begin(); it != this->allNotificationsList_.end(); it++)
+        {
+            if(set.find(it->second->getSender()) != set.end()) //!< Checks whether the overlay has the sender of the current notification as target.
+            {
+                map.insert(std::pair<std::time_t,Notification*>(it->first, it->second));
+            }
+        }
+
+        listener->update(); //!< Update the listener.
+
+        COUT(3) << "NotificationListener registered with the NotificationManager." << std::endl;
+
+        return true;
+    }
+
+    /**
+    @brief
+        Fetches the Notifications for a specific NotificationListener in a specified timeframe.
+    @param listener
+        The NotificationListener the Notifications are fetched for.
+    @param map
+        A multimap, in which the notifications are stored.
+    @param timeFrameStart
+        The start time of the timeframe.
+    @param timeFrameEnd
+        The end time of the timeframe.
+    @return
+        Returns true if successful.
+    */
+    bool NotificationManager::getNotifications(NotificationListener* listener, std::multimap<std::time_t,Notification*>* map, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd)
+    {
+        if(listener == NULL || map == NULL)
+            return false;
+
+        std::multimap<std::time_t,Notification*>* notifications = this->notificationLists_[this->listenerList_[listener]]; //!< The Notifications for the input NotificationListener.
+
+        if(notifications == NULL) //!< Returns NULL, if there are no Notifications.
+            return true;
+
+        std::multimap<std::time_t,Notification*>::iterator it, itLowest, itHighest;
+        itLowest = notifications->lower_bound(timeFrameStart);
+        itHighest = notifications->upper_bound(timeFrameStart);
+
+        for(it = itLowest; it != itHighest; it++) //!< Iterate through the Notifications from the start of the time Frame to the end of it.
+        {
+            map->insert(std::pair<std::time_t,Notification*>(it->first,it->second)); //!< Add the found Notifications to the map.
+        }
+
+        return true;
+    }
+
+}
Index: /code/branches/libraries2/src/modules/questsystem/notifications/NotificationManager.h
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/notifications/NotificationManager.h	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/notifications/NotificationManager.h	(revision 5721)
@@ -0,0 +1,104 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the NotificationManager class.
+*/
+
+#ifndef _NotificationManager_H__
+#define _NotificationManager_H__
+
+#include "objects/quest/QuestPrereqs.h"
+
+#include <ctime>
+#include <map>
+#include <string>
+
+#include "util/ScopedSingleton.h"
+#include "core/OrxonoxClass.h"
+
+namespace orxonox
+{
+
+    /**
+    @brief
+        The Singleton NotificationManager functions as a gateway between Notifications and NotificationListeners.
+        It receives, organizes Notifications and the redistributes them to the specific NotificationListeners.
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _QuestExport NotificationManager : public ScopedSingleton<NotificationManager, ScopeID::GSLevel>, public OrxonoxClass
+    {
+            friend class ScopedSingleton<NotificationManager, ScopeID::GSLevel>;
+        public:
+            NotificationManager();
+            virtual ~NotificationManager();
+
+            static const std::string ALL;
+            static const std::string NONE;
+
+            bool registerNotification(Notification* notification); //!< Registers a Notification within the NotificationManager.
+            bool registerListener(NotificationListener* listener); //!< Registers a NotificationListener within the NotificationManager.
+
+            bool getNotifications(NotificationListener* listener, std::multimap<std::time_t,Notification*>* map, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd); //!< Returns the Notifications for a specific NotificationListener in a specified timeframe.
+
+            /**
+            @brief Fetches the Notifications for a specific NotificationListener starting at a specified time.
+            @param listener The NotificationListener the Notifications are fetched for.
+            @param map A multimap, in which the notifications are stored.
+            @param timeFrameStart The start time the Notifications are fetched from.
+            @return Returns true if successful.
+            */
+            bool getNotifications(NotificationListener* listener, std::multimap<std::time_t,Notification*>* map, const std::time_t & timeFrameStart)
+                { return this->getNotifications(listener, map, timeFrameStart, std::time(0)); }
+            /**
+            @brief Fetches the Notifications for a specific NotificationListener starting at a specified timespan before now.
+            @param listener The NotificationListener the Notifications are fetched for.
+            @param map A multimap, in which the notifications are stored.
+            @param timeDelay The timespan.
+            @return Returns true if successful.
+            */
+            bool getNotifications(NotificationListener* listener, std::multimap<std::time_t,Notification*>* map, int timeDelay)
+                { return this->getNotifications(listener, map, std::time(0)-timeDelay, std::time(0)); }
+
+        private:
+            static NotificationManager* singletonPtr_s;
+
+            int highestIndex_; //!< This variable holds the highest index (resp. key) in notificationLists_s, to secure that  no key appears twice.
+
+            std::multimap<std::time_t,Notification*> allNotificationsList_; //!< Container where all notifications are stored (together with their respecive timestamps).
+            std::map<NotificationListener*,int> listenerList_; //!< Container where all NotificationListeners are stored with a number as identifier.
+            std::map<int,std::multimap<std::time_t,Notification*>*> notificationLists_; //!< Container where all Notifications, for each identifier (associated with a NotificationListener), are stored.
+
+
+    };
+
+}
+
+#endif /* _NotificationManager_H__ */
Index: /code/branches/libraries2/src/modules/questsystem/notifications/NotificationOverlay.cc
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/notifications/NotificationOverlay.cc	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/notifications/NotificationOverlay.cc	(revision 5721)
@@ -0,0 +1,136 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the NotificationOverlay class.
+*/
+
+#include "NotificationOverlay.h"
+
+#include "util/Exception.h"
+#include "core/CoreIncludes.h"
+#include "objects/quest/notifications/Notification.h"
+#include "NotificationQueue.h"
+
+namespace orxonox
+{
+
+    /**
+    @brief
+        Constructor. Intializes the class.
+    */
+    NotificationOverlay::NotificationOverlay(BaseObject* creator) : OverlayText(creator)
+    {
+        RegisterObject(NotificationOverlay);
+        this->initialize();
+    }
+
+    /**
+    @brief
+        Constructor. Initializes the class creates a graphical representation of the input Notification for the input Queue.
+    @param queue
+        A pointer to the queue the NotificatonOverlay belongs to.
+    @param notification
+        A pointer to the Notification represented by this overlay.
+    @throws Argument
+        Throws an Argument-Exception if either no Notification or no NotificationQueue were input.
+    */
+    NotificationOverlay::NotificationOverlay(NotificationQueue* queue, Notification* notification) : OverlayText(NULL)
+    {
+        this->initialize();
+
+        if(notification == NULL || queue == NULL) //!> If either notification or queue are not given an Exception is thrown.
+        {
+            ThrowException(Argument, "There were NULL-Pointer arguments in NotificationOverlay creation.");
+        }
+
+        this->queue_ = queue;
+        this->defineOverlay();
+
+        this->processNotification(notification);
+    }
+
+    /**
+    @brief
+        Initializes and Registers the object.
+    */
+    void NotificationOverlay::initialize(void)
+    {
+        this->queue_ = NULL;
+    }
+
+    /**
+    @brief
+        Set some Overlay-specific values.
+    */
+    void NotificationOverlay::defineOverlay(void)
+    {
+        this->setFont(this->queue_->getFont());
+        this->setTextSize(this->queue_->getFontSize());
+
+        this->setPosition(this->queue_->getPosition());
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    NotificationOverlay::~NotificationOverlay()
+    {
+    }
+
+    /**
+    @brief
+        Processes the input notification, resp. sees to it. that the NotificationOverlay displays the Notification message.
+    @param notification
+        A pointer to the notification that should be processed.
+    @return
+        Returns true if successful.
+    */
+    bool NotificationOverlay::processNotification(Notification* notification)
+    {
+        if(notification == NULL)
+            return false;
+        this->setCaption(clipMessage(notification->getMessage()));
+        this->notification_ = notification;
+        return true;
+    }
+
+    /**
+    @brief
+        Clips the input message so that it meets the requirements for the maximal length of Notifications given by the NotificationQueue.
+    */
+    std::string NotificationOverlay::clipMessage(const std::string & message)
+    {
+        if(message.length() <= static_cast<unsigned int>(this->queue_->getNotificationLength())) //!< If the message is not too long.
+            return message;
+        return message.substr(0, this->queue_->getNotificationLength());
+    }
+
+}
Index: /code/branches/libraries2/src/modules/questsystem/notifications/NotificationOverlay.h
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/notifications/NotificationOverlay.h	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/notifications/NotificationOverlay.h	(revision 5721)
@@ -0,0 +1,83 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the NotificationOverlay class.
+*/
+
+
+#ifndef _NotificationOverlay_H__
+#define _NotificationOverlay_H__
+
+#include "objects/quest/QuestPrereqs.h"
+
+#include <string>
+#include "overlays/OverlayText.h"
+
+namespace orxonox
+{
+
+    /**
+    @brief
+        The NotificationOverlay is used to display single Notifications, then bundled in a NotificationQUeue.
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _QuestExport NotificationOverlay : public OverlayText
+    {
+
+        public:
+            NotificationOverlay(BaseObject* creator);
+            NotificationOverlay(NotificationQueue* queue, Notification* notification);
+            virtual ~NotificationOverlay();
+
+            bool processNotification(Notification* notification); //!< Processes the input Notification.
+
+            /**
+            @brief Sets the font size of this overlay's text.
+            @param size The font size.
+            */
+            inline void setFontSize(float size)
+                { this->setTextSize(size); }
+
+        protected:
+            std::string clipMessage(const std::string & message); //!< Clips the input message if too long.
+
+        private:
+            NotificationQueue* queue_; //!< The NotificationQeue this overlay belongs to.
+            Notification* notification_; //!< The Notification this overlay displays.
+
+            void initialize(void); //!< Initializes the object.
+            void defineOverlay(void); //!< Sets some overlay-specific values.
+
+    };
+
+}
+
+#endif /* _NotificationOverlay_H__ */
Index: /code/branches/libraries2/src/modules/questsystem/notifications/NotificationQueue.cc
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/notifications/NotificationQueue.cc	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/notifications/NotificationQueue.cc	(revision 5721)
@@ -0,0 +1,449 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the NotificationQueue class.
+*/
+
+#include "NotificationQueue.h"
+
+#include <sstream>
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "NotificationOverlay.h"
+#include "objects/quest/notifications/NotificationManager.h"
+
+namespace orxonox
+{
+
+    CreateFactory(NotificationQueue);
+
+    const std::string NotificationQueue::DEFAULT_FONT = "VeraMono";
+    const Vector2 NotificationQueue::DEFAULT_POSITION = Vector2(0.0,0.0);
+    const float NotificationQueue::DEFAULT_FONT_SIZE  = 0.025f;
+
+    /**
+    @brief
+        Constructor. Creates and initializes the object.
+    */
+    NotificationQueue::NotificationQueue(BaseObject* creator) : OverlayGroup(creator)
+    {
+        RegisterObject(NotificationQueue);
+        this->initialize();
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    NotificationQueue::~NotificationQueue()
+    {
+        this->targets_.clear();
+        this->clear();
+    }
+
+    /**
+    @brief
+        Initializes the object.
+        Registers the object, initializes variables, sets default values and registers the queue with the NotificationManager.
+    */
+    void NotificationQueue::initialize(void)
+    {
+        this->size_ = 0;
+        this->tickTime_ = 0.0;
+
+        NotificationManager::getInstance().registerListener(this);
+    }
+
+    /**
+    @brief
+        Sets the defaults.
+    */
+    void NotificationQueue::setDefaults(void)
+    {
+        this->setMaxSize(DEFAULT_SIZE);
+        this->setNotificationLength(DEFAULT_LENGTH);
+        this->setDisplayTime(DEFAULT_DISPLAY_TIME);
+        this->setPosition(DEFAULT_POSITION);
+
+        this->setTargets(NotificationManager::ALL);
+
+        this->setFontSize(DEFAULT_FONT_SIZE);
+        this->setFont(DEFAULT_FONT);
+    }
+
+    /**
+    @brief
+        Method for creating a NotificationQueue object through XML.
+    */
+    void NotificationQueue::XMLPort(Element& xmlElement, XMLPort::Mode mode)
+    {
+        SUPER(NotificationQueue, XMLPort, xmlElement, mode);
+
+        this->setDefaults();
+
+        XMLPortParam(NotificationQueue, "maxSize", setMaxSize, getMaxSize, xmlElement, mode);
+        XMLPortParam(NotificationQueue, "notificationLength", setNotificationLength, getNotificationLength, xmlElement, mode);
+        XMLPortParam(NotificationQueue, "displayTime", setDisplayTime, getDisplayTime, xmlElement, mode);
+        XMLPortParam(NotificationQueue, "targets", setTargets, getTargets, xmlElement, mode);
+        XMLPortParam(NotificationQueue, "font", setFont, getFont, xmlElement, mode);
+        XMLPortParam(NotificationQueue, "fontSize", setFontSize, getFontSize, xmlElement, mode);
+        XMLPortParam(NotificationQueue, "position", setPosition, getPosition, xmlElement, mode);
+
+        COUT(3) << "NotificationQueue created." << std::endl;
+    }
+
+    /**
+    @brief
+        Updates the queue from time to time.
+    @param dt
+        The time interval that has passed since the last tick.
+    */
+    void NotificationQueue::tick(float dt)
+    {
+        this->tickTime_ += dt; //!< Add the time interval that has passed to the time counter.
+        if(this->tickTime_ >= 1.0) //!< If the time counter is greater than 1s all Notifications that have expired are removed, if it is smaller we wait to the next tick.
+        {
+            this->timeLimit_.time = std::time(0)-this->displayTime_; //!< Container containig the current time.
+
+            std::multiset<NotificationOverlayContainer*, NotificationOverlayContainerCompare>::iterator it;
+            it = this->containers_.begin();
+            while(it != this->containers_.upper_bound(&this->timeLimit_)) //!< Iterate through all elements whose creation time is smaller than the current time minus the display time.
+            {
+                this->removeContainer(*it);
+                this->scroll(Vector2(0.0,-(1.1*this->getFontSize())));
+                it = this->containers_.begin(); //TDO: Needed?
+            }
+
+            this->tickTime_ = 0.0; //!< Reset time counter.
+        }
+    }
+
+    /**
+    @brief
+        Updates the NotificationQueue.
+        Updates by clearing the queue and requesting all relevant Notifications from the NotificationManager and inserting the in the queue.
+    */
+    void NotificationQueue::update(void)
+    {
+        this->clear();
+
+        std::multimap<std::time_t,Notification*>* notifications = new std::multimap<std::time_t,Notification*>;
+        if(!NotificationManager::getInstance().getNotifications(this, notifications, this->displayTime_)) //!< Get the Notifications sent in the interval form now to minus the display time.
+        {
+            COUT(1) << "NotificationQueue update failed due to undetermined cause." << std::endl;
+            return;
+        }
+
+        if(notifications->empty())
+            return;
+
+        for(std::multimap<std::time_t,Notification*>::iterator it = notifications->begin(); it != notifications->end(); it++) //!> Add all Notifications.
+        {
+            this->addNotification(it->second, it->first);
+        }
+
+        delete notifications;
+
+        COUT(3) << "NotificationQueue updated." << std::endl;
+    }
+
+    /**
+    @brief
+        Updates the NotificationQueue by adding an new Notification.
+    @param notification
+        Pointer to the Notification.
+    @param time
+        The time the Notification was sent.
+    */
+    void NotificationQueue::update(Notification* notification, const std::time_t & time)
+    {
+        this->addNotification(notification, time);
+
+        std::multiset<NotificationOverlayContainer*, NotificationOverlayContainerCompare>::iterator it;
+        while(this->getSize() > this->getMaxSize())
+        {
+            it = this->containers_.begin();
+            this->removeContainer(*it);
+            this->scroll(Vector2(0.0,-(1.1*this->getFontSize())));
+        }
+
+        COUT(3) << "NotificationQueue updated. A new Notifications has been added." << std::endl;
+    }
+
+    /**
+    @brief
+        Sets the maximum number of displayed Notifications.
+    @param size
+        The size to be set.
+    @return
+        Returns true if successful.
+    */
+    bool NotificationQueue::setMaxSize(int size)
+    {
+        if(size < 0)
+            return false;
+        this->maxSize_ = size;
+        this->update();
+        return true;
+    }
+
+    /**
+    @brief
+        Sets the maximum number of characters a Notification message displayed by this queue is allowed to have.
+    @param length
+        The length to be set.
+    @return
+        Returns true if successful.
+    */
+    bool NotificationQueue::setNotificationLength(int length)
+    {
+        if(length < 0)
+            return false;
+        this->notificationLength_ = length;
+        this->update();
+        return true;
+    }
+
+    /**
+    @brief
+        Sets the maximum number of seconds a Notification is displayed.
+    @param time
+        The number of seconds the Notifications is displayed.
+    @return
+        Returns true if successful.
+    */
+    bool NotificationQueue::setDisplayTime(int time)
+    {
+        if(time < 0)
+            return false;
+        this->displayTime_ = time;
+        this->update();
+        return true;
+    }
+
+    /**
+    @brief
+        Produces all targets concatinated as string, with kommas (',') as seperators.
+    @param string
+        Pointer to a string which will be used by the method to fill with the concatination of the targets.
+    @return
+        Returns true if successful.
+    */
+    bool NotificationQueue::getTargets(std::string* string) const
+    {
+        if(string == NULL)
+        {
+            COUT(4) << "Input string must have memory allocated." << std::endl;
+            return false;
+        }
+        string->clear();
+        bool first = true;
+        for(std::set<std::string>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); it++) //!< Iterate through the set of targets.
+        {
+            if(!first)
+            {
+                *string += ",";
+            }
+            else
+            {
+                first = false;
+            }
+            *string += *it;
+        }
+
+        return true;
+    }
+
+    /**
+    @brief
+        Sets the targets of the queue.
+        The targets are the senders whose Notifications are displayed in this queue.
+    @param targets
+        Accepts a string of targets, each seperated by commas (','), spaces are ignored.
+    @return
+        Returns true if successful.
+    */
+    bool NotificationQueue::setTargets(const std::string & targets)
+    {
+        this->targets_.clear();
+
+        std::string* pTemp;
+        unsigned int index = 0;
+        while( index < targets.size() ) //!< Go through the string, character by character until the end is reached.
+        {
+            pTemp = new std::string("");
+            while(index < targets.size() && targets[index] != ',' && targets[index] != ' ')
+            {
+                *pTemp += targets[index];
+                index++;
+            }
+            index++;
+            this->targets_.insert(*pTemp);
+        }
+
+        return true;
+    }
+
+    /**
+    @brief
+        Sets the font size.
+    @param size
+        The font size.
+    @return
+        Returns true if successful.
+    */
+    bool NotificationQueue::setFontSize(float size)
+    {
+        if(size <= 0)
+            return false;
+        this->fontSize_ = size;
+        for (std::map<Notification*, NotificationOverlayContainer*>::iterator it = this->overlays_.begin(); it != this->overlays_.end(); it++) //!< Set the font size for each overlay.
+        {
+            it->second->overlay->setFontSize(size);
+        }
+        return true;
+    }
+
+    /**
+    @brief
+        Sets the font.
+    @param font
+        The font.
+    @return
+        Returns true if successful.
+    */
+    bool NotificationQueue::setFont(const std::string & font)
+    {
+        this->font_ = font;
+        for (std::map<Notification*, NotificationOverlayContainer*>::iterator it = this->overlays_.begin(); it != this->overlays_.end(); it++) //!< Set the font for each overlay.
+        {
+            it->second->overlay->setFont(font);
+        }
+        return true;
+    }
+
+    /**
+    @brief
+        Scrolls the NotificationQueue, meaning all NotificationOverlays are moved the input vector.
+    @param pos
+        The vector the NotificationQueue is scrolled.
+    */
+    void NotificationQueue::scroll(const Vector2 pos)
+    {
+        for (std::map<Notification*, NotificationOverlayContainer*>::iterator it = this->overlays_.begin(); it != this->overlays_.end(); ++it) //!< Scroll each overlay.
+        {
+            it->second->overlay->scroll(pos);
+        }
+    }
+
+    /**
+    @brief
+        Aligns all the Notifications to the position of the NotificationQueue.
+    */
+    void NotificationQueue::positionChanged(void)
+    {
+        int counter = 0;
+        for (std::multiset<NotificationOverlayContainer*, NotificationOverlayContainerCompare>::iterator it = this->containers_.begin(); it != this->containers_.end(); it++) //!< Set the position for each overlay.
+        {
+            (*it)->overlay->setPosition(this->getPosition());
+            (*it)->overlay->scroll(Vector2(0.0,(1.1*this->getFontSize())*counter));
+            counter++;
+        }
+    }
+
+    /**
+    @brief
+        Adds a Notification, to the queue.
+        It inserts it into the storage containers, creates an corresponding overlay and a container.
+    @param notification
+        The Notification.
+    @param time
+        The time.
+    */
+    void NotificationQueue::addNotification(Notification* notification, const std::time_t & time)
+    {
+        NotificationOverlayContainer* container = new NotificationOverlayContainer;
+        container->overlay = new NotificationOverlay(this, notification);
+        container->notification = notification;
+        container->time = time;
+        std::string timeString = std::ctime(&time);
+        timeString.erase(timeString.length()-1);
+        std::ostringstream stream;
+        stream << reinterpret_cast<unsigned long>(notification);
+        std::string addressString = stream.str() ;
+        container->name = "NotificationOverlay(" + timeString + ")&" + addressString;
+
+        this->containers_.insert(container);
+        this->overlays_[notification] = container;
+        this->addElement(container->overlay);
+        this->size_= this->size_+1;
+
+        container->overlay->scroll(Vector2(0.0,(1.1*this->getFontSize())*(this->getSize()-1)));
+    }
+
+    /**
+    @brief
+        Removes a container from the queue.
+    @param container
+        A pointer to the container.
+    @return
+        Returns true if successful.
+    */
+    bool NotificationQueue::removeContainer(NotificationOverlayContainer* container)
+    {
+        if(this->size_ == 0) //!< You cannot remove anything if the queue is empty.
+            return false;
+
+        this->removeElement(container->overlay);
+        this->containers_.erase(container);
+        this->overlays_.erase(container->notification);
+        delete container->overlay;
+        delete container;
+        this->size_= this->size_-1;
+
+        return true;
+    }
+
+    /**
+    @brief
+        Clears the queue by removing all containers.
+    */
+    void NotificationQueue::clear(void)
+    {
+        std::multiset<NotificationOverlayContainer*, NotificationOverlayContainerCompare>::iterator it = this->containers_.begin();
+        while(it != this->containers_.end())
+        {
+            this->removeContainer(*it);
+            it = this->containers_.begin(); //TDO: Needed?
+        }
+    }
+
+}
Index: /code/branches/libraries2/src/modules/questsystem/notifications/NotificationQueue.h
===================================================================
--- /code/branches/libraries2/src/modules/questsystem/notifications/NotificationQueue.h	(revision 5721)
+++ /code/branches/libraries2/src/modules/questsystem/notifications/NotificationQueue.h	(revision 5721)
@@ -0,0 +1,210 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the NotificationQueue class.
+*/
+
+#ifndef _NotificationOueue_H__
+#define _NotificationOueue_H__
+
+#include "objects/quest/QuestPrereqs.h"
+
+#include <ctime>
+#include <map>
+#include <set>
+#include <string>
+
+#include "util/Math.h"
+#include "tools/interfaces/Tickable.h"
+#include "overlays/OverlayGroup.h"
+#include "interfaces/NotificationListener.h"
+
+namespace orxonox
+{
+
+    //! Container to allow easy handling.
+    struct NotificationOverlayContainer
+    {
+        NotificationOverlay* overlay; //!< Pointer to the NotificationOverlay, everything is about.
+        Notification* notification; //!< The Notification displayed by the overlay.
+        time_t time; //!< The time the Notification was sent and thus first displayed.
+        std::string name; //!< The name of the overlay.
+    };
+
+    //! Struct to allow ordering of NotificationOverlayContainers.
+    struct NotificationOverlayContainerCompare {
+        bool operator() (const NotificationOverlayContainer* const & a, const NotificationOverlayContainer* const & b) const
+            { return a->time < b->time; } //!< Ordered by time.
+    };
+
+    /**
+    @brief
+        Displays Notifications from specific senders.
+        Beware! The NotificationQueue is an OverlayGruop and thus cannot be be a sub-element of an OverlayGroup (at least no for now.)
+
+        Creating a NotificationQueue through XML goes as follows:
+        <NotificationQueue
+            name = "SuperQueue" //Name of your OverlayQueue.
+            maxSize = "5" //The maximum size of Notifications displayed.
+            notificationLength = "64" //The maximum number of characters of a Notification, that are displayed. (Default is 5)
+            displayTime = "30" //The time a Notification is displayed in seconds. (Default is 30)
+            targets = "target1, target2" //The senders this NotificationQueue displays Notifications from. (all, if all Notifications should be displayed.)
+            font = "VeraMono" //The font (Default is VeraMono)
+            fontSize = '0.4' //The font size. (Default is 0.025)
+            position = "0.0, .0.0" //The position of the NotificationQueue. (Default is 0.0,0.0)
+        />
+    @author
+        Damian 'Mozork' Frick
+    */
+
+    class _QuestExport NotificationQueue : public OverlayGroup, public Tickable, public NotificationListener
+    {
+
+        public:
+            NotificationQueue(BaseObject* creator);
+            virtual ~NotificationQueue();
+
+            virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode); //!< Method for creating a NotificationQueue object through XML.
+
+            virtual void tick(float dt); //!< To update from time to time.
+
+            void update(void); //!< Updates the queue.
+            void update(Notification* notification, const std::time_t & time); //!< Adds a Notification to the queue.
+
+            /**
+            @brief Returns the maximum number of Notifications displayed.
+            @return Returns maximum size.
+            */
+            inline int getMaxSize() const
+                { return this->maxSize_; }
+            /**
+            @brief Returns the current number of Notifications displayed.
+            @return Returns the size of the queue.
+            */
+            inline int getSize() const
+                { return this->size_; }
+            /**
+            @brief Returns the maximum length in characters a Notification message is allowed to have.
+            @return Returns the maximum Notification length.
+            */
+            inline int getNotificationLength() const
+                { return this->notificationLength_; }
+            /**
+            @brief Returns the time interval the Notification is displayed.
+            @return Returns the display time.
+            */
+            inline int getDisplayTime() const
+                { return this->displayTime_; }
+            /**
+            @brief Returns the position of the NotificationQueue.
+            @return Returns the position.
+            */
+            inline const Vector2 & getPosition() const
+                { return this->position_; }
+            /**
+            @brief Returns the font size used to display the Notifications.
+            @return  Returns the font size.
+            */
+            inline float getFontSize() const
+                { return this->fontSize_; }
+            /**
+            @brief Returns the font used to display the Notifications.
+            @return Returns the font.
+            */
+            inline const std::string & getFont() const
+                { return this->font_; }
+
+            /**
+            @brief Returns the targets of this queue, reps. the senders which Notifications are displayed in this queue.
+            @return Retuns a set of string holding the different targets.
+            */
+            inline const std::set<std::string> & getTargetsSet()
+                { return this->targets_; }
+            bool getTargets(std::string* string) const; //!< Returns a string consisting of the concatination of the targets.
+
+            /**
+            @brief Sets the position of the NotificationQueue.
+            @param pos The position.
+            */
+            inline void setPosition(Vector2 pos)
+                { this->position_ = pos; this->positionChanged(); }
+
+            void scroll(const Vector2 pos); //!< Scrolls the NotificationQueue, meaning all NotificationOverlays are moved the input vector.
+
+        private:
+            static const int DEFAULT_SIZE = 5; //!< The default maximum number of Notifications displayed.
+            static const int DEFAULT_LENGTH = 64; //!< The default maximum number of Notifications displayed.
+            static const int DEFAULT_DISPLAY_TIME = 30; //!< The default display time.
+            static const float DEFAULT_FONT_SIZE; //!< The default font size.
+
+            static const std::string DEFAULT_FONT; //!< The default font.
+            static const Vector2 DEFAULT_POSITION; //!< the default position.
+
+            int maxSize_; //!< The maximal number of Notifications displayed.
+            int size_; //!< The number of Notifications displayed.
+            int notificationLength_; //!< The maximal number of characters a Notification-message is allowed to have.
+            int displayTime_; //!< The time a Notification is displayed.
+            Vector2 position_; //!< The position of the NotificationQueue.
+
+            std::set<std::string> targets_; //!< The targets the Queue displays Notifications of.
+
+            float fontSize_; //!< The font size.
+            std::string font_; //!< The font.
+
+            std::multiset<NotificationOverlayContainer*, NotificationOverlayContainerCompare> containers_; //!< Multiset, because the ordering is based on, not necessarily unique, timestamps.
+            std::map<Notification*, NotificationOverlayContainer*> overlays_; //!< Mapping notifications to their corresponding overlay containers, for easier association and finding.
+
+            float tickTime_; //!< Helper variable, to not have to check for overlays that have been displayed too long, every tick.
+            NotificationOverlayContainer timeLimit_; //!< Helper object to check against to determine whether Notifications have expired.
+
+            void initialize(void); //!< Initializes the object.
+            void setDefaults(void); //!< Helper method to set the default values.
+
+            bool setMaxSize(int size); //!< Sets the maximum number of displayed Notifications.
+            bool setNotificationLength(int length); //!< Sets the maximum number of characters a Notification message displayed by this queue is allowed to have.
+            bool setDisplayTime(int time); //!< Sets the maximum number of seconds a Notification is displayed.
+
+            bool setTargets(const std::string & targets); //!< Set the targets of this queue.
+
+            bool setFontSize(float size); //!< Set the font size.
+            bool setFont(const std::string & font); //!< Set the font.
+
+            void positionChanged(void); //!< Aligns all the Notifications to the position of the NotificationQueue.
+
+            void addNotification(Notification* notification, const std::time_t & time); //!< Add a notification to the queue.
+            bool removeContainer(NotificationOverlayContainer* container); //!< Remove a container from the queue.
+
+            void clear(void); //!< Clear the queue.
+
+    };
+
+}
+
+#endif /* _NotificationOverlay_H__ */
