forked from liza/Deliveroo
Make reserved seal count configurable, load seal cap from excel
This commit is contained in:
parent
a9b72380cd
commit
7a5dbe095d
@ -9,4 +9,6 @@ internal sealed class Configuration : IPluginConfiguration
|
|||||||
|
|
||||||
public List<uint> ItemsAvailableForPurchase { get; set; } = new();
|
public List<uint> ItemsAvailableForPurchase { get; set; } = new();
|
||||||
public uint SelectedPurchaseItemId { get; set; } = 0;
|
public uint SelectedPurchaseItemId { get; set; } = 0;
|
||||||
|
|
||||||
|
public int ReservedSealCount { get; set; } = 0;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,9 @@ 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.Client.UI.Agent;
|
||||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||||
|
using Lumina.Excel.GeneratedSheets;
|
||||||
using Character = Dalamud.Game.ClientState.Objects.Types.Character;
|
using Character = Dalamud.Game.ClientState.Objects.Types.Character;
|
||||||
|
using GrandCompany = FFXIVClientStructs.FFXIV.Client.UI.Agent.GrandCompany;
|
||||||
using ValueType = FFXIVClientStructs.FFXIV.Component.GUI.ValueType;
|
using ValueType = FFXIVClientStructs.FFXIV.Component.GUI.ValueType;
|
||||||
|
|
||||||
namespace Deliveroo;
|
namespace Deliveroo;
|
||||||
@ -41,10 +43,12 @@ public sealed class DeliverooPlugin : IDalamudPlugin
|
|||||||
|
|
||||||
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
|
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
|
||||||
private readonly Configuration _configuration;
|
private readonly Configuration _configuration;
|
||||||
|
|
||||||
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
|
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
|
||||||
private readonly GcRewardsCache _gcRewardsCache;
|
private readonly GcRewardsCache _gcRewardsCache;
|
||||||
private readonly ConfigWindow _configWindow;
|
private readonly ConfigWindow _configWindow;
|
||||||
private readonly TurnInWindow _turnInWindow;
|
private readonly TurnInWindow _turnInWindow;
|
||||||
|
private readonly IReadOnlyDictionary<uint, uint> _sealCaps;
|
||||||
|
|
||||||
private Stage _currentStageInternal = Stage.Stop;
|
private Stage _currentStageInternal = Stage.Stop;
|
||||||
private DateTime _continueAt = DateTime.MinValue;
|
private DateTime _continueAt = DateTime.MinValue;
|
||||||
@ -68,6 +72,8 @@ public sealed class DeliverooPlugin : IDalamudPlugin
|
|||||||
_windowSystem.AddWindow(_configWindow);
|
_windowSystem.AddWindow(_configWindow);
|
||||||
_turnInWindow = new TurnInWindow(this, _pluginInterface, _configuration, _gcRewardsCache);
|
_turnInWindow = new TurnInWindow(this, _pluginInterface, _configuration, _gcRewardsCache);
|
||||||
_windowSystem.AddWindow(_turnInWindow);
|
_windowSystem.AddWindow(_turnInWindow);
|
||||||
|
_sealCaps = dataManager.GetExcelSheet<GrandCompanyRank>()!.Where(x => x.RowId > 0)
|
||||||
|
.ToDictionary(x => x.RowId, x => x.MaxSeals);
|
||||||
|
|
||||||
_framework.Update += FrameworkUpdate;
|
_framework.Update += FrameworkUpdate;
|
||||||
_pluginInterface.UiBuilder.Draw += _windowSystem.Draw;
|
_pluginInterface.UiBuilder.Draw += _windowSystem.Draw;
|
||||||
@ -252,7 +258,8 @@ public sealed class DeliverooPlugin : IDalamudPlugin
|
|||||||
_turnInWindow.State = false;
|
_turnInWindow.State = false;
|
||||||
CurrentStage = Stage.Stop;
|
CurrentStage = Stage.Stop;
|
||||||
}
|
}
|
||||||
else if (GetCurrentSealCount() <= 2000 + _selectedRewardItem.SealCost)
|
else if (GetCurrentSealCount() <=
|
||||||
|
_configuration.ReservedSealCount + _selectedRewardItem.SealCost)
|
||||||
{
|
{
|
||||||
_turnInWindow.State = false;
|
_turnInWindow.State = false;
|
||||||
CurrentStage = Stage.Stop;
|
CurrentStage = Stage.Stop;
|
||||||
@ -267,7 +274,7 @@ public sealed class DeliverooPlugin : IDalamudPlugin
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Stage.TargetQuartermaster:
|
case Stage.TargetQuartermaster:
|
||||||
if (GetCurrentSealCount() < 2000) // fixme this should be selectable/dependent on shop item
|
if (GetCurrentSealCount() < _configuration.ReservedSealCount)
|
||||||
{
|
{
|
||||||
CurrentStage = Stage.Stop;
|
CurrentStage = Stage.Stop;
|
||||||
break;
|
break;
|
||||||
@ -499,7 +506,7 @@ public sealed class DeliverooPlugin : IDalamudPlugin
|
|||||||
uint itemId = addonExchange->AtkValues[317 + i].UInt;
|
uint itemId = addonExchange->AtkValues[317 + i].UInt;
|
||||||
if (itemId == _selectedRewardItem.ItemId)
|
if (itemId == _selectedRewardItem.ItemId)
|
||||||
{
|
{
|
||||||
long toBuy = (GetCurrentSealCount() - 2000) / _selectedRewardItem.SealCost;
|
long toBuy = (GetCurrentSealCount() - _configuration.ReservedSealCount) / _selectedRewardItem.SealCost;
|
||||||
bool isVenture = _selectedRewardItem.ItemId == ItemIds.Venture;
|
bool isVenture = _selectedRewardItem.ItemId == ItemIds.Venture;
|
||||||
if (isVenture)
|
if (isVenture)
|
||||||
toBuy = Math.Min(toBuy, 65000 - GetCurrentVentureCount());
|
toBuy = Math.Min(toBuy, 65000 - GetCurrentVentureCount());
|
||||||
@ -575,24 +582,7 @@ public sealed class DeliverooPlugin : IDalamudPlugin
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private int GetSealCap()
|
private uint GetSealCap() => _sealCaps.TryGetValue(GetGrandCompanyRank(), out var cap) ? cap : 0;
|
||||||
{
|
|
||||||
return GetGrandCompanyRank() switch
|
|
||||||
{
|
|
||||||
1 => 10_000,
|
|
||||||
2 => 15_000,
|
|
||||||
3 => 20_000,
|
|
||||||
4 => 25_000,
|
|
||||||
5 => 30_000,
|
|
||||||
6 => 35_000,
|
|
||||||
7 => 40_000,
|
|
||||||
8 => 45_000,
|
|
||||||
9 => 50_000,
|
|
||||||
10 => 80_000,
|
|
||||||
11 => 90_000,
|
|
||||||
_ => 0,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private unsafe int GetCurrentVentureCount()
|
private unsafe int GetCurrentVentureCount()
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
using Dalamud.Interface;
|
||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Interface.Windowing;
|
||||||
using Dalamud.Logging;
|
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
using Deliveroo.GameData;
|
using Deliveroo.GameData;
|
||||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||||
@ -34,106 +35,144 @@ internal sealed class ConfigWindow : Window
|
|||||||
.Distinct()
|
.Distinct()
|
||||||
.ToDictionary(x => x.ItemId, x => x);
|
.ToDictionary(x => x.ItemId, x => x);
|
||||||
|
|
||||||
Size = new Vector2(400, 300);
|
Size = new Vector2(420, 300);
|
||||||
SizeCondition = ImGuiCond.Appearing;
|
SizeCondition = ImGuiCond.Appearing;
|
||||||
|
|
||||||
|
SizeConstraints = new WindowSizeConstraints
|
||||||
|
{
|
||||||
|
MinimumSize = new Vector2(420, 300),
|
||||||
|
MaximumSize = new Vector2(9999, 9999),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public override unsafe void Draw()
|
public override void Draw()
|
||||||
{
|
{
|
||||||
ImGui.Text("Items available for Auto-Buy:");
|
|
||||||
uint? itemToRemove = null;
|
|
||||||
uint? itemToAdd = null;
|
|
||||||
int indexToAdd = 0;
|
|
||||||
|
|
||||||
if (_configuration.ItemsAvailableForPurchase.Count == 0)
|
if (_configuration.ItemsAvailableForPurchase.Count == 0)
|
||||||
{
|
{
|
||||||
_configuration.ItemsAvailableForPurchase.Add(ItemIds.Venture);
|
_configuration.ItemsAvailableForPurchase.Add(ItemIds.Venture);
|
||||||
_pluginInterface.SavePluginConfig(_configuration);
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui.BeginChild("Items", new Vector2(-1, -30), true, ImGuiWindowFlags.NoSavedSettings))
|
if (ImGui.BeginTabBar("DeliverooConfigTabs"))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _configuration.ItemsAvailableForPurchase.Count; ++i)
|
DrawBuyList();
|
||||||
{
|
DrawAdditionalSettings();
|
||||||
uint itemId = _configuration.ItemsAvailableForPurchase[i];
|
|
||||||
ImGui.PushID($"###Item{i}");
|
|
||||||
ImGui.BeginDisabled(_configuration.ItemsAvailableForPurchase.Count == 1 && itemId == ItemIds.Venture);
|
|
||||||
|
|
||||||
ImGui.Selectable(_itemLookup[itemId].Name);
|
ImGui.EndTabBar();
|
||||||
|
|
||||||
if (ImGui.BeginDragDropSource())
|
|
||||||
{
|
|
||||||
ImGui.SetDragDropPayload("DeliverooDragDrop", nint.Zero, 0);
|
|
||||||
_dragDropSource = itemId;
|
|
||||||
|
|
||||||
ImGui.EndDragDropSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui.BeginDragDropTarget() &&
|
|
||||||
_dragDropSource > 0 &&
|
|
||||||
ImGui.AcceptDragDropPayload("DeliverooDragDrop").NativePtr != null)
|
|
||||||
{
|
|
||||||
itemToAdd = _dragDropSource;
|
|
||||||
indexToAdd = i;
|
|
||||||
|
|
||||||
ImGui.EndDragDropTarget();
|
|
||||||
_dragDropSource = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui.OpenPopupOnItemClick($"###ctx{i}", ImGuiPopupFlags.MouseButtonRight);
|
|
||||||
if (ImGui.BeginPopup($"###ctx{i}"))
|
|
||||||
{
|
|
||||||
if (ImGui.Selectable($"Remove {_itemLookup[itemId].Name}"))
|
|
||||||
itemToRemove = itemId;
|
|
||||||
|
|
||||||
ImGui.EndPopup();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui.EndDisabled();
|
|
||||||
ImGui.PopID();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndChild();
|
|
||||||
|
|
||||||
if (itemToRemove != null)
|
|
||||||
{
|
|
||||||
_configuration.ItemsAvailableForPurchase.Remove(itemToRemove.Value);
|
|
||||||
_pluginInterface.SavePluginConfig(_configuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (itemToAdd != null)
|
|
||||||
{
|
|
||||||
_configuration.ItemsAvailableForPurchase.Remove(itemToAdd.Value);
|
|
||||||
_configuration.ItemsAvailableForPurchase.Insert(indexToAdd, itemToAdd.Value);
|
|
||||||
_pluginInterface.SavePluginConfig(_configuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_plugin.GetGrandCompany() != GrandCompany.None)
|
|
||||||
{
|
|
||||||
List<(uint ItemId, string Name)> comboValues = _gcRewardsCache.Rewards[_plugin.GetGrandCompany()]
|
|
||||||
.Where(x => x.SubCategory == RewardSubCategory.Materials || x.SubCategory == RewardSubCategory.Materiel)
|
|
||||||
.Where(x => x.StackSize > 1)
|
|
||||||
.Where(x => !_configuration.ItemsAvailableForPurchase.Contains(x.ItemId))
|
|
||||||
.Select(x => (x.ItemId, x.Name))
|
|
||||||
.OrderBy(x => x.Name)
|
|
||||||
.ThenBy(x => x.GetHashCode())
|
|
||||||
.ToList();
|
|
||||||
comboValues.Insert(0, (0, ""));
|
|
||||||
|
|
||||||
int currentItem = 0;
|
|
||||||
if (ImGui.Combo("Add Item", ref currentItem, comboValues.Select(x => x.Name).ToArray(), comboValues.Count))
|
|
||||||
{
|
|
||||||
_configuration.ItemsAvailableForPurchase.Add(comboValues[currentItem].ItemId);
|
|
||||||
_pluginInterface.SavePluginConfig(_configuration);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int currentItem = 0;
|
|
||||||
ImGui.Combo("Add Item", ref currentItem, new string[] { "(Not part of a GC)" }, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui.Unindent(30);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private unsafe void DrawBuyList()
|
||||||
|
{
|
||||||
|
if (ImGui.BeginTabItem("Items for Auto-Buy"))
|
||||||
|
{
|
||||||
|
uint? itemToRemove = null;
|
||||||
|
uint? itemToAdd = null;
|
||||||
|
int indexToAdd = 0;
|
||||||
|
if (ImGui.BeginChild("Items", new Vector2(-1, -30), true, ImGuiWindowFlags.NoSavedSettings))
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _configuration.ItemsAvailableForPurchase.Count; ++i)
|
||||||
|
{
|
||||||
|
uint itemId = _configuration.ItemsAvailableForPurchase[i];
|
||||||
|
ImGui.PushID($"###Item{i}");
|
||||||
|
ImGui.BeginDisabled(
|
||||||
|
_configuration.ItemsAvailableForPurchase.Count == 1 && itemId == ItemIds.Venture);
|
||||||
|
|
||||||
|
ImGui.Selectable(_itemLookup[itemId].Name);
|
||||||
|
|
||||||
|
if (ImGui.BeginDragDropSource())
|
||||||
|
{
|
||||||
|
ImGui.SetDragDropPayload("DeliverooDragDrop", nint.Zero, 0);
|
||||||
|
_dragDropSource = itemId;
|
||||||
|
|
||||||
|
ImGui.EndDragDropSource();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui.BeginDragDropTarget() &&
|
||||||
|
_dragDropSource > 0 &&
|
||||||
|
ImGui.AcceptDragDropPayload("DeliverooDragDrop").NativePtr != null)
|
||||||
|
{
|
||||||
|
itemToAdd = _dragDropSource;
|
||||||
|
indexToAdd = i;
|
||||||
|
|
||||||
|
ImGui.EndDragDropTarget();
|
||||||
|
_dragDropSource = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.OpenPopupOnItemClick($"###ctx{i}", ImGuiPopupFlags.MouseButtonRight);
|
||||||
|
if (ImGui.BeginPopup($"###ctx{i}"))
|
||||||
|
{
|
||||||
|
if (ImGui.Selectable($"Remove {_itemLookup[itemId].Name}"))
|
||||||
|
itemToRemove = itemId;
|
||||||
|
|
||||||
|
ImGui.EndPopup();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.EndDisabled();
|
||||||
|
ImGui.PopID();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.EndChild();
|
||||||
|
|
||||||
|
if (itemToRemove != null)
|
||||||
|
{
|
||||||
|
_configuration.ItemsAvailableForPurchase.Remove(itemToRemove.Value);
|
||||||
|
Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itemToAdd != null)
|
||||||
|
{
|
||||||
|
_configuration.ItemsAvailableForPurchase.Remove(itemToAdd.Value);
|
||||||
|
_configuration.ItemsAvailableForPurchase.Insert(indexToAdd, itemToAdd.Value);
|
||||||
|
Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_plugin.GetGrandCompany() != GrandCompany.None)
|
||||||
|
{
|
||||||
|
List<(uint ItemId, string Name)> comboValues = _gcRewardsCache.Rewards[_plugin.GetGrandCompany()]
|
||||||
|
.Where(x => x.SubCategory == RewardSubCategory.Materials ||
|
||||||
|
x.SubCategory == RewardSubCategory.Materiel)
|
||||||
|
.Where(x => x.StackSize > 1)
|
||||||
|
.Where(x => !_configuration.ItemsAvailableForPurchase.Contains(x.ItemId))
|
||||||
|
.Select(x => (x.ItemId, x.Name))
|
||||||
|
.OrderBy(x => x.Name)
|
||||||
|
.ThenBy(x => x.GetHashCode())
|
||||||
|
.ToList();
|
||||||
|
comboValues.Insert(0, (0, ""));
|
||||||
|
|
||||||
|
int currentItem = 0;
|
||||||
|
if (ImGui.Combo("Add Item", ref currentItem, comboValues.Select(x => x.Name).ToArray(),
|
||||||
|
comboValues.Count))
|
||||||
|
{
|
||||||
|
_configuration.ItemsAvailableForPurchase.Add(comboValues[currentItem].ItemId);
|
||||||
|
Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int currentItem = 0;
|
||||||
|
ImGui.Combo("Add Item", ref currentItem, new string[] { "(Not part of a GC)" }, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.EndTabItem();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawAdditionalSettings()
|
||||||
|
{
|
||||||
|
if (ImGui.BeginTabItem("Additional Settings"))
|
||||||
|
{
|
||||||
|
ImGui.SetNextItemWidth(ImGuiHelpers.GlobalScale * 100);
|
||||||
|
int reservedSealCount = _configuration.ReservedSealCount;
|
||||||
|
if (ImGui.InputInt("Minimum Seals to keep (e.g. for Squadron Missions)", ref reservedSealCount, 1000))
|
||||||
|
{
|
||||||
|
_configuration.ReservedSealCount = Math.Max(0, Math.Min(90_000, reservedSealCount));
|
||||||
|
Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void Save() => _pluginInterface.SavePluginConfig(_configuration);
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ using System.Linq;
|
|||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using Dalamud.Interface.Colors;
|
using Dalamud.Interface.Colors;
|
||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Interface.Windowing;
|
||||||
using Dalamud.Logging;
|
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
using Deliveroo.GameData;
|
using Deliveroo.GameData;
|
||||||
using FFXIVClientStructs.FFXIV.Client.Game;
|
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||||
@ -93,49 +92,49 @@ internal sealed class TurnInWindow : Window
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool state = State;
|
bool state = State;
|
||||||
if (ImGui.Checkbox("Handle GC turn ins/exchange automatically", ref state))
|
if (ImGui.Checkbox("Handle GC turn ins/exchange automatically", ref state))
|
||||||
{
|
{
|
||||||
State = state;
|
State = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.Indent(27);
|
ImGui.Indent(27);
|
||||||
if (Multiplier == 1m)
|
if (Multiplier == 1m)
|
||||||
{
|
{
|
||||||
ImGui.TextColored(ImGuiColors.DalamudRed, "You do not have an active seal buff.");
|
ImGui.TextColored(ImGuiColors.DalamudRed, "You do not have an active seal buff.");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui.TextColored(ImGuiColors.HealerGreen, $"Current Buff: {(Multiplier - 1m) * 100:N0}%%");
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.Spacing();
|
||||||
|
ImGui.BeginDisabled(state);
|
||||||
|
|
||||||
|
List<string> comboValues = new() { GcRewardItem.None.Name };
|
||||||
|
foreach (var itemId in _configuration.ItemsAvailableForPurchase)
|
||||||
|
{
|
||||||
|
var name = _gcRewardsCache.Rewards[grandCompany].First(x => x.ItemId == itemId).Name;
|
||||||
|
int itemCount = GetItemCount(itemId);
|
||||||
|
if (itemCount > 0)
|
||||||
|
comboValues.Add($"{name} ({itemCount:N0})");
|
||||||
else
|
else
|
||||||
{
|
comboValues.Add(name);
|
||||||
ImGui.TextColored(ImGuiColors.HealerGreen, $"Current Buff: {(Multiplier - 1m) * 100:N0}%%");
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ImGui.Spacing();
|
if (ImGui.Combo("", ref _selectedAutoBuyItem, comboValues.ToArray(), comboValues.Count))
|
||||||
ImGui.BeginDisabled(state);
|
{
|
||||||
|
_configuration.SelectedPurchaseItemId = SelectedItemId;
|
||||||
|
_pluginInterface.SavePluginConfig(_configuration);
|
||||||
|
}
|
||||||
|
|
||||||
List<string> comboValues = new() { GcRewardItem.None.Name };
|
if (SelectedItem.IsValid() && SelectedItem.RequiredRank > _plugin.GetGrandCompanyRank())
|
||||||
foreach (var itemId in _configuration.ItemsAvailableForPurchase)
|
ImGui.TextColored(ImGuiColors.DalamudRed, "Your rank isn't high enough to buy this item.");
|
||||||
{
|
|
||||||
var name = _gcRewardsCache.Rewards[grandCompany].First(x => x.ItemId == itemId).Name;
|
|
||||||
int itemCount = GetItemCount(itemId);
|
|
||||||
if (itemCount > 0)
|
|
||||||
comboValues.Add($"{name} ({itemCount:N0})");
|
|
||||||
else
|
|
||||||
comboValues.Add(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui.Combo("", ref _selectedAutoBuyItem, comboValues.ToArray(), comboValues.Count))
|
ImGui.EndDisabled();
|
||||||
{
|
ImGui.Unindent(27);
|
||||||
_configuration.SelectedPurchaseItemId = SelectedItemId;
|
|
||||||
_pluginInterface.SavePluginConfig(_configuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SelectedItem.IsValid() && SelectedItem.RequiredRank > _plugin.GetGrandCompanyRank())
|
ImGui.Separator();
|
||||||
ImGui.TextColored(ImGuiColors.DalamudRed, "Your rank isn't high enough to buy this item.");
|
ImGui.Text($"Debug (State): {_plugin.CurrentStage}");
|
||||||
|
|
||||||
ImGui.EndDisabled();
|
|
||||||
ImGui.Unindent(27);
|
|
||||||
|
|
||||||
ImGui.Separator();
|
|
||||||
ImGui.Text($"Debug (State): {_plugin.CurrentStage}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private unsafe int GetItemCount(uint itemId)
|
private unsafe int GetItemCount(uint itemId)
|
||||||
|
Loading…
Reference in New Issue
Block a user