2024-07-02 20:31:08 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
2024-06-19 13:20:55 +00:00
|
|
|
using Gearsetter.GameData;
|
|
|
|
using Gearsetter.Model;
|
|
|
|
using Lumina.Excel.GeneratedSheets;
|
2024-07-02 20:31:08 +00:00
|
|
|
using Xunit;
|
2024-06-19 13:20:55 +00:00
|
|
|
|
|
|
|
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");
|
2024-06-19 13:20:55 +00:00
|
|
|
|
|
|
|
[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,
|
2024-06-23 20:35:26 +00:00
|
|
|
Items = initialItemIds.Select(rowId => new EquipmentItem(items.GetRow(rowId)!, false))
|
|
|
|
.Cast<BaseItem>()
|
|
|
|
.ToList(),
|
2024-06-19 13:20:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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());
|
|
|
|
}
|
|
|
|
}
|