2024-07-08 18:46:01 +00:00
|
|
|
|
using System.Collections.Immutable;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using Dalamud.Plugin.Services;
|
2024-11-16 20:53:37 +00:00
|
|
|
|
using Lumina.Excel.Sheets;
|
2024-07-08 18:46:01 +00:00
|
|
|
|
|
|
|
|
|
namespace Questionable.Data;
|
|
|
|
|
|
|
|
|
|
internal sealed class AetherCurrentData
|
|
|
|
|
{
|
|
|
|
|
private readonly ImmutableDictionary<ushort, ImmutableList<uint>> _overworldCurrents;
|
|
|
|
|
|
2024-07-14 14:17:08 +00:00
|
|
|
|
public AetherCurrentData(IDataManager dataManager)
|
2024-07-08 18:46:01 +00:00
|
|
|
|
{
|
2024-11-18 19:56:13 +00:00
|
|
|
|
_overworldCurrents = dataManager.GetExcelSheet<AetherCurrentCompFlgSet>()
|
2024-07-08 18:46:01 +00:00
|
|
|
|
.Where(x => x.RowId > 0)
|
2024-11-16 20:53:37 +00:00
|
|
|
|
.Where(x => x.Territory.IsValid)
|
2024-07-08 18:46:01 +00:00
|
|
|
|
.ToImmutableDictionary(
|
2024-11-16 20:53:37 +00:00
|
|
|
|
x => (ushort)x.Territory.RowId,
|
2024-07-08 18:46:01 +00:00
|
|
|
|
x => x.AetherCurrents
|
2024-11-16 20:53:37 +00:00
|
|
|
|
.Where(y => y.RowId > 0 && y.Value.Quest.RowId == 0)
|
|
|
|
|
.Select(y => y.RowId)
|
2024-07-08 18:46:01 +00:00
|
|
|
|
.ToImmutableList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool IsValidAetherCurrent(ushort territoryId, uint aetherCurrentId)
|
|
|
|
|
{
|
|
|
|
|
return _overworldCurrents.TryGetValue(territoryId, out ImmutableList<uint>? currentIds) &&
|
|
|
|
|
currentIds.Contains(aetherCurrentId);
|
|
|
|
|
}
|
|
|
|
|
}
|