feat: send hex quest email when The Lotus Eaters and The Duviri Paradox are complete #1761

Merged
Sainan merged 2 commits from hex-quest into main 2025-04-21 10:44:01 -07:00
Showing only changes of commit 9d8318f9d6 - Show all commits

View File

@ -191,6 +191,25 @@ const getQuestCompletionItems = (questKey: string): ITypeCount[] | undefined =>
return items;
};
// Checks that `questKey` is in `requirements`, and if so, that all other quests in `requirements` are also already completed.
const doesQuestCompletionFinishSet = (
inventory: TInventoryDatabaseDocument,
questKey: string,
requirements: string[]
): boolean => {
let holds = false;
for (const requirement of requirements) {
if (questKey == requirement) {
holds = true;
} else {
if (!inventory.QuestKeys.find(x => x.ItemType == requirement)?.Completed) {
return false;
}
}
}
return holds;
};
const handleQuestCompletion = async (
inventory: TInventoryDatabaseDocument,
questKey: string,
@ -218,12 +237,10 @@ const handleQuestCompletion = async (
// Whispers in the Walls is unlocked once The New + Heart of Deimos are completed.
if (
(questKey == "/Lotus/Types/Keys/NewWarQuest/NewWarQuestKeyChain" &&
inventory.QuestKeys.find(
x => x.ItemType == "/Lotus/Types/Keys/InfestedMicroplanetQuest/InfestedMicroplanetQuestKeyChain"
)?.Completed) ||
(questKey == "/Lotus/Types/Keys/InfestedMicroplanetQuest/InfestedMicroplanetQuestKeyChain" &&
inventory.QuestKeys.find(x => x.ItemType == "/Lotus/Types/Keys/NewWarQuest/NewWarQuestKeyChain")?.Completed)
doesQuestCompletionFinishSet(inventory, questKey, [
"/Lotus/Types/Keys/NewWarQuest/NewWarQuestKeyChain",
"/Lotus/Types/Keys/InfestedMicroplanetQuest/InfestedMicroplanetQuestKeyChain"
])
) {
await createMessage(inventory.accountOwnerId, [
{