diff --git a/SomethingNeedDoing/Interface/HelpWindow.cs b/SomethingNeedDoing/Interface/HelpWindow.cs index 25689134..7dd44792 100644 --- a/SomethingNeedDoing/Interface/HelpWindow.cs +++ b/SomethingNeedDoing/Interface/HelpWindow.cs @@ -328,14 +328,18 @@ static void DisplayChangelog(string date, string changes, bool separator = true) ImGui.PushFont(UiBuilder.MonoFont); DisplayChangelog( - "2024-02-03", + "2024-02-04", + "- Fixed the AR character query commands to only check enabled characters\n" + "- Added PauseTextAdvance()\n" + "- Added RestoreTextAdvance()\n" + "- Added PandoraGetFeatureEnabled()\n" + "- Added PandoraGetFeatureConfigEnabled()\n" + "- Added PandoraSetFeatureState()\n" + "- Added PandoraSetFeatureConfigState()\n" + - "- Added PandoraPauseFeature()\n"); + "- Added PandoraPauseFeature()\n\n" + + "- Added GetClipboard()\n" + + "- Added SetClipboard()\n" + + "- Added CrashTheGame()\n"); DisplayChangelog( "2024-02-01", @@ -1035,11 +1039,12 @@ Lua scripts work by yielding commands back to the macro engine. (nameof(AddonCommands), AddonCommands.Instance), (nameof(CharacterStateCommands), CharacterStateCommands.Instance), (nameof(CraftingCommands), CraftingCommands.Instance), + (nameof(EntityStateCommands), EntityStateCommands.Instance), (nameof(InventoryCommands), InventoryCommands.Instance), (nameof(IpcCommands), IpcCommands.Instance), (nameof(QuestCommands), QuestCommands.Instance), - (nameof(EntityStateCommands), EntityStateCommands.Instance), - (nameof(WorldStateCommands), WorldStateCommands.Instance) + (nameof(SystemCommands), SystemCommands.Instance), + (nameof(WorldStateCommands), WorldStateCommands.Instance), }; foreach (var (commandName, commandInstance) in commands) @@ -1133,7 +1138,8 @@ private void DrawGameData() ("Weather", this.DrawWeather), ("CFC", this.DrawCFC), ("Duty Roulette", this.DrawDutyRoulette), - ("Ocean Fishing Routes", this.DrawOceanFishingSpots), + //("Ocean Fishing Routes", this.DrawOceanFishingRoutes), + ("Fishing Spots", this.DrawOceanFishingSpots), ("Achievements", this.DrawAchievements), }; @@ -1181,6 +1187,18 @@ private void DrawOceanFishingSpots() ImGui.PopStyleColor(); } + //private readonly IEnumerable fishingRoutesSheet = Svc.Data.GetExcelSheet(Svc.ClientState.ClientLanguage)!.Where(x => x.RowId != 0); + //private void DrawOceanFishingRoutes() + //{ + // using var font = ImRaii.PushFont(UiBuilder.MonoFont); + // ImGui.PushStyleColor(ImGuiCol.Text, ShadedColor); + // foreach (var w in fishingRoutesSheet) + // { + // ImGui.Text($"{w.RowId}: {string.Join(" ", w.UnkData0.ToList())}"); + // } + // ImGui.PopStyleColor(); + //} + private readonly IEnumerable rouletteSheet = Svc.Data.GetExcelSheet(Svc.ClientState.ClientLanguage)!.Where(x => !x.Name.RawString.IsNullOrEmpty()); private void DrawDutyRoulette() { diff --git a/SomethingNeedDoing/Misc/ActiveMacro.cs b/SomethingNeedDoing/Misc/ActiveMacro.cs index 0d965b5c..5db267fa 100644 --- a/SomethingNeedDoing/Misc/ActiveMacro.cs +++ b/SomethingNeedDoing/Misc/ActiveMacro.cs @@ -238,10 +238,11 @@ static void RegisterClassMethods(Lua lua, object obj) RegisterClassMethods(this.lua, AddonCommands.Instance); RegisterClassMethods(this.lua, CharacterStateCommands.Instance); RegisterClassMethods(this.lua, CraftingCommands.Instance); + RegisterClassMethods(this.lua, EntityStateCommands.Instance); RegisterClassMethods(this.lua, InventoryCommands.Instance); RegisterClassMethods(this.lua, IpcCommands.Instance); RegisterClassMethods(this.lua, QuestCommands.Instance); - RegisterClassMethods(this.lua, EntityStateCommands.Instance); + RegisterClassMethods(this.lua, SystemCommands.Instance); RegisterClassMethods(this.lua, WorldStateCommands.Instance); script = string.Format(EntrypointTemplate, script); diff --git a/SomethingNeedDoing/Misc/Commands/IpcCommands.cs b/SomethingNeedDoing/Misc/Commands/IpcCommands.cs index eceaa587..8f0c6ff4 100644 --- a/SomethingNeedDoing/Misc/Commands/IpcCommands.cs +++ b/SomethingNeedDoing/Misc/Commands/IpcCommands.cs @@ -1,4 +1,5 @@ using AutoRetainerAPI; +using AutoRetainerAPI.Configuration; using ECommons.DalamudServices; using SomethingNeedDoing.IPC; using System; @@ -78,17 +79,14 @@ public unsafe List ARGetRegisteredEnabledCharacters() => .Where(c => _autoRetainerApi.GetOfflineCharacterData(c).Enabled) .Select(c => $"{_autoRetainerApi.GetOfflineCharacterData(c).Name}@{_autoRetainerApi.GetOfflineCharacterData(c).World}").ToList(); - public unsafe bool ARAnyWaitingToBeProcessed(bool allCharacters = false) => - allCharacters ? - ARRetainersWaitingToBeProcessed(allCharacters) || ARSubsWaitingToBeProcessed(allCharacters) : - ARRetainersWaitingToBeProcessed() || ARSubsWaitingToBeProcessed(); + public unsafe bool ARAnyWaitingToBeProcessed(bool allCharacters = false) => ARRetainersWaitingToBeProcessed(allCharacters) || ARSubsWaitingToBeProcessed(allCharacters) public unsafe bool ARRetainersWaitingToBeProcessed(bool allCharacters = false) { if (!allCharacters) return _autoRetainerApi.GetOfflineCharacterData(Svc.ClientState.LocalContentId).RetainerData.AsParallel().Any(x => x.HasVenture && x.VentureEndsAt <= DateTime.Now.ToUnixTimestamp()); else - return _autoRetainerApi.GetRegisteredCharacters().AsParallel().Any(character => _autoRetainerApi.GetOfflineCharacterData(character).RetainerData.Any(x => x.HasVenture && x.VentureEndsAt <= DateTime.Now.ToUnixTimestamp())); + return GetAllEnabledCharacters().Any(character => _autoRetainerApi.GetOfflineCharacterData(character).RetainerData.Any(x => x.HasVenture && x.VentureEndsAt <= DateTime.Now.ToUnixTimestamp())); } public unsafe bool ARSubsWaitingToBeProcessed(bool allCharacters = false) @@ -96,8 +94,10 @@ public unsafe bool ARSubsWaitingToBeProcessed(bool allCharacters = false) if (!allCharacters) return _autoRetainerApi.GetOfflineCharacterData(Svc.ClientState.LocalContentId).OfflineSubmarineData.AsParallel().Any(x => x.ReturnTime <= DateTime.Now.ToUnixTimestamp()); else - return _autoRetainerApi.GetRegisteredCharacters().AsParallel().Any(character => _autoRetainerApi.GetOfflineCharacterData(character).OfflineSubmarineData.Any(x => x.ReturnTime <= DateTime.Now.ToUnixTimestamp())); + return GetAllEnabledCharacters().Any(c => _autoRetainerApi.GetOfflineCharacterData(c).OfflineSubmarineData.Any(x => x.ReturnTime <= DateTime.Now.ToUnixTimestamp())); } + + private unsafe ParallelQuery GetAllEnabledCharacters() => _autoRetainerApi.GetRegisteredCharacters().AsParallel().Where(c => _autoRetainerApi.GetOfflineCharacterData(c).Enabled); #endregion #region YesAlready diff --git a/SomethingNeedDoing/Misc/Commands/SystemCommands.cs b/SomethingNeedDoing/Misc/Commands/SystemCommands.cs new file mode 100644 index 00000000..1bab3b42 --- /dev/null +++ b/SomethingNeedDoing/Misc/Commands/SystemCommands.cs @@ -0,0 +1,31 @@ +using FFXIVClientStructs.FFXIV.Client.System.Framework; +using FFXIVClientStructs.FFXIV.Client.UI; +using ImGuiNET; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; + +namespace SomethingNeedDoing.Misc.Commands; + +public class SystemCommands +{ + internal static SystemCommands Instance { get; } = new(); + + public List ListAllFunctions() + { + MethodInfo[] methods = this.GetType().GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy); + var list = new List(); + foreach (MethodInfo method in methods.Where(x => x.Name != nameof(ListAllFunctions) && x.DeclaringType != typeof(object))) + { + var parameterList = method.GetParameters().Select(p => $"{p.ParameterType.Name} {p.Name}{(p.IsOptional ? " = " + (p.DefaultValue ?? "null") : "")}"); + list.Add($"{method.ReturnType.Name} {method.Name}({string.Join(", ", parameterList)})"); + } + return list; + } + + public string GetClipboard() => ImGui.GetClipboardText(); + + public void SetClipboard(string text) => ImGui.SetClipboardText(text); + + public unsafe void CrashTheGame() => Framework.Instance()->UIModule = (UIModule*)0; +}