using LLib.GameData;
using LLib.GameUI;
using Lumina.Excel.GeneratedSheets;
+using Microsoft.Extensions.Logging;
using Questionable.Controller;
using Questionable.Controller.Steps.Interactions;
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;
private readonly IDataManager _dataManager;
private readonly IClientState _clientState;
private readonly IGameGui _gameGui;
+ private readonly ILogger<QuestFunctions> _logger;
public QuestFunctions(
QuestRegistry questRegistry,
Configuration configuration,
IDataManager dataManager,
IClientState clientState,
- IGameGui gameGui)
+ IGameGui gameGui,
+ ILogger<QuestFunctions> logger)
{
_questRegistry = questRegistry;
_questData = questData;
_dataManager = dataManager;
_clientState = clientState;
_gameGui = gameGui;
+ _logger = logger;
}
public (ElementId? CurrentQuest, byte Sequence) GetCurrentQuest()
//
// Of course, they can still be accepted manually.
InventoryManager* inventoryManager = InventoryManager.Instance();
- if (inventoryManager->GetItemCountInContainer(1, InventoryType.Currency) < 2000)
- return null;
+ int gil = inventoryManager->GetItemCountInContainer(1, InventoryType.Currency);
return GetPriorityQuestsThatCanBeAccepted()
.Where(x =>
if (!_questRegistry.TryGetQuest(x, out Quest? quest))
return false;
+ if (gil < EstimateTeleportCosts(quest))
+ return false;
+
return quest.AllSteps().All(y =>
{
if (y.Step.AetheryteShortcut is { } aetheryteShortcut &&
- _aetheryteFunctions.IsAetheryteUnlocked(aetheryteShortcut))
- return false;
+ !_aetheryteFunctions.IsAetheryteUnlocked(aetheryteShortcut))
+ {
+ if (y.Step.SkipConditions?.AetheryteShortcutIf?.AetheryteLocked == aetheryteShortcut)
+ {
+ // _logger.LogTrace("Checking priority quest {QuestId}: aetheryte locked, but is listed as skippable", quest.Id);
+ }
+ else return false;
+ }
if (y.Step.AethernetShortcut is { } aethernetShortcut &&
(!_aetheryteFunctions.IsAetheryteUnlocked(aethernetShortcut.From) ||
});
}
+ private static 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);
+ */
+ return 0;
+ }
+
private List<ElementId> GetPriorityQuestsThatCanBeAccepted()
{
List<ElementId> priorityQuests =