Remove estimated seals (wrong estimates), add some notes on seal overcapping
This commit is contained in:
parent
601c928f18
commit
a8ba89da4c
@ -120,6 +120,9 @@ partial class DeliverooPlugin
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This returns ALL items that can be turned in, regardless of filter settings.
|
||||||
|
/// </summary>
|
||||||
private unsafe List<TurnInItem> BuildTurnInList(AgentGrandCompanySupply* agent)
|
private unsafe List<TurnInItem> BuildTurnInList(AgentGrandCompanySupply* agent)
|
||||||
{
|
{
|
||||||
List<TurnInItem> list = new();
|
List<TurnInItem> list = new();
|
||||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Dalamud.Game.ClientState.Objects.Types;
|
using Dalamud.Game.ClientState.Objects.Types;
|
||||||
using Dalamud.Logging;
|
using Dalamud.Logging;
|
||||||
|
using Dalamud.Memory;
|
||||||
using Deliveroo.GameData;
|
using Deliveroo.GameData;
|
||||||
using FFXIVClientStructs.FFXIV.Client.UI;
|
using FFXIVClientStructs.FFXIV.Client.UI;
|
||||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||||
@ -72,11 +73,13 @@ partial class DeliverooPlugin
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
AtkUnitBase* addon = GetAddonById(addonId);
|
AtkUnitBase* addon = GetAddonById(addonId);
|
||||||
if (addon == null || !IsAddonReady(addon) || addon->UldManager.NodeListCount <= 20 ||
|
if (addon == null || !IsAddonReady(addon) || addon->UldManager.NodeListCount <= 20)
|
||||||
!addon->UldManager.NodeList[5]->IsVisible)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var addonGc = (AddonGrandCompanySupplyList*)addon;
|
var addonGc = (AddonGrandCompanySupplyList*)addon;
|
||||||
|
if (addonGc->ExpertDeliveryList == null || !addonGc->ExpertDeliveryList->AtkComponentBase.OwnerNode->AtkResNode.IsVisible)
|
||||||
|
return;
|
||||||
|
|
||||||
if (addonGc->SelectedTab != 2)
|
if (addonGc->SelectedTab != 2)
|
||||||
{
|
{
|
||||||
_turnInWindow.Error = "Wrong tab selected";
|
_turnInWindow.Error = "Wrong tab selected";
|
||||||
@ -90,16 +93,42 @@ partial class DeliverooPlugin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var agent = (AgentGrandCompanySupply*)agentInterface;
|
if (addonGc->ListEmptyTextNode->AtkResNode.IsVisible)
|
||||||
List<TurnInItem> items = BuildTurnInList(agent);
|
|
||||||
_turnInWindow.EstimatedGcSeals = GetCurrentSealCount() + items.Sum(x => x.SealsWithBonus);
|
|
||||||
if (items.Count == 0 || addon->UldManager.NodeList[20]->IsVisible)
|
|
||||||
{
|
{
|
||||||
CurrentStage = Stage.CloseGcSupplyThenStop;
|
CurrentStage = Stage.CloseGcSupplyThenStop;
|
||||||
addon->FireCallbackInt(-1);
|
addon->FireCallbackInt(-1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var agent = (AgentGrandCompanySupply*)agentInterface;
|
||||||
|
List<TurnInItem> items = BuildTurnInList(agent);
|
||||||
|
if (items.Count == 0)
|
||||||
|
{
|
||||||
|
// probably shouldn't happen with the previous node visibility check
|
||||||
|
CurrentStage = Stage.CloseGcSupplyThenStop;
|
||||||
|
addon->FireCallbackInt(-1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO The way the items are handled above, we don't actually know if items[0] is the first visible item
|
||||||
|
// in the list, it is "only" the highest-value item to turn in.
|
||||||
|
//
|
||||||
|
// For example, if you have
|
||||||
|
// - Trojan Ring, SealsWithoutBonus = 1887, part of a gear set
|
||||||
|
// - Radiant Battleaxe, SealsWithoutBonus = 1879, not part of a gear set
|
||||||
|
// then this algorithm will ensure that you have enough space for the highest-value item (trojan ring), even
|
||||||
|
// though it turn in the Radiant Battleaxe.
|
||||||
|
//
|
||||||
|
// Alternatively, and probably easier:
|
||||||
|
// - look up how many seals the first item gets
|
||||||
|
// - find *any* item in the list with that seal count (and possibly matching the name) to determine the
|
||||||
|
// seals with bonus + whether it exists
|
||||||
|
// - use that item instead of items[0] here
|
||||||
|
//
|
||||||
|
// However, since this never over-caps seals, this isn't a very high priority.
|
||||||
|
// ---------------------------------------------------------------------------------------------------------
|
||||||
|
// TODO If we ever manage to obtain a mapping name to itemId here, we can try and exclude e.g. Red Onion
|
||||||
|
// Helms from being turned in.
|
||||||
if (GetCurrentSealCount() + items[0].SealsWithBonus > GetSealCap())
|
if (GetCurrentSealCount() + items[0].SealsWithBonus > GetSealCap())
|
||||||
{
|
{
|
||||||
CurrentStage = Stage.CloseGcSupply;
|
CurrentStage = Stage.CloseGcSupply;
|
||||||
|
@ -1,32 +1,21 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using Dalamud.Data;
|
using Dalamud.Data;
|
||||||
using Dalamud.Game;
|
using Dalamud.Game;
|
||||||
using Dalamud.Game.ClientState;
|
using Dalamud.Game.ClientState;
|
||||||
using Dalamud.Game.ClientState.Objects;
|
using Dalamud.Game.ClientState.Objects;
|
||||||
using Dalamud.Game.ClientState.Objects.Enums;
|
|
||||||
using Dalamud.Game.ClientState.Objects.Types;
|
using Dalamud.Game.ClientState.Objects.Types;
|
||||||
using Dalamud.Game.Gui;
|
using Dalamud.Game.Gui;
|
||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Interface.Windowing;
|
||||||
using Dalamud.Logging;
|
using Dalamud.Logging;
|
||||||
using Dalamud.Memory;
|
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
using Deliveroo.External;
|
using Deliveroo.External;
|
||||||
using Deliveroo.GameData;
|
using Deliveroo.GameData;
|
||||||
using Deliveroo.Windows;
|
using Deliveroo.Windows;
|
||||||
using FFXIVClientStructs.FFXIV.Client.Game;
|
|
||||||
using FFXIVClientStructs.FFXIV.Client.Game.Control;
|
|
||||||
using FFXIVClientStructs.FFXIV.Client.Game.UI;
|
|
||||||
using FFXIVClientStructs.FFXIV.Client.UI;
|
using FFXIVClientStructs.FFXIV.Client.UI;
|
||||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
|
||||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||||
using Lumina.Excel.GeneratedSheets;
|
using Lumina.Excel.GeneratedSheets;
|
||||||
using Character = Dalamud.Game.ClientState.Objects.Types.Character;
|
|
||||||
using GrandCompany = FFXIVClientStructs.FFXIV.Client.UI.Agent.GrandCompany;
|
|
||||||
using ValueType = FFXIVClientStructs.FFXIV.Component.GUI.ValueType;
|
|
||||||
|
|
||||||
namespace Deliveroo;
|
namespace Deliveroo;
|
||||||
|
|
||||||
|
@ -47,7 +47,6 @@ internal sealed class TurnInWindow : Window
|
|||||||
|
|
||||||
public bool State { get; set; }
|
public bool State { get; set; }
|
||||||
public decimal Multiplier { private get; set; }
|
public decimal Multiplier { private get; set; }
|
||||||
public int EstimatedGcSeals { private get; set; }
|
|
||||||
public string Error { private get; set; } = string.Empty;
|
public string Error { private get; set; } = string.Empty;
|
||||||
|
|
||||||
public List<PurchaseItemRequest> SelectedItems
|
public List<PurchaseItemRequest> SelectedItems
|
||||||
@ -135,15 +134,6 @@ internal sealed class TurnInWindow : Window
|
|||||||
|
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
ImGui.Text($"Debug (State): {_plugin.CurrentStage}");
|
ImGui.Text($"Debug (State): {_plugin.CurrentStage}");
|
||||||
switch (_plugin.CurrentStage)
|
|
||||||
{
|
|
||||||
case Stage.SelectItemToTurnIn:
|
|
||||||
case Stage.TurnInSelected:
|
|
||||||
case Stage.FinalizeTurnIn:
|
|
||||||
case Stage.CloseGcSupply:
|
|
||||||
ImGui.Text($"Estimated Total Seal Count: {EstimatedGcSeals:N0}");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawItemsToBuy(GrandCompany grandCompany)
|
private void DrawItemsToBuy(GrandCompany grandCompany)
|
||||||
|
Loading…
Reference in New Issue
Block a user