2024-02-25 14:46:47 +00:00
|
|
|
#pragma once
|
2023-06-20 04:33:09 +00:00
|
|
|
|
|
|
|
#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);
|
|
|
|
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<String> const& questId);
|
|
|
|
void markAsRead(String const& questId);
|
|
|
|
bool hasCompleted(String const& questId) const;
|
|
|
|
bool canTurnIn(String const& questId) const;
|
|
|
|
|
|
|
|
Maybe<QuestPtr> getFirstNewQuest();
|
|
|
|
Maybe<QuestPtr> getFirstCompletableQuest();
|
|
|
|
Maybe<QuestPtr> getFirstFailableQuest();
|
|
|
|
Maybe<QuestPtr> getFirstMainQuest();
|
|
|
|
|
|
|
|
List<QuestPtr> listActiveQuests() const;
|
|
|
|
List<QuestPtr> listCompletedQuests() const;
|
|
|
|
List<QuestPtr> listFailedQuests() const;
|
|
|
|
|
|
|
|
Maybe<QuestPtr> currentQuest() const;
|
|
|
|
Maybe<QuestPtr> trackedQuest() const;
|
|
|
|
Maybe<QuestIndicator> getQuestIndicator(EntityPtr const& entity) const;
|
|
|
|
|
|
|
|
// Handled at this level to allow multiple active quests to specify interestingObjects
|
|
|
|
StringSet interestingObjects();
|
|
|
|
|
|
|
|
Maybe<Json> receiveMessage(String const& message, bool localMessage, JsonArray const& args = {});
|
2023-07-20 14:58:49 +00:00
|
|
|
void update(float dt);
|
2023-06-20 04:33:09 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
List<QuestPtr> serverQuests() const;
|
|
|
|
void startInitialQuests();
|
|
|
|
void setMostRecentQuestCurrent();
|
|
|
|
|
|
|
|
Player* m_player;
|
|
|
|
World* m_world;
|
|
|
|
UniverseClient* m_client;
|
|
|
|
|
|
|
|
StringMap<QuestPtr> m_quests;
|
|
|
|
|
|
|
|
Maybe<String> m_trackedQuestId;
|
|
|
|
bool m_trackOnWorldQuests;
|
|
|
|
Maybe<String> m_onWorldQuestId;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|