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> _overworldCurrents; public AetherCurrentData(IDataManager dataManager) { _overworldCurrents = (from x in dataManager.GetExcelSheet() 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 value)) { return value.Contains(aetherCurrentId); } return false; } }