forked from liza/Questionable
master #2
@ -12,11 +12,11 @@ using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||
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;
|
||||
@ -32,6 +32,7 @@ internal sealed unsafe class QuestFunctions
|
||||
private readonly IDataManager _dataManager;
|
||||
private readonly IClientState _clientState;
|
||||
private readonly IGameGui _gameGui;
|
||||
private readonly ILogger<QuestFunctions> _logger;
|
||||
|
||||
public QuestFunctions(
|
||||
QuestRegistry questRegistry,
|
||||
@ -40,7 +41,8 @@ internal sealed unsafe class QuestFunctions
|
||||
Configuration configuration,
|
||||
IDataManager dataManager,
|
||||
IClientState clientState,
|
||||
IGameGui gameGui)
|
||||
IGameGui gameGui,
|
||||
ILogger<QuestFunctions> logger)
|
||||
{
|
||||
_questRegistry = questRegistry;
|
||||
_questData = questData;
|
||||
@ -49,6 +51,7 @@ internal sealed unsafe class QuestFunctions
|
||||
_dataManager = dataManager;
|
||||
_clientState = clientState;
|
||||
_gameGui = gameGui;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public (ElementId? CurrentQuest, byte Sequence) GetCurrentQuest()
|
||||
@ -251,8 +254,7 @@ internal sealed unsafe class QuestFunctions
|
||||
//
|
||||
// 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 =>
|
||||
@ -278,11 +280,20 @@ internal sealed unsafe class QuestFunctions
|
||||
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) ||
|
||||
@ -294,6 +305,17 @@ internal sealed unsafe class QuestFunctions
|
||||
});
|
||||
}
|
||||
|
||||
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 =
|
||||
|
Loading…
Reference in New Issue
Block a user