using System; using System.Collections.Generic; using System.Linq; using Dalamud.Plugin.Services; using Questionable.Data; using Questionable.Functions; using Questionable.Model.Common; using Questionable.Model.Questing.Converter; namespace Questionable.Controller.DebugCommands; internal sealed class AethernetCommandHandler : IDebugCommandHandler { private readonly IDataManager _dataManager; private readonly IClientState _clientState; private readonly AetheryteFunctions _aetheryteFunctions; private readonly IChatGui _chatGui; public string CommandName => "aethernet"; public AethernetCommandHandler(IDataManager dataManager, IClientState clientState, AetheryteFunctions aetheryteFunctions, IChatGui chatGui) { _dataManager = dataManager; _clientState = clientState; _aetheryteFunctions = aetheryteFunctions; _chatGui = chatGui; } public void Execute(string[] arguments) { ushort territoryType = _clientState.TerritoryType; Dictionary values = AethernetShardConverter.Values; AetheryteData aetheryteData = new AetheryteData(_dataManager); HashSet hashSet = new HashSet(); Dictionary> dictionary = new Dictionary>(); EAetheryteLocation key; string value; foreach (KeyValuePair item3 in values) { item3.Deconstruct(out key, out value); EAetheryteLocation key2 = key; string text = value; if (aetheryteData.TerritoryIds.TryGetValue(key2, out var value2) && value2 == territoryType) { int num = text.IndexOf(']', StringComparison.Ordinal); if (num > 0) { string item = text.Substring(1, num - 1); hashSet.Add(item); } } } if (hashSet.Count == 0) { _chatGui.Print("No aethernet shards found in current zone.", "Questionable", 576); return; } foreach (KeyValuePair item4 in values) { item4.Deconstruct(out key, out value); EAetheryteLocation eAetheryteLocation = key; string text2 = value; int num2 = text2.IndexOf(']', StringComparison.Ordinal); if (num2 <= 0) { continue; } string text3 = text2.Substring(1, num2 - 1); if (hashSet.Contains(text3)) { if (!dictionary.ContainsKey(text3)) { dictionary[text3] = new List<(EAetheryteLocation, string, bool)>(); } bool item2 = _aetheryteFunctions.IsAetheryteUnlocked(eAetheryteLocation); dictionary[text3].Add((eAetheryteLocation, text2, item2)); } } foreach (KeyValuePair> item5 in dictionary.OrderBy>, string>((KeyValuePair> x) => x.Key)) { item5.Deconstruct(out value, out var value3); string value4 = value; List<(EAetheryteLocation, string, bool)> list = value3; List<(EAetheryteLocation, string, bool)> list2 = list.Where<(EAetheryteLocation, string, bool)>(((EAetheryteLocation Location, string Name, bool Unlocked) x) => x.Unlocked).ToList(); List<(EAetheryteLocation, string, bool)> list3 = list.Where<(EAetheryteLocation, string, bool)>(((EAetheryteLocation Location, string Name, bool Unlocked) x) => !x.Unlocked).ToList(); _chatGui.Print($"Aethernet Shards in {value4} ({list.Count} total):", "Questionable", 576); _chatGui.Print($" Unlocked: {list2.Count}", "Questionable", 576); _chatGui.Print($" Missing: {list3.Count}", "Questionable", 576); _chatGui.Print("", "Questionable", 576); if (list3.Count > 0) { _chatGui.Print("Missing/Unattuned Aethernet Shards:", "Questionable", 576); foreach (var item6 in list3.OrderBy<(EAetheryteLocation, string, bool), string>(((EAetheryteLocation Location, string Name, bool Unlocked) x) => x.Name)) { _chatGui.Print(" " + item6.Item2, "Questionable", 576); } _chatGui.Print("", "Questionable", 576); } if (list2.Count > 0) { _chatGui.Print("Unlocked Aethernet Shards:", "Questionable", 576); foreach (var item7 in list2.OrderBy<(EAetheryteLocation, string, bool), string>(((EAetheryteLocation Location, string Name, bool Unlocked) x) => x.Name)) { _chatGui.Print(" " + item7.Item2, "Questionable", 576); } } if (dictionary.Count > 1) { _chatGui.Print("", "Questionable", 576); } } } }