diff --git a/README.md b/README.md index e88bdc7..bb9456b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,18 @@ -# YesAlready2 +## YesAlready -It was so good it's being rewritten +### Update as of 2023/10/03 - YesAlready is now maintained by Puni.sh, support can be provided in our Discord community. Please update your repo url to the one found further below. + +[![image](https://discordapp.com/api/guilds/1001823907193552978/embed.png?style=banner2)](https://discord.gg/Zzrcc8kmvy) + +This plugin stores a list of Yes/No dialogs (among others) and clicks yes for you when they show up. Look, I already said yes once, don't ask me again. Like for all those little prompts in dungeons. Yes I really do want to teleport to the next area in Praetorium. + +Each type of dialog needs to be manually added, if you would like one that is not currently supported, please let me know. + +## In-game usage + +- Type `/pyes` to pull up the GUI. +- Type `/pyes help` to view additional command line arguments. + +## Installation + +- Add `https://love.puni.sh/ment.json` to your list of repos in `/xlsettings` diff --git a/YesAlready/Features/AddonItemInspectionResultFeature.cs b/YesAlready/Features/AddonItemInspectionResultFeature.cs index b25fbd1..f3bfbc7 100644 --- a/YesAlready/Features/AddonItemInspectionResultFeature.cs +++ b/YesAlready/Features/AddonItemInspectionResultFeature.cs @@ -48,7 +48,7 @@ protected unsafe void AddonSetup(AddonEvent eventType, AddonArgs addonInfo) if (descText.Contains('※') || descText.Contains("liées à Garde-la-Reine")) { nameText.Payloads.Insert(0, new TextPayload("Received: ")); - Svc.Log.Info(nameText.ToString()); + Utils.SEString.PrintPluginMessage(nameText); } itemInspectionCount++; @@ -56,7 +56,7 @@ protected unsafe void AddonSetup(AddonEvent eventType, AddonArgs addonInfo) if (rateLimiter != 0 && itemInspectionCount % rateLimiter == 0) { itemInspectionCount = 0; - Svc.Log.Info("Rate limited, pausing item inspection loop."); + Utils.SEString.PrintPluginMessage("Rate limited, pausing item inspection loop."); return; } diff --git a/YesAlready/Features/AddonSelectYesNoFeature.cs b/YesAlready/Features/AddonSelectYesNoFeature.cs index b3b6084..5ce9131 100644 --- a/YesAlready/Features/AddonSelectYesNoFeature.cs +++ b/YesAlready/Features/AddonSelectYesNoFeature.cs @@ -5,7 +5,6 @@ using ClickLib.Clicks; using Dalamud.Game.Addon.Lifecycle; using Dalamud.Game.Addon.Lifecycle.AddonArgTypes; -using Dalamud.Memory; using ECommons.DalamudServices; using FFXIVClientStructs.FFXIV.Client.UI; using FFXIVClientStructs.FFXIV.Component.GUI; @@ -38,8 +37,7 @@ protected unsafe void AddonSetup(AddonEvent eventType, AddonArgs addonInfo) if (dataPtr == null) return; - //var text = P.LastSeenDialogText = Utils.SEString.GetSeStringText(dataPtr->TextPtr); - var text = P.LastSeenDialogText = MemoryHelper.ReadSeStringNullTerminated(new nint(addon->AtkValues[0].String)).ToString(); + var text = P.LastSeenDialogText = Utils.SEString.GetSeStringText(new nint(addon->AtkValues[0].String)); Svc.Log.Debug($"AddonSelectYesNo: text={text}"); if (P.ForcedYesKeyPressed) diff --git a/YesAlready/UI/ZoneListWindow.cs b/YesAlready/UI/ZoneListWindow.cs index 6eda93e..2080529 100644 --- a/YesAlready/UI/ZoneListWindow.cs +++ b/YesAlready/UI/ZoneListWindow.cs @@ -14,8 +14,8 @@ internal class ZoneListWindow : Window public ZoneListWindow() : base("Yes Already Zone List") { - this.Size = new Vector2(525, 600); - this.SizeCondition = ImGuiCond.FirstUseEver; + Size = new Vector2(525, 600); + SizeCondition = ImGuiCond.FirstUseEver; } public override void PreDraw() @@ -46,7 +46,7 @@ public override void Draw() var names = P.TerritoryNames.AsEnumerable(); - if (this.sortZoneByName) + if (sortZoneByName) names = names.ToList().OrderBy(kvp => kvp.Value); foreach (var kvp in names) diff --git a/YesAlready/YesAlready.cs b/YesAlready/YesAlready.cs index b74c367..66ebd4b 100644 --- a/YesAlready/YesAlready.cs +++ b/YesAlready/YesAlready.cs @@ -32,7 +32,7 @@ public class YesAlready : IDalamudPlugin internal WindowSystem Ws; internal MainWindow MainWindow; internal Configuration Config; - private readonly ZoneListWindow zoneListWindow; + internal ZoneListWindow zoneListWindow; internal static YesAlready P; internal static DalamudPluginInterface pi; @@ -49,7 +49,9 @@ public YesAlready(DalamudPluginInterface pluginInterface) ECommonsMain.Init(pi, P); Ws = new(); MainWindow = new(); + zoneListWindow = new(); Ws.AddWindow(MainWindow); + Ws.AddWindow(zoneListWindow); BlockListHandler = new(); Config = pi.GetPluginConfig() as Configuration ?? new Configuration(); @@ -119,6 +121,7 @@ public void Dispose() Ws.RemoveAllWindows(); MainWindow = null; + zoneListWindow = null; Ws = null; ECommonsMain.Dispose(); pi = null; @@ -156,16 +159,21 @@ private void LoadTerritories() } } + private bool wasDisableKeyPressed; private void FrameworkUpdate(object framework) { + // This doesn't respect the plugin being turned off manually. if (Config.DisableKey != VirtualKey.NO_KEY) - { DisableKeyPressed = Svc.KeyState[Config.DisableKey]; - } else - { DisableKeyPressed = false; - } + + if (DisableKeyPressed && !wasDisableKeyPressed) + P.Config.Enabled = false; + else if (!DisableKeyPressed && wasDisableKeyPressed) + P.Config.Enabled = true; + + wasDisableKeyPressed = DisableKeyPressed; if (Config.ForcedYesKey != VirtualKey.NO_KEY) { @@ -264,7 +272,7 @@ private static void CommandHelpMenu() sb.AppendLine($"{Command} lasttalk - Add the last seen target during a Talk dialog."); sb.AppendLine($"{Command} dutyconfirm - Toggle duty confirm."); sb.AppendLine($"{Command} onetimeconfirm - Toggles duty confirm as well as one-time confirm."); - Svc.Log.Info(sb.ToString()); + Utils.SEString.PrintPluginMessage(sb.ToString()); } private void CommandAddNode(bool zoneRestricted, bool createFolder, bool selectNo) @@ -280,7 +288,7 @@ private void CommandAddNode(bool zoneRestricted, bool createFolder, bool selectN Configuration.CreateTextNode(Config.RootFolder, zoneRestricted, createFolder, selectNo); Config.Save(); - Svc.Log.Info("Added a new text entry."); + Utils.SEString.PrintPluginMessage("Added a new text entry."); } private void CommandAddListNode() @@ -306,7 +314,7 @@ private void CommandAddListNode() parent.Children.Add(newNode); Config.Save(); - Svc.Log.Info("Added a new list entry."); + Utils.SEString.PrintPluginMessage("Added a new list entry."); } private void CommandAddTalkNode() @@ -325,7 +333,7 @@ private void CommandAddTalkNode() parent.Children.Add(newNode); Config.Save(); - Svc.Log.Info("Added a new talk entry."); + Utils.SEString.PrintPluginMessage("Added a new talk entry."); } private void ToggleDutyConfirm() @@ -335,7 +343,7 @@ private void ToggleDutyConfirm() Config.Save(); var state = Config.ContentsFinderConfirmEnabled ? "enabled" : "disabled"; - Svc.Log.Info($"Duty Confirm {state}."); + Utils.SEString.PrintPluginMessage($"Duty Confirm {state}."); } private void ToggleOneTimeConfirm() @@ -345,7 +353,7 @@ private void ToggleOneTimeConfirm() Config.Save(); var state = Config.ContentsFinderOneTimeConfirmEnabled ? "enabled" : "disabled"; - Svc.Log.Info($"Duty Confirm and One Time Confirm {state}."); + Utils.SEString.PrintPluginMessage($"Duty Confirm and One Time Confirm {state}."); } #endregion