Update to Lumina 5 (new Excel parsing) (#2022)

* Refactor and upgrade to new excel design

* Obsolete ExcelResolver<T> and use only RowRef<T>

* Better benchmarking for Lumina

* Add custom game-supported RSV provider

* Refactor and move Lazy<T> and nullable/cached row objects to RowRefs

* Convert IRSVProvider to delegate, resolve strings by default

* Split IExcelRow into IExcelSubrow

* Extra lumina documentation

* Minor RSV CS fixes

* Fix UIGlowPayload warning

* Fix rebase

* Update to Lumina 5
This commit is contained in:
Asriel Camora 2024-10-20 19:59:03 -07:00 committed by GitHub
parent 08d8605871
commit 0b9af0e3f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
49 changed files with 460 additions and 403 deletions

View file

@ -1,6 +1,3 @@
using System.Collections.Generic;
using System.Linq;
using Dalamud.Data;
using Dalamud.Utility;
using Lumina.Excel;
@ -11,31 +8,46 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
/// Test setup for Lumina.
/// </summary>
/// <typeparam name="T">ExcelRow to run test on.</typeparam>
internal class LuminaAgingStep<T> : IAgingStep
where T : ExcelRow
/// <param name="isLargeSheet">Whether or not the sheet is large. If it is large, the self test will iterate through the full sheet in one frame and benchmark the time taken.</param>
internal class LuminaAgingStep<T>(bool isLargeSheet) : IAgingStep
where T : struct, IExcelRow<T>
{
private int step = 0;
private List<T> rows;
private ExcelSheet<T> rows;
/// <inheritdoc/>
public string Name => "Test Lumina";
public string Name => $"Test Lumina ({typeof(T).Name})";
/// <inheritdoc/>
public SelfTestStepResult RunStep()
{
var dataManager = Service<DataManager>.Get();
this.rows ??= Service<DataManager>.Get().GetExcelSheet<T>();
this.rows ??= dataManager.GetExcelSheet<T>().ToList();
if (isLargeSheet)
{
var i = 0;
T currentRow = default;
foreach (var row in this.rows)
{
i++;
currentRow = row;
}
Util.ShowObject(this.rows[this.step]);
Util.ShowObject(currentRow);
return SelfTestStepResult.Pass;
}
else
{
Util.ShowObject(this.rows.GetRowAt(this.step));
this.step++;
return this.step >= this.rows.Count ? SelfTestStepResult.Pass : SelfTestStepResult.Waiting;
this.step++;
return this.step >= this.rows.Count ? SelfTestStepResult.Pass : SelfTestStepResult.Waiting;
}
}
/// <inheritdoc/>
public void CleanUp()
{
// ignored
this.step = 0;
}
}