diff --git a/source/game/StarQuestManager.cpp b/source/game/StarQuestManager.cpp index 876f0b8..df8a19a 100644 --- a/source/game/StarQuestManager.cpp +++ b/source/game/StarQuestManager.cpp @@ -273,6 +273,10 @@ List QuestManager::listFailedQuests() const { return result; } +Maybe QuestManager::currentQuestId() const { + return m_trackedQuestId; +} + Maybe QuestManager::currentQuest() const { auto questId = m_onWorldQuestId.orMaybe(m_trackedQuestId); if (questId && isActive(*questId)) { @@ -283,6 +287,10 @@ Maybe QuestManager::currentQuest() const { return {}; } +Maybe QuestManager::trackedQuestId() const { + return m_trackedQuestId; +} + Maybe QuestManager::trackedQuest() const { if (m_trackedQuestId && isActive(*m_trackedQuestId)) { auto current = getQuest(*m_trackedQuestId); diff --git a/source/game/StarQuestManager.hpp b/source/game/StarQuestManager.hpp index 3d7ee22..549f13b 100644 --- a/source/game/StarQuestManager.hpp +++ b/source/game/StarQuestManager.hpp @@ -52,7 +52,9 @@ public: List listCompletedQuests() const; List listFailedQuests() const; + Maybe currentQuestId() const; Maybe currentQuest() const; + Maybe trackedQuestId() const; Maybe trackedQuest() const; Maybe getQuestIndicator(EntityPtr const& entity) const; diff --git a/source/game/scripting/StarPlayerLuaBindings.cpp b/source/game/scripting/StarPlayerLuaBindings.cpp index 15ad1dd..ea902ab 100644 --- a/source/game/scripting/StarPlayerLuaBindings.cpp +++ b/source/game/scripting/StarPlayerLuaBindings.cpp @@ -484,8 +484,8 @@ LuaCallbacks LuaBindings::makePlayerCallbacks(Player* player) { return player->questManager()->hasCompleted(questId); }); - callbacks.registerCallback("trackedQuest", [player]() { - return player->questManager()->trackedQuest(); + callbacks.registerCallback("trackedQuestId", [player]() { + return player->questManager()->trackedQuestId(); }); callbacks.registerCallback("setTrackedQuest", [player](Maybe const& questId) { @@ -496,6 +496,10 @@ LuaCallbacks LuaBindings::makePlayerCallbacks(Player* player) { return player->questManager()->canTurnIn(questId); }); + callbacks.registerCallback("currentQuestId", [player]() { + return player->questManager()->currentQuestId(); + }); + callbacks.registerCallback("currentQuest", [player]() -> Json { auto maybeQuest = player->questManager()->currentQuest(); if (maybeQuest) {