예제 #1
0
        private void UiBuilder_ItemsWithoutText()
        {
            if (ImGui.CollapsingHeader("Non-text Matching"))
            {
                if (ImGui.Checkbox("Desynthesis", ref plugin.Configuration.DesynthDialogEnabled))
                {
                    plugin.SaveConfiguration();
                }
                ImGuiEx.TextTooltip("Don't blame me when you destroy something important");

                if (ImGui.Checkbox("Materialize", ref plugin.Configuration.MaterializeDialogEnabled))
                {
                    plugin.SaveConfiguration();
                }
                ImGuiEx.TextTooltip("The dialog that extracts materia from items");

                if (ImGui.Checkbox("Item Inspection Result", ref plugin.Configuration.ItemInspectionResultEnabled))
                {
                    plugin.SaveConfiguration();
                }
                ImGuiEx.TextTooltip("Eureka/Bozja lockboxes, forgotten fragments, and more.");

                if (ImGui.Checkbox("Assign on Retainer Venture Request", ref plugin.Configuration.RetainerTaskAskEnabled))
                {
                    plugin.SaveConfiguration();
                }
                ImGuiEx.TextTooltip("The final dialog before sending out a retainer.");

                if (ImGui.Checkbox("Reassign on Retainer Venture Result", ref plugin.Configuration.RetainerTaskResultEnabled))
                {
                    plugin.SaveConfiguration();
                }
                ImGuiEx.TextTooltip("Where you receive the item and can resend on the same task.");
            }
        }
예제 #2
0
        private void UiBuilder_ItemsWithoutText()
        {
            if (!ImGui.CollapsingHeader("Non-text Matching"))
            {
                return;
            }

            if (ImGui.Checkbox("Desynthesis", ref plugin.Configuration.DesynthDialogEnabled))
            {
                plugin.SaveConfiguration();
            }
            ImGuiEx.TextTooltip("Don't blame me when you destroy something important.");

            if (ImGui.Checkbox("Desynthesis (Bulk)", ref plugin.Configuration.DesynthBulkDialogEnabled))
            {
                plugin.SaveConfiguration();
            }
            ImGuiEx.TextTooltip("That little checkbox when wanting to bulk desynthesize. The checkbox isn't actually clicked, but it works.");

            if (ImGui.Checkbox("Materialize", ref plugin.Configuration.MaterializeDialogEnabled))
            {
                plugin.SaveConfiguration();
            }
            ImGuiEx.TextTooltip("The dialog that extracts materia from items.");

            if (ImGui.Checkbox("Item Inspection Result", ref plugin.Configuration.ItemInspectionResultEnabled))
            {
                plugin.SaveConfiguration();
            }
            ImGuiEx.TextTooltip("Eureka/Bozja lockboxes, forgotten fragments, and more.");

            if (ImGui.Checkbox("Assign on Retainer Venture Request", ref plugin.Configuration.RetainerTaskAskEnabled))
            {
                plugin.SaveConfiguration();
            }
            ImGuiEx.TextTooltip("The final dialog before sending out a retainer.");

            if (ImGui.Checkbox("Reassign on Retainer Venture Result", ref plugin.Configuration.RetainerTaskResultEnabled))
            {
                plugin.SaveConfiguration();
            }
            ImGuiEx.TextTooltip("Where you receive the item and can resend on the same task.");

            if (ImGui.Checkbox("Grand Company Expert Delivery Reward", ref plugin.Configuration.GrandCompanySupplyReward))
            {
                plugin.SaveConfiguration();
            }
            ImGuiEx.TextTooltip("Don't blame me when you give away something important.");

            if (ImGui.Checkbox("Shop Card Dialog", ref plugin.Configuration.ShopCardDialog))
            {
                plugin.SaveConfiguration();
            }
            ImGuiEx.TextTooltip("When selling Triple Triad cards.");
        }
예제 #3
0
        private void UiBuilder_TextEntry(ConfigTextEntry entry)
        {
            if (ImGui.Checkbox($"###enabled-{entry.GetHashCode()}", ref entry.Enabled))
            {
                plugin.SaveConfiguration();
            }
            if (ImGui.IsItemHovered() && ImGui.IsMouseClicked(ImGuiMouseButton.Right))
            {
                var io = ImGui.GetIO();
                if (io.KeyCtrl && io.KeyShift)
                {
                    TextEntryQuickDeleteTarget = entry;
                }
                else
                {
                    TextEntryOptionsTarget = entry;
                    ImGui.OpenPopup("EntryOptions");
                }
            }

            ImGuiEx.TextTooltip("Enabled");

            if (entry.IsRegex && entry.Regex == null)
            {
                ImGui.PushStyleColor(ImGuiCol.Text, 0xFF0000FF);
                ImGui.PushFont(UiBuilder.IconFont);

                ImGui.SameLine();
                ImGui.Text(FontAwesomeIcon.Exclamation.ToIconString());

                ImGui.PopFont();
                ImGui.PopStyleColor();

                ImGuiEx.TextTooltip("Invalid Regex");
            }

            ImGui.PushItemWidth(-1);

            ImGui.SameLine();
            if (ImGui.InputText($"###text-{entry.GetHashCode()}", ref entry.Text, 10_000) && (!entry.IsRegex || entry.Regex != null))
            {
                plugin.SaveConfiguration();
            }

            ImGui.PopItemWidth();
        }
예제 #4
0
        private void UiBuilder_TextEntryOptionsPopup()
        {
            var entry = TextEntryOptionsTarget;

            if (ImGui.BeginPopupContextItem("EntryOptions"))
            {
                if (ImGui.InputText("Folder", ref entry.Folder, 100))
                {
                    plugin.SaveConfiguration();
                }

                ImGui.SameLine();
                if (ImGuiEx.IconButton(FontAwesomeIcon.TrashAlt, "Delete"))
                {
                    plugin.Configuration.TextEntries.Remove(entry);
                    plugin.SaveConfiguration();
                    ImGui.CloseCurrentPopup();
                }
                ImGui.EndPopup();
            }
        }
예제 #5
0
        private void UiBuilder_TestButton()
        {
            ImGui.InputText("ClickName", ref DebugClickName, 100);
            ImGui.SameLine();
            if (ImGuiEx.IconButton(FontAwesomeIcon.Check, "Submit"))
            {
                try
                {
                    DebugClickName ??= "";
                    ClickLib.Click.SendClick(DebugClickName.Trim());
                    plugin.PrintMessage($"Clicked {DebugClickName} successfully.");
                }
                catch (ClickLib.ClickNotFoundError ex)
                {
                    plugin.PrintError(ex.Message);
                }
                catch (ClickLib.InvalidClickException ex)
                {
                    plugin.PrintError(ex.Message);
                }
            }

            ImGui.InputText("GetAgentAddonName", ref AgentAddonName, 100);
            ImGui.SameLine();
            if (ImGuiEx.IconButton(FontAwesomeIcon.CheckCircle, "Submit"))
            {
                try
                {
                    var addr = FindAgentInterface(AgentAddonName);
                    plugin.PrintMessage($"Agent{AgentAddonName}={addr.ToInt64():X}");
                }
                catch (Exception ex)
                {
                    plugin.PrintError(ex.Message);
                }
            }
        }
예제 #6
0
        private void UiBuilder_TextEntryButtons()
        {
            if (ImGuiEx.IconButton(FontAwesomeIcon.Plus, "Add new entry"))
            {
                plugin.Configuration.TextEntries.Insert(0, new() { Text = "" });
                plugin.SaveConfiguration();
            }

            ImGui.SameLine();
            if (ImGuiEx.IconButton(FontAwesomeIcon.SearchPlus, "Add last seen as new entry"))
            {
                plugin.Configuration.TextEntries.Insert(0, new() { Text = plugin.LastSeenDialogText });
                plugin.SaveConfiguration();
            }

            var sb = new StringBuilder();

            sb.AppendLine("Enter into the input all or part of the text inside a dialog.");
            sb.AppendLine("For example: \"Teleport to \" for the teleport dialog.");
            sb.AppendLine();
            sb.AppendLine("Alternatively, wrap your text in forward slashes to use as a regex.");
            sb.AppendLine("As such: \"/Teleport to .*? for \\d+ gil\\?/\"");
            sb.AppendLine();
            sb.AppendLine("If it matches, the yes button (and checkbox if present) will be clicked.");
            sb.AppendLine();
            sb.AppendLine("Right click the enabled button to view options.");
            sb.AppendLine("Ctrl-Shift right click the enabled button to delete that entry.");
            sb.AppendLine();
            sb.AppendLine("Currently supported text addons:");
            sb.AppendLine("  - SelectYesNo");
            sb.AppendLine();
            sb.AppendLine("Non-text addons are each listed separately in the lower config section.");

            ImGui.SameLine();
            ImGuiEx.IconButton(FontAwesomeIcon.QuestionCircle, sb.ToString());
        }
예제 #7
0
        private void TextNodePopup(ITextNode node)
        {
            var style          = ImGui.GetStyle();
            var newItemSpacing = new Vector2(style.ItemSpacing.X / 2, style.ItemSpacing.Y);

            if (ImGui.BeginPopup($"{node.GetHashCode()}-popup"))
            {
                if (node is TextEntryNode entryNode)
                {
                    ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, newItemSpacing);

                    var enabled = entryNode.Enabled;
                    if (ImGui.Checkbox("Enabled", ref enabled))
                    {
                        entryNode.Enabled = enabled;
                        plugin.SaveConfiguration();
                    }

                    ImGui.SameLine(ImGui.GetContentRegionMax().X - ImGuiEx.GetIconButtonWidth(FontAwesomeIcon.TrashAlt));
                    if (ImGuiEx.IconButton(FontAwesomeIcon.TrashAlt, "Delete"))
                    {
                        if (plugin.Configuration.TryFindParent(node, out var parentNode))
                        {
                            RemoveTextNode.Add(new RemoveTextNodeOperation {
                                Node = node, ParentNode = parentNode
                            });
                        }
                    }

                    var matchText = entryNode.Text;
                    if (ImGui.InputText($"##{node.Name}-matchText", ref matchText, 100, ImGuiInputTextFlags.AutoSelectAll | ImGuiInputTextFlags.EnterReturnsTrue))
                    {
                        entryNode.Text = matchText;
                        plugin.SaveConfiguration();
                    }

                    var zoneRestricted = entryNode.ZoneRestricted;
                    if (ImGui.Checkbox("Zone Restricted", ref zoneRestricted))
                    {
                        entryNode.ZoneRestricted = zoneRestricted;
                        plugin.SaveConfiguration();
                    }

                    var searchWidth     = ImGuiEx.GetIconButtonWidth(FontAwesomeIcon.Search);
                    var searchPlusWidth = ImGuiEx.GetIconButtonWidth(FontAwesomeIcon.SearchPlus);

                    ImGui.SameLine(ImGui.GetContentRegionMax().X - searchWidth);
                    if (ImGuiEx.IconButton(FontAwesomeIcon.Search, "Zone List"))
                    {
                        IsImguiZoneListOpen = true;
                    }

                    ImGui.SameLine(ImGui.GetContentRegionMax().X - searchWidth - searchPlusWidth - newItemSpacing.X);
                    if (ImGuiEx.IconButton(FontAwesomeIcon.SearchPlus, "Fill with current zone"))
                    {
                        var currentID = plugin.Interface.ClientState.TerritoryType;
                        if (plugin.TerritoryNames.TryGetValue(currentID, out var zoneName))
                        {
                            entryNode.ZoneText = zoneName;
                        }
                        else
                        {
                            entryNode.ZoneText = "Could not find name";
                        }
                    }

                    ImGui.PopStyleVar(); // ItemSpacing

                    var zoneText = entryNode.ZoneText;
                    if (ImGui.InputText($"##{node.Name}-zoneText", ref zoneText, 100, ImGuiInputTextFlags.AutoSelectAll | ImGuiInputTextFlags.EnterReturnsTrue))
                    {
                        entryNode.ZoneText = zoneText;
                        plugin.SaveConfiguration();
                    }
                }

                if (node is TextFolderNode folderNode)
                {
                    ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, newItemSpacing);

                    if (ImGuiEx.IconButton(FontAwesomeIcon.Plus, "Add entry"))
                    {
                        var newNode = new TextEntryNode {
                            Enabled = false, Text = "Your text goes here"
                        };
                        AddTextNode.Add(new AddTextNodeOperation {
                            Node = newNode, ParentNode = folderNode, Index = -1
                        });
                    }

                    ImGui.SameLine();
                    if (ImGuiEx.IconButton(FontAwesomeIcon.SearchPlus, "Add last seen as new entry"))
                    {
                        var newNode = new TextEntryNode()
                        {
                            Enabled = true, Text = plugin.LastSeenDialogText
                        };
                        AddTextNode.Add(new AddTextNodeOperation {
                            Node = newNode, ParentNode = folderNode, Index = -1
                        });
                    }

                    ImGui.SameLine();
                    if (ImGuiEx.IconButton(FontAwesomeIcon.FolderPlus, "Add folder"))
                    {
                        var newNode = new TextFolderNode {
                            Name = "Untitled folder"
                        };
                        AddTextNode.Add(new AddTextNodeOperation {
                            Node = newNode, ParentNode = folderNode, Index = -1
                        });
                    }

                    var trashWidth = ImGuiEx.GetIconButtonWidth(FontAwesomeIcon.TrashAlt);
                    ImGui.SameLine(ImGui.GetContentRegionMax().X - trashWidth);
                    if (ImGuiEx.IconButton(FontAwesomeIcon.TrashAlt, "Delete"))
                    {
                        if (plugin.Configuration.TryFindParent(node, out var parentNode))
                        {
                            RemoveTextNode.Add(new RemoveTextNodeOperation {
                                Node = node, ParentNode = parentNode
                            });
                        }
                    }

                    ImGui.PopStyleVar(); // ItemSpacing

                    var folderName = folderNode.Name;
                    if (ImGui.InputText($"##{node.Name}-rename", ref folderName, 100, ImGuiInputTextFlags.AutoSelectAll | ImGuiInputTextFlags.EnterReturnsTrue))
                    {
                        folderNode.Name = folderName;
                        plugin.SaveConfiguration();
                    }
                }

                ImGui.EndPopup();
            }
        }
예제 #8
0
        private void UiBuilder_DisplayTextEntryNode(TextEntryNode node)
        {
            var validRegex = node.IsTextRegex && node.TextRegex != null || !node.IsTextRegex;
            var validZone  = !node.ZoneRestricted || node.ZoneIsRegex && node.ZoneRegex != null || !node.ZoneIsRegex;

            if (!node.Enabled && (!validRegex || !validZone))
            {
                ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(.5f, 0, 0, 1));
            }
            else if (!node.Enabled)
            {
                ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(.5f, .5f, .5f, 1));
            }
            else if (!validRegex || !validZone)
            {
                ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(1, 0, 0, 1));
            }

            ImGui.TreeNodeEx($"{node.Name}##{node.Name}-tree", ImGuiTreeNodeFlags.Leaf);
            ImGui.TreePop();

            if (!node.Enabled || !validRegex || !validZone)
            {
                ImGui.PopStyleColor();
            }

            if (!validRegex && !validZone)
            {
                ImGuiEx.TextTooltip("Invalid Text and Zone Regex");
            }
            else if (!validRegex)
            {
                ImGuiEx.TextTooltip("Invalid Text Regex");
            }
            else if (!validZone)
            {
                ImGuiEx.TextTooltip("Invalid Zone Regex");
            }


            if (ImGui.IsItemHovered())
            {
                if (ImGui.IsMouseDoubleClicked(ImGuiMouseButton.Left))
                {
                    node.Enabled = !node.Enabled;
                    plugin.SaveConfiguration();
                    return;
                }
                else if (ImGui.IsMouseClicked(ImGuiMouseButton.Right))
                {
                    var io = ImGui.GetIO();
                    if (io.KeyCtrl && io.KeyShift)
                    {
                        if (plugin.Configuration.TryFindParent(node, out var parent))
                        {
                            RemoveTextNode.Add(new() { Node = node, ParentNode = parent });
                        }
                        return;
                    }
                    else
                    {
                        ImGui.OpenPopup($"{node.GetHashCode()}-popup");
                    }
                }
            }

            TextNodePopup(node);
            TextNodeDragDrop(node);
        }
예제 #9
0
        private void UiBuilder_TextNodeButtons()
        {
            var style    = ImGui.GetStyle();
            var newStyle = new Vector2(style.ItemSpacing.X / 2, style.ItemSpacing.Y);

            ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, newStyle);

            if (ImGuiEx.IconButton(FontAwesomeIcon.Plus, "Add new entry"))
            {
                var newNode = new TextEntryNode {
                    Enabled = false, Text = "Your text goes here"
                };
                AddTextNode.Add(new AddTextNodeOperation {
                    Node = newNode, ParentNode = plugin.Configuration.RootFolder, Index = -1
                });
            }

            ImGui.SameLine();
            if (ImGuiEx.IconButton(FontAwesomeIcon.SearchPlus, "Add last seen as new entry"))
            {
                var newNode = new TextEntryNode {
                    Enabled = true, Text = plugin.LastSeenDialogText
                };
                AddTextNode.Add(new AddTextNodeOperation {
                    Node = newNode, ParentNode = plugin.Configuration.RootFolder, Index = -1
                });
            }

            ImGui.SameLine();
            if (ImGuiEx.IconButton(FontAwesomeIcon.FolderPlus, "Add folder"))
            {
                var newNode = new TextFolderNode {
                    Name = "Untitled folder"
                };
                AddTextNode.Add(new AddTextNodeOperation {
                    Node = newNode, ParentNode = plugin.Configuration.RootFolder, Index = -1
                });
            }

            var sb = new StringBuilder();

            sb.AppendLine("Enter into the input all or part of the text inside a dialog.");
            sb.AppendLine("For example: \"Teleport to \" for the teleport dialog.");
            sb.AppendLine();
            sb.AppendLine("Alternatively, wrap your text in forward slashes to use as a regex.");
            sb.AppendLine("As such: \"/Teleport to .*? for \\d+ gil\\?/\"");
            sb.AppendLine();
            sb.AppendLine("If it matches, the yes button (and checkbox if present) will be clicked.");
            sb.AppendLine();
            sb.AppendLine("Right click a line to view options.");
            sb.AppendLine("Double click an entry for quick enable/disable.");
            sb.AppendLine("Ctrl-Shift right click a line to delete it and any children.");
            sb.AppendLine();
            sb.AppendLine("Currently supported text addons:");
            sb.AppendLine("  - SelectYesNo");
            sb.AppendLine();
            sb.AppendLine("Non-text addons are each listed separately in the lower config section.");

            ImGui.SameLine();
            ImGuiEx.IconButton(FontAwesomeIcon.QuestionCircle, sb.ToString());

            ImGui.PopStyleVar(); // ItemSpacing
        }