This commit is contained in:
Liza 2024-11-19 17:30:38 +01:00
parent 49e16ab278
commit ac44d91f5b
Signed by: liza
GPG Key ID: 7199F8D727D55F67
18 changed files with 70 additions and 68 deletions

View File

@ -1,4 +1,4 @@
<Project Sdk="Dalamud.NET.Sdk/9.0.2"> <Project Sdk="Dalamud.NET.Sdk/11.0.0">
<PropertyGroup> <PropertyGroup>
<Version>1.0</Version> <Version>1.0</Version>
<OutputPath>dist</OutputPath> <OutputPath>dist</OutputPath>

View File

@ -4,9 +4,9 @@
"net8.0-windows7.0": { "net8.0-windows7.0": {
"DalamudPackager": { "DalamudPackager": {
"type": "Direct", "type": "Direct",
"requested": "[2.1.13, )", "requested": "[11.0.0, )",
"resolved": "2.1.13", "resolved": "11.0.0",
"contentHash": "rMN1omGe8536f4xLMvx9NwfvpAc9YFFfeXJ1t4P4PE6Gu8WCIoFliR1sh07hM+bfODmesk/dvMbji7vNI+B/pQ==" "contentHash": "bjT7XUlhIJSmsE/O76b7weUX+evvGQctbQB8aKXt94o+oPWxHpCepxAGMs7Thow3AzCyqWs7cOpp9/2wcgRRQA=="
}, },
"DotNet.ReproducibleBuilds": { "DotNet.ReproducibleBuilds": {
"type": "Direct", "type": "Direct",
@ -75,12 +75,6 @@
"Microsoft.Build.Tasks.Git": "1.1.1", "Microsoft.Build.Tasks.Git": "1.1.1",
"Microsoft.SourceLink.Common": "1.1.1" "Microsoft.SourceLink.Common": "1.1.1"
} }
},
"llib": {
"type": "Project",
"dependencies": {
"DalamudPackager": "[2.1.13, )"
}
} }
} }
} }

View File

@ -1,4 +1,4 @@
<Project Sdk="Dalamud.NET.Sdk/9.0.2"> <Project Sdk="Dalamud.NET.Sdk/11.0.0">
<PropertyGroup> <PropertyGroup>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject> <IsTestProject>true</IsTestProject>

View File

@ -4,7 +4,7 @@ using System.Linq;
using Gearsetter.GameData; using Gearsetter.GameData;
using Gearsetter.Model; using Gearsetter.Model;
using LLib.GameData; using LLib.GameData;
using Lumina.Excel.GeneratedSheets; using Lumina.Excel.Sheets;
using Xunit; using Xunit;
namespace Gearsetter.Test; namespace Gearsetter.Test;
@ -35,7 +35,7 @@ public sealed class ItemSortingTest
ClassJob = EClassJob.Marauder, ClassJob = EClassJob.Marauder,
EquipSlotCategory = EEquipSlotCategory.Ears, EquipSlotCategory = EEquipSlotCategory.Ears,
ItemUiCategory = 41, ItemUiCategory = 41,
Items = initialItemIds.Select(rowId => new EquipmentItem(items.GetRow(rowId)!, false)) Items = initialItemIds.Select(rowId => new EquipmentItem(items.GetRow(rowId), false))
.Cast<BaseItem>() .Cast<BaseItem>()
.ToList(), .ToList(),
}; };

View File

@ -10,9 +10,9 @@
}, },
"DalamudPackager": { "DalamudPackager": {
"type": "Direct", "type": "Direct",
"requested": "[2.1.13, )", "requested": "[11.0.0, )",
"resolved": "2.1.13", "resolved": "11.0.0",
"contentHash": "rMN1omGe8536f4xLMvx9NwfvpAc9YFFfeXJ1t4P4PE6Gu8WCIoFliR1sh07hM+bfODmesk/dvMbji7vNI+B/pQ==" "contentHash": "bjT7XUlhIJSmsE/O76b7weUX+evvGQctbQB8aKXt94o+oPWxHpCepxAGMs7Thow3AzCyqWs7cOpp9/2wcgRRQA=="
}, },
"DotNet.ReproducibleBuilds": { "DotNet.ReproducibleBuilds": {
"type": "Direct", "type": "Direct",
@ -1093,14 +1093,14 @@
"gearsetter": { "gearsetter": {
"type": "Project", "type": "Project",
"dependencies": { "dependencies": {
"DalamudPackager": "[2.1.13, )", "DalamudPackager": "[11.0.0, )",
"LLib": "[1.0.0, )" "LLib": "[1.0.0, )"
} }
}, },
"llib": { "llib": {
"type": "Project", "type": "Project",
"dependencies": { "dependencies": {
"DalamudPackager": "[2.1.13, )" "DalamudPackager": "[11.0.0, )"
} }
} }
} }

View File

@ -2,6 +2,8 @@
internal enum EBaseParam : byte internal enum EBaseParam : byte
{ {
None = 0,
Strength = 1, Strength = 1,
Dexterity = 2, Dexterity = 2,
Vitality = 3, Vitality = 3,

View File

@ -7,7 +7,7 @@ using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Client.Game; using FFXIVClientStructs.FFXIV.Client.Game;
using Gearsetter.Model; using Gearsetter.Model;
using LLib.GameData; using LLib.GameData;
using Lumina.Excel.GeneratedSheets; using Lumina.Excel.Sheets;
namespace Gearsetter.GameData; namespace Gearsetter.GameData;
@ -20,7 +20,7 @@ internal sealed class GameDataHolder
public GameDataHolder(IDataManager dataManager, Configuration configuration) public GameDataHolder(IDataManager dataManager, Configuration configuration)
{ {
_configuration = configuration; _configuration = configuration;
_classJobCategories = dataManager.GetExcelSheet<ClassJobCategory>()! _classJobCategories = dataManager.GetExcelSheet<ClassJobCategory>()
.ToDictionary(x => x.RowId, x => .ToDictionary(x => x.RowId, x =>
new Dictionary<EClassJob, bool> new Dictionary<EClassJob, bool>
{ {
@ -71,33 +71,33 @@ internal sealed class GameDataHolder
.Where(y => y.Value) .Where(y => y.Value)
.Select(y => y.Key) .Select(y => y.Key)
.ToList()); .ToList());
ClassJobNames = dataManager.GetExcelSheet<ClassJob>()! ClassJobNames = dataManager.GetExcelSheet<ClassJob>()
.Where(x => x.RowId > 0 && Enum.IsDefined(typeof(EClassJob), x.RowId)) .Where(x => x.RowId > 0 && Enum.IsDefined(typeof(EClassJob), x.RowId))
.OrderBy(x => x.UIPriority) .OrderBy(x => x.UIPriority)
.Select(x => ((EClassJob)x.RowId, .Select(x => ((EClassJob)x.RowId,
dataManager.Language == ClientLanguage.English ? x.NameEnglish.ToString() : x.Name.ToString())) dataManager.Language == ClientLanguage.English ? x.NameEnglish.ToString() : x.Name.ToString()))
.ToList(); .ToList();
PrimaryStats = dataManager.GetExcelSheet<ClassJob>()! PrimaryStats = dataManager.GetExcelSheet<ClassJob>()
.Where(x => x.RowId > 0 && Enum.IsDefined(typeof(EClassJob), x.RowId)) .Where(x => x.RowId > 0 && Enum.IsDefined(typeof(EClassJob), x.RowId))
.Where(x => x.PrimaryStat > 0) .Where(x => x.PrimaryStat > 0)
.ToDictionary(x => (EClassJob)x.RowId, x => (EBaseParam)x.PrimaryStat); .ToDictionary(x => (EClassJob)x.RowId, x => (EBaseParam)x.PrimaryStat);
ItemUiCategoryNames = dataManager.GetExcelSheet<ItemUICategory>()! ItemUiCategoryNames = dataManager.GetExcelSheet<ItemUICategory>()
.Where(x => x.RowId > 0) .Where(x => x.RowId > 0)
.OrderBy(x => x.OrderMajor) .OrderBy(x => x.OrderMajor)
.ThenBy(x => x.OrderMinor) .ThenBy(x => x.OrderMinor)
.Select(x => (x.RowId, x.Name.ToString())) .Select(x => (x.RowId, x.Name.ToString()))
.ToList(); .ToList();
Materias = dataManager.GetExcelSheet<Materia>()! Materias = dataManager.GetExcelSheet<Materia>()
.Where(x => x.RowId > 0 && Enum.IsDefined(typeof(EBaseParam), (byte)x.BaseParam.Row)) .Where(x => x.RowId > 0 && Enum.IsDefined(typeof(EBaseParam), (byte)x.BaseParam.RowId))
.ToDictionary(x => x.RowId, x => new MateriaStat((EBaseParam)x.BaseParam.Row, x.Value)); .ToDictionary(x => x.RowId, x => new MateriaStat((EBaseParam)x.BaseParam.RowId, x.Value.ToArray()));
_allItemLists = _allItemLists =
dataManager.GetExcelSheet<Item>()! dataManager.GetExcelSheet<Item>()
.Where(x => x.RowId > 1600) // exclude outdated names .Where(x => x.RowId > 1600) // exclude outdated names
.Where(x => x.EquipSlotCategory.Row > 0 && .Where(x => x.EquipSlotCategory.RowId > 0 &&
Enum.IsDefined(typeof(EEquipSlotCategory), x.EquipSlotCategory.Row)) Enum.IsDefined(typeof(EEquipSlotCategory), x.EquipSlotCategory.RowId))
.Where(x => x.LevelItem.Row > 1) // ignore ilvl 1 glamour items (also includes starter weapons) .Where(x => x.LevelItem.RowId > 1) // ignore ilvl 1 glamour items (also includes starter weapons)
.Where(x => x.ItemSeries.Row is <= 3 or >= 28) .Where(x => x.ItemSeries.RowId is <= 3 or >= 28)
.SelectMany(LoadItem) .SelectMany(LoadItem)
.SelectMany(x => x.ClassJobs.Select(y => x.Item with { ClassJob = y })) .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 .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<EClassJob> ClassJobs)> LoadItem(Item item) private IEnumerable<(EquipmentItem Item, List<EClassJob> ClassJobs)> LoadItem(Item item)
{ {
var classJobCategories = _classJobCategories[item.ClassJobCategory.Row]; var classJobCategories = _classJobCategories[item.ClassJobCategory.RowId];
yield return (new EquipmentItem(item, false), classJobCategories); yield return (new EquipmentItem(item, false), classJobCategories);
if (item.CanBeHq) if (item.CanBeHq)
yield return (new EquipmentItem(item, true), classJobCategories); yield return (new EquipmentItem(item, true), classJobCategories);

View File

@ -1,6 +1,6 @@
<Project Sdk="Dalamud.NET.Sdk/9.0.2"> <Project Sdk="Dalamud.NET.Sdk/11.0.0">
<PropertyGroup> <PropertyGroup>
<Version>1.3</Version> <Version>2.0</Version>
<OutputPath>dist</OutputPath> <OutputPath>dist</OutputPath>
</PropertyGroup> </PropertyGroup>

View File

@ -2,7 +2,11 @@
"Name": "Gearsetter", "Name": "Gearsetter",
"Author": "Liza Carvelli", "Author": "Liza Carvelli",
"Punchline": "Find gear upgrades", "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", "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"
]
} }

View File

@ -17,7 +17,7 @@ using Gearsetter.GameData;
using Gearsetter.Model; using Gearsetter.Model;
using Gearsetter.Windows; using Gearsetter.Windows;
using LLib.GameData; using LLib.GameData;
using Lumina.Excel.GeneratedSheets; using Lumina.Excel.Sheets;
using GrandCompany = FFXIVClientStructs.FFXIV.Client.UI.Agent.GrandCompany; using GrandCompany = FFXIVClientStructs.FFXIV.Client.UI.Agent.GrandCompany;
using InventoryItem = FFXIVClientStructs.FFXIV.Client.Game.InventoryItem; using InventoryItem = FFXIVClientStructs.FFXIV.Client.Game.InventoryItem;
@ -83,7 +83,7 @@ public sealed class GearsetterPlugin : IDalamudPlugin
_pluginInterface.UiBuilder.OpenMainUi += _equipmentBrowserWindow.Toggle; _pluginInterface.UiBuilder.OpenMainUi += _equipmentBrowserWindow.Toggle;
_pluginInterface.UiBuilder.OpenConfigUi += _configWindow.Toggle; _pluginInterface.UiBuilder.OpenConfigUi += _configWindow.Toggle;
_classJobToArrayIndex = dataManager.GetExcelSheet<ClassJob>()! _classJobToArrayIndex = dataManager.GetExcelSheet<ClassJob>()
.Where(x => x.RowId > 0 && Enum.IsDefined(typeof(EClassJob), x.RowId)) .Where(x => x.RowId > 0 && Enum.IsDefined(typeof(EClassJob), x.RowId))
.ToDictionary(x => (EClassJob)x.RowId, x => (byte)x.ExpArrayIndex); .ToDictionary(x => (EClassJob)x.RowId, x => (byte)x.ExpArrayIndex);
} }
@ -142,7 +142,7 @@ public sealed class GearsetterPlugin : IDalamudPlugin
var gearset = gearsetModule->GetGearset(i); var gearset = gearsetModule->GetGearset(i);
if (gearset != null && gearset->Flags.HasFlag(RaptureGearsetModule.GearsetFlag.Exists)) 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; continue;
var gearsetData = PrepareGearset(gearset); var gearsetData = PrepareGearset(gearset);

View File

@ -1,6 +1,6 @@
using Gearsetter.GameData; using Gearsetter.GameData;
using LLib.GameData; using LLib.GameData;
using Lumina.Excel.GeneratedSheets; using Lumina.Excel.Sheets;
namespace Gearsetter.Model; namespace Gearsetter.Model;
@ -12,10 +12,10 @@ internal abstract record BaseItem(Item Item, bool Hq, MateriaStats? MateriaStats
public bool CanBeHq { get; } = Item.CanBeHq; public bool CanBeHq { get; } = Item.CanBeHq;
public string Name { get; } = Item.Name.ToString(); public string Name { get; } = Item.Name.ToString();
public byte Level { get; } = Item.LevelEquip; 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 byte Rarity { get; } = Item.Rarity;
public EEquipSlotCategory EquipSlotCategory { get; } = (EEquipSlotCategory)Item.EquipSlotCategory.Row; public EEquipSlotCategory EquipSlotCategory { get; } = (EEquipSlotCategory)Item.EquipSlotCategory.RowId;
public uint ItemUiCategory { get; } = Item.ItemUICategory.Row; public uint ItemUiCategory { get; } = Item.ItemUICategory.RowId;
public abstract EClassJob ClassJob { get; init; } public abstract EClassJob ClassJob { get; init; }
public EquipmentStats Stats { get; } = new(Item, Hq, MateriaStats); public EquipmentStats Stats { get; } = new(Item, Hq, MateriaStats);

View File

@ -1,6 +1,6 @@
using Gearsetter.GameData; using Gearsetter.GameData;
using LLib.GameData; using LLib.GameData;
using Lumina.Excel.GeneratedSheets; using Lumina.Excel.Sheets;
namespace Gearsetter.Model; namespace Gearsetter.Model;

View File

@ -1,7 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Gearsetter.GameData; using Gearsetter.GameData;
using Lumina.Excel.GeneratedSheets; using Lumina.Excel.Sheets;
namespace Gearsetter.Model; namespace Gearsetter.Model;
@ -12,17 +12,22 @@ internal sealed class EquipmentStats
public EquipmentStats(Item item, bool hq, MateriaStats? materiaStats) public EquipmentStats(Item item, bool hq, MateriaStats? materiaStats)
{ {
_equipmentValues = item.UnkData59.Where(x => x.BaseParam > 0) _equipmentValues = Enumerable.Range(0, item.BaseParam.Count)
.ToDictionary(x => (EBaseParam)x.BaseParam, x => x.BaseParamValue); .Where(i => item.BaseParam[i].RowId > 0)
.ToDictionary(i => (EBaseParam)item.BaseParam[i].RowId, i => item.BaseParamValue[i]);
if (hq) if (hq)
{ {
foreach (var hqstat in item.UnkData73.Select(x => for (int i = 0; i < item.BaseParamSpecial.Count; ++i)
((EBaseParam)x.BaseParamSpecial, x.BaseParamValueSpecial)))
{ {
if (_equipmentValues.TryGetValue(hqstat.Item1, out var stat)) EBaseParam baseParam = (EBaseParam)item.BaseParamSpecial[i].RowId;
_equipmentValues[hqstat.Item1] = (short)(stat + hqstat.BaseParamValueSpecial); if (baseParam == EBaseParam.None)
continue;
var baseParamValue = item.BaseParamValueSpecial[i];
if (_equipmentValues.TryGetValue(baseParam, out var stat))
_equipmentValues[baseParam] = (short)(stat + baseParamValue);
else else
_equipmentValues[hqstat.Item1] = hqstat.BaseParamValueSpecial; _equipmentValues[baseParam] = baseParamValue;
} }
} }

View File

@ -1,9 +1,7 @@
using System.Collections.Generic; using Dalamud.Plugin.Services;
using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Client.UI.Misc; using FFXIVClientStructs.FFXIV.Client.UI.Misc;
using Gearsetter.GameData;
using LLib.GameData; using LLib.GameData;
using Lumina.Excel.GeneratedSheets; using Lumina.Excel.Sheets;
namespace Gearsetter.Model; namespace Gearsetter.Model;
@ -35,7 +33,7 @@ internal sealed class GearsetData
if (gearsetItem.ItemId == 0) if (gearsetItem.ItemId == 0)
return null; return null;
var item = dataManager.GetExcelSheet<Item>()!.GetRow(gearsetItem.ItemId % 1_000_000)!; var item = dataManager.GetExcelSheet<Item>().GetRow(gearsetItem.ItemId % 1_000_000);
return new EquipmentItem(item, 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? Hands { get; }
public EquipmentItem? Legs { get; } public EquipmentItem? Legs { get; }
public EquipmentItem? Feet { get; } public EquipmentItem? Feet { get; }
public EquipmentItem? Ears { get; set; } public EquipmentItem? Ears { get; }
public EquipmentItem? Neck { get; set; } public EquipmentItem? Neck { get; }
public EquipmentItem? Wrists { get; } public EquipmentItem? Wrists { get; }
public EquipmentItem? RingLeft { get; } public EquipmentItem? RingLeft { get; }
public EquipmentItem? RingRight { get; } public EquipmentItem? RingRight { get; }

View File

@ -1,6 +1,5 @@
using Gearsetter.GameData; using LLib.GameData;
using LLib.GameData; using Lumina.Excel.Sheets;
using Lumina.Excel.GeneratedSheets;
namespace Gearsetter.Model; namespace Gearsetter.Model;

View File

@ -62,7 +62,7 @@ internal sealed class EquipmentBrowserWindow : LWindow
public override void OnOpen() public override void OnOpen()
{ {
if (_clientState.LocalPlayer != null) if (_clientState.LocalPlayer != null)
_selectedClassJob = ((EClassJob)_clientState.LocalPlayer.ClassJob.Id).AsJob(); _selectedClassJob = ((EClassJob)_clientState.LocalPlayer.ClassJob.RowId).AsJob();
UpdateEquipmentCategories(); UpdateEquipmentCategories();
} }

View File

@ -4,9 +4,9 @@
"net8.0-windows7.0": { "net8.0-windows7.0": {
"DalamudPackager": { "DalamudPackager": {
"type": "Direct", "type": "Direct",
"requested": "[2.1.13, )", "requested": "[11.0.0, )",
"resolved": "2.1.13", "resolved": "11.0.0",
"contentHash": "rMN1omGe8536f4xLMvx9NwfvpAc9YFFfeXJ1t4P4PE6Gu8WCIoFliR1sh07hM+bfODmesk/dvMbji7vNI+B/pQ==" "contentHash": "bjT7XUlhIJSmsE/O76b7weUX+evvGQctbQB8aKXt94o+oPWxHpCepxAGMs7Thow3AzCyqWs7cOpp9/2wcgRRQA=="
}, },
"DotNet.ReproducibleBuilds": { "DotNet.ReproducibleBuilds": {
"type": "Direct", "type": "Direct",
@ -79,7 +79,7 @@
"llib": { "llib": {
"type": "Project", "type": "Project",
"dependencies": { "dependencies": {
"DalamudPackager": "[2.1.13, )" "DalamudPackager": "[11.0.0, )"
} }
} }
} }

2
LLib

@ -1 +1 @@
Subproject commit 9db9f95b8cd3f36262b5b4b14f12b7331d3c7279 Subproject commit e4bbc05ede6f6f01e7028b24614ed8cb333e909c