From 47ac1c4e88be6a02105c332f77fa269a0d663f56 Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Fri, 15 Nov 2024 23:10:32 +0100 Subject: [PATCH] API 11 --- ARControl/ARControl.csproj | 4 +- ARControl/AutoRetainerControlPlugin.Sync.cs | 5 +- ARControl/GameData/GameCache.cs | 40 ++--- ARControl/GameData/ItemToGather.cs | 13 +- ARControl/GameData/Venture.cs | 15 +- ARControl/Windows/Config/LockedItemsTab.cs | 183 ++++++++++---------- ARControl/packages.lock.json | 10 +- AutoRetainerAPI | 2 +- ECommons | 2 +- LLib | 2 +- 10 files changed, 144 insertions(+), 132 deletions(-) diff --git a/ARControl/ARControl.csproj b/ARControl/ARControl.csproj index bad06b9..33ca1e2 100644 --- a/ARControl/ARControl.csproj +++ b/ARControl/ARControl.csproj @@ -1,6 +1,6 @@ - + - 5.8 + 6.0 dist diff --git a/ARControl/AutoRetainerControlPlugin.Sync.cs b/ARControl/AutoRetainerControlPlugin.Sync.cs index 43d1aba..eab9f97 100644 --- a/ARControl/AutoRetainerControlPlugin.Sync.cs +++ b/ARControl/AutoRetainerControlPlugin.Sync.cs @@ -109,9 +109,10 @@ partial class AutoRetainerControlPlugin save = true; } - if (retainer.DisplayOrder != retainerData.DisplayOrder) + int displayOrder = offlineCharacterData.RetainerData.IndexOf(retainerData); + if (retainer.DisplayOrder != displayOrder) { - retainer.DisplayOrder = retainerData.DisplayOrder; + retainer.DisplayOrder = displayOrder; save = true; } diff --git a/ARControl/GameData/GameCache.cs b/ARControl/GameData/GameCache.cs index 3cbd059..3767371 100644 --- a/ARControl/GameData/GameCache.cs +++ b/ARControl/GameData/GameCache.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Linq; using Dalamud.Plugin.Services; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; namespace ARControl.GameData; @@ -9,27 +9,27 @@ internal sealed class GameCache { public GameCache(IDataManager dataManager) { - Jobs = dataManager.GetExcelSheet()!.ToDictionary(x => x.RowId, x => x.Abbreviation.ToString()); - Ventures = dataManager.GetExcelSheet()! - .Where(x => x.RowId > 0 && !x.IsRandom && x.Task != 0) + Jobs = dataManager.GetExcelSheet().ToDictionary(x => x.RowId, x => x.Abbreviation.ToString()); + Ventures = dataManager.GetExcelSheet() + .Where(x => x.RowId > 0 && !x.IsRandom && x.Task.RowId != 0) .Select(x => new Venture(dataManager, x)) .ToList() .AsReadOnly(); - ItemsToGather = dataManager.GetExcelSheet()! - .Where(x => x.RowId > 0 && x.RowId < 10_000 && x.Item != 0 && x.Quest.Row == 0) - .Where(x => Ventures.Any(y => y.ItemId == x.Item)) - .Select(x => new ItemToGather(dataManager, x)) + ItemsToGather = dataManager.GetExcelSheet() + .Where(x => x.RowId > 0 && x.RowId < 10_000 && x.Item.RowId != 0) + .Where(x => Ventures.Any(y => y.ItemId == x.Item.RowId)) + .Select(x => new ItemToGather(x)) .OrderBy(x => x.Name) .ToList() .AsReadOnly(); - FolkloreBooks = dataManager.GetExcelSheet()! + FolkloreBooks = dataManager.GetExcelSheet() .Where(x => x.RowId > 0) - .Where(x => x.Item.Row != 0) + .Where(x => x.Item.RowId != 0) .Select(x => new { x.RowId, - ItemId = x.Item.Row, - ItemName = x.Item.Value!.Name.ToString() + ItemId = x.Item.RowId, + ItemName = x.Item.Value.Name.ToString() }) .GroupBy(x => (x.ItemId, x.ItemName)) .Select(x => @@ -41,23 +41,23 @@ internal sealed class GameCache }) .ToDictionary(x => x.ItemId, x => x); - var gatheringNodes = dataManager.GetExcelSheet()! - .Where(x => x.RowId > 0 && x.GatheringType.Row <= 3) + var gatheringNodes = dataManager.GetExcelSheet() + .Where(x => x.RowId > 0 && x.GatheringType.RowId <= 3) .Select(x => new { GatheringPointBaseId = x.RowId, GatheringPoint = - dataManager.GetExcelSheet()!.FirstOrDefault(y => - y.GatheringPointBase.Row == x.RowId), - Items = x.Item.Where(y => y > 0).ToList() + dataManager.GetExcelSheet().Cast().FirstOrDefault(y => + y!.Value.GatheringPointBase.RowId == x.RowId), + Items = x.Item.Where(y => y.RowId > 0).ToList() }) .Where(x => x.GatheringPoint != null) .Select(x => new { x.GatheringPointBaseId, - CategoryId = (ushort)x.GatheringPoint!.GatheringSubCategory.Row, + CategoryId = (ushort)x.GatheringPoint!.Value.GatheringSubCategory.RowId, x.Items, }) .ToList(); @@ -73,13 +73,13 @@ internal sealed class GameCache new { x.CategoryId, - ItemId = (uint)y + ItemId = y.RowId })) .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()!.GetRow(book.ItemId)!.ItemAction.Value!.Data[0]; + book.TomeId = dataManager.GetExcelSheet().GetRow(book.ItemId).ItemAction.Value.Data[0]; foreach (var category in book.GatheringSubCategories) { if (itemsWithTomes.TryGetValue(category, out var itemsInCategory)) diff --git a/ARControl/GameData/ItemToGather.cs b/ARControl/GameData/ItemToGather.cs index 2cb69cd..0bdb75d 100644 --- a/ARControl/GameData/ItemToGather.cs +++ b/ARControl/GameData/ItemToGather.cs @@ -1,19 +1,20 @@ -using Dalamud.Plugin.Services; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; namespace ARControl.GameData; internal sealed class ItemToGather { - public ItemToGather(IDataManager dataManager, GatheringItem item) + public ItemToGather(GatheringItem item) { GatheredItemId = item.RowId; - ItemId = item.Item; - Name = dataManager.GetExcelSheet()!.GetRow((uint)item.Item)!.Name.ToString(); + + var itemRef = item.Item.GetValueOrDefault()!.Value; + ItemId = itemRef.RowId; + Name = itemRef.Name.ToString(); } public uint GatheredItemId { get; } - public int ItemId { get; } + public uint ItemId { get; } public string Name { get; } } diff --git a/ARControl/GameData/Venture.cs b/ARControl/GameData/Venture.cs index 5037cbb..08a50f1 100644 --- a/ARControl/GameData/Venture.cs +++ b/ARControl/GameData/Venture.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using Dalamud.Plugin.Services; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; namespace ARControl.GameData; @@ -9,13 +9,14 @@ internal sealed class Venture public Venture(IDataManager dataManager, RetainerTask retainerTask) { RowId = retainerTask.RowId; - Category = retainerTask.ClassJobCategory.Value!; + Category = retainerTask.ClassJobCategory.Value; - var taskDetails = dataManager.GetExcelSheet()!.GetRow(retainerTask.Task)!; - var taskParameters = retainerTask.RetainerTaskParameter.Value!; - ItemId = taskDetails.Item.Row; - IconId = taskDetails.Item.Value!.Icon; - Name = taskDetails.Item.Value!.Name.ToString(); + RetainerTaskNormal taskDetails = + dataManager.GetExcelSheet().GetRow(retainerTask.Task.RowId); + RetainerTaskParameter taskParameters = retainerTask.RetainerTaskParameter.Value; + ItemId = taskDetails.Item.RowId; + IconId = taskDetails.Item.Value.Icon; + Name = taskDetails.Item.Value.Name.ToString(); Level = retainerTask.RetainerLevel; ItemLevelCombat = retainerTask.RequiredItemLevel; RequiredGathering = retainerTask.RequiredGathering; diff --git a/ARControl/Windows/Config/LockedItemsTab.cs b/ARControl/Windows/Config/LockedItemsTab.cs index deda5eb..7fa45fd 100644 --- a/ARControl/Windows/Config/LockedItemsTab.cs +++ b/ARControl/Windows/Config/LockedItemsTab.cs @@ -84,114 +84,123 @@ internal sealed class LockedItemsTab : ITab .ToList(); if (checkPerCharacter) + DrawPerCharacter(charactersToCheck, itemsToCheck, onlyShowMissing); + else + DrawPerItem(charactersToCheck, itemsToCheck, onlyShowMissing); + } + + private void DrawPerCharacter(List charactersToCheck, List itemsToCheck, + bool onlyShowMissing) + { + foreach (var ch in charactersToCheck.Where(x => x.ToCheck(onlyShowMissing).Count != 0)) { - foreach (var ch in charactersToCheck.Where(x => x.ToCheck(onlyShowMissing).Count != 0)) + bool currentCharacter = _clientState.LocalContentId == ch.Character.LocalContentId; + ImGui.BeginDisabled(currentCharacter); + if (ImGuiComponents.IconButton($"SwitchCharacters{ch.Character.LocalContentId}", + FontAwesomeIcon.DoorOpen)) { - bool currentCharacter = _clientState.LocalContentId == ch.Character.LocalContentId; - ImGui.BeginDisabled(currentCharacter); - if (ImGuiComponents.IconButton($"SwitchCharacters{ch.Character.LocalContentId}", - FontAwesomeIcon.DoorOpen)) + _commandManager.ProcessCommand( + $"/ays relog {ch.Character.CharacterName}@{ch.Character.WorldName}"); + } + + ImGui.EndDisabled(); + ImGui.SameLine(); + + if (currentCharacter) + ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.HealerGreen); + + bool expanded = ImGui.CollapsingHeader($"{ch.Character}###GatheredCh{ch.Character.LocalContentId}"); + if (currentCharacter) + ImGui.PopStyleColor(); + + if (expanded) + { + ImGui.Indent(_configWindow.MainIndentSize + ImGui.GetStyle().FramePadding.X); + foreach (var item in itemsToCheck.Where(x => + ch.ToCheck(onlyShowMissing).ContainsKey(x.ItemId))) { - _commandManager.ProcessCommand( - $"/ays relog {ch.Character.CharacterName}@{ch.Character.WorldName}"); - } - - ImGui.EndDisabled(); - ImGui.SameLine(); - - if (currentCharacter) - ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.HealerGreen); - - bool expanded = ImGui.CollapsingHeader($"{ch.Character}###GatheredCh{ch.Character.LocalContentId}"); - if (currentCharacter) - ImGui.PopStyleColor(); - - if (expanded) - { - ImGui.Indent(_configWindow.MainIndentSize + ImGui.GetStyle().FramePadding.X); - foreach (var item in itemsToCheck.Where(x => - ch.ToCheck(onlyShowMissing).ContainsKey(x.ItemId))) + var color = ch.Items[item.ItemId]; + if (color != ColorGrey) { - 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) { - 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); + if (ImGui.IsItemClicked(ImGuiMouseButton.Left)) { - ImGui.Selectable(itemName); - if (ImGui.IsItemClicked(ImGuiMouseButton.Left)) - { - uint classJob = _clientState.LocalPlayer!.ClassJob.Id; - if (classJob == 16) - _commandManager.ProcessCommand($"/gathermin {item.GatheredItem.Name}"); - else if (classJob == 17) - _commandManager.ProcessCommand($"/gatherbtn {item.GatheredItem.Name}"); - else if (classJob == 18) - _commandManager.ProcessCommand($"/gatherfish {item.GatheredItem.Name}"); - else - _commandManager.ProcessCommand($"/gather {item.GatheredItem.Name}"); - } + uint classJob = _clientState.LocalPlayer!.ClassJob.RowId; + if (classJob == 16) + _commandManager.ProcessCommand($"/gathermin {item.GatheredItem.Name}"); + else if (classJob == 17) + _commandManager.ProcessCommand($"/gatherbtn {item.GatheredItem.Name}"); + else if (classJob == 18) + _commandManager.ProcessCommand($"/gatherfish {item.GatheredItem.Name}"); + else + _commandManager.ProcessCommand($"/gather {item.GatheredItem.Name}"); } - else - { - ImGui.Text(itemName); - } - - ImGui.PopStyleColor(); } - } + else + { + ImGui.Text(itemName); + } - ImGui.Unindent(_configWindow.MainIndentSize + ImGui.GetStyle().FramePadding.X); + ImGui.PopStyleColor(); + } } + + ImGui.Unindent(_configWindow.MainIndentSize + ImGui.GetStyle().FramePadding.X); } } - else + } + + private void DrawPerItem(List charactersToCheck, List itemsToCheck, + bool onlyShowMissing) + { + foreach (var item in itemsToCheck.Where(x => + charactersToCheck.Any(y => y.ToCheck(onlyShowMissing).ContainsKey(x.ItemId)))) { - 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}")) { - 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); + foreach (var ch in charactersToCheck) { - ImGui.Indent(_configWindow.MainIndentSize + ImGui.GetStyle().FramePadding.X); - foreach (var ch in charactersToCheck) + var color = ch.Items[item.ItemId]; + if (color == ColorRed || (color == ColorGreen && !onlyShowMissing)) { - var color = ch.Items[item.ItemId]; - if (color == ColorRed || (color == ColorGreen && !onlyShowMissing)) + bool currentCharacter = _clientState.LocalContentId == ch.Character.LocalContentId; + if (currentCharacter) { - bool currentCharacter = _clientState.LocalContentId == ch.Character.LocalContentId; - if (currentCharacter) + ImGui.PushFont(UiBuilder.IconFont); + var pos = ImGui.GetCursorPos(); + ImGui.SetCursorPos(pos with { - ImGui.PushFont(UiBuilder.IconFont); - var pos = ImGui.GetCursorPos(); - ImGui.SetCursorPos(pos with - { - X = pos.X - ImGui.CalcTextSize(CurrentCharPrefix).X - 5 - }); - ImGui.TextUnformatted(CurrentCharPrefix); - ImGui.SetCursorPos(pos); - 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.PopStyleColor(); + X = pos.X - ImGui.CalcTextSize(CurrentCharPrefix).X - 5 + }); + ImGui.TextUnformatted(CurrentCharPrefix); + ImGui.SetCursorPos(pos); + ImGui.PopFont(); } - } - ImGui.Unindent(_configWindow.MainIndentSize + ImGui.GetStyle().FramePadding.X); + 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.PopStyleColor(); + } } + + ImGui.Unindent(_configWindow.MainIndentSize + ImGui.GetStyle().FramePadding.X); } } } diff --git a/ARControl/packages.lock.json b/ARControl/packages.lock.json index d7dd5bc..9b01336 100644 --- a/ARControl/packages.lock.json +++ b/ARControl/packages.lock.json @@ -4,9 +4,9 @@ "net8.0-windows7.0": { "DalamudPackager": { "type": "Direct", - "requested": "[2.1.13, )", - "resolved": "2.1.13", - "contentHash": "rMN1omGe8536f4xLMvx9NwfvpAc9YFFfeXJ1t4P4PE6Gu8WCIoFliR1sh07hM+bfODmesk/dvMbji7vNI+B/pQ==" + "requested": "[11.0.0, )", + "resolved": "11.0.0", + "contentHash": "bjT7XUlhIJSmsE/O76b7weUX+evvGQctbQB8aKXt94o+oPWxHpCepxAGMs7Thow3AzCyqWs7cOpp9/2wcgRRQA==" }, "DotNet.ReproducibleBuilds": { "type": "Direct", @@ -79,7 +79,7 @@ "autoretainerapi": { "type": "Project", "dependencies": { - "ECommons": "[2.1.0.7, )" + "ECommons": "[2.2.0.2, )" } }, "ecommons": { @@ -88,7 +88,7 @@ "llib": { "type": "Project", "dependencies": { - "DalamudPackager": "[2.1.13, )" + "DalamudPackager": "[11.0.0, )" } } } diff --git a/AutoRetainerAPI b/AutoRetainerAPI index a63c8e7..069cf98 160000 --- a/AutoRetainerAPI +++ b/AutoRetainerAPI @@ -1 +1 @@ -Subproject commit a63c8e7154e272374ffa03d5c801736d4229e38a +Subproject commit 069cf988b5da8657bc13ade73bfcbc2675601023 diff --git a/ECommons b/ECommons index 677e28c..b99ba7a 160000 --- a/ECommons +++ b/ECommons @@ -1 +1 @@ -Subproject commit 677e28c0696eb13351d90d13ff27adb667b2c862 +Subproject commit b99ba7a861300164b9b293b2bbbd510af0cda8a2 diff --git a/LLib b/LLib index fa3d19d..4033a1c 160000 --- a/LLib +++ b/LLib @@ -1 +1 @@ -Subproject commit fa3d19dde18bfd00237e66ea1eb48a60caa01b8a +Subproject commit 4033a1c78aec5bc2a187268e8f2615779dcc2b72