31 lines
1.1 KiB
C#
31 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using System.Linq;
|
|
using Dalamud.Plugin.Services;
|
|
using Lumina.Excel.Sheets;
|
|
using Questionable.Model;
|
|
using Questionable.Model.Questing;
|
|
|
|
namespace Questionable.Controller.CustomDelivery;
|
|
|
|
internal sealed class CustomDeliveryNpcData
|
|
{
|
|
private readonly List<CustomDeliveryNpc> _npcs;
|
|
|
|
private readonly Dictionary<ushort, CustomDeliveryNpc> _npcsByRowId;
|
|
|
|
public IReadOnlyList<CustomDeliveryNpc> AllNpcs => _npcs;
|
|
|
|
public CustomDeliveryNpcData(IDataManager dataManager)
|
|
{
|
|
_npcs = (from x in dataManager.GetExcelSheet<SatisfactionNpc>()
|
|
where x.RowId != 0 && x.Npc.RowId != 0
|
|
select new CustomDeliveryNpc((int)(x.RowId - 1), (ushort)x.RowId, x.Npc.Value.Singular.ToString(), x.LevelUnlock, (EExpansionVersion)x.QuestRequired.Value.Expansion.RowId, QuestId.FromRowId(x.QuestRequired.RowId))).ToList();
|
|
_npcsByRowId = _npcs.ToDictionary((CustomDeliveryNpc x) => x.NpcRowId);
|
|
}
|
|
|
|
public bool TryGetByRowId(ushort npcRowId, [NotNullWhen(true)] out CustomDeliveryNpc? npc)
|
|
{
|
|
return _npcsByRowId.TryGetValue(npcRowId, out npc);
|
|
}
|
|
}
|