#pragma once #include "StarQuests.hpp" namespace Star { STAR_CLASS(QuestManager); struct QuestIndicator { String indicatorImage; Vec2F worldPosition; }; class QuestManager { public: QuestManager(Player* player); void diskLoad(Json const& quests); Json diskStore(); void setUniverseClient(UniverseClient* client); void init(World* world); void uninit(); bool canStart(QuestArcDescriptor const& questArc) const; // Show a dialog offering the player a quest, and later start it if they // accept it. void offer(QuestPtr const& quest); StringMap quests() const; // Only returns quests that are exclusive to the current server. StringMap serverQuests() const; QuestPtr getQuest(String const& questId) const; bool hasQuest(String const& questId) const; bool hasAcceptedQuest(String const& questId) const; bool isActive(String const& questId) const; bool isCurrent(String const& questId) const; bool isTracked(String const& questId) const; void setAsTracked(Maybe const& questId); void markAsRead(String const& questId); bool hasCompleted(String const& questId) const; bool canTurnIn(String const& questId) const; Maybe getFirstNewQuest(); Maybe getFirstCompletableQuest(); Maybe getFirstFailableQuest(); Maybe getFirstMainQuest(); List listActiveQuests() const; List listCompletedQuests() const; List listFailedQuests() const; Maybe currentQuestId() const; Maybe currentQuest() const; Maybe trackedQuestId() const; Maybe trackedQuest() const; Maybe getQuestIndicator(EntityPtr const& entity) const; // Handled at this level to allow multiple active quests to specify interestingObjects StringSet interestingObjects(); Maybe receiveMessage(String const& message, bool localMessage, JsonArray const& args = {}); void update(float dt); private: void startInitialQuests(); void setMostRecentQuestCurrent(); bool questValidOnServer(QuestPtr quest) const; Player* m_player; World* m_world; UniverseClient* m_client; StringMap m_quests; Maybe m_trackedQuestId; bool m_trackOnWorldQuests; Maybe m_onWorldQuestId; }; }