Updated to Risa's changes

This commit is contained in:
2025-08-10 12:48:02 +03:00
parent 0a0ae4bee9
commit 9730de1ba4
59 changed files with 302 additions and 2810 deletions

View File

@@ -6,20 +6,23 @@ using System.Collections.Frozen;
using System.Diagnostics.CodeAnalysis;
using CustomizePlus.GameData.ReverseSearchDictionaries.Bases;
using Lumina.Excel.Sheets;
using Dalamud.Game.ClientState.Objects.Enums;
namespace CustomizePlus.GameData.ReverseSearchDictionaries;
#pragma warning disable SeStringEvaluator
/// <summary> A dictionary that matches names to event npc ids. </summary>
public sealed class ReverseSearchDictENpc(IDalamudPluginInterface pluginInterface, Logger log, IDataManager gameData)
: ReverseNameDictionary(pluginInterface, log, gameData, "ReverseSearchENpcs", Penumbra.GameData.DataContainers.Version.DictENpc, () => CreateENpcData(gameData))
public sealed class ReverseSearchDictENpc(IDalamudPluginInterface pluginInterface, Logger log, IDataManager gameData, ISeStringEvaluator evaluator)
: ReverseNameDictionary(pluginInterface, log, gameData, "ReverseSearchENpcs", Penumbra.GameData.DataContainers.Version.DictENpc, () => CreateENpcData(gameData, evaluator))
{
/// <summary> Create the data. </summary>
private static IReadOnlyDictionary<string, uint> CreateENpcData(IDataManager gameData)
private static IReadOnlyDictionary<string, uint> CreateENpcData(IDataManager gameData, ISeStringEvaluator evaluator)
{
var sheet = gameData.GetExcelSheet<ENpcResident>(gameData.Language)!;
var dict = new Dictionary<string, uint>((int)sheet.Count);
foreach (var n in sheet.Where(e => e.Singular.ByteLength > 0))
dict.TryAdd(DataUtility.ToTitleCaseExtended(n.Singular, (Dalamud.Game.ClientLanguage)n.Article), n.RowId);
dict.TryAdd(evaluator.EvaluateObjStr(ObjectKind.EventNpc, n.RowId, gameData.Language), n.RowId);
return dict.ToFrozenDictionary();
}