Updated Pelupelu quests to allow for multiple quests to be turned in at once

This commit is contained in:
Liza 2024-11-18 18:21:36 +01:00
parent a540fd8b86
commit 0d7263604b
Signed by: liza
GPG Key ID: 7199F8D727D55F67
8 changed files with 173 additions and 14 deletions

View File

@ -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,

View File

@ -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
}
}
}
}
]
},

View File

@ -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,

View File

@ -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,

View File

@ -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
}
}
}
}
]
},

View File

@ -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,

View File

@ -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,

View File

@ -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)