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,4 +1,4 @@
using System.Linq;
using System.Linq;
using System.Numerics;
using System.Text;
@ -16,7 +16,8 @@ using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET;
using Lumina.Excel.GeneratedSheets2;
using Lumina.Excel;
using Lumina.Excel.Sheets;
using Lumina.Text;
using Lumina.Text.Payloads;
using Lumina.Text.ReadOnly;
@ -33,7 +34,7 @@ internal unsafe class SeStringRendererTestWidget : IDataWindowWidget
private static readonly string[] ThemeNames = ["Dark", "Light", "Classic FF", "Clear Blue"];
private ImVectorWrapper<byte> testStringBuffer;
private string testString = string.Empty;
private Addon[]? addons;
private ExcelSheet<Addon> addons;
private ReadOnlySeString? logkind;
private SeStringDrawParams style;
private bool interactable;
@ -53,7 +54,7 @@ internal unsafe class SeStringRendererTestWidget : IDataWindowWidget
public void Load()
{
this.style = new() { GetEntity = this.GetEntity };
this.addons = null;
this.addons = Service<DataManager>.Get().GetExcelSheet<Addon>();
this.logkind = null;
this.testString = string.Empty;
this.interactable = this.useEntity = true;
@ -155,9 +156,9 @@ internal unsafe class SeStringRendererTestWidget : IDataWindowWidget
if (this.logkind is null)
{
var tt = new SeStringBuilder();
foreach (var uc in Service<DataManager>.Get().GetExcelSheet<LogKind>()!)
foreach (var uc in Service<DataManager>.Get().GetExcelSheet<LogKind>())
{
var ucsp = uc.Format.AsReadOnly().AsSpan();
var ucsp = uc.Format.AsSpan();
if (ucsp.IsEmpty)
continue;
@ -184,7 +185,6 @@ internal unsafe class SeStringRendererTestWidget : IDataWindowWidget
if (ImGui.CollapsingHeader("Addon Table"))
{
this.addons ??= Service<DataManager>.Get().GetExcelSheet<Addon>()!.ToArray();
if (ImGui.BeginTable("Addon Sheet", 3))
{
ImGui.TableSetupScrollFreeze(0, 1);
@ -197,25 +197,27 @@ internal unsafe class SeStringRendererTestWidget : IDataWindowWidget
ImGui.TableHeadersRow();
var clipper = new ImGuiListClipperPtr(ImGuiNative.ImGuiListClipper_ImGuiListClipper());
clipper.Begin(this.addons.Length);
clipper.Begin(this.addons.Count);
while (clipper.Step())
{
for (var i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)
{
var row = this.addons.GetRowAt(i);
ImGui.TableNextRow();
ImGui.PushID(i);
ImGui.TableNextColumn();
ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted($"{this.addons[i].RowId}");
ImGui.TextUnformatted($"{row.RowId}");
ImGui.TableNextColumn();
ImGui.AlignTextToFramePadding();
ImGuiHelpers.SeStringWrapped(this.addons[i].Text.AsReadOnly(), this.style);
ImGuiHelpers.SeStringWrapped(row.Text, this.style);
ImGui.TableNextColumn();
if (ImGui.Button("Print to Chat"))
Service<ChatGui>.Get().Print(this.addons[i].Text.ToDalamudString());
Service<ChatGui>.Get().Print(row.Text.ToDalamudString());
ImGui.PopID();
}