From df4c48e86610e5ac021172feeeb70f047535c053 Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Tue, 5 Aug 2025 19:22:57 +0200 Subject: [PATCH] Include free/reduced aetherytes in teleport cost estimation --- Questionable/Functions/QuestFunctions.cs | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Questionable/Functions/QuestFunctions.cs b/Questionable/Functions/QuestFunctions.cs index dbeb55a5..30c3a3ad 100644 --- a/Questionable/Functions/QuestFunctions.cs +++ b/Questionable/Functions/QuestFunctions.cs @@ -16,6 +16,7 @@ using Lumina.Excel.Sheets; using Questionable.Controller; using Questionable.Data; using Questionable.Model; +using Questionable.Model.Common; using Questionable.Model.Questing; using GrandCompany = FFXIVClientStructs.FFXIV.Client.UI.Agent.GrandCompany; using Quest = Questionable.Model.Quest; @@ -33,6 +34,7 @@ internal sealed unsafe class QuestFunctions private readonly IDataManager _dataManager; private readonly IClientState _clientState; private readonly IGameGui _gameGui; + private readonly IAetheryteList _aetheryteList; public QuestFunctions( QuestRegistry questRegistry, @@ -43,7 +45,8 @@ internal sealed unsafe class QuestFunctions Configuration configuration, IDataManager dataManager, IClientState clientState, - IGameGui gameGui) + IGameGui gameGui, + IAetheryteList aetheryteList) { _questRegistry = questRegistry; _questData = questData; @@ -54,6 +57,7 @@ internal sealed unsafe class QuestFunctions _dataManager = dataManager; _clientState = clientState; _gameGui = gameGui; + _aetheryteList = aetheryteList; } public QuestReference GetCurrentQuest(bool allowNewMsq = true) @@ -439,12 +443,20 @@ internal sealed unsafe class QuestFunctions .ToList(); } - private static int EstimateTeleportCosts(Quest quest) + private int EstimateTeleportCosts(Quest quest) { - if (quest.Info.Expansion == EExpansionVersion.ARealmReborn) - return 300 * quest.AllSteps().Count(x => x.Step.AetheryteShortcut != null); - else - return 1000 * quest.AllSteps().Count(x => x.Step.AetheryteShortcut != null); + Dictionary cheapTeleports = _aetheryteList.Where(x => x.IsFavourite || x.GilCost == 0) + .ToDictionary(x => (EAetheryteLocation)x.AetheryteId, x => + { + if (x.GilCost == 0) + return 0; + else + return 0.5f; + }); + + int baseCost = quest.Info.Expansion == EExpansionVersion.ARealmReborn ? 300 : 1000; + return quest.AllSteps().Where(x => x.Step.AetheryteShortcut != null) + .Sum(x => (int)(baseCost * cheapTeleports.GetValueOrDefault(x.Step.AethernetShortcut!.From, 1f))); } public List GetPriorityQuests(bool onlyClassAndRoleQuests = false) -- 2.30.2