From 0d7263604b6ce2afa5f2d0a0714d534792e9992e Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Mon, 18 Nov 2024 18:21:36 +0100 Subject: [PATCH] Updated Pelupelu quests to allow for multiple quests to be turned in at once --- ...1_Ferocious Foliage, Fearful Tourists.json | 16 ++++++- ...5202_Community Outreach in Kozanuakiy.json | 16 ++++++- .../Dailies/5203_Preventative Measures.json | 32 +++++++++++++- .../Dailies/5204_Burden of Beasts.json | 32 +++++++++++++- .../5210_The Rudiments of Fiend Removal.json | 16 ++++++- .../Dailies/5212_Starting from Scrap.json | 16 ++++++- .../Dailies/5218_The Hand That Feeds.json | 16 ++++++- Questionable/Functions/QuestFunctions.cs | 43 ++++++++++++++++--- 8 files changed, 173 insertions(+), 14 deletions(-) diff --git a/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5201_Ferocious Foliage, Fearful Tourists.json b/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5201_Ferocious Foliage, Fearful Tourists.json index 056eab0b..933c123d 100644 --- a/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5201_Ferocious Foliage, Fearful Tourists.json +++ b/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5201_Ferocious Foliage, Fearful Tourists.json @@ -53,7 +53,21 @@ null, null, null - ] + ], + "AetheryteShortcut": "Kozama'uka - Dock Poga", + "SkipConditions": { + "AetheryteShortcutIf": { + "NearPosition": { + "Position": { + "X": 770.7179, + "Y": 12.84657, + "Z": -263.99634 + }, + "TerritoryId": 1188, + "MaximumDistance": 300 + } + } + } }, { "DataId": 2014481, diff --git a/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5202_Community Outreach in Kozanuakiy.json b/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5202_Community Outreach in Kozanuakiy.json index 87cadfa6..eb50d2c3 100644 --- a/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5202_Community Outreach in Kozanuakiy.json +++ b/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5202_Community Outreach in Kozanuakiy.json @@ -39,7 +39,21 @@ }, "TerritoryId": 1188, "InteractionType": "Interact", - "Fly": true + "Fly": true, + "AetheryteShortcut": "Kozama'uka - Dock Poga", + "SkipConditions": { + "AetheryteShortcutIf": { + "NearPosition": { + "Position": { + "X": 770.7179, + "Y": 12.84657, + "Z": -263.99634 + }, + "TerritoryId": 1188, + "MaximumDistance": 300 + } + } + } } ] }, diff --git a/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5203_Preventative Measures.json b/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5203_Preventative Measures.json index 262ce23e..cb54fe59 100644 --- a/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5203_Preventative Measures.json +++ b/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5203_Preventative Measures.json @@ -48,7 +48,21 @@ null, null, 64 - ] + ], + "AetheryteShortcut": "Kozama'uka - Dock Poga", + "SkipConditions": { + "AetheryteShortcutIf": { + "NearPosition": { + "Position": { + "X": 770.7179, + "Y": 12.84657, + "Z": -263.99634 + }, + "TerritoryId": 1188, + "MaximumDistance": 300 + } + } + } }, { "DataId": 2014485, @@ -101,7 +115,21 @@ }, "TerritoryId": 1188, "InteractionType": "WalkTo", - "Fly": true + "Fly": true, + "AetheryteShortcut": "Kozama'uka - Dock Poga", + "SkipConditions": { + "AetheryteShortcutIf": { + "NearPosition": { + "Position": { + "X": 770.7179, + "Y": 12.84657, + "Z": -263.99634 + }, + "TerritoryId": 1188, + "MaximumDistance": 300 + } + } + } }, { "DataId": 1051711, diff --git a/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5204_Burden of Beasts.json b/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5204_Burden of Beasts.json index 549951cf..f5bcdb6f 100644 --- a/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5204_Burden of Beasts.json +++ b/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5204_Burden of Beasts.json @@ -39,7 +39,21 @@ }, "TerritoryId": 1188, "InteractionType": "Interact", - "Fly": true + "Fly": true, + "AetheryteShortcut": "Kozama'uka - Dock Poga", + "SkipConditions": { + "AetheryteShortcutIf": { + "NearPosition": { + "Position": { + "X": 770.7179, + "Y": 12.84657, + "Z": -263.99634 + }, + "TerritoryId": 1188, + "MaximumDistance": 300 + } + } + } } ] }, @@ -85,7 +99,21 @@ }, "TerritoryId": 1188, "InteractionType": "WalkTo", - "Fly": true + "Fly": true, + "AetheryteShortcut": "Kozama'uka - Dock Poga", + "SkipConditions": { + "AetheryteShortcutIf": { + "NearPosition": { + "Position": { + "X": 770.7179, + "Y": 12.84657, + "Z": -263.99634 + }, + "TerritoryId": 1188, + "MaximumDistance": 300 + } + } + } }, { "DataId": 1051711, diff --git a/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5210_The Rudiments of Fiend Removal.json b/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5210_The Rudiments of Fiend Removal.json index 1203c94c..eb5c727e 100644 --- a/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5210_The Rudiments of Fiend Removal.json +++ b/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5210_The Rudiments of Fiend Removal.json @@ -40,7 +40,21 @@ }, "TerritoryId": 1188, "InteractionType": "Interact", - "Fly": true + "Fly": true, + "AetheryteShortcut": "Kozama'uka - Dock Poga", + "SkipConditions": { + "AetheryteShortcutIf": { + "NearPosition": { + "Position": { + "X": 770.7179, + "Y": 12.84657, + "Z": -263.99634 + }, + "TerritoryId": 1188, + "MaximumDistance": 300 + } + } + } } ] }, diff --git a/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5212_Starting from Scrap.json b/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5212_Starting from Scrap.json index f4add830..264ed756 100644 --- a/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5212_Starting from Scrap.json +++ b/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5212_Starting from Scrap.json @@ -47,7 +47,21 @@ null, null, 128 - ] + ], + "AetheryteShortcut": "Kozama'uka - Dock Poga", + "SkipConditions": { + "AetheryteShortcutIf": { + "NearPosition": { + "Position": { + "X": 770.7179, + "Y": 12.84657, + "Z": -263.99634 + }, + "TerritoryId": 1188, + "MaximumDistance": 300 + } + } + } }, { "DataId": 2014495, diff --git a/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5218_The Hand That Feeds.json b/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5218_The Hand That Feeds.json index 1b751760..744e96ea 100644 --- a/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5218_The Hand That Feeds.json +++ b/QuestPaths/7.x - Dawntrail/Allied Societies/Pelupelu/Dailies/5218_The Hand That Feeds.json @@ -38,7 +38,21 @@ }, "TerritoryId": 1188, "InteractionType": "WalkTo", - "Fly": true + "Fly": true, + "AetheryteShortcut": "Kozama'uka - Dock Poga", + "SkipConditions": { + "AetheryteShortcutIf": { + "NearPosition": { + "Position": { + "X": 770.7179, + "Y": 12.84657, + "Z": -263.99634 + }, + "TerritoryId": 1188, + "MaximumDistance": 300 + } + } + } }, { "DataId": 1052331, diff --git a/Questionable/Functions/QuestFunctions.cs b/Questionable/Functions/QuestFunctions.cs index 9211514d..fa837cac 100644 --- a/Questionable/Functions/QuestFunctions.cs +++ b/Questionable/Functions/QuestFunctions.cs @@ -122,6 +122,7 @@ internal sealed unsafe class QuestFunctions // do the MSQ; if a side quest is the first item do that side quest. // // If no quests are marked as 'priority', accepting a new quest adds it to the top of the list. + List<(ElementId Quest, byte Sequence)> trackedQuests = []; for (int i = questManager->TrackedQuests.Length - 1; i >= 0; --i) { ElementId currentQuest; @@ -129,22 +130,40 @@ internal sealed unsafe class QuestFunctions switch (trackedQuest.QuestType) { default: - continue; + break; case 1: // normal quest currentQuest = new QuestId(questManager->NormalQuests[trackedQuest.Index].QuestId); if (_questRegistry.IsKnownQuest(currentQuest)) - return (currentQuest, QuestManager.GetQuestSequence(currentQuest.Value)); - continue; + trackedQuests.Add((currentQuest, QuestManager.GetQuestSequence(currentQuest.Value))); + break; case 2: // leve currentQuest = new LeveId(questManager->LeveQuests[trackedQuest.Index].LeveId); if (_questRegistry.IsKnownQuest(currentQuest)) - return (currentQuest, questManager->GetLeveQuestById(currentQuest.Value)->Sequence); - continue; + trackedQuests.Add((currentQuest, questManager->GetLeveQuestById(currentQuest.Value)->Sequence)); + break; } } + if (trackedQuests.Count > 0) + { + // if we have multiple quests to turn in for an allied society, try and complete all of them + var (firstTrackedQuest, firstTrackedSequence) = trackedQuests.First(); + EAlliedSociety firstTrackedAlliedSociety = GetCommonAlliedSocietyTurnIn(firstTrackedQuest); + if (firstTrackedAlliedSociety != EAlliedSociety.None && firstTrackedSequence == 255) + { + foreach (var (quest, sequence) in trackedQuests.Skip(1)) + { + // only if the other quest isn't ready to be turned in + if (GetCommonAlliedSocietyTurnIn(quest) == firstTrackedAlliedSociety && sequence != 255) + return (quest, sequence); + } + } + + return (firstTrackedQuest, firstTrackedSequence); + } + ElementId? priorityQuest = GetNextPriorityQuestThatCanBeAccepted(); if (priorityQuest != null) { @@ -221,6 +240,20 @@ internal sealed unsafe class QuestFunctions return (currentQuest, QuestManager.GetQuestSequence(currentQuest.Value)); } + private static EAlliedSociety GetCommonAlliedSocietyTurnIn(ElementId elementId) + { + if (elementId is QuestId questId) + { + return questId.Value switch + { + >= 5199 and <= 5226 => EAlliedSociety.Pelupelu, + _ => EAlliedSociety.None, + }; + } + + return EAlliedSociety.None; + } + public QuestProgressInfo? GetQuestProgressInfo(ElementId elementId) { if (elementId is QuestId questId)