Compare commits
No commits in common. "master" and "v5.2" have entirely different histories.
@ -1,6 +1,6 @@
|
||||
<Project Sdk="Dalamud.NET.Sdk/9.0.2">
|
||||
<PropertyGroup>
|
||||
<Version>5.8</Version>
|
||||
<Version>5.2</Version>
|
||||
<OutputPath>dist</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -44,16 +44,6 @@ partial class AutoRetainerControlPlugin
|
||||
save = true;
|
||||
}
|
||||
|
||||
if (_clientState.LocalContentId == registeredCharacterId)
|
||||
{
|
||||
var unlockedFolkloreBooks = _gameCache.FolkloreBooks.Values.Where(x => x.IsUnlocked()).Select(x => x.ItemId).ToHashSet();
|
||||
if (character.UnlockedFolkloreBooks != unlockedFolkloreBooks)
|
||||
{
|
||||
character.UnlockedFolkloreBooks = unlockedFolkloreBooks;
|
||||
save = true;
|
||||
}
|
||||
}
|
||||
|
||||
// remove retainers without name
|
||||
save |= character.Retainers.RemoveAll(x => string.IsNullOrEmpty(x.Name)) > 0;
|
||||
|
||||
|
@ -63,7 +63,7 @@ public sealed partial class AutoRetainerControlPlugin : IDalamudPlugin
|
||||
_allaganToolsIpc = new AllaganToolsIpc(pluginInterface, pluginLog);
|
||||
_configWindow =
|
||||
new ConfigWindow(_pluginInterface, _configuration, _gameCache, _clientState, _commandManager, _iconCache,
|
||||
discardHelperIpc, _allaganToolsIpc, _pluginLog);
|
||||
discardHelperIpc, _pluginLog);
|
||||
_windowSystem.AddWindow(_configWindow);
|
||||
|
||||
ECommonsMain.Init(_pluginInterface, this);
|
||||
|
@ -81,7 +81,6 @@ internal sealed class Configuration : IPluginConfiguration
|
||||
|
||||
public List<RetainerConfiguration> Retainers { get; set; } = new();
|
||||
public HashSet<uint> GatheredItems { get; set; } = new();
|
||||
public HashSet<uint> UnlockedFolkloreBooks { get; set; } = new();
|
||||
|
||||
public override string ToString() => $"{CharacterName} @ {WorldName}";
|
||||
}
|
||||
|
31
ARControl/External/AllaganToolsIpc.cs
vendored
31
ARControl/External/AllaganToolsIpc.cs
vendored
@ -1,6 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Linq;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Ipc;
|
||||
using Dalamud.Plugin.Ipc.Exceptions;
|
||||
@ -22,44 +20,17 @@ internal sealed class AllaganToolsIpc
|
||||
InventoryType.RetainerPage5,
|
||||
InventoryType.RetainerPage6,
|
||||
InventoryType.RetainerPage7,
|
||||
InventoryType.RetainerCrystals,
|
||||
}
|
||||
.Select(x => (uint)x).ToArray();
|
||||
|
||||
private readonly ICallGateSubscriber<ulong,HashSet<ulong[]>> _getClownItems;
|
||||
private readonly ICallGateSubscriber<uint, bool, uint[], uint> _itemCountOwned;
|
||||
|
||||
public AllaganToolsIpc(IDalamudPluginInterface pluginInterface, IPluginLog pluginLog)
|
||||
{
|
||||
_pluginLog = pluginLog;
|
||||
_getClownItems = pluginInterface.GetIpcSubscriber<ulong, HashSet<ulong[]>>("AllaganTools.GetCharacterItems");
|
||||
_itemCountOwned = pluginInterface.GetIpcSubscriber<uint, bool, uint[], uint>("AllaganTools.ItemCountOwned");
|
||||
}
|
||||
|
||||
public List<(uint ItemId, uint Quantity)> GetCharacterItems(ulong contentId)
|
||||
{
|
||||
try
|
||||
{
|
||||
HashSet<ulong[]> items = _getClownItems.InvokeFunc(contentId);
|
||||
_pluginLog.Information($"CID: {contentId}, Items: {items.Count}");
|
||||
|
||||
return items.Select(x => (ItemId: (uint)x[2], Quantity: (uint)x[3]))
|
||||
.GroupBy(x => x.ItemId)
|
||||
.Select(x => (x.Key, (uint)x.Sum(y => y.Quantity)))
|
||||
.ToList();
|
||||
}
|
||||
catch (TargetInvocationException e)
|
||||
{
|
||||
_pluginLog.Information(e, $"Unable to retrieve items for character {contentId}");
|
||||
return [];
|
||||
}
|
||||
catch (IpcError)
|
||||
{
|
||||
_pluginLog.Warning("Could not query allagantools for character items");
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
public uint GetRetainerItemCount(uint itemId)
|
||||
{
|
||||
try
|
||||
|
@ -1,18 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.UI;
|
||||
|
||||
namespace ARControl.GameData;
|
||||
|
||||
internal sealed class FolkloreBook
|
||||
{
|
||||
public required uint ItemId { get; init; }
|
||||
public required string Name { get; init; }
|
||||
public required IReadOnlyList<ushort> GatheringSubCategories { get; init; }
|
||||
public List<uint> GatheringItemIds { get; } = [];
|
||||
public ushort TomeId { get; set; }
|
||||
|
||||
public unsafe bool IsUnlocked()
|
||||
{
|
||||
return PlayerState.Instance()->IsFolkloreBookUnlocked(TomeId);
|
||||
}
|
||||
}
|
@ -22,74 +22,9 @@ internal sealed class GameCache
|
||||
.OrderBy(x => x.Name)
|
||||
.ToList()
|
||||
.AsReadOnly();
|
||||
FolkloreBooks = dataManager.GetExcelSheet<GatheringSubCategory>()!
|
||||
.Where(x => x.RowId > 0)
|
||||
.Where(x => x.Item.Row != 0)
|
||||
.Select(x => new
|
||||
{
|
||||
x.RowId,
|
||||
ItemId = x.Item.Row,
|
||||
ItemName = x.Item.Value!.Name.ToString()
|
||||
})
|
||||
.GroupBy(x => (x.ItemId, x.ItemName))
|
||||
.Select(x =>
|
||||
new FolkloreBook
|
||||
{
|
||||
ItemId = x.Key.ItemId,
|
||||
Name = x.Key.ItemName,
|
||||
GatheringSubCategories = x.Select(y => (ushort)y.RowId).ToList(),
|
||||
})
|
||||
.ToDictionary(x => x.ItemId, x => x);
|
||||
|
||||
var gatheringNodes = dataManager.GetExcelSheet<GatheringPointBase>()!
|
||||
.Where(x => x.RowId > 0 && x.GatheringType.Row <= 3)
|
||||
.Select(x =>
|
||||
new
|
||||
{
|
||||
GatheringPointBaseId = x.RowId,
|
||||
GatheringPoint =
|
||||
dataManager.GetExcelSheet<GatheringPoint>()!.FirstOrDefault(y =>
|
||||
y.GatheringPointBase.Row == x.RowId),
|
||||
Items = x.Item.Where(y => y > 0).ToList()
|
||||
})
|
||||
.Where(x => x.GatheringPoint != null)
|
||||
.Select(x =>
|
||||
new
|
||||
{
|
||||
x.GatheringPointBaseId,
|
||||
CategoryId = (ushort)x.GatheringPoint!.GatheringSubCategory.Row,
|
||||
x.Items,
|
||||
})
|
||||
.ToList();
|
||||
var itemsWithoutTomes = gatheringNodes
|
||||
.Where(x => !FolkloreBooks.Values.Any(y => y.GatheringSubCategories.Contains(x.CategoryId)))
|
||||
.SelectMany(x => x.Items)
|
||||
.ToList();
|
||||
var itemsWithTomes = gatheringNodes
|
||||
.SelectMany(x => x.Items
|
||||
.Where(y => !itemsWithoutTomes.Contains(y))
|
||||
.Select(
|
||||
y =>
|
||||
new
|
||||
{
|
||||
x.CategoryId,
|
||||
ItemId = (uint)y
|
||||
}))
|
||||
.GroupBy(x => x.CategoryId)
|
||||
.ToDictionary(x => x.Key, x => x.Select(y => y.ItemId).ToList());
|
||||
foreach (var book in FolkloreBooks.Values)
|
||||
{
|
||||
book.TomeId = dataManager.GetExcelSheet<Item>()!.GetRow(book.ItemId)!.ItemAction.Value!.Data[0];
|
||||
foreach (var category in book.GatheringSubCategories)
|
||||
{
|
||||
if (itemsWithTomes.TryGetValue(category, out var itemsInCategory))
|
||||
book.GatheringItemIds.AddRange(itemsInCategory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IReadOnlyDictionary<uint, string> Jobs { get; }
|
||||
public IReadOnlyList<Venture> Ventures { get; }
|
||||
public IReadOnlyList<ItemToGather> ItemsToGather { get; }
|
||||
public Dictionary<uint, FolkloreBook> FolkloreBooks { get; }
|
||||
}
|
||||
|
@ -1,295 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using ARControl.External;
|
||||
using ARControl.GameData;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.Components;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using Dalamud.Plugin.Services;
|
||||
using ImGuiNET;
|
||||
|
||||
namespace ARControl.Windows.Config;
|
||||
|
||||
internal sealed class InventoryTab : ITab
|
||||
{
|
||||
private readonly Configuration _configuration;
|
||||
private readonly AllaganToolsIpc _allaganToolsIpc;
|
||||
private readonly GameCache _gameCache;
|
||||
private readonly IPluginLog _pluginLog;
|
||||
|
||||
private List<TreeNode>? _listAsTrees;
|
||||
private DateTime? _lastUpdate;
|
||||
|
||||
public InventoryTab(Configuration configuration, AllaganToolsIpc allaganToolsIpc, GameCache gameCache,
|
||||
IPluginLog pluginLog)
|
||||
{
|
||||
_configuration = configuration;
|
||||
_allaganToolsIpc = allaganToolsIpc;
|
||||
_gameCache = gameCache;
|
||||
_pluginLog = pluginLog;
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
using var tab = ImRaii.TabItem("Inventory###TabInventory");
|
||||
if (!tab)
|
||||
{
|
||||
_listAsTrees = null;
|
||||
_lastUpdate = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_listAsTrees == null)
|
||||
RefreshInventory();
|
||||
|
||||
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Redo, "Refresh"))
|
||||
RefreshInventory();
|
||||
|
||||
if (_lastUpdate != null)
|
||||
{
|
||||
string text = $"Last Update: {_lastUpdate:t}";
|
||||
ImGui.SameLine();
|
||||
|
||||
ImGui.SameLine(ImGui.GetContentRegionAvail().X - ImGui.CalcTextSize(text).X + ImGui.GetCursorPosX());
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextColored(ImGuiColors.DalamudGrey, text);
|
||||
}
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
if (_listAsTrees == null || _listAsTrees.Count == 0)
|
||||
{
|
||||
ImGui.Text("No items in inventory. Do you have AllaganTools installed?");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var list in _configuration.ItemLists)
|
||||
{
|
||||
using var id = ImRaii.PushId($"List{list.Id}");
|
||||
if (ImGui.CollapsingHeader($"{list.Name} {list.GetIcon()}"))
|
||||
{
|
||||
using var indent = ImRaii.PushIndent();
|
||||
var rootNode = _listAsTrees.FirstOrDefault(x => x.Id == list.Id.ToString());
|
||||
if (rootNode == null || rootNode.Children.Count == 0)
|
||||
{
|
||||
ImGui.Text("This list is empty.");
|
||||
continue;
|
||||
}
|
||||
|
||||
using var table = ImRaii.Table($"InventoryTable{list.Id}", 2, ImGuiTableFlags.NoSavedSettings);
|
||||
if (!table)
|
||||
continue;
|
||||
|
||||
ImGui.TableSetupColumn("", ImGuiTableColumnFlags.NoHide);
|
||||
ImGui.TableSetupColumn("", ImGuiTableColumnFlags.WidthFixed, 120 * ImGui.GetIO().FontGlobalScale);
|
||||
|
||||
foreach (var child in rootNode.Children)
|
||||
child.Draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshInventory()
|
||||
{
|
||||
try
|
||||
{
|
||||
List<CharacterInventory> inventories = new();
|
||||
foreach (Configuration.CharacterConfiguration character in _configuration.Characters)
|
||||
{
|
||||
List<Guid> itemListIds = new();
|
||||
if (character.Type == Configuration.CharacterType.Standalone)
|
||||
{
|
||||
itemListIds = character.ItemListIds;
|
||||
}
|
||||
else if (character.Type == Configuration.CharacterType.PartOfCharacterGroup)
|
||||
{
|
||||
var group = _configuration.CharacterGroups.SingleOrDefault(x => x.Id == character.CharacterGroupId);
|
||||
if (group != null)
|
||||
itemListIds = group.ItemListIds;
|
||||
}
|
||||
|
||||
var inventory = new CharacterInventory(character, itemListIds);
|
||||
|
||||
var itemIdsOnLists = itemListIds.Where(listId => listId != Guid.Empty)
|
||||
.Select(listId => _configuration.ItemLists.SingleOrDefault(x => x.Id == listId))
|
||||
.Where(list => list != null)
|
||||
.SelectMany(list => list!.Items.Select(x => x.ItemId))
|
||||
.Distinct()
|
||||
.ToHashSet();
|
||||
|
||||
UpdateOwnedItems(character.LocalContentId, inventory.Items, itemIdsOnLists);
|
||||
foreach (var retainer in inventory.Retainers)
|
||||
UpdateOwnedItems(retainer.Configuration.RetainerContentId, retainer.Items, itemIdsOnLists);
|
||||
|
||||
inventories.Add(inventory);
|
||||
}
|
||||
|
||||
List<TreeNode> listAsTrees = [];
|
||||
if (inventories.Count > 0)
|
||||
{
|
||||
foreach (var list in _configuration.ItemLists)
|
||||
{
|
||||
TreeNode rootNode = new TreeNode(list.Id.ToString(), string.Empty, -1);
|
||||
listAsTrees.Add(rootNode);
|
||||
|
||||
var relevantCharacters = inventories.Where(x => x.ItemListIds.Contains(list.Id)).ToList();
|
||||
foreach (var item in list.Items)
|
||||
{
|
||||
var venture = _gameCache.Ventures.FirstOrDefault(x => x.ItemId == item.ItemId);
|
||||
var total = relevantCharacters.Sum(x => x.CountItems(item.ItemId, list.CheckRetainerInventory));
|
||||
TreeNode itemNode = rootNode.AddChild(item.InternalId.ToString(), venture?.Name ?? string.Empty,
|
||||
total);
|
||||
|
||||
foreach (var character in relevantCharacters)
|
||||
{
|
||||
string characterName =
|
||||
$"{character.Configuration.CharacterName} @ {character.Configuration.WorldName}";
|
||||
long? stockQuantity = list.Type == Configuration.ListType.KeepStocked
|
||||
? item.RemainingQuantity
|
||||
: null;
|
||||
uint characterCount = character.CountItems(item.ItemId, list.CheckRetainerInventory);
|
||||
if (characterCount == 0)
|
||||
continue;
|
||||
var characterNode = itemNode.AddChild(
|
||||
character.Configuration.LocalContentId.ToString(CultureInfo.InvariantCulture),
|
||||
characterName, characterCount, stockQuantity);
|
||||
|
||||
if (list.CheckRetainerInventory)
|
||||
{
|
||||
characterNode.AddChild("Self", "In Inventory",
|
||||
character.CountItems(item.ItemId, false));
|
||||
|
||||
foreach (var retainer in character.Retainers)
|
||||
{
|
||||
uint retainerCount = retainer.CountItems(item.ItemId);
|
||||
if (retainerCount == 0)
|
||||
continue;
|
||||
characterNode.AddChild(
|
||||
retainer.Configuration.RetainerContentId.ToString(CultureInfo.InvariantCulture),
|
||||
retainer.Configuration.Name, retainerCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_listAsTrees = listAsTrees;
|
||||
_lastUpdate = DateTime.Now;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_listAsTrees = [];
|
||||
_pluginLog.Error(e, "Failed to load inventories via AllaganTools");
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateOwnedItems(ulong localContentId, List<Item> items, HashSet<uint> itemIdsOnLists)
|
||||
{
|
||||
var ownedItems = _allaganToolsIpc.GetCharacterItems(localContentId);
|
||||
foreach (var ownedItem in ownedItems)
|
||||
{
|
||||
if (!itemIdsOnLists.Contains(ownedItem.ItemId))
|
||||
continue;
|
||||
|
||||
items.Add(new Item(ownedItem.ItemId, ownedItem.Quantity));
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class CharacterInventory
|
||||
{
|
||||
public CharacterInventory(Configuration.CharacterConfiguration configuration, List<Guid> itemListIds)
|
||||
{
|
||||
Configuration = configuration;
|
||||
ItemListIds = itemListIds;
|
||||
Retainers = configuration.Retainers.Where(x => x is { Job: > 0, Managed: true })
|
||||
.OrderBy(x => x.DisplayOrder)
|
||||
.ThenBy(x => x.RetainerContentId)
|
||||
.Select(x => new RetainerInventory(x))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public Configuration.CharacterConfiguration Configuration { get; }
|
||||
public List<Guid> ItemListIds { get; }
|
||||
public List<RetainerInventory> Retainers { get; }
|
||||
public List<Item> Items { get; } = [];
|
||||
|
||||
public uint CountItems(uint itemId, bool checkRetainerInventory)
|
||||
{
|
||||
uint sum = (uint)Items.Where(x => x.ItemId == itemId).Sum(x => x.Quantity);
|
||||
if (checkRetainerInventory)
|
||||
sum += (uint)Retainers.Sum(x => x.CountItems(itemId));
|
||||
|
||||
return sum;
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class RetainerInventory(Configuration.RetainerConfiguration configuration)
|
||||
{
|
||||
public Configuration.RetainerConfiguration Configuration { get; } = configuration;
|
||||
public List<Item> Items { get; } = [];
|
||||
|
||||
public uint CountItems(uint itemId) => (uint)Items.Where(x => x.ItemId == itemId).Sum(x => x.Quantity);
|
||||
}
|
||||
|
||||
private sealed record Item(uint ItemId, uint Quantity);
|
||||
|
||||
private sealed record TreeNode(string Id, string Label, long Quantity, long? StockQuantity = null)
|
||||
{
|
||||
public List<TreeNode> Children { get; } = [];
|
||||
|
||||
public TreeNode AddChild(string id, string label, long quantity, long? stockQuantity = null)
|
||||
{
|
||||
TreeNode child = new TreeNode(id, label, quantity, stockQuantity);
|
||||
Children.Add(child);
|
||||
return child;
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
ImGui.TableNextRow();
|
||||
ImGui.TableNextColumn();
|
||||
if (Children.Count > 0)
|
||||
{
|
||||
bool open = ImGui.TreeNodeEx(Label, ImGuiTreeNodeFlags.SpanFullWidth);
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
DrawCount();
|
||||
|
||||
if (open)
|
||||
{
|
||||
foreach (var child in Children)
|
||||
child.Draw();
|
||||
|
||||
ImGui.TreePop();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.TreeNodeEx(Label,
|
||||
ImGuiTreeNodeFlags.Leaf | ImGuiTreeNodeFlags.NoTreePushOnOpen | ImGuiTreeNodeFlags.SpanFullWidth);
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
DrawCount();
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawCount()
|
||||
{
|
||||
if (StockQuantity != null)
|
||||
{
|
||||
using var color = ImRaii.PushColor(ImGuiCol.Text, Quantity >= StockQuantity.Value
|
||||
? ImGuiColors.HealerGreen
|
||||
: ImGuiColors.DalamudRed);
|
||||
ImGui.TextUnformatted(string.Create(CultureInfo.CurrentCulture,
|
||||
$"{Quantity:N0} / {StockQuantity.Value:N0}"));
|
||||
}
|
||||
else
|
||||
ImGui.TextUnformatted(Quantity.ToString("N0", CultureInfo.CurrentCulture));
|
||||
}
|
||||
}
|
||||
}
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using ARControl.GameData;
|
||||
using Dalamud.Game.Text;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.Components;
|
||||
@ -115,16 +114,10 @@ internal sealed class LockedItemsTab : ITab
|
||||
var color = ch.Items[item.ItemId];
|
||||
if (color != ColorGrey)
|
||||
{
|
||||
string itemName = item.GatheredItem.Name;
|
||||
var folkloreBook = _gameCache.FolkloreBooks.Values.FirstOrDefault(x =>
|
||||
x.GatheringItemIds.Contains(item.GatheredItem.GatheredItemId));
|
||||
if (folkloreBook != null && !ch.Character.UnlockedFolkloreBooks.Contains(folkloreBook.ItemId))
|
||||
itemName += $" ({SeIconChar.Prohibited.ToIconString()} {folkloreBook.Name})";
|
||||
|
||||
ImGui.PushStyleColor(ImGuiCol.Text, color);
|
||||
if (currentCharacter && color == ColorRed)
|
||||
{
|
||||
ImGui.Selectable(itemName);
|
||||
ImGui.Selectable(item.GatheredItem.Name);
|
||||
if (ImGui.IsItemClicked(ImGuiMouseButton.Left))
|
||||
{
|
||||
uint classJob = _clientState.LocalPlayer!.ClassJob.Id;
|
||||
@ -140,7 +133,7 @@ internal sealed class LockedItemsTab : ITab
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.Text(itemName);
|
||||
ImGui.Text(item.GatheredItem.Name);
|
||||
}
|
||||
|
||||
ImGui.PopStyleColor();
|
||||
@ -156,8 +149,6 @@ internal sealed class LockedItemsTab : ITab
|
||||
foreach (var item in itemsToCheck.Where(x =>
|
||||
charactersToCheck.Any(y => y.ToCheck(onlyShowMissing).ContainsKey(x.ItemId))))
|
||||
{
|
||||
var folkloreBook = _gameCache.FolkloreBooks.Values.FirstOrDefault(x =>
|
||||
x.GatheringItemIds.Contains(item.GatheredItem.GatheredItemId));
|
||||
if (ImGui.CollapsingHeader($"{item.GatheredItem.Name}##Gathered{item.GatheredItem.ItemId}"))
|
||||
{
|
||||
ImGui.Indent(_configWindow.MainIndentSize + ImGui.GetStyle().FramePadding.X);
|
||||
@ -180,12 +171,8 @@ internal sealed class LockedItemsTab : ITab
|
||||
ImGui.PopFont();
|
||||
}
|
||||
|
||||
string characterName = ch.Character.ToString();
|
||||
if (folkloreBook != null && !ch.Character.UnlockedFolkloreBooks.Contains(folkloreBook.ItemId))
|
||||
characterName += $" ({SeIconChar.Prohibited.ToIconString()} {folkloreBook.Name})";
|
||||
|
||||
ImGui.PushStyleColor(ImGuiCol.Text, color);
|
||||
ImGui.TextUnformatted(characterName);
|
||||
ImGui.TextUnformatted(ch.Character.ToString());
|
||||
ImGui.PopStyleColor();
|
||||
}
|
||||
}
|
||||
|
@ -175,9 +175,9 @@ internal sealed class RetainersTab : ITab
|
||||
.OrderBy(x => x.DisplayOrder)
|
||||
.ThenBy(x => x.RetainerContentId))
|
||||
{
|
||||
ImGui.BeginDisabled(retainer is { Managed: false, Level: < ConfigWindow.MinLevel });
|
||||
ImGui.BeginDisabled(retainer.Level < ConfigWindow.MinLevel);
|
||||
|
||||
bool managed = retainer.Managed;
|
||||
bool managed = retainer is { Managed: true, Level: >= ConfigWindow.MinLevel };
|
||||
|
||||
IDalamudTextureWrap? icon = _iconCache.GetIcon(62000 + retainer.Job);
|
||||
if (icon != null)
|
||||
|
@ -29,8 +29,7 @@ internal sealed class VentureListTab : ITab
|
||||
{ "Collect in order of the list", "Collect item with lowest inventory first" };
|
||||
|
||||
private static readonly Regex CountAndName = new(@"^(\d{1,5})x?\s+(.*)$", RegexOptions.Compiled);
|
||||
private const FontAwesomeIcon WarningIcon = FontAwesomeIcon.ExclamationCircle;
|
||||
private const FontAwesomeIcon ExcessCrystalsIcon = FontAwesomeIcon.Diamond;
|
||||
private static readonly string DiscardWarningPrefix = FontAwesomeIcon.ExclamationCircle.ToIconString();
|
||||
|
||||
private readonly ConfigWindow _configWindow;
|
||||
private readonly Configuration _configuration;
|
||||
@ -206,15 +205,16 @@ internal sealed class VentureListTab : ITab
|
||||
var venture = ventures.First();
|
||||
|
||||
if (itemsToDiscard.Contains(venture.ItemId))
|
||||
DrawWarning(WarningIcon, "This item will be automatically discarded by 'Discard Helper'.");
|
||||
else if (item.ItemId is >= 2 and <= 13 && item.RemainingQuantity >= 10000)
|
||||
{
|
||||
if (list.Type == Configuration.ListType.CollectOneTime || list.CheckRetainerInventory)
|
||||
DrawWarning(ExcessCrystalsIcon,
|
||||
"You are responsible for manually moving shards or crystals to your retainers - ARC won't do that for you.\nIf you don't, this may lead to wasted ventures.",
|
||||
ImGuiColors.ParsedBlue);
|
||||
else
|
||||
DrawWarning(WarningIcon, "You can never have this many of a shard or crystal in your inventory.");
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
var pos = ImGui.GetCursorPos();
|
||||
ImGui.SetCursorPos(new Vector2(pos.X - ImGui.CalcTextSize(DiscardWarningPrefix).X - 5, pos.Y + 2));
|
||||
ImGui.TextColored(ImGuiColors.DalamudYellow, DiscardWarningPrefix);
|
||||
ImGui.SetCursorPos(pos);
|
||||
ImGui.PopFont();
|
||||
|
||||
if (ImGui.IsItemHovered())
|
||||
ImGui.SetTooltip("This item will be automatically discarded by 'Discard Helper'.");
|
||||
}
|
||||
|
||||
IDalamudTextureWrap? icon = _iconCache.GetIcon(venture.IconId);
|
||||
@ -245,8 +245,7 @@ internal sealed class VentureListTab : ITab
|
||||
ImGui.GetStyle().ItemSpacing.X);
|
||||
ImGui.PopFont();
|
||||
|
||||
if (_draggedItem != null && _draggedItem.Value.Item1 == list.Id &&
|
||||
_draggedItem.Value.Item2 == item.InternalId)
|
||||
if (_draggedItem != null && _draggedItem.Value.Item1 == list.Id && _draggedItem.Value.Item2 == item.InternalId)
|
||||
{
|
||||
ImGuiComponents.IconButton("##Move", FontAwesomeIcon.ArrowsUpDown,
|
||||
ImGui.ColorConvertU32ToFloat4(ImGui.GetColorU32(ImGuiCol.ButtonActive)));
|
||||
@ -291,10 +290,9 @@ internal sealed class VentureListTab : ITab
|
||||
var (topLeft, bottomRight) = itemPositions[oldIndex];
|
||||
if (!itemsToDiscard.Contains(draggedItem.ItemId))
|
||||
topLeft += new Vector2(_configWindow.MainIndentSize, 0);
|
||||
ImGui.GetWindowDrawList().AddRect(topLeft, bottomRight, ImGui.GetColorU32(ImGuiColors.DalamudGrey), 3f,
|
||||
ImDrawFlags.RoundCornersAll);
|
||||
ImGui.GetWindowDrawList().AddRect(topLeft, bottomRight, ImGui.GetColorU32(ImGuiColors.DalamudGrey), 3f, ImDrawFlags.RoundCornersAll);
|
||||
|
||||
int newIndex = itemPositions.FindIndex(x => ImGui.IsMouseHoveringRect(x.TopLeft, x.BottomRight, true));
|
||||
int newIndex = itemPositions.IndexOf(x => ImGui.IsMouseHoveringRect(x.TopLeft, x.BottomRight, true));
|
||||
if (newIndex >= 0 && oldIndex != newIndex)
|
||||
{
|
||||
itemToAdd = list.Items.Single(x => x.InternalId == _draggedItem.Value.Item2);
|
||||
@ -324,19 +322,6 @@ internal sealed class VentureListTab : ITab
|
||||
ImGui.Spacing();
|
||||
}
|
||||
|
||||
private static void DrawWarning(FontAwesomeIcon icon, string tooltip, Vector4? color = null)
|
||||
{
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
var pos = ImGui.GetCursorPos();
|
||||
ImGui.SetCursorPos(new Vector2(pos.X - ImGui.CalcTextSize(icon.ToIconString()).X - 5, pos.Y + 2));
|
||||
ImGui.TextColored(color ?? ImGuiColors.DalamudYellow, icon.ToIconString());
|
||||
ImGui.SetCursorPos(pos);
|
||||
ImGui.PopFont();
|
||||
|
||||
if (ImGui.IsItemHovered())
|
||||
ImGui.SetTooltip(tooltip);
|
||||
}
|
||||
|
||||
private void DrawNewVentureList()
|
||||
{
|
||||
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Plus, "Add Venture List"))
|
||||
@ -456,28 +441,18 @@ internal sealed class VentureListTab : ITab
|
||||
}))
|
||||
{
|
||||
IDalamudTextureWrap? icon = _iconCache.GetIcon(filtered.Venture.IconId);
|
||||
Vector2 pos = ImGui.GetCursorPos();
|
||||
Vector2 iconSize = new Vector2(ImGui.GetTextLineHeight() + ImGui.GetStyle().ItemSpacing.Y);
|
||||
|
||||
if (icon != null)
|
||||
{
|
||||
ImGui.SetCursorPos(pos + new Vector2(iconSize.X + ImGui.GetStyle().FramePadding.X,
|
||||
ImGui.GetStyle().ItemSpacing.Y / 2));
|
||||
ImGui.Image(icon.ImGuiHandle, new Vector2(23, 23));
|
||||
ImGui.SameLine();
|
||||
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + 3);
|
||||
|
||||
icon.Dispose();
|
||||
}
|
||||
|
||||
bool addThis = ImGui.Selectable(
|
||||
$"{filtered.Venture.Name} ({string.Join(" ", filtered.CategoryNames)})##SelectVenture{filtered.Venture.RowId}");
|
||||
|
||||
|
||||
if (icon != null)
|
||||
{
|
||||
ImGui.SameLine(0, 0);
|
||||
ImGui.SetCursorPos(pos);
|
||||
ImGui.Image(icon.ImGuiHandle, iconSize);
|
||||
|
||||
icon.Dispose();
|
||||
}
|
||||
|
||||
if (addThis || addFirst)
|
||||
{
|
||||
list.Items.Add(new Configuration.QueuedItem
|
||||
|
@ -41,7 +41,6 @@ internal sealed class ConfigWindow : LWindow
|
||||
ICommandManager commandManager,
|
||||
IconCache iconCache,
|
||||
DiscardHelperIpc discardHelperIpc,
|
||||
AllaganToolsIpc allaganToolsIpc,
|
||||
IPluginLog pluginLog)
|
||||
: base($"ARC {SeIconChar.Collectible.ToIconString()}###ARControlConfig")
|
||||
{
|
||||
@ -55,7 +54,6 @@ internal sealed class ConfigWindow : LWindow
|
||||
new VentureListTab(this, _configuration, gameCache, iconCache, discardHelperIpc, pluginLog),
|
||||
new CharacterGroupTab(this, _configuration),
|
||||
new RetainersTab(this, _configuration, iconCache),
|
||||
new InventoryTab(_configuration, allaganToolsIpc, _gameCache, pluginLog),
|
||||
new LockedItemsTab(this, _configuration, clientState, commandManager, gameCache),
|
||||
new MiscTab(this, _configuration),
|
||||
];
|
||||
@ -155,11 +153,7 @@ internal sealed class ConfigWindow : LWindow
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
ImGui.SameLine(0,
|
||||
ImGui.CalcTextSize(FontAwesomeIcon.ArrowsUpDown.ToIconString()).X +
|
||||
ImGui.GetStyle().FramePadding.X * 2 + ImGui.GetStyle().ItemSpacing.X * 2);
|
||||
ImGui.PopFont();
|
||||
ImGui.SameLine(0, 58);
|
||||
}
|
||||
|
||||
if (ImGuiComponents.IconButton($"##Remove{i}", FontAwesomeIcon.Times))
|
||||
@ -208,8 +202,7 @@ internal sealed class ConfigWindow : LWindow
|
||||
|
||||
var (topLeft, bottomRight) = itemPositions[oldIndex];
|
||||
topLeft += new Vector2(MainIndentSize, 0);
|
||||
ImGui.GetWindowDrawList().AddRect(topLeft, bottomRight, ImGui.GetColorU32(ImGuiColors.DalamudGrey), 3f,
|
||||
ImDrawFlags.RoundCornersAll);
|
||||
ImGui.GetWindowDrawList().AddRect(topLeft, bottomRight, ImGui.GetColorU32(ImGuiColors.DalamudGrey), 3f, ImDrawFlags.RoundCornersAll);
|
||||
|
||||
int newIndex = itemPositions.IndexOf(x => ImGui.IsMouseHoveringRect(x.TopLeft, x.BottomRight, true));
|
||||
if (newIndex >= 0 && oldIndex != newIndex)
|
||||
|
Loading…
Reference in New Issue
Block a user