diff --git a/ECommons b/ECommons index 4c0f3e3..71ee09f 160000 --- a/ECommons +++ b/ECommons @@ -1 +1 @@ -Subproject commit 4c0f3e33e4dbda20a4470da3b7bb153f0ad12ace +Subproject commit 71ee09f7cc2230a73503b945422760da1368405c diff --git a/RebornToolbox/Features/ChocoboRacing/ChocoboRacing.cs b/RebornToolbox/Features/ChocoboRacing/ChocoboRacing.cs index 3ef2e0c..5bdb563 100644 --- a/RebornToolbox/Features/ChocoboRacing/ChocoboRacing.cs +++ b/RebornToolbox/Features/ChocoboRacing/ChocoboRacing.cs @@ -11,7 +11,7 @@ using FFXIVClientStructs.FFXIV.Client.UI; using FFXIVClientStructs.FFXIV.Client.UI.Agent; using FFXIVClientStructs.FFXIV.Component.GUI; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; namespace RebornToolbox.Features.ChocoboRacing; @@ -166,11 +166,7 @@ private unsafe void SelectDuty(AddonContentsFinder* addonContentsFinder) var vectorDutyListItems = addonContentsFinder->DutyList->Items; List listAtkComponentTreeListItems = []; - vectorDutyListItems.ForEach(pointAtkComponentTreeListItem => - listAtkComponentTreeListItems.Add(*(pointAtkComponentTreeListItem.Value))); - - Callback.Fire((AtkUnitBase*)addonContentsFinder, true, 3, - addonContentsFinder->SelectedRow - - (HeadersCount(addonContentsFinder->SelectedRow, listAtkComponentTreeListItems) - 1)); + vectorDutyListItems.ForEach(pointAtkComponentTreeListItem => listAtkComponentTreeListItems.Add(*(pointAtkComponentTreeListItem.Value))); + Callback.Fire((AtkUnitBase*)addonContentsFinder, true, 3, HeadersCount((uint)addonContentsFinder->DutyList->SelectedItemIndex, listAtkComponentTreeListItems) + 1); // - (HeadersCount(addonContentsFinder->DutyList->SelectedItemIndex, listAtkComponentTreeListItems) + 1)); } } \ No newline at end of file diff --git a/RebornToolbox/Features/MBShoppingList/MBShoppingList.UI.cs b/RebornToolbox/Features/MBShoppingList/MBShoppingList.UI.cs index 79cd04c..1696328 100644 --- a/RebornToolbox/Features/MBShoppingList/MBShoppingList.UI.cs +++ b/RebornToolbox/Features/MBShoppingList/MBShoppingList.UI.cs @@ -18,7 +18,7 @@ using FFXIVClientStructs.FFXIV.Client.UI; using FFXIVClientStructs.FFXIV.Client.UI.Info; using ImGuiNET; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; using OtterGui; using OtterGui.Classes; using RebornToolbox.Features.MBShoppingList.Models; @@ -114,14 +114,14 @@ private void ExtractClipboardText() bool saveNeeded = false; foreach (var item in items) { - var itemObj = MBShoppingList.AllItems.FirstOrDefault(i => string.Equals(i.Name, item.Key, StringComparison.OrdinalIgnoreCase)); + var itemObj = MBShoppingList.AllItems.FirstOrNull(i => string.Equals(i.Name.ToString(), item.Key, StringComparison.OrdinalIgnoreCase)); if (itemObj is null) { Svc.Log.Error($"Item {item.Key} not found"); continue; } - var shoppingListItem = new ShoppingListItem(itemObj, item.Value); + var shoppingListItem = new ShoppingListItem(itemObj.Value, item.Value); _manager.WantedItems.Add(shoppingListItem); saveNeeded = true; } @@ -307,7 +307,7 @@ private void DrawItemAdd() ImGui.BeginChild($"ItemList", new Vector2(0, 150), true); foreach (var item in matchingItems) { - if (ImGui.Selectable(item.Name)) + if (ImGui.Selectable(item.Name.ToString())) { _selectedItem = item; _searchTerm = item.Name.ToString(); @@ -327,7 +327,7 @@ private void DrawItemAdd() return; } - var shoppingListItem = new ShoppingListItem(_selectedItem, 1); + var shoppingListItem = new ShoppingListItem(_selectedItem.Value, 1); _manager.WantedItems.Add(shoppingListItem); _searchTerm = string.Empty; _selectedItem = null; @@ -395,12 +395,12 @@ void ExtractItemsFromMakePlaceList(string text, string startSection, string endS itemName += " Dye"; int quantity = int.Parse(match.Groups[2].Value.Trim()); - var item = MBShoppingList.AllItems.FirstOrDefault(i => - string.Equals(i.Name, itemName, StringComparison.OrdinalIgnoreCase)); + var item = MBShoppingList.AllItems.FirstOrNull(i => + string.Equals(i.Name.ToString(), itemName, StringComparison.OrdinalIgnoreCase)); if (item == null && string.Equals(startSection, "Dyes", StringComparison.OrdinalIgnoreCase)) { - item = MBShoppingList.AllItems.FirstOrDefault(i => - string.Equals(i.Name, $"General-purpose {itemName}", StringComparison.OrdinalIgnoreCase)); + item = MBShoppingList.AllItems.FirstOrNull(i => + string.Equals(i.Name.ToString(), $"General-purpose {itemName}", StringComparison.OrdinalIgnoreCase)); } if (item == null) @@ -409,7 +409,7 @@ void ExtractItemsFromMakePlaceList(string text, string startSection, string endS continue; } - var existingItem = _manager.WantedItems.FirstOrDefault(i => i.ItemId == item.RowId); + var existingItem = _manager.WantedItems.FirstOrDefault(i => i.ItemId == item.Value.RowId); // Add or update the item in the dictionary if (existingItem != null) @@ -418,7 +418,7 @@ void ExtractItemsFromMakePlaceList(string text, string startSection, string endS } else { - _manager.WantedItems.Add(new ShoppingListItem(item, quantity)); + _manager.WantedItems.Add(new ShoppingListItem(item.Value, quantity)); } } } diff --git a/RebornToolbox/Features/MBShoppingList/MBShoppingList.cs b/RebornToolbox/Features/MBShoppingList/MBShoppingList.cs index 99e2a61..1cdf9f8 100644 --- a/RebornToolbox/Features/MBShoppingList/MBShoppingList.cs +++ b/RebornToolbox/Features/MBShoppingList/MBShoppingList.cs @@ -12,7 +12,7 @@ using ECommons.GameHelpers; using FFXIVClientStructs.FFXIV.Client.Game; using FFXIVClientStructs.FFXIV.Client.Game.Control; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; using Newtonsoft.Json; using RebornToolbox.Features.MBShoppingList.Models; using RebornToolbox.IPC; @@ -46,7 +46,7 @@ public class MBShoppingList public MBShoppingList() { AllItems = Svc.Data.GameData.GetExcelSheet()!.ToList(); - MarketableItems = AllItems.Where(i => i.ItemSearchCategory.Row != 0).ToList(); + MarketableItems = AllItems.Where(i => i.ItemSearchCategory.RowId != 0).ToList(); Chat = new Chat(); diff --git a/RebornToolbox/Features/MBShoppingList/Models/ShoppingListItem.cs b/RebornToolbox/Features/MBShoppingList/Models/ShoppingListItem.cs index 61845eb..e1b7509 100644 --- a/RebornToolbox/Features/MBShoppingList/Models/ShoppingListItem.cs +++ b/RebornToolbox/Features/MBShoppingList/Models/ShoppingListItem.cs @@ -3,7 +3,8 @@ using ECommons; using ECommons.DalamudServices; using FFXIVClientStructs.FFXIV.Client.Game; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; +using Lumina.Excel.Sheets; using Newtonsoft.Json; using RebornToolbox.IPC; @@ -11,14 +12,14 @@ namespace RebornToolbox.Features.MBShoppingList.Models; public class ShoppingListItem { - [Newtonsoft.Json.JsonIgnore] private Item _itemRecord; + [Newtonsoft.Json.JsonIgnore] private Item? _itemRecord; public ShoppingListItem(Item item, int quantity) { ItemId = item.RowId; Quantity = quantity; _itemRecord = item; // Cache the item here - IsMarketable = MBShoppingList.MarketableItems.Contains(ItemRecord); + IsMarketable = MBShoppingList.MarketableItems.Contains(ItemRecord!.Value); } public ShoppingListItem() @@ -29,7 +30,7 @@ public ShoppingListItem() internal void OnDeserializedMethod(StreamingContext context) { // Initialize _itemRecord after deserialization - _itemRecord = MBShoppingList.AllItems.FirstOrDefault(x => x.RowId == ItemId); + _itemRecord = MBShoppingList.AllItems.FirstOrNull(x => x.RowId == ItemId); if (_itemRecord == null) { // Handle the case where the item is not found @@ -37,13 +38,13 @@ internal void OnDeserializedMethod(StreamingContext context) } else { - IsMarketable = MBShoppingList.MarketableItems.Contains(_itemRecord); + IsMarketable = MBShoppingList.MarketableItems.Contains(_itemRecord.Value); } } - [Newtonsoft.Json.JsonIgnore] public Item ItemRecord => _itemRecord; + [Newtonsoft.Json.JsonIgnore] public Item? ItemRecord => _itemRecord; - [Newtonsoft.Json.JsonIgnore] public string Name => _itemRecord.Name; + [Newtonsoft.Json.JsonIgnore] public string Name => _itemRecord.Value.Name.ToString(); public uint ItemId { get; set; } diff --git a/RebornToolbox/RebornToolbox.json b/RebornToolbox/RebornToolbox.json index 6721387..350675e 100644 --- a/RebornToolbox/RebornToolbox.json +++ b/RebornToolbox/RebornToolbox.json @@ -8,7 +8,7 @@ "Toolbox", "Reborn" ], - "DalamudApiLevel": 10, + "DalamudApiLevel": 11, "LoadRequiredState": 0, "LoadSync": false, "CanUnloadAsync": false,