Gearsetter/Gearsetter.Test/ItemSortingTest.cs

65 lines
1.7 KiB
C#
Raw Normal View History

2024-07-02 20:31:08 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using Gearsetter.GameData;
using Gearsetter.Model;
using Lumina.Excel.GeneratedSheets;
2024-07-02 20:31:08 +00:00
using Xunit;
namespace Gearsetter.Test;
public sealed class ItemSortingTest
{
2024-07-02 20:31:08 +00:00
Lumina.GameData _lumina = new("C:/Program Files (x86)/steam/steamapps/common/FINAL FANTASY XIV Online/game/sqpack");
[Fact]
public void Test1()
{
var items = _lumina.GetExcelSheet<Item>()!;
List<uint> initialItemIds =
[
11851,
11853,
14447,
15131,
16039,
16240,
17436,
25928,
32558,
];
var itemList = new ItemList
{
ClassJob = EClassJob.Marauder,
EquipSlotCategory = EEquipSlotCategory.Ears,
ItemUiCategory = 41,
Items = initialItemIds.Select(rowId => new EquipmentItem(items.GetRow(rowId)!, false))
.Cast<BaseItem>()
.ToList(),
};
var primaryStats = _lumina.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);
itemList.UpdateStats(primaryStats, new Configuration());
itemList.Sort();
List<uint> expectedItems =
[
32558,
25928,
11851,
17436,
16240,
14447,
11853,
16039,
15131, // weathered earrings benefit from having primary stats
];
Assert.Equal(expectedItems, itemList.Items.Select(x => x.ItemId).ToList());
}
}