qstbak/Questionable/Questionable.Data/AetherCurrentData.cs
2025-10-09 07:47:19 +10:00

31 lines
965 B
C#

using System.Collections.Immutable;
using System.Linq;
using Dalamud.Plugin.Services;
using Lumina.Excel;
using Lumina.Excel.Sheets;
namespace Questionable.Data;
internal sealed class AetherCurrentData
{
private readonly ImmutableDictionary<ushort, ImmutableList<uint>> _overworldCurrents;
public AetherCurrentData(IDataManager dataManager)
{
_overworldCurrents = (from x in dataManager.GetExcelSheet<AetherCurrentCompFlgSet>()
where x.RowId != 0
where x.Territory.IsValid
select x).ToImmutableDictionary((AetherCurrentCompFlgSet x) => (ushort)x.Territory.RowId, (AetherCurrentCompFlgSet x) => (from y in x.AetherCurrents
where y.RowId != 0 && y.Value.Quest.RowId == 0
select y.RowId).ToImmutableList());
}
public bool IsValidAetherCurrent(ushort territoryId, uint aetherCurrentId)
{
if (_overworldCurrents.TryGetValue(territoryId, out ImmutableList<uint> value))
{
return value.Contains(aetherCurrentId);
}
return false;
}
}