From ac44d91f5ba4912367ef22657b41dc14e501536b Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Tue, 19 Nov 2024 17:30:38 +0100 Subject: [PATCH] API 11 --- Gearsetter.IpcTest/Gearsetter.IpcTest.csproj | 2 +- Gearsetter.IpcTest/packages.lock.json | 12 +++------ Gearsetter.Test/Gearsetter.Test.csproj | 2 +- Gearsetter.Test/ItemSortingTest.cs | 4 +-- Gearsetter.Test/packages.lock.json | 10 +++---- Gearsetter/GameData/EBaseParam.cs | 2 ++ Gearsetter/GameData/GameDataHolder.cs | 28 ++++++++++---------- Gearsetter/Gearsetter.csproj | 4 +-- Gearsetter/Gearsetter.json | 8 ++++-- Gearsetter/GearsetterPlugin.cs | 6 ++--- Gearsetter/Model/BaseItem.cs | 8 +++--- Gearsetter/Model/EquipmentItem.cs | 2 +- Gearsetter/Model/EquipmentStats.cs | 21 +++++++++------ Gearsetter/Model/GearsetData.cs | 12 ++++----- Gearsetter/Model/InventoryItem.cs | 5 ++-- Gearsetter/Windows/EquipmentBrowserWindow.cs | 2 +- Gearsetter/packages.lock.json | 8 +++--- LLib | 2 +- 18 files changed, 70 insertions(+), 68 deletions(-) diff --git a/Gearsetter.IpcTest/Gearsetter.IpcTest.csproj b/Gearsetter.IpcTest/Gearsetter.IpcTest.csproj index 004879b..f3d2a00 100644 --- a/Gearsetter.IpcTest/Gearsetter.IpcTest.csproj +++ b/Gearsetter.IpcTest/Gearsetter.IpcTest.csproj @@ -1,4 +1,4 @@ - + 1.0 dist diff --git a/Gearsetter.IpcTest/packages.lock.json b/Gearsetter.IpcTest/packages.lock.json index f5ad582..ea8254e 100644 --- a/Gearsetter.IpcTest/packages.lock.json +++ b/Gearsetter.IpcTest/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", @@ -75,12 +75,6 @@ "Microsoft.Build.Tasks.Git": "1.1.1", "Microsoft.SourceLink.Common": "1.1.1" } - }, - "llib": { - "type": "Project", - "dependencies": { - "DalamudPackager": "[2.1.13, )" - } } } } diff --git a/Gearsetter.Test/Gearsetter.Test.csproj b/Gearsetter.Test/Gearsetter.Test.csproj index c871969..f913014 100644 --- a/Gearsetter.Test/Gearsetter.Test.csproj +++ b/Gearsetter.Test/Gearsetter.Test.csproj @@ -1,4 +1,4 @@ - + false true diff --git a/Gearsetter.Test/ItemSortingTest.cs b/Gearsetter.Test/ItemSortingTest.cs index e7e3d34..2676c13 100644 --- a/Gearsetter.Test/ItemSortingTest.cs +++ b/Gearsetter.Test/ItemSortingTest.cs @@ -4,7 +4,7 @@ using System.Linq; using Gearsetter.GameData; using Gearsetter.Model; using LLib.GameData; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; using Xunit; namespace Gearsetter.Test; @@ -35,7 +35,7 @@ public sealed class ItemSortingTest ClassJob = EClassJob.Marauder, EquipSlotCategory = EEquipSlotCategory.Ears, ItemUiCategory = 41, - Items = initialItemIds.Select(rowId => new EquipmentItem(items.GetRow(rowId)!, false)) + Items = initialItemIds.Select(rowId => new EquipmentItem(items.GetRow(rowId), false)) .Cast() .ToList(), }; diff --git a/Gearsetter.Test/packages.lock.json b/Gearsetter.Test/packages.lock.json index fd41f90..4aece45 100644 --- a/Gearsetter.Test/packages.lock.json +++ b/Gearsetter.Test/packages.lock.json @@ -10,9 +10,9 @@ }, "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", @@ -1093,14 +1093,14 @@ "gearsetter": { "type": "Project", "dependencies": { - "DalamudPackager": "[2.1.13, )", + "DalamudPackager": "[11.0.0, )", "LLib": "[1.0.0, )" } }, "llib": { "type": "Project", "dependencies": { - "DalamudPackager": "[2.1.13, )" + "DalamudPackager": "[11.0.0, )" } } } diff --git a/Gearsetter/GameData/EBaseParam.cs b/Gearsetter/GameData/EBaseParam.cs index 7ad9c6d..dc5e4f0 100644 --- a/Gearsetter/GameData/EBaseParam.cs +++ b/Gearsetter/GameData/EBaseParam.cs @@ -2,6 +2,8 @@ internal enum EBaseParam : byte { + None = 0, + Strength = 1, Dexterity = 2, Vitality = 3, diff --git a/Gearsetter/GameData/GameDataHolder.cs b/Gearsetter/GameData/GameDataHolder.cs index 10f3083..513fce3 100644 --- a/Gearsetter/GameData/GameDataHolder.cs +++ b/Gearsetter/GameData/GameDataHolder.cs @@ -7,7 +7,7 @@ using Dalamud.Plugin.Services; using FFXIVClientStructs.FFXIV.Client.Game; using Gearsetter.Model; using LLib.GameData; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; namespace Gearsetter.GameData; @@ -20,7 +20,7 @@ internal sealed class GameDataHolder public GameDataHolder(IDataManager dataManager, Configuration configuration) { _configuration = configuration; - _classJobCategories = dataManager.GetExcelSheet()! + _classJobCategories = dataManager.GetExcelSheet() .ToDictionary(x => x.RowId, x => new Dictionary { @@ -71,33 +71,33 @@ internal sealed class GameDataHolder .Where(y => y.Value) .Select(y => y.Key) .ToList()); - ClassJobNames = dataManager.GetExcelSheet()! + ClassJobNames = dataManager.GetExcelSheet() .Where(x => x.RowId > 0 && Enum.IsDefined(typeof(EClassJob), x.RowId)) .OrderBy(x => x.UIPriority) .Select(x => ((EClassJob)x.RowId, dataManager.Language == ClientLanguage.English ? x.NameEnglish.ToString() : x.Name.ToString())) .ToList(); - PrimaryStats = dataManager.GetExcelSheet()! + PrimaryStats = dataManager.GetExcelSheet() .Where(x => x.RowId > 0 && Enum.IsDefined(typeof(EClassJob), x.RowId)) .Where(x => x.PrimaryStat > 0) .ToDictionary(x => (EClassJob)x.RowId, x => (EBaseParam)x.PrimaryStat); - ItemUiCategoryNames = dataManager.GetExcelSheet()! + ItemUiCategoryNames = dataManager.GetExcelSheet() .Where(x => x.RowId > 0) .OrderBy(x => x.OrderMajor) .ThenBy(x => x.OrderMinor) .Select(x => (x.RowId, x.Name.ToString())) .ToList(); - Materias = dataManager.GetExcelSheet()! - .Where(x => x.RowId > 0 && Enum.IsDefined(typeof(EBaseParam), (byte)x.BaseParam.Row)) - .ToDictionary(x => x.RowId, x => new MateriaStat((EBaseParam)x.BaseParam.Row, x.Value)); + Materias = dataManager.GetExcelSheet() + .Where(x => x.RowId > 0 && Enum.IsDefined(typeof(EBaseParam), (byte)x.BaseParam.RowId)) + .ToDictionary(x => x.RowId, x => new MateriaStat((EBaseParam)x.BaseParam.RowId, x.Value.ToArray())); _allItemLists = - dataManager.GetExcelSheet()! + dataManager.GetExcelSheet() .Where(x => x.RowId > 1600) // exclude outdated names - .Where(x => x.EquipSlotCategory.Row > 0 && - Enum.IsDefined(typeof(EEquipSlotCategory), x.EquipSlotCategory.Row)) - .Where(x => x.LevelItem.Row > 1) // ignore ilvl 1 glamour items (also includes starter weapons) - .Where(x => x.ItemSeries.Row is <= 3 or >= 28) + .Where(x => x.EquipSlotCategory.RowId > 0 && + Enum.IsDefined(typeof(EEquipSlotCategory), x.EquipSlotCategory.RowId)) + .Where(x => x.LevelItem.RowId > 1) // ignore ilvl 1 glamour items (also includes starter weapons) + .Where(x => x.ItemSeries.RowId is <= 3 or >= 28) .SelectMany(LoadItem) .SelectMany(x => x.ClassJobs.Select(y => x.Item with { ClassJob = y })) .Where(x => x.ClassJob != EClassJob.Scholar || x.ItemUiCategory != 10) // exclude ACN weapon as scholar @@ -206,7 +206,7 @@ internal sealed class GameDataHolder private IEnumerable<(EquipmentItem Item, List ClassJobs)> LoadItem(Item item) { - var classJobCategories = _classJobCategories[item.ClassJobCategory.Row]; + var classJobCategories = _classJobCategories[item.ClassJobCategory.RowId]; yield return (new EquipmentItem(item, false), classJobCategories); if (item.CanBeHq) yield return (new EquipmentItem(item, true), classJobCategories); diff --git a/Gearsetter/Gearsetter.csproj b/Gearsetter/Gearsetter.csproj index 92cb819..1eb8ebb 100644 --- a/Gearsetter/Gearsetter.csproj +++ b/Gearsetter/Gearsetter.csproj @@ -1,6 +1,6 @@ - + - 1.3 + 2.0 dist diff --git a/Gearsetter/Gearsetter.json b/Gearsetter/Gearsetter.json index b0af1bd..d917fe0 100644 --- a/Gearsetter/Gearsetter.json +++ b/Gearsetter/Gearsetter.json @@ -2,7 +2,11 @@ "Name": "Gearsetter", "Author": "Liza Carvelli", "Punchline": "Find gear upgrades", - "Description": "", + "Description": "Browse through all gear pieces available for each class/job and show possible upgrades", "RepoUrl": "https://git.carvel.li/liza/Gearsetter", - "IconUrl": "https://plugins.carvel.li/icons/Gearsetter.png" + "IconUrl": "https://plugins.carvel.li/icons/Gearsetter.png", + "Tags": [ + "gearset", + "gearsets" + ] } diff --git a/Gearsetter/GearsetterPlugin.cs b/Gearsetter/GearsetterPlugin.cs index 3ec9218..c222fa0 100644 --- a/Gearsetter/GearsetterPlugin.cs +++ b/Gearsetter/GearsetterPlugin.cs @@ -17,7 +17,7 @@ using Gearsetter.GameData; using Gearsetter.Model; using Gearsetter.Windows; using LLib.GameData; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; using GrandCompany = FFXIVClientStructs.FFXIV.Client.UI.Agent.GrandCompany; using InventoryItem = FFXIVClientStructs.FFXIV.Client.Game.InventoryItem; @@ -83,7 +83,7 @@ public sealed class GearsetterPlugin : IDalamudPlugin _pluginInterface.UiBuilder.OpenMainUi += _equipmentBrowserWindow.Toggle; _pluginInterface.UiBuilder.OpenConfigUi += _configWindow.Toggle; - _classJobToArrayIndex = dataManager.GetExcelSheet()! + _classJobToArrayIndex = dataManager.GetExcelSheet() .Where(x => x.RowId > 0 && Enum.IsDefined(typeof(EClassJob), x.RowId)) .ToDictionary(x => (EClassJob)x.RowId, x => (byte)x.ExpArrayIndex); } @@ -142,7 +142,7 @@ public sealed class GearsetterPlugin : IDalamudPlugin var gearset = gearsetModule->GetGearset(i); if (gearset != null && gearset->Flags.HasFlag(RaptureGearsetModule.GearsetFlag.Exists)) { - if (onlyCurrentJob && gearset->ClassJob != _clientState.LocalPlayer!.ClassJob.Id) + if (onlyCurrentJob && gearset->ClassJob != _clientState.LocalPlayer!.ClassJob.RowId) continue; var gearsetData = PrepareGearset(gearset); diff --git a/Gearsetter/Model/BaseItem.cs b/Gearsetter/Model/BaseItem.cs index 9141d37..12ad9cb 100644 --- a/Gearsetter/Model/BaseItem.cs +++ b/Gearsetter/Model/BaseItem.cs @@ -1,6 +1,6 @@ using Gearsetter.GameData; using LLib.GameData; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; namespace Gearsetter.Model; @@ -12,10 +12,10 @@ internal abstract record BaseItem(Item Item, bool Hq, MateriaStats? MateriaStats public bool CanBeHq { get; } = Item.CanBeHq; public string Name { get; } = Item.Name.ToString(); public byte Level { get; } = Item.LevelEquip; - public uint ItemLevel { get; } = Item.LevelItem.Row; + public uint ItemLevel { get; } = Item.LevelItem.RowId; public byte Rarity { get; } = Item.Rarity; - public EEquipSlotCategory EquipSlotCategory { get; } = (EEquipSlotCategory)Item.EquipSlotCategory.Row; - public uint ItemUiCategory { get; } = Item.ItemUICategory.Row; + public EEquipSlotCategory EquipSlotCategory { get; } = (EEquipSlotCategory)Item.EquipSlotCategory.RowId; + public uint ItemUiCategory { get; } = Item.ItemUICategory.RowId; public abstract EClassJob ClassJob { get; init; } public EquipmentStats Stats { get; } = new(Item, Hq, MateriaStats); diff --git a/Gearsetter/Model/EquipmentItem.cs b/Gearsetter/Model/EquipmentItem.cs index 8b55b25..20ce940 100644 --- a/Gearsetter/Model/EquipmentItem.cs +++ b/Gearsetter/Model/EquipmentItem.cs @@ -1,6 +1,6 @@ using Gearsetter.GameData; using LLib.GameData; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; namespace Gearsetter.Model; diff --git a/Gearsetter/Model/EquipmentStats.cs b/Gearsetter/Model/EquipmentStats.cs index 72860f2..353ac68 100644 --- a/Gearsetter/Model/EquipmentStats.cs +++ b/Gearsetter/Model/EquipmentStats.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Linq; using Gearsetter.GameData; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; namespace Gearsetter.Model; @@ -12,17 +12,22 @@ internal sealed class EquipmentStats public EquipmentStats(Item item, bool hq, MateriaStats? materiaStats) { - _equipmentValues = item.UnkData59.Where(x => x.BaseParam > 0) - .ToDictionary(x => (EBaseParam)x.BaseParam, x => x.BaseParamValue); + _equipmentValues = Enumerable.Range(0, item.BaseParam.Count) + .Where(i => item.BaseParam[i].RowId > 0) + .ToDictionary(i => (EBaseParam)item.BaseParam[i].RowId, i => item.BaseParamValue[i]); if (hq) { - foreach (var hqstat in item.UnkData73.Select(x => - ((EBaseParam)x.BaseParamSpecial, x.BaseParamValueSpecial))) + for (int i = 0; i < item.BaseParamSpecial.Count; ++i) { - if (_equipmentValues.TryGetValue(hqstat.Item1, out var stat)) - _equipmentValues[hqstat.Item1] = (short)(stat + hqstat.BaseParamValueSpecial); + EBaseParam baseParam = (EBaseParam)item.BaseParamSpecial[i].RowId; + if (baseParam == EBaseParam.None) + continue; + + var baseParamValue = item.BaseParamValueSpecial[i]; + if (_equipmentValues.TryGetValue(baseParam, out var stat)) + _equipmentValues[baseParam] = (short)(stat + baseParamValue); else - _equipmentValues[hqstat.Item1] = hqstat.BaseParamValueSpecial; + _equipmentValues[baseParam] = baseParamValue; } } diff --git a/Gearsetter/Model/GearsetData.cs b/Gearsetter/Model/GearsetData.cs index 96b4667..1523318 100644 --- a/Gearsetter/Model/GearsetData.cs +++ b/Gearsetter/Model/GearsetData.cs @@ -1,9 +1,7 @@ -using System.Collections.Generic; -using Dalamud.Plugin.Services; +using Dalamud.Plugin.Services; using FFXIVClientStructs.FFXIV.Client.UI.Misc; -using Gearsetter.GameData; using LLib.GameData; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; namespace Gearsetter.Model; @@ -35,7 +33,7 @@ internal sealed class GearsetData if (gearsetItem.ItemId == 0) return null; - var item = dataManager.GetExcelSheet()!.GetRow(gearsetItem.ItemId % 1_000_000)!; + var item = dataManager.GetExcelSheet().GetRow(gearsetItem.ItemId % 1_000_000); return new EquipmentItem(item, gearsetItem.ItemId > 1_000_000); } @@ -49,8 +47,8 @@ internal sealed class GearsetData public EquipmentItem? Hands { get; } public EquipmentItem? Legs { get; } public EquipmentItem? Feet { get; } - public EquipmentItem? Ears { get; set; } - public EquipmentItem? Neck { get; set; } + public EquipmentItem? Ears { get; } + public EquipmentItem? Neck { get; } public EquipmentItem? Wrists { get; } public EquipmentItem? RingLeft { get; } public EquipmentItem? RingRight { get; } diff --git a/Gearsetter/Model/InventoryItem.cs b/Gearsetter/Model/InventoryItem.cs index 061f39e..d42e4fe 100644 --- a/Gearsetter/Model/InventoryItem.cs +++ b/Gearsetter/Model/InventoryItem.cs @@ -1,6 +1,5 @@ -using Gearsetter.GameData; -using LLib.GameData; -using Lumina.Excel.GeneratedSheets; +using LLib.GameData; +using Lumina.Excel.Sheets; namespace Gearsetter.Model; diff --git a/Gearsetter/Windows/EquipmentBrowserWindow.cs b/Gearsetter/Windows/EquipmentBrowserWindow.cs index e362d72..1e80dd5 100644 --- a/Gearsetter/Windows/EquipmentBrowserWindow.cs +++ b/Gearsetter/Windows/EquipmentBrowserWindow.cs @@ -62,7 +62,7 @@ internal sealed class EquipmentBrowserWindow : LWindow public override void OnOpen() { if (_clientState.LocalPlayer != null) - _selectedClassJob = ((EClassJob)_clientState.LocalPlayer.ClassJob.Id).AsJob(); + _selectedClassJob = ((EClassJob)_clientState.LocalPlayer.ClassJob.RowId).AsJob(); UpdateEquipmentCategories(); } diff --git a/Gearsetter/packages.lock.json b/Gearsetter/packages.lock.json index f5ad582..f6a8acd 100644 --- a/Gearsetter/packages.lock.json +++ b/Gearsetter/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 @@ "llib": { "type": "Project", "dependencies": { - "DalamudPackager": "[2.1.13, )" + "DalamudPackager": "[11.0.0, )" } } } diff --git a/LLib b/LLib index 9db9f95..e4bbc05 160000 --- a/LLib +++ b/LLib @@ -1 +1 @@ -Subproject commit 9db9f95b8cd3f36262b5b4b14f12b7331d3c7279 +Subproject commit e4bbc05ede6f6f01e7028b24614ed8cb333e909c