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>
<Version>1.0</Version>
<OutputPath>dist</OutputPath>

View File

@ -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, )"
}
}
}
}

View File

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

View File

@ -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<BaseItem>()
.ToList(),
};

View File

@ -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, )"
}
}
}

View File

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

View File

@ -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<ClassJobCategory>()!
_classJobCategories = dataManager.GetExcelSheet<ClassJobCategory>()
.ToDictionary(x => x.RowId, x =>
new Dictionary<EClassJob, bool>
{
@ -71,33 +71,33 @@ internal sealed class GameDataHolder
.Where(y => y.Value)
.Select(y => y.Key)
.ToList());
ClassJobNames = dataManager.GetExcelSheet<ClassJob>()!
ClassJobNames = dataManager.GetExcelSheet<ClassJob>()
.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<ClassJob>()!
PrimaryStats = dataManager.GetExcelSheet<ClassJob>()
.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<ItemUICategory>()!
ItemUiCategoryNames = dataManager.GetExcelSheet<ItemUICategory>()
.Where(x => x.RowId > 0)
.OrderBy(x => x.OrderMajor)
.ThenBy(x => x.OrderMinor)
.Select(x => (x.RowId, x.Name.ToString()))
.ToList();
Materias = dataManager.GetExcelSheet<Materia>()!
.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<Materia>()
.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<Item>()!
dataManager.GetExcelSheet<Item>()
.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<EClassJob> 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);

View File

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

View File

@ -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"
]
}

View File

@ -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<ClassJob>()!
_classJobToArrayIndex = dataManager.GetExcelSheet<ClassJob>()
.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);

View File

@ -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);

View File

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

View File

@ -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;
}
}

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 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<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);
}
@ -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; }

View File

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

View File

@ -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();
}

View File

@ -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, )"
}
}
}

2
LLib

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