mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-21 15:27:43 +01:00
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:
parent
08d8605871
commit
0b9af0e3f4
49 changed files with 460 additions and 403 deletions
|
|
@ -1,11 +1,11 @@
|
|||
using System.Numerics;
|
||||
using System.Numerics;
|
||||
|
||||
using Dalamud.Data;
|
||||
using Dalamud.Game.ClientState.Objects.Types;
|
||||
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using Lumina.Excel.Sheets;
|
||||
|
||||
namespace Dalamud.Utility;
|
||||
|
||||
|
|
@ -149,9 +149,7 @@ public static class MapUtil
|
|||
if (agentMap == null || agentMap->CurrentMapId == 0)
|
||||
throw new InvalidOperationException("Could not determine active map - data may not be loaded yet?");
|
||||
|
||||
var territoryTransient = Service<DataManager>.Get()
|
||||
.GetExcelSheet<TerritoryTypeTransient>()!
|
||||
.GetRow(agentMap->CurrentTerritoryId);
|
||||
var territoryTransient = LuminaUtils.CreateRef<TerritoryTypeTransient>(agentMap->CurrentTerritoryId);
|
||||
|
||||
return WorldToMap(
|
||||
go.Position,
|
||||
|
|
@ -161,7 +159,7 @@ public static class MapUtil
|
|||
*/
|
||||
-agentMap->CurrentOffsetX,
|
||||
-agentMap->CurrentOffsetY,
|
||||
territoryTransient?.OffsetZ ?? 0,
|
||||
territoryTransient.ValueNullable?.OffsetZ ?? 0,
|
||||
(uint)agentMap->CurrentMapSizeFactor,
|
||||
correctZOffset);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
using Lumina.Text.Parse;
|
||||
using Lumina.Text.Parse;
|
||||
|
||||
using Lumina.Text.ReadOnly;
|
||||
|
||||
using DSeString = Dalamud.Game.Text.SeStringHandling.SeString;
|
||||
using DSeStringBuilder = Dalamud.Game.Text.SeStringHandling.SeStringBuilder;
|
||||
|
|
@ -20,6 +22,22 @@ public static class SeStringExtensions
|
|||
/// <returns>The re-parsed Dalamud SeString.</returns>
|
||||
public static DSeString ToDalamudString(this LSeString originalString) => DSeString.Parse(originalString.RawData);
|
||||
|
||||
/// <summary>
|
||||
/// Convert a Lumina ReadOnlySeString into a Dalamud SeString.
|
||||
/// This conversion re-parses the string.
|
||||
/// </summary>
|
||||
/// <param name="originalString">The original Lumina ReadOnlySeString.</param>
|
||||
/// <returns>The re-parsed Dalamud SeString.</returns>
|
||||
public static DSeString ToDalamudString(this ReadOnlySeString originalString) => DSeString.Parse(originalString.Data.Span);
|
||||
|
||||
/// <summary>
|
||||
/// Convert a Lumina ReadOnlySeStringSpan into a Dalamud SeString.
|
||||
/// This conversion re-parses the string.
|
||||
/// </summary>
|
||||
/// <param name="originalString">The original Lumina ReadOnlySeStringSpan.</param>
|
||||
/// <returns>The re-parsed Dalamud SeString.</returns>
|
||||
public static DSeString ToDalamudString(this ReadOnlySeStringSpan originalString) => DSeString.Parse(originalString.Data);
|
||||
|
||||
/// <summary>Compiles and appends a macro string.</summary>
|
||||
/// <param name="ssb">Target SeString builder.</param>
|
||||
/// <param name="macroString">Macro string in UTF-8 to compile and append to <paramref name="ssb"/>.</param>
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ using Dalamud.Interface.Colors;
|
|||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Support;
|
||||
using ImGuiNET;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using Lumina.Excel.Sheets;
|
||||
using Serilog;
|
||||
using TerraFX.Interop.Windows;
|
||||
using Windows.Win32.Storage.FileSystem;
|
||||
|
|
@ -813,7 +813,7 @@ public static class Util
|
|||
var names = data.GetExcelSheet<BNpcName>(ClientLanguage.English)!;
|
||||
var rng = new Random();
|
||||
|
||||
return names.ElementAt(rng.Next(0, names.Count() - 1)).Singular.RawString;
|
||||
return names.GetRowAt(rng.Next(0, names.Count - 1)).Singular.ExtractText();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -891,13 +891,13 @@ public static class Util
|
|||
if (actor is ICharacter chara)
|
||||
{
|
||||
actorString +=
|
||||
$" Level: {chara.Level} ClassJob: {(resolveGameData ? chara.ClassJob.GameData?.Name : chara.ClassJob.Id.ToString())} CHP: {chara.CurrentHp} MHP: {chara.MaxHp} CMP: {chara.CurrentMp} MMP: {chara.MaxMp}\n Customize: {BitConverter.ToString(chara.Customize).Replace("-", " ")} StatusFlags: {chara.StatusFlags}\n";
|
||||
$" Level: {chara.Level} ClassJob: {(resolveGameData ? chara.ClassJob.ValueNullable?.Name : chara.ClassJob.RowId.ToString())} CHP: {chara.CurrentHp} MHP: {chara.MaxHp} CMP: {chara.CurrentMp} MMP: {chara.MaxMp}\n Customize: {BitConverter.ToString(chara.Customize).Replace("-", " ")} StatusFlags: {chara.StatusFlags}\n";
|
||||
}
|
||||
|
||||
if (actor is IPlayerCharacter pc)
|
||||
{
|
||||
actorString +=
|
||||
$" HomeWorld: {(resolveGameData ? pc.HomeWorld.GameData?.Name : pc.HomeWorld.Id.ToString())} CurrentWorld: {(resolveGameData ? pc.CurrentWorld.GameData?.Name : pc.CurrentWorld.Id.ToString())} FC: {pc.CompanyTag}\n";
|
||||
$" HomeWorld: {(resolveGameData ? pc.HomeWorld.ValueNullable?.Name : pc.HomeWorld.RowId.ToString())} CurrentWorld: {(resolveGameData ? pc.CurrentWorld.ValueNullable?.Name : pc.CurrentWorld.RowId.ToString())} FC: {pc.CompanyTag}\n";
|
||||
}
|
||||
|
||||
ImGui.TextUnformatted(actorString);
|
||||
|
|
@ -925,13 +925,13 @@ public static class Util
|
|||
if (actor is Character chara)
|
||||
{
|
||||
actorString +=
|
||||
$" Level: {chara.Level} ClassJob: {(resolveGameData ? chara.ClassJob.GameData?.Name : chara.ClassJob.Id.ToString())} CHP: {chara.CurrentHp} MHP: {chara.MaxHp} CMP: {chara.CurrentMp} MMP: {chara.MaxMp}\n Customize: {BitConverter.ToString(chara.Customize).Replace("-", " ")} StatusFlags: {chara.StatusFlags}\n";
|
||||
$" Level: {chara.Level} ClassJob: {(resolveGameData ? chara.ClassJob.ValueNullable?.Name : chara.ClassJob.RowId.ToString())} CHP: {chara.CurrentHp} MHP: {chara.MaxHp} CMP: {chara.CurrentMp} MMP: {chara.MaxMp}\n Customize: {BitConverter.ToString(chara.Customize).Replace("-", " ")} StatusFlags: {chara.StatusFlags}\n";
|
||||
}
|
||||
|
||||
if (actor is PlayerCharacter pc)
|
||||
{
|
||||
actorString +=
|
||||
$" HomeWorld: {(resolveGameData ? pc.HomeWorld.GameData?.Name : pc.HomeWorld.Id.ToString())} CurrentWorld: {(resolveGameData ? pc.CurrentWorld.GameData?.Name : pc.CurrentWorld.Id.ToString())} FC: {pc.CompanyTag}\n";
|
||||
$" HomeWorld: {(resolveGameData ? pc.HomeWorld.ValueNullable?.Name : pc.HomeWorld.RowId.ToString())} CurrentWorld: {(resolveGameData ? pc.CurrentWorld.ValueNullable?.Name : pc.CurrentWorld.RowId.ToString())} FC: {pc.CompanyTag}\n";
|
||||
}
|
||||
|
||||
ImGui.TextUnformatted(actorString);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue