Exemplo n.º 1
0
        private void DrawThresholds()
        {
            ImGui.Text(Loc.Localize("MinimumPrice", "Minimum Price"));
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "MinimumPrice_HelpMarker",
                                           "set minimum price at which actual average will be displayed"));
            var minPrice = this.plugin.Configuration.MinPrice;

            if (ImGui.InputInt("###PriceCheck_MinPrice_Slider", ref minPrice, 500, 500))
            {
                this.plugin.Configuration.MinPrice = Math.Abs(minPrice);
                this.plugin.SaveConfig();
            }

            ImGui.Spacing();
            ImGui.Text(Loc.Localize("MaxUploadDays", "Max Upload Days"));
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "MaxUploadDays_HelpMarker",
                                           "set maximum age to avoid using old data"));
            var maxUploadDays = this.plugin.Configuration.MaxUploadDays;

            if (ImGui.InputInt("###PriceCheck_MaxUploadDays_Slider", ref maxUploadDays, 5, 5))
            {
                this.plugin.Configuration.MaxUploadDays = Math.Abs(maxUploadDays);
                this.plugin.SaveConfig();
            }
        }
Exemplo n.º 2
0
        private void DrawFilters()
        {
            var restrictInCombat = this.plugin.Configuration.RestrictInCombat;

            if (ImGui.Checkbox(
                    Loc.Localize("RestrictInCombat", "Don't process in combat") + "###PriceCheck_RestrictInCombat_Checkbox",
                    ref restrictInCombat))
            {
                this.plugin.Configuration.RestrictInCombat = restrictInCombat;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "RestrictInCombat_HelpMarker",
                                           "don't process price checks while in combat"));

            var restrictInContent = this.plugin.Configuration.RestrictInContent;

            if (ImGui.Checkbox(
                    Loc.Localize("RestrictInContent", "Don't process in content") + "###PriceCheck_RestrictInContent_Checkbox",
                    ref restrictInContent))
            {
                this.plugin.Configuration.RestrictInContent = restrictInContent;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "RestrictInContent_HelpMarker",
                                           "don't process price checks while in content"));
        }
Exemplo n.º 3
0
            public static void Draw(Mod mod, Vector2 buttonSize)
            {
                ImGui.SetNextItemWidth(buttonSize.X * 2 + ImGui.GetStyle().ItemSpacing.X);
                var tmp = _currentModDirectory ?? mod.ModPath.Name;

                if (ImGui.InputText("##newModMove", ref tmp, 64))
                {
                    _currentModDirectory = tmp;
                    _state = Mod.Manager.NewDirectoryValid(mod.ModPath.Name, _currentModDirectory, out _);
                }

                var(disabled, tt) = _state switch
                {
                    Mod.Manager.NewDirectoryState.Identical => (true, "Current directory name is identical to new one."),
                    Mod.Manager.NewDirectoryState.Empty => (true, "Please enter a new directory name first."),
                    Mod.Manager.NewDirectoryState.NonExisting => (false, $"Move mod from {mod.ModPath.Name} to {_currentModDirectory}."),
                    Mod.Manager.NewDirectoryState.ExistsEmpty => (false, $"Move mod from {mod.ModPath.Name} to {_currentModDirectory}."),
                    Mod.Manager.NewDirectoryState.ExistsNonEmpty => (true, $"{_currentModDirectory} already exists and is not empty."),
                    Mod.Manager.NewDirectoryState.ExistsAsFile => (true, $"{_currentModDirectory} exists as a file."),
                    Mod.Manager.NewDirectoryState.ContainsInvalidSymbols => (true,
                                                                             $"{_currentModDirectory} contains invalid symbols for FFXIV."),
                    _ => (true, "Unknown error."),
                };
                ImGui.SameLine();
                if (ImGuiUtil.DrawDisabledButton("Rename Mod Directory", buttonSize, tt, disabled) && _currentModDirectory != null)
                {
                    Penumbra.ModManager.MoveModDirectory(mod.Index, _currentModDirectory);
                    Reset();
                }

                ImGui.SameLine();
                ImGuiComponents.HelpMarker(
                    "The mod directory name is used to correspond stored settings and sort orders, otherwise it has no influence on anything that is displayed.\n"
                    + "This can currently not be used on pre-existing folders and does not support merges or overwriting.");
            }
Exemplo n.º 4
0
        private void DrawGeneral()
        {
            // plugin enabled
            var enabled = this.plugin.Configuration.Enabled;

            if (ImGui.Checkbox(
                    Loc.Localize("PluginEnabled", "Plugin Enabled") + "###Kapture_PluginEnabled_Checkbox",
                    ref enabled))
            {
                this.plugin.Configuration.Enabled = enabled;
                this.plugin
                .SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "PluginEnabled_HelpMarker",
                                           "toggle the plugin on/off"));
            ImGui.Spacing();

            // combat
            var restrictInCombat = this.plugin.Configuration.RestrictInCombat;

            if (ImGui.Checkbox(
                    Loc.Localize("RestrictInCombat", "Don't process in combat") + "###Kapture_RestrictInCombat_Checkbox",
                    ref restrictInCombat))
            {
                this.plugin.Configuration.RestrictInCombat = restrictInCombat;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "RestrictInComba_HelpMarker",
                                           "stop processing data while in combat"));
            ImGui.Spacing();

            // loot name format
            ImGui.Text(Loc.Localize("ChatNameFormat", "Chat Name Format"));
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ChatNameFormat_HelpMarker",
                                           "set to match your chat name format setting"));
            ImGui.Spacing();
            var characterNameFormat = this.plugin.Configuration.ChatNameFormat;

            if (ImGui.Combo(
                    "###Kapture_ChatNameFormat_Combo",
                    ref characterNameFormat,
                    NameFormatNames.ToArray(),
                    NameFormatNames.Count))
            {
                this.plugin.Configuration.ChatNameFormat = characterNameFormat;
                this.plugin.SaveConfig();
            }
        }
Exemplo n.º 5
0
        public static void Draw(Mod.Editor editor, Vector2 buttonSize)
        {
            DrawRaceCodeCombo(buttonSize);
            ImGui.SameLine();
            ImGui.SetNextItemWidth(buttonSize.X);
            ImGui.InputTextWithHint("##suffixFrom", "From...", ref _materialSuffixFrom, 32);
            ImGui.SameLine();
            ImGui.SetNextItemWidth(buttonSize.X);
            ImGui.InputTextWithHint("##suffixTo", "To...", ref _materialSuffixTo, 32);
            ImGui.SameLine();
            var disabled = !Mod.Editor.ValidString(_materialSuffixTo);
            var tt       = _materialSuffixTo.Length == 0
                ? "Please enter a target suffix."
                : _materialSuffixFrom == _materialSuffixTo
                    ? "The source and target are identical."
                    : disabled
                        ? "The suffix is invalid."
                        : _materialSuffixFrom.Length == 0
                            ? _raceCode == GenderRace.Unknown
                                ? "Convert all skin material suffices to the target."
                                : "Convert all skin material suffices for the given race code to the target."
                            : _raceCode == GenderRace.Unknown
                                ? $"Convert all skin material suffices that are currently '{_materialSuffixFrom}' to '{_materialSuffixTo}'."
                                : $"Convert all skin material suffices for the given race code that are currently '{_materialSuffixFrom}' to '{_materialSuffixTo}'.";

            if (ImGuiUtil.DrawDisabledButton("Change Material Suffix", buttonSize, tt, disabled))
            {
                editor.ReplaceAllMaterials(_materialSuffixTo, _materialSuffixFrom, _raceCode);
            }

            var anyChanges = editor.ModelFiles.Any(m => m.Changed);

            if (ImGuiUtil.DrawDisabledButton("Save All Changes", buttonSize,
                                             anyChanges ? "Irreversibly rewrites all currently applied changes to model files." : "No changes made yet.", !anyChanges))
            {
                editor.SaveAllModels();
            }

            ImGui.SameLine();
            if (ImGuiUtil.DrawDisabledButton("Revert All Changes", buttonSize,
                                             anyChanges ? "Revert all currently made and unsaved changes." : "No changes made yet.", !anyChanges))
            {
                editor.RestoreAllModels();
            }

            ImGui.SameLine();
            ImGuiComponents.HelpMarker(
                "Model files refer to the skin material they should use. This skin material is always the same, but modders have started using different suffices to differentiate between body types.\n"
                + "This option allows you to switch the suffix of all model files to another. This changes the files, so you do this on your own risk.\n"
                + "If you do not know what the currently used suffix of this mod is, you can leave 'From' blank and it will replace all suffices with 'To', instead of only the matching ones.");
        }
Exemplo n.º 6
0
        private void DrawToast()
        {
            var showToast = this.plugin.Configuration.ShowToast;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowToast", "Show toast") + "###PriceCheck_ShowToast_Checkbox",
                    ref showToast))
            {
                this.plugin.Configuration.ShowToast = showToast;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowToast_HelpMarker",
                                           "show price check results in toasts"));
        }
Exemplo n.º 7
0
        private void RestrictToContent()
        {
            var restrictToContent = this.plugin.Configuration.RestrictToContent;

            if (ImGui.Checkbox(
                    Loc.Localize("RestrictToContent", "Content Only") + "###Kapture_RestrictToContent_Checkbox",
                    ref restrictToContent))
            {
                this.plugin.Configuration.RestrictToContent = restrictToContent;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "RestrictToContent_HelpMarker",
                                           "restrict to instanced content and exclude overworld encounters"));
            ImGui.Spacing();
        }
Exemplo n.º 8
0
        private void RestrictToHighEndDuty()
        {
            var restrictToHighEndDuty = this.plugin.Configuration.RestrictToHighEndDuty;

            if (ImGui.Checkbox(
                    Loc.Localize("RestrictToHighEndDuty", "High-End Duty Only") +
                    "###Kapture_RestrictToHighEndDuty_Checkbox",
                    ref restrictToHighEndDuty))
            {
                this.plugin.Configuration.RestrictToHighEndDuty = restrictToHighEndDuty;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "RestrictToHighEndDuty_HelpMarker",
                                           "restrict to high-end duties only (e.g. savage)"));
            ImGui.Spacing();
        }
Exemplo n.º 9
0
        private void DrawDiscord()
        {
            // discord enabled
            var sendDiscordEnabled = this.plugin.Configuration.SendDiscordEnabled;

            if (ImGui.Checkbox(
                    Loc.Localize("SendDiscordEnabled", "Enable Send to Discord") +
                    "###Kapture_SendDiscordEnabled_Checkbox",
                    ref sendDiscordEnabled))
            {
                this.plugin.Configuration.SendDiscordEnabled = sendDiscordEnabled;
                this.plugin.SaveConfig();
                if (sendDiscordEnabled)
                {
                    this.plugin.LootLogger.SetLogFormat();
                }
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "SendDiscordEnabled_HelpMarker",
                                           "requires setup of the discord bridge plugin to work"));
            ImGui.Spacing();

            // discord frequency
            ImGui.Text(Loc.Localize("SendDiscordFrequency", "Send Discord Message Frequency"));
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "SendDiscordFrequency_HelpMarker",
                                           "frequency to send discord requests in seconds"));
            var sendDiscordFrequency = this.plugin.Configuration.SendDiscordFrequency.FromMillisecondsToSeconds();

            if (ImGui.SliderInt("###Kapture_SendDiscordFrequency_Slider", ref sendDiscordFrequency, 1, 300))
            {
                this.plugin.Configuration.SendDiscordFrequency = sendDiscordFrequency.FromSecondsToMilliseconds();
                this.plugin.SaveConfig();
            }

            // explanation
            ImGui.Spacing();
            ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("DiscordInstructionsHeading", "Instructions"));
            ImGui.Text(Loc.Localize("DiscordInstructions1", "* Install DiscordBridge plugin."));
            ImGui.Text(Loc.Localize("DiscordInstructions2", "* Setup and configure DiscordBridge to send messages to your server."));
            ImGui.Text(Loc.Localize("DiscordInstructions3", "* Run \"xl!setchannel ipc\" in Discord (the chat type used for Kapture messages)."));
            ImGui.Spacing();
        }
Exemplo n.º 10
0
        private void DrawLog()
        {
            // logging enabled
            var loggingEnabled = this.plugin.Configuration.LoggingEnabled;

            if (ImGui.Checkbox(
                    Loc.Localize("LoggingEnabled", "Enable Loot Logging") +
                    "###Kapture_LoggingEnabled_Checkbox",
                    ref loggingEnabled))
            {
                this.plugin.Configuration.LoggingEnabled = loggingEnabled;
                this.plugin.SaveConfig();
                if (loggingEnabled)
                {
                    this.plugin.LootLogger.SetLogFormat();
                }
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "LoggingEnabled_HelpMarker",
                                           "save your loot messages to a file in config (see links)"));
            ImGui.Spacing();

            // log format
            ImGui.Text(Loc.Localize("LogFormat", "Log Format"));
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "LogFormat_HelpMarker",
                                           "set format for log file with loot info"));
            ImGui.Spacing();
            var pluginLogFormat = this.plugin.Configuration.LogFormat;

            if (ImGui.Combo(
                    "###Kapture_LogFormat_Combo",
                    ref pluginLogFormat,
                    LogFormat.LogFormatNames.ToArray(),
                    LogFormat.LogFormatNames.Count))
            {
                this.plugin.Configuration.LogFormat = pluginLogFormat;
                this.plugin.SaveConfig();
                this.plugin.LootLogger.SetLogFormat();
            }
        }
Exemplo n.º 11
0
        // Draw the new collection input as well as its buttons.
        private void DrawNewCollectionInput()
        {
            // Input for new collection name. Also checks for validity when changed.
            ImGui.SetNextItemWidth(_window._inputTextWidth.X);
            if (ImGui.InputTextWithHint("##New Collection", "New Collection Name", ref _newCollectionName, 64))
            {
                _canAddCollection = Penumbra.CollectionManager.CanAddCollection(_newCollectionName, out _);
            }

            ImGui.SameLine();
            ImGuiComponents.HelpMarker(
                "A collection is a set of settings for your installed mods, including their enabled status, their priorities and their mod-specific configuration.\n"
                + "You can use multiple collections to quickly switch between sets of mods.");

            // Creation buttons.
            var tt = _canAddCollection ? string.Empty : "Please enter a unique name before creating a collection.";

            if (ImGuiUtil.DrawDisabledButton("Create New Empty Collection", Vector2.Zero, tt, !_canAddCollection))
            {
                CreateNewCollection(false);
            }

            ImGui.SameLine();
            if (ImGuiUtil.DrawDisabledButton("Duplicate Current Collection", Vector2.Zero, tt, !_canAddCollection))
            {
                CreateNewCollection(true);
            }

            // Deletion conditions.
            var deleteCondition = Penumbra.CollectionManager.Current.Name != ModCollection.DefaultCollection;

            tt = deleteCondition ? string.Empty : "You can not delete the default collection.";
            ImGui.SameLine();
            if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Trash.ToIconString(), Vector2.Zero, tt, !deleteCondition, true))
            {
                Penumbra.CollectionManager.RemoveCollection(Penumbra.CollectionManager.Current);
            }

            DrawCleanCollectionButton();
        }
Exemplo n.º 12
0
        private void DrawLoot()
        {
            // show loot overlay
            var showLootOverlay = this.plugin.Configuration.ShowLootOverlay;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowLootOverlay", "Show Loot Overlay") + "###Kapture_ShowLootOverlay_Checkbox",
                    ref showLootOverlay))
            {
                this.plugin.Configuration.ShowLootOverlay     = showLootOverlay;
                this.Plugin.WindowManager.LootWindow !.IsOpen = showLootOverlay;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowLootOverlay_HelpMarker",
                                           "show loot overlay window"));
            ImGui.Spacing();

            // display mode
            ImGui.Text(Loc.Localize("LootDisplayMode", "Display Mode"));
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "LootDisplayMode_HelpMarker",
                                           "when to show loot overlay"));
            ImGui.Spacing();
            var pluginLootDisplayMode = this.plugin.Configuration.LootDisplayMode;

            if (ImGui.Combo(
                    "###Kapture_LootDisplayMode_Combo",
                    ref pluginLootDisplayMode,
                    DisplayModeNames.ToArray(),
                    DisplayModeNames.Count))
            {
                this.plugin.Configuration.LootDisplayMode = pluginLootDisplayMode;
                this.plugin.SaveConfig();
            }

            ImGui.Spacing();
        }
Exemplo n.º 13
0
        private void DrawFilters()
        {
            // filter to own loot
            var selfOnly = this.plugin.Configuration.SelfOnly;

            if (ImGui.Checkbox(
                    Loc.Localize("SelfOnly", "Self Only") +
                    "###Kapture_SelfOnly_Checkbox",
                    ref selfOnly))
            {
                this.plugin.Configuration.SelfOnly = selfOnly;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "SelfOnly_HelpMarker",
                                           "filter to own items only"));

            var offset = 110f * ImGuiHelpers.GlobalScale;

            var restrictToCustomItemsList = this.plugin.Configuration.RestrictToCustomItems;

            if (ImGui.Checkbox(
                    Loc.Localize("RestrictToCustomItems", "Restrict to Following Items") +
                    "###Kapture_RestrictToCustomItems_Checkbox",
                    ref restrictToCustomItemsList))
            {
                this.plugin.Configuration.RestrictToCustomItems = restrictToCustomItemsList;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "RestrictToCustomItems_HelpMarker",
                                           "add item to list by using dropdown or remove by clicking on them"));

            ImGui.SameLine();
            if (ImGui.SmallButton(Loc.Localize("Reset", "Reset") + "###Kapture_CustomItemReset_Button"))
            {
                this.selectedItemIndex             = 0;
                this.selectedItemCategoryItemIndex = 0;
                this.UpdateItemList();
                this.plugin.Configuration.PermittedItems = new List <uint>();
                this.plugin.SaveConfig();
            }

            ImGui.Spacing();

            // select category by item ui category
            ImGui.Text(Loc.Localize("SelectCategory", "Select Category"));
            ImGui.SameLine(offset);
            ImGui.SetNextItemWidth(ImGui.GetWindowSize().X / 2 * ImGuiHelpers.GlobalScale);
            if (ImGui.Combo(
                    "###Kapture_ItemCategoryItems_Combo",
                    ref this.selectedItemCategoryItemIndex,
                    this.plugin.ItemCategoryNames,
                    this.plugin.ItemCategoryIds.Length))
            {
                this.UpdateItemList();
            }

            // select item based on category
            ImGui.Text(Loc.Localize("SelectItem", "Select Item"));
            ImGui.SameLine(offset);
            ImGui.SetNextItemWidth(ImGui.GetWindowSize().X / 2 * ImGuiHelpers.GlobalScale);
            ImGui.Combo(
                "###Kapture_ItemItems_Combo",
                ref this.selectedItemIndex,
                this.itemNames,
                this.itemIds.Length);
            ImGui.SameLine();
            if (ImGui.SmallButton(Loc.Localize("Add", "Add") + "###Kapture_AddItemItem_Button"))
            {
                if (this.plugin.Configuration.PermittedItems.Contains(
                        this.itemIds[this.selectedItemIndex]))
                {
                    ImGui.OpenPopup("###Kapture_DupeCustomItem_Popup");
                }
                else
                {
                    this.plugin.Configuration.PermittedItems.Add(
                        this.itemIds[this.selectedItemIndex]);
                    this.plugin.SaveConfig();
                }
            }

            // dupe popup
            if (ImGui.BeginPopup("###Kapture_DupeCustomItem_Popup"))
            {
                ImGui.Text(Loc.Localize("DupeCustomItem", "This item is already added!"));
                ImGui.EndPopup();
            }

            ImGui.Spacing();

            // item list
            ImGui.Text(Loc.Localize("PermittedItems", "Permitted Items"));
            ImGui.SameLine(offset - (5f * ImGuiHelpers.GlobalScale));
            ImGui.Indent(offset - (5f * ImGuiHelpers.GlobalScale));
            if (this.plugin.Configuration.PermittedItems.Count > 0)
            {
                foreach (var permittedItem in this.plugin.Configuration.PermittedItems.ToList())
                {
                    var index = Array.IndexOf(this.plugin.ItemIds, permittedItem);
                    ImGui.Text(this.plugin.ItemNames[index]);
                    if (ImGui.IsItemClicked())
                    {
                        this.plugin.Configuration.PermittedItems.Remove(permittedItem);
                        this.plugin.SaveConfig();
                    }
                }
            }
            else
            {
                ImGui.Text(Loc.Localize("NoPermittedItems", "None"));
            }

            ImGui.Spacing();
        }
Exemplo n.º 14
0
        private void RestrictToCustom()
        {
            var restrictToCustomList = this.plugin.Configuration.RestrictToCustomContent;

            if (ImGui.Checkbox(
                    Loc.Localize("RestrictToCustom", "Restrict to Following Content") +
                    "###Kapture_RestrictToCustom_Checkbox",
                    ref restrictToCustomList))
            {
                this.plugin.Configuration.RestrictToCustomContent = restrictToCustomList;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "RestrictToCustom_HelpMarker",
                                           "add content to list by using dropdown or remove by clicking on them"));
            ImGui.Spacing();

            ImGui.SetNextItemWidth(ImGui.GetWindowSize().X / 2 * ImGuiHelpers.GlobalScale);
            ImGui.Combo(
                "###Kapture_Content_Combo",
                ref this.selectedContentIndex,
                this.contentNames,
                this.contentIds.Length);
            ImGui.SameLine();

            if (ImGui.SmallButton(Loc.Localize("Add", "Add") + "###Kapture_ContentAdd_Button"))
            {
                if (this.plugin.Configuration.PermittedContent.Contains(
                        this.contentIds[this.selectedContentIndex]))
                {
                    ImGui.OpenPopup("###Kapture_DupeContent_Popup");
                }
                else
                {
                    this.plugin.Configuration.PermittedContent.Add(
                        this.contentIds[this.selectedContentIndex]);
                    this.plugin.SaveConfig();
                }
            }

            ImGui.SameLine();
            if (ImGui.SmallButton(Loc.Localize("Reset", "Reset") + "###Kapture_ContentReset_Button"))
            {
                this.selectedContentIndex = 0;
                this.plugin.Configuration.PermittedContent = new List <uint>();
                this.plugin.SaveConfig();
            }

            if (ImGui.BeginPopup("###Kapture_DupeContent_Popup"))
            {
                ImGui.Text(Loc.Localize("DupeContent", "This content is already added!"));
                ImGui.EndPopup();
            }

            ImGui.Spacing();

            foreach (var permittedContent in this.plugin.Configuration.PermittedContent.ToList())
            {
                var index = Array.IndexOf(this.contentIds, permittedContent);
                ImGui.Text(this.contentNames[index]);
                if (ImGui.IsItemClicked())
                {
                    this.plugin.Configuration.PermittedContent.Remove(permittedContent);
                    this.plugin.SaveConfig();
                }
            }

            ImGui.Spacing();
        }
Exemplo n.º 15
0
        private void DrawChat()
        {
            ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("DisplayHeading", "Display"));
            ImGui.Spacing();

            var showInChat = this.plugin.Configuration.ShowInChat;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowInChat", "Show in chat") + "###PriceCheck_ShowInChat_Checkbox",
                    ref showInChat))
            {
                this.plugin.Configuration.ShowInChat = showInChat;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowInChat_HelpMarker",
                                           "show price check results in chat"));

            ImGui.Text(Loc.Localize("ChatChannel", "Chat channel"));
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ChatChannel_HelpMarker",
                                           "set the chat channel to send messages"));
            var chatChannel = this.plugin.Configuration.ChatChannel;

            ImGui.SetNextItemWidth(ImGui.GetWindowSize().X / 3);
            if (ImGui.BeginCombo("###PriceCheck_ChatChannel_Combo", chatChannel.ToString()))
            {
                foreach (var type in Enum.GetValues(typeof(XivChatType)).Cast <XivChatType>())
                {
                    if (ImGui.Selectable(type.ToString(), type == chatChannel))
                    {
                        this.plugin.Configuration.ChatChannel = type;
                        this.plugin.SaveConfig();
                    }
                }

                ImGui.EndCombo();
            }

            ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("StyleHeading", "Style"));
            ImGui.Spacing();

            var useChatColors = this.plugin.Configuration.UseChatColors;

            if (ImGui.Checkbox(
                    Loc.Localize("UseChatColors", "Use chat colors") + "###PriceCheck_UseChatColors_Checkbox",
                    ref useChatColors))
            {
                this.plugin.Configuration.UseChatColors = useChatColors;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "UseChatColors_HelpMarker",
                                           "use different colors for chat based on result"));

            var useItemLinks = this.plugin.Configuration.UseItemLinks;

            if (ImGui.Checkbox(
                    Loc.Localize("UseItemLinks", "Use item links") + "###PriceCheck_UseItemLinks_Checkbox",
                    ref useItemLinks))
            {
                this.plugin.Configuration.UseItemLinks = useItemLinks;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "UseItemLinks_HelpMarker",
                                           "use item links in chat results"));

            ImGui.Spacing();
            ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("FiltersHeading", "Filters"));
            var showSuccessInChat = this.plugin.Configuration.ShowSuccessInChat;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowSuccessInChat", "Show successful price check") + "###PriceCheck_ShowSuccessInChat_Checkbox",
                    ref showSuccessInChat))
            {
                this.plugin.Configuration.ShowSuccessInChat = showSuccessInChat;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowSuccessInChat_HelpMarker",
                                           "show successful price check"));

            var showFailedToProcessInChat = this.plugin.Configuration.ShowFailedToProcessInChat;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowFailedToProcessInChat", "Show failed to process error") + "###PriceCheck_ShowFailedToProcessInChat_Checkbox",
                    ref showFailedToProcessInChat))
            {
                this.plugin.Configuration.ShowFailedToProcessInChat = showFailedToProcessInChat;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowFailedToProcessInChat_HelpMarker",
                                           "show error where something went wrong unexpectedly"));

            var showFailedToGetDataInChat = this.plugin.Configuration.ShowFailedToGetDataInChat;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowFailedToGetDataInChat", "Show failed to get data error") + "###PriceCheck_ShowFailedToGetDataInChat_Checkbox",
                    ref showFailedToGetDataInChat))
            {
                this.plugin.Configuration.ShowFailedToGetDataInChat = showFailedToGetDataInChat;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowFailedToGetDataInChat_HelpMarker",
                                           "show error where the plugin couldn't connect to universalis to get the data - usually a problem with your connection or universalis is down"));

            var showNoDataAvailableInChat = this.plugin.Configuration.ShowNoDataAvailableInChat;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowNoDataAvailableInChat", "Show no data available warning") + "###PriceCheck_ShowNoDataAvailableInChat_Checkbox",
                    ref showNoDataAvailableInChat))
            {
                this.plugin.Configuration.ShowNoDataAvailableInChat = showNoDataAvailableInChat;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowNoDataAvailableInChat_HelpMarker",
                                           "show warning where there was no data from universalis available for the item"));

            var showNoRecentDataAvailableInChat = this.plugin.Configuration.ShowNoRecentDataAvailableInChat;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowNoRecentDataAvailableInChat", "Show no recent data available warning") + "###PriceCheck_ShowNoRecentDataAvailableInChat_Checkbox",
                    ref showNoRecentDataAvailableInChat))
            {
                this.plugin.Configuration.ShowNoRecentDataAvailableInChat = showNoRecentDataAvailableInChat;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowNoRecentDataAvailableInChat_HelpMarker",
                                           "show warning where there was no recent data from universalis available for the item within your threshold"));

            var showBelowVendorInChat = this.plugin.Configuration.ShowBelowVendorInChat;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowBelowVendorInChat", "Show cheaper than vendor price warning") + "###PriceCheck_ShowBelowVendorInChat_Checkbox",
                    ref showBelowVendorInChat))
            {
                this.plugin.Configuration.ShowBelowVendorInChat = showBelowVendorInChat;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowBelowVendorInChat_HelpMarker",
                                           "show warning that the market price is cheaper than what you can sell it to a vendor for"));

            var showBelowMinimumInChat = this.plugin.Configuration.ShowBelowMinimumInChat;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowBelowMinimumInChat", "Show cheaper than minimum threshold warning") + "###PriceCheck_ShowBelowMinimumInChat_Checkbox",
                    ref showBelowMinimumInChat))
            {
                this.plugin.Configuration.ShowBelowMinimumInChat = showBelowMinimumInChat;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowBelowMinimumInChat_HelpMarker",
                                           "show warning the price is below your minimum threshold"));

            var showUnmarketableInChat = this.plugin.Configuration.ShowUnmarketableInChat;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowUnmarketableInChat", "Show unmarketable warning") + "###PriceCheck_ShowUnmarketableInChat_Checkbox",
                    ref showUnmarketableInChat))
            {
                this.plugin.Configuration.ShowUnmarketableInChat = showUnmarketableInChat;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowUnmarketableInChat_HelpMarker",
                                           "show warning that the item can't be sold on the market board"));
        }
Exemplo n.º 16
0
        private void DrawContextMenu()
        {
            var showContextMenu = this.plugin.Configuration.ShowContextMenu;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowContextMenu", "Show context menu") +
                    "###PriceCheck_ShowContextMenu_Checkbox",
                    ref showContextMenu))
            {
                this.plugin.Configuration.ShowContextMenu = showContextMenu;
                this.plugin.SaveConfig();
            }

            ImGui.Spacing();
            ImGui.Text(Loc.Localize("ShowContextPosition", "Set context menu item position"));
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowContextPosition_HelpMarker",
                                           "show above or below the first matching item in the menu."));

            var names  = Enum.GetNames(typeof(InternalAction));
            var values = Enum.GetValues(typeof(InternalAction)).Cast <byte>().ToArray();

            ImGui.SetNextItemWidth(ImGui.GetWindowSize().X / 2);
            ImGui.Combo("###PriceCheck_ShowContext_Combo", ref this.currentInternalAction, names, names.Length);
            ImGui.SameLine();

            if (ImGui.SmallButton(Loc.Localize("ShowAbove", "Show Above") + "###PriceCheck_ContextAbove_Button"))
            {
                if (this.plugin.Configuration.ShowContextAboveThis.Contains(
                        values[this.currentInternalAction]) || this.plugin.Configuration.ShowContextBelowThis.Contains(
                        values[this.currentInternalAction]))
                {
                    ImGui.OpenPopup("###PriceCheck_DupeContext_Popup");
                }
                else
                {
                    this.plugin.Configuration.ShowContextAboveThis.Add(
                        values[this.currentInternalAction]);
                    this.plugin.SaveConfig();
                }
            }

            ImGui.SameLine();

            if (ImGui.SmallButton(Loc.Localize("ShowBelow", "Show Below") + "###PriceCheck_ContextBelow_Button"))
            {
                if (this.plugin.Configuration.ShowContextAboveThis.Contains(
                        values[this.currentInternalAction]) || this.plugin.Configuration.ShowContextBelowThis.Contains(
                        values[this.currentInternalAction]))
                {
                    ImGui.OpenPopup("###PriceCheck_DupeContext_Popup");
                }
                else
                {
                    this.plugin.Configuration.ShowContextBelowThis.Add(
                        values[this.currentInternalAction]);
                    this.plugin.SaveConfig();
                }
            }

            ImGui.Spacing();
            ImGui.Spacing();
            ImGui.TextColored(ImGuiColors.DalamudGrey, Loc.Localize("ShowAboveList", "Show Above"));
            if (this.plugin.Configuration.ShowContextAboveThis.Count > 0)
            {
                foreach (var contextAbove in this.plugin.Configuration.ShowContextAboveThis.ToList())
                {
                    var index = Array.IndexOf(values, contextAbove);
                    ImGui.Text(names[index]);
                    if (ImGui.IsItemClicked())
                    {
                        this.plugin.Configuration.ShowContextAboveThis.Remove(contextAbove);
                        this.plugin.SaveConfig();
                    }
                }
            }
            else
            {
                ImGui.Text(Loc.Localize("NoContextItems", "None."));
            }

            ImGui.Spacing();
            ImGui.TextColored(ImGuiColors.DalamudGrey, Loc.Localize("ShowBelowList", "Show Below"));
            if (this.plugin.Configuration.ShowContextBelowThis.Count > 0)
            {
                foreach (var contextBelow in this.plugin.Configuration.ShowContextBelowThis.ToList())
                {
                    var index = Array.IndexOf(values, contextBelow);
                    ImGui.Text(names[index]);
                    if (ImGui.IsItemClicked())
                    {
                        this.plugin.Configuration.ShowContextBelowThis.Remove(contextBelow);
                        this.plugin.SaveConfig();
                    }
                }
            }
            else
            {
                ImGui.Text(Loc.Localize("NoContextItems", "None."));
            }

            if (ImGui.BeginPopup("###PriceCheck_DupeContext_Popup"))
            {
                ImGui.Text(Loc.Localize("DupeContextBelow", "This context item is already added!"));
                ImGui.EndPopup();
            }
        }
Exemplo n.º 17
0
        private void DrawRolls()
        {
            // show roll overlay
            var showRollOverlay = this.plugin.Configuration.ShowRollMonitorOverlay;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowRollOverlay", "Show Roll Monitor Overlay") + "###Kapture_ShowRollOverlay_Checkbox",
                    ref showRollOverlay))
            {
                this.plugin.Configuration.ShowRollMonitorOverlay = showRollOverlay;
                this.Plugin.WindowManager.RollWindow !.IsOpen    = showRollOverlay;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowRollOverlay_HelpMarker",
                                           "show roll monitor overlay window"));
            ImGui.Spacing();

            // show roll reminder
            var showRollReminder = this.plugin.Configuration.SendRollReminder;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowRollReminder", "Show Roll Reminder in Chat") + "###Kapture_ShowRollReminder_Checkbox",
                    ref showRollReminder))
            {
                this.plugin.Configuration.SendRollReminder = showRollReminder;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowRollReminder_HelpMarker",
                                           "send roll reminder before item drops"));
            ImGui.Spacing();

            // display mode
            ImGui.Text(Loc.Localize("RollDisplayMode", "Display Mode"));
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "RollDisplayMode_HelpMarker",
                                           "when to show roll monitor overlay"));
            ImGui.Spacing();
            var pluginRollDisplayMode = this.plugin.Configuration.RollDisplayMode;

            if (ImGui.Combo(
                    "###Kapture_RollDisplayMode_Combo",
                    ref pluginRollDisplayMode,
                    DisplayModeNames.ToArray(),
                    DisplayModeNames.Count))
            {
                this.plugin.Configuration.RollDisplayMode = pluginRollDisplayMode;
                this.plugin.SaveConfig();
            }

            ImGui.Spacing();

            // roll timeout
            ImGui.Text(Loc.Localize("RollMonitorAddedTimeout", "Show Added Items (minutes)"));
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "RollMonitorAddedTimeout_HelpMarker",
                                           "amount of time before removing added items from roll monitor"));
            var rollMonitorAddedTimeout =
                this.plugin.Configuration.RollMonitorAddedTimeout.FromMillisecondsToMinutes();

            if (ImGui.SliderInt("###PlayerTrack_RollMonitorAddedTimeout_Slider", ref rollMonitorAddedTimeout, 5, 60))
            {
                this.plugin.Configuration.RollMonitorAddedTimeout =
                    rollMonitorAddedTimeout.FromMinutesToMilliseconds();
                this.plugin.SaveConfig();
            }

            ImGui.Spacing();

            // roll timeout
            ImGui.Text(Loc.Localize("RollMonitorObtainedTimeout", "Show Obtained Items (seconds)"));
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "RollMonitorObtainedTimeout_HelpMarker",
                                           "amount of time before removing obtained/lost items from roll monitor"));
            var rollMonitorObtainedTimeout =
                this.plugin.Configuration.RollMonitorObtainedTimeout.FromMillisecondsToSeconds();

            if (ImGui.SliderInt("###PlayerTrack_RollMonitorObtainedTimeout_Slider", ref rollMonitorObtainedTimeout, 5, 300))
            {
                this.plugin.Configuration.RollMonitorObtainedTimeout =
                    rollMonitorObtainedTimeout.FromSecondsToMilliseconds();
                this.plugin.SaveConfig();
            }

            ImGui.Spacing();

            // roll reminder warning
            ImGui.Text(Loc.Localize("RollReminderTime", "Roll Reminder Warning (seconds)"));
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "RollReminderTime_HelpMarker",
                                           "amount of time in advanced of missing roll to send reminder"));
            var rollReminderTime =
                this.plugin.Configuration.RollReminderTime.FromMillisecondsToSeconds();

            if (ImGui.SliderInt("###PlayerTrack_RollReminderTime_Slider", ref rollReminderTime, 5, 60))
            {
                this.plugin.Configuration.RollReminderTime =
                    rollReminderTime.FromSecondsToMilliseconds();
                this.plugin.SaveConfig();
            }

            ImGui.Spacing();
        }
Exemplo n.º 18
0
        private void NamePlateConfig()
        {
            // warning about compatability
            ImGui.TextColored(ImGuiColors.DalamudYellow, Loc.Localize(
                                  "NamePlateCompatabilityWarning",
                                  "Warning: Not all of these settings will work if you are using other plugins that modify nameplates."));
            ImGui.Spacing();

            // restrict nameplate use
            ImGui.Text(Loc.Localize("ShowNamePlates", "Show Nameplates"));
            var showNamePlatesIndex = this.plugin.Configuration.ShowNamePlates;

            ImGui.SetNextItemWidth(180f * ImGuiHelpers.GlobalScale);
            if (ImGui.Combo(
                    "###PlayerTrack_ShowNamePlates_Combo",
                    ref showNamePlatesIndex,
                    ContentRestrictionType.RestrictionTypeNames.ToArray(),
                    ContentRestrictionType.RestrictionTypeNames.Count))
            {
                this.plugin.Configuration.ShowNamePlates = ContentRestrictionType.GetContentRestrictionTypeByIndex(showNamePlatesIndex).Index;
                this.plugin.SaveConfig();
                this.plugin.PlayerService.ResetViewPlayers();
                this.plugin.NamePlateManager.ForceRedraw();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowNamePlates_HelpMarker",
                                           "when to show custom nameplates"));
            ImGui.Spacing();

            // restrict in combat
            var restrictNamePlatesInCombat = this.Plugin.Configuration.RestrictNamePlatesInCombat;

            if (ImGui.Checkbox(
                    Loc.Localize("RestrictNamePlatesInCombat", "Don't show nameplates in combat") +
                    "###PlayerTrack_RestrictNamePlatesInCombat_Checkbox",
                    ref restrictNamePlatesInCombat))
            {
                this.Plugin.Configuration.RestrictNamePlatesInCombat = restrictNamePlatesInCombat;
                this.Plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "RestrictNamePlatesInCombat_HelpMarker",
                                           "stop showing nameplates in combat regardless of other settings"));
            ImGui.Spacing();

            // use nameplate colors
            var useNamePlateColors = this.Plugin.Configuration.UseNamePlateColors;

            if (ImGui.Checkbox(
                    Loc.Localize($"UseNamePlateColors", "Use nameplate color"),
                    ref useNamePlateColors))
            {
                this.Plugin.Configuration.UseNamePlateColors = useNamePlateColors;
                this.Plugin.SaveConfig();
                this.plugin.NamePlateManager.ForceRedraw();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "UseNamePlateColors_HelpMarker",
                                           "override normal nameplate color with category/player colors"));
            ImGui.Spacing();

            // disable name plate color change if player is dead
            var disableNamePlateColorIfDead = this.Plugin.Configuration.DisableNamePlateColorIfDead;

            if (ImGui.Checkbox(
                    Loc.Localize("DisableNamePlateColorIfDead", "Disable nameplate color if player is dead") +
                    "###PlayerTrack_DisableNamePlateColorIfDead_Checkbox",
                    ref disableNamePlateColorIfDead))
            {
                this.Plugin.Configuration.DisableNamePlateColorIfDead = disableNamePlateColorIfDead;
                this.Plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "DisableNamePlateColorIfDead_HelpMarker",
                                           "don't update nameplate for dead players so easier to see they are dead"));
            ImGui.Spacing();

            // default the nameplate color to the list color unless changed
            var defaultNamePlateColorToListColor = this.Plugin.Configuration.DefaultNamePlateColorToListColor;

            if (ImGui.Checkbox(
                    Loc.Localize("DefaultNamePlateColorToListColor", "Default nameplate color to list color") +
                    "###PlayerTrack_DefaultNamePlateColorToListColor_Checkbox",
                    ref defaultNamePlateColorToListColor))
            {
                this.Plugin.Configuration.DefaultNamePlateColorToListColor = defaultNamePlateColorToListColor;
                this.Plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "DefaultNamePlateColorToListColor_HelpMarker",
                                           "default the nameplate color to the list color unless changed"));
            ImGui.Spacing();

            // use nameplate titles
            var changeNamePlateTitle = this.Plugin.Configuration.ChangeNamePlateTitle;

            if (ImGui.Checkbox(
                    Loc.Localize($"ChangeNamePlateTitle", "Change nameplate title"),
                    ref changeNamePlateTitle))
            {
                this.Plugin.Configuration.ChangeNamePlateTitle = changeNamePlateTitle;
                this.Plugin.SaveConfig();
                this.plugin.NamePlateManager.ForceRedraw();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ChangeNamePlateTitle_HelpMarker",
                                           "override normal nameplate to use title or category name"));
            ImGui.Spacing();

            // force nameplate style
            var forceNamePlateStyle = this.Plugin.Configuration.ForceNamePlateStyle;

            if (ImGui.Checkbox(
                    Loc.Localize($"ForceNamePlateStyle", "Force consistent nameplate style"),
                    ref forceNamePlateStyle))
            {
                this.Plugin.Configuration.ForceNamePlateStyle = forceNamePlateStyle;
                this.Plugin.SaveConfig();
                this.plugin.NamePlateManager.ForceRedraw();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ForceNamePlateStyle_HelpMarker",
                                           "force LowTitleNoFc nameplate style which looks more " +
                                           "consistent \nbut hides FC and doesn't play nicely with other plugins"));
            ImGui.Spacing();
        }
Exemplo n.º 19
0
        private void DrawHTTP()
        {
            // http enabled
            var sendHTTPEnabled = this.plugin.Configuration.SendHTTPEnabled;

            if (ImGui.Checkbox(
                    Loc.Localize("SendHTTPEnabled", "Enable Send to HTTP Endpoint") +
                    "###Kapture_SendHTTPEnabled_Checkbox",
                    ref sendHTTPEnabled))
            {
                this.plugin.Configuration.SendHTTPEnabled = sendHTTPEnabled;
                this.plugin.SaveConfig();
                if (sendHTTPEnabled)
                {
                    this.plugin.LootLogger.SetLogFormat();
                }
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "SendHTTPEnabled_HelpMarker",
                                           "send your loot messages to http endpoint"));
            ImGui.Spacing();

            // http endpoint
            var httpEndpoint = this.plugin.Configuration.HTTPEndpoint;

            ImGui.Text(Loc.Localize("HTTPEndpoint", "HTTP Endpoint"));
            if (ImGui.InputText(string.Empty, ref httpEndpoint, 200))
            {
                this.plugin.Configuration.HTTPEndpoint = httpEndpoint;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "HTTPEndpoint_HelpMarker",
                                           "http endpoint to send your loot messages to"));
            ImGui.Spacing();

            // http frequency
            ImGui.Text(Loc.Localize("SendHTTPFrequency", "Send HTTP Frequency"));
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "SendHTTPFrequency_HelpMarker",
                                           "frequency to send HTTP requests in seconds"));
            var sendHTTPFrequency = this.plugin.Configuration.SendHTTPFrequency.FromMillisecondsToSeconds();

            if (ImGui.SliderInt("###Kapture_SendHTTPFrequency_Slider", ref sendHTTPFrequency, 1, 300))
            {
                this.plugin.Configuration.SendHTTPFrequency = sendHTTPFrequency.FromSecondsToMilliseconds();
                this.plugin.SaveConfig();
            }

            ImGui.Spacing();

            // http frequency
            ImGui.Text(Loc.Localize("SendHTTPRequestTimeout", "HTTP Request Timeout"));
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "SendHTTPRequestTimeout_HelpMarker",
                                           "amount of time before request time out"));
            var sendHTTPRequestTimeout = this.plugin.Configuration.SendHTTPRequestTimeout.FromMillisecondsToSeconds();

            if (ImGui.SliderInt("###Kapture_SendHTTPRequestTimeout_Slider", ref sendHTTPRequestTimeout, 0, 300))
            {
                this.plugin.Configuration.SendHTTPRequestTimeout = sendHTTPRequestTimeout.FromSecondsToMilliseconds();
                this.plugin.SaveConfig();
            }

            ImGui.Spacing();

            // custom json to send with requests
            ImGui.Text(Loc.Localize("CustomJSON", "Custom JSON"));
            ImGui.SameLine();
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "CustomJSON_HelpMarker",
                                           "custom json to send with each http request"));
            var customJSON = this.plugin.Configuration.HTTPCustomJSON;

            if (ImGui.InputTextMultiline(
                    "###Kapture_CustomJSON_MultiText",
                    ref customJSON,
                    2000,
                    new Vector2(
                        x: ImGui.GetWindowSize().X - (20f * ImGuiHelpers.GlobalScale),
                        y: -1 - (5f * ImGuiHelpers.GlobalScale))))
            {
                this.plugin.Configuration.HTTPCustomJSON = customJSON;
                this.plugin.SaveConfig();
            }
        }
Exemplo n.º 20
0
        private void DrawGeneral()
        {
            var enabled = this.plugin.Configuration.Enabled;

            if (ImGui.Checkbox(
                    Loc.Localize("PluginEnabled", "Plugin enabled") + "###PriceCheck_PluginEnabled_Checkbox",
                    ref enabled))
            {
                this.plugin.Configuration.Enabled = enabled;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "PluginEnabled_HelpMarker",
                                           "toggle the plugin on/off"));

            var showPrices = this.plugin.Configuration.ShowPrices;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowPrices", "Show prices") + "###PriceCheck_ShowPrices_Checkbox",
                    ref showPrices))
            {
                this.plugin.Configuration.ShowPrices = showPrices;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowPrices_HelpMarker",
                                           "show price or just show advice"));

            var allowKeybindAfterHover = this.plugin.Configuration.AllowKeybindAfterHover;

            if (ImGui.Checkbox(
                    Loc.Localize("AllowKeybindAfterHover", "Allow keybind to be pressed after hovering over item") + "###PriceCheck_AllowKeybindAfterHover_Checkbox",
                    ref allowKeybindAfterHover))
            {
                this.plugin.Configuration.AllowKeybindAfterHover = allowKeybindAfterHover;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "AllowKeybindAfterHover_HelpMarker",
                                           "allows you to hold the keybind after the item tooltip has been opened (disable for legacy mode)"));

            ImGui.Spacing();
            ImGui.Text(Loc.Localize("HoverDelay", "Hover delay"));
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "HoverDelay_HelpMarker",
                                           "delay (in seconds) before processing after hovering"));
            var hoverDelay = this.plugin.Configuration.HoverDelay;

            if (ImGui.SliderInt("###PriceCheck_HoverDelay_Slider", ref hoverDelay, 0, 10))
            {
                this.plugin.Configuration.HoverDelay = hoverDelay;
                this.plugin.SaveConfig();
            }

            ImGui.Spacing();
            ImGui.Text(Loc.Localize("PriceMode", "Price mode"));
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "PriceMode_HelpMarker",
                                           "select price calculation to use"));
            var priceMode = this.plugin.Configuration.PriceMode;

            if (ImGui.Combo(
                    "###PriceCheck_PriceMode_Combo",
                    ref priceMode,
                    PriceMode.PriceModeNames.ToArray(),
                    PriceMode.PriceModeNames.Count))
            {
                this.plugin.Configuration.PriceMode = priceMode;
                this.plugin.SaveConfig();
            }

            ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.HealerGreen);
            ImGui.TextWrapped(PriceMode.GetPriceModeByIndex(priceMode)?.Description);
            ImGui.PopStyleColor();

            ImGui.Spacing();
        }
        private void IconConfig()
        {
            if (ImGui.SmallButton(Loc.Localize("IconGlossary", "Glossary") + "###PlayerTrack_OpenGlossary_Button"))
            {
                this.plugin.WindowManager.ModalWindow.Open(ModalWindow.ModalType.IconGlossary);
            }

            ImGui.SameLine();
            if (ImGui.SmallButton(Loc.Localize("Reset", "Reset") + "###PlayerTrack_IconReset_Button"))
            {
                this.selectedIconIndex = 4;
                this.plugin.SetDefaultIcons();
            }

            ImGui.Separator();
            ImGui.Text(Loc.Localize("Icons", "Add / Remove Icons"));
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "AddRemoveIcons",
                                           "add new icons using dropdown or remove icons by clicking on them"));
            ImGui.Spacing();
            ImGui.SetNextItemWidth(ImGui.GetWindowSize().X / 2);
            ImGui.Combo(
                "###PlayerTrack_Icon_Combo",
                ref this.selectedIconIndex,
                IconHelper.IconNames,
                IconHelper.Icons.Length);
            ImGui.SameLine();

            ImGui.PushFont(UiBuilder.IconFont);
            ImGui.Text(IconHelper.Icons[this.selectedIconIndex].ToIconString());
            ImGui.PopFont();
            ImGui.SameLine();

            if (ImGui.SmallButton(Loc.Localize("AddIcon", "Add") + "###PlayerTrack_IconAdd_Button"))
            {
                if (this.Plugin.Configuration.EnabledIcons.Contains(IconHelper.Icons[this.selectedIconIndex]))
                {
                    ImGui.OpenPopup("###PlayerTrack_DupeIcon_Popup");
                }
                else
                {
                    this.Plugin.Configuration.EnabledIcons.Add(IconHelper.Icons[this.selectedIconIndex]);
                    this.Plugin.SaveConfig();
                }
            }

            if (ImGui.BeginPopup("###PlayerTrack_DupeIcon_Popup"))
            {
                ImGui.Text(Loc.Localize("DupeIcon", "This icon is already added!"));
                ImGui.EndPopup();
            }

            ImGui.Spacing();

            foreach (var enabledIcon in this.Plugin.Configuration.EnabledIcons.ToList())
            {
                ImGui.BeginGroup();
                ImGui.PushFont(UiBuilder.IconFont);
                ImGui.Text(enabledIcon.ToIconString());
                ImGui.PopFont();
                ImGui.SameLine();
                ImGui.Text(enabledIcon.ToString());
                ImGui.EndGroup();
                if (ImGui.IsItemClicked())
                {
                    this.Plugin.Configuration.EnabledIcons.Remove(enabledIcon);
                    this.Plugin.SaveConfig();
                }
            }

            ImGui.Spacing();
        }
Exemplo n.º 22
0
        private void ProcessingConfig()
        {
            // restrict in combat
            var restrictInCombat = this.Plugin.Configuration.RestrictInCombat;

            if (ImGui.Checkbox(
                    Loc.Localize("RestrictInCombat", "Don't process in combat") +
                    "###PlayerTrack_RestrictInCombat_Checkbox",
                    ref restrictInCombat))
            {
                this.Plugin.Configuration.RestrictInCombat = restrictInCombat;
                this.Plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "RestrictInCombat_HelpMarker",
                                           "stop processing players while in combat"));
            ImGui.Spacing();

            // add / update players
            ImGui.Text(Loc.Localize("RestrictAddUpdatePlayers", "Add / Update Players"));
            var restrictAddUpdatePlayersIndex = this.plugin.Configuration.RestrictAddUpdatePlayers;

            ImGui.SetNextItemWidth(180f * ImGuiHelpers.GlobalScale);
            if (ImGui.Combo(
                    "###PlayerTrack_RestrictAddUpdatePlayers_Combo",
                    ref restrictAddUpdatePlayersIndex,
                    ContentRestrictionType.RestrictionTypeNames.ToArray(),
                    ContentRestrictionType.RestrictionTypeNames.Count))
            {
                this.plugin.Configuration.RestrictAddUpdatePlayers = ContentRestrictionType.GetContentRestrictionTypeByIndex(restrictAddUpdatePlayersIndex).Index;
                this.plugin.SaveConfig();
                this.plugin.PlayerService.ResetViewPlayers();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "RestrictAddUpdatePlayers_HelpMarker",
                                           "when to add or update players in your area"));
            ImGui.Spacing();

            // add encounters
            ImGui.Text(Loc.Localize("RestrictAddEncounters", "Add New Encounters"));
            var restrictAddEncountersIndex = this.plugin.Configuration.RestrictAddEncounters;

            ImGui.SetNextItemWidth(180f * ImGuiHelpers.GlobalScale);
            if (ImGui.Combo(
                    "###PlayerTrack_RestrictAddEncounters_Combo",
                    ref restrictAddEncountersIndex,
                    ContentRestrictionType.RestrictionTypeNames.ToArray(),
                    ContentRestrictionType.RestrictionTypeNames.Count))
            {
                this.plugin.Configuration.RestrictAddEncounters = ContentRestrictionType.GetContentRestrictionTypeByIndex(restrictAddEncountersIndex).Index;
                this.plugin.SaveConfig();
                this.plugin.PlayerService.ResetViewPlayers();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "RestrictAddEncounters_HelpMarker",
                                           "when to add new encounters (new row in the encounters tab). " +
                                           "don't recommend using always as this will significantly increase file size."));
            ImGui.Spacing();

            // encounters threshold
            ImGui.Text(Loc.Localize("NewEncounterThreshold", "New Encounter Threshold (minutes)"));
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "NewEncounterThreshold_HelpMarker",
                                           "threshold for creating new encounter for player in same location"));
            var newEncounterThreshold =
                this.plugin.Configuration.CreateNewEncounterThreshold.FromMillisecondsToMinutes();

            if (ImGui.SliderInt("###PlayerTrack_NewEncounterThreshold_Slider", ref newEncounterThreshold, 0, 240))
            {
                this.plugin.Configuration.CreateNewEncounterThreshold =
                    newEncounterThreshold.FromMinutesToMilliseconds();
                this.plugin.SaveConfig();
            }

            ImGui.Spacing();
        }
Exemplo n.º 23
0
        private void IntegrationsConfig()
        {
            ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("Lodestone", "Lodestone"));
            var syncToLodestone = this.Plugin.Configuration.SyncToLodestone;

            if (ImGui.Checkbox(
                    Loc.Localize($"SyncToLodestone", "Sync to Lodestone"),
                    ref syncToLodestone))
            {
                this.Plugin.Configuration.SyncToLodestone = syncToLodestone;
                this.Plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "SyncToLodestone_HelpMarker",
                                           "pull player data from lodestone to track name/world changes"));
            ImGui.Spacing();

            ImGui.Text(Loc.Localize("LodestoneLocale", "Lodestone Locale"));
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "LodestoneLocale_HelpMarker",
                                           "set locale for lodestone profile link"));
            ImGui.Spacing();
            var lodestoneLocale = (int)this.Plugin.Configuration.LodestoneLocale;

            if (ImGui.Combo(
                    "###PlayerTrack_LodestoneLocale_Combo",
                    ref lodestoneLocale,
                    Enum.GetNames(typeof(LodestoneLocale)),
                    Enum.GetNames(typeof(LodestoneLocale)).Length))
            {
                this.Plugin.Configuration.LodestoneLocale = (LodestoneLocale)lodestoneLocale;
                this.Plugin.SaveConfig();
            }

            ImGui.Spacing();
            ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("Visibility", "Visibility"));
            var syncWithVisibility = this.Plugin.Configuration.SyncWithVisibility;

            if (ImGui.Checkbox(
                    Loc.Localize($"SyncWithVisibility", "Sync with Visibility"),
                    ref syncWithVisibility))
            {
                this.Plugin.Configuration.SyncWithVisibility = syncWithVisibility;
                this.Plugin.SaveConfig();
                if (syncWithVisibility)
                {
                    this.plugin.VisibilityService.SyncWithVisibility();
                }
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "SyncWithVisibility_HelpMarker",
                                           "synchronize with visibility plugin"));
            ImGui.Spacing();

            var showHiddenPlayersInList = this.Plugin.Configuration.ShowVoidedPlayersInList;

            if (ImGui.Checkbox(
                    Loc.Localize($"ShowHiddenPlayersInList", "Show hidden players in list"),
                    ref showHiddenPlayersInList))
            {
                this.Plugin.Configuration.ShowVoidedPlayersInList = showHiddenPlayersInList;
                this.Plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowHiddenPlayersInList_HelpMarker",
                                           "toggle showing players hidden with visibility in list"));

            ImGui.Spacing();
            ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("FCNameColor", "FCNameColor"));
            var syncWithFCNameColor = this.Plugin.Configuration.SyncWithFCNameColor;

            if (ImGui.Checkbox(
                    Loc.Localize($"SyncWithFCNameColor", "Sync with FCNameColor"),
                    ref syncWithFCNameColor))
            {
                this.Plugin.Configuration.SyncWithFCNameColor = syncWithFCNameColor;
                this.Plugin.SaveConfig();
                if (syncWithFCNameColor)
                {
                    this.plugin.FCNameColorService.SyncWithFCNameColor();
                }
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "SyncWithFCNameColor_HelpMarker",
                                           "synchronize with FCNameColor plugin"));
            ImGui.Spacing();

            var createDynamicFCCategories = this.Plugin.Configuration.CreateDynamicFCCategories;

            if (ImGui.Checkbox(
                    Loc.Localize($"CreateDynamicFCCategories", "Create dynamic FC categories"),
                    ref createDynamicFCCategories))
            {
                this.Plugin.Configuration.CreateDynamicFCCategories = createDynamicFCCategories;
                this.Plugin.SaveConfig();
                if (syncWithFCNameColor && createDynamicFCCategories)
                {
                    this.plugin.FCNameColorService.SyncWithFCNameColor();
                }
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "CreateDynamicFCCategories_HelpMarker",
                                           "create categories that automatically add/remove players based on current FC roster"));

            ImGui.Spacing();

            var reassignPlayersFromExistingCategory = this.Plugin.Configuration.ReassignPlayersFromExistingCategory;

            if (ImGui.Checkbox(
                    Loc.Localize($"ReassignPlayersFromExistingCategory", "Reassign players from existing categories"),
                    ref reassignPlayersFromExistingCategory))
            {
                this.Plugin.Configuration.ReassignPlayersFromExistingCategory = reassignPlayersFromExistingCategory;
                this.Plugin.SaveConfig();
                if (syncWithFCNameColor && createDynamicFCCategories && reassignPlayersFromExistingCategory)
                {
                    this.plugin.FCNameColorService.SyncWithFCNameColor();
                }
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ReassignPlayersFromExistingCategory_HelpMarker",
                                           "reassign players from existing category assignments into fc category and not just default category"));
        }
Exemplo n.º 24
0
        private void DrawOverlay()
        {
            ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("DisplayHeading", "Display"));
            ImGui.Spacing();

            var showOverlay = this.plugin.Configuration.ShowOverlay;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowOverlay", "Show overlay") + "###PriceCheck_ShowOverlay_Checkbox",
                    ref showOverlay))
            {
                this.plugin.Configuration.ShowOverlay         = showOverlay;
                this.plugin.WindowManager.MainWindow !.IsOpen = showOverlay;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowOverlay_HelpMarker",
                                           "show price check results in overlay window"));

            var showOverlayOnLogin = this.plugin.Configuration.ShowOverlayOnLogin;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowOverlayOnLogin", "Show overlay on login") + "###PriceCheck_ShowOverlayOnLogin_Checkbox",
                    ref showOverlayOnLogin))
            {
                this.plugin.Configuration.ShowOverlayOnLogin = showOverlayOnLogin;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowOverlayOnLogin_HelpMarker",
                                           "show overlay window on login"));

            var showOverlayByKeybind = this.plugin.Configuration.ShowOverlayByKeybind;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowOverlayByKeybind", "Show overlay by keybind") + "###PriceCheck_ShowOverlayByKeybind_Checkbox",
                    ref showOverlayByKeybind))
            {
                this.plugin.Configuration.ShowOverlayByKeybind = showOverlayByKeybind;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowOverlayByKeybind_HelpMarker",
                                           "show overlay window when keybind is being held"));

            ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("StyleHeading", "Style"));
            ImGui.Spacing();

            var useOverlayColors = this.plugin.Configuration.UseOverlayColors;

            if (ImGui.Checkbox(
                    Loc.Localize("UseOverlayColors", "Use overlay colors") + "###PriceCheck_UseOverlayColors_Checkbox",
                    ref useOverlayColors))
            {
                this.plugin.Configuration.UseOverlayColors = useOverlayColors;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "UseOverlayColors_HelpMarker",
                                           "use different colors for overlay based on result"));

            ImGui.Spacing();
            ImGui.Text(Loc.Localize("MaxItems", "Max items"));
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "MaxItems_HelpMarker",
                                           "set max number of items in overlay at a time"));
            var maxItemsInOverlay = this.plugin.Configuration.MaxItemsInOverlay;

            if (ImGui.SliderInt("###PriceCheck_MaxItems_Slider", ref maxItemsInOverlay, 1, 30))
            {
                this.plugin.Configuration.MaxItemsInOverlay = maxItemsInOverlay;
                this.plugin.SaveConfig();
            }

            ImGui.Spacing();
            ImGui.Text(Loc.Localize("HideOverlayTimer", "Hide overlay timer"));
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "HideOverlayTimer_HelpMarker",
                                           "hide overlay after x amount of seconds since last price check - you can this by setting to zero."));
            var hideOverlayTimer = this.plugin.Configuration.HideOverlayElapsed.FromMillisecondsToSeconds();

            if (ImGui.SliderInt("###PriceCheck_HideOverlay_Slider", ref hideOverlayTimer, 0, 300))
            {
                this.plugin.Configuration.HideOverlayElapsed = hideOverlayTimer.FromSecondsToMilliseconds();
                this.plugin.SaveConfig();
            }

            ImGui.Spacing();
            ImGui.TextColored(ImGuiColors.DalamudViolet, Loc.Localize("FiltersHeading", "Filters"));
            ImGui.Spacing();
            var showSuccessInOverlay = this.plugin.Configuration.ShowSuccessInOverlay;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowSuccessInOverlay", "Show successful price check") + "###PriceCheck_ShowSuccessInOverlay_Checkbox",
                    ref showSuccessInOverlay))
            {
                this.plugin.Configuration.ShowSuccessInOverlay = showSuccessInOverlay;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowSuccessInOverlay_HelpMarker",
                                           "show successful price check"));

            var showFailedToProcessInOverlay = this.plugin.Configuration.ShowFailedToProcessInOverlay;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowFailedToProcessInOverlay", "Show failed to process error") + "###PriceCheck_ShowFailedToProcessInOverlay_Checkbox",
                    ref showFailedToProcessInOverlay))
            {
                this.plugin.Configuration.ShowFailedToProcessInOverlay = showFailedToProcessInOverlay;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowFailedToProcessInOverlay_HelpMarker",
                                           "show error where something went wrong unexpectedly"));

            var showFailedToGetDataInOverlay = this.plugin.Configuration.ShowFailedToGetDataInOverlay;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowFailedToGetDataInOverlay", "Show failed to get data error") + "###PriceCheck_ShowFailedToGetDataInOverlay_Checkbox",
                    ref showFailedToGetDataInOverlay))
            {
                this.plugin.Configuration.ShowFailedToGetDataInOverlay = showFailedToGetDataInOverlay;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowFailedToGetDataInOverlay_HelpMarker",
                                           "show error where the plugin couldn't connect to universalis to get the data - usually a problem with your connection or universalis is down"));

            var showNoDataAvailableInOverlay = this.plugin.Configuration.ShowNoDataAvailableInOverlay;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowNoDataAvailableInOverlay", "Show no data available warning") + "###PriceCheck_ShowNoDataAvailableInOverlay_Checkbox",
                    ref showNoDataAvailableInOverlay))
            {
                this.plugin.Configuration.ShowNoDataAvailableInOverlay = showNoDataAvailableInOverlay;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowNoDataAvailableInOverlay_HelpMarker",
                                           "show warning where there was no data from universalis available for the item"));

            var showNoRecentDataAvailableInOverlay = this.plugin.Configuration.ShowNoRecentDataAvailableInOverlay;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowNoRecentDataAvailableInOverlay", "Show no recent data available warning") + "###PriceCheck_ShowNoRecentDataAvailableInOverlay_Checkbox",
                    ref showNoRecentDataAvailableInOverlay))
            {
                this.plugin.Configuration.ShowNoRecentDataAvailableInOverlay = showNoRecentDataAvailableInOverlay;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowNoRecentDataAvailableInOverlay_HelpMarker",
                                           "show warning where there was no recent data from universalis available for the item within your threshold"));

            var showBelowVendorInOverlay = this.plugin.Configuration.ShowBelowVendorInOverlay;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowBelowVendorInOverlay", "Show cheaper than vendor price warning") + "###PriceCheck_ShowBelowVendorInOverlay_Checkbox",
                    ref showBelowVendorInOverlay))
            {
                this.plugin.Configuration.ShowBelowVendorInOverlay = showBelowVendorInOverlay;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowBelowVendorInOverlay_HelpMarker",
                                           "show warning that the market price is cheaper than what you can sell it to a vendor for"));

            var showBelowMinimumInOverlay = this.plugin.Configuration.ShowBelowMinimumInOverlay;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowBelowMinimumInOverlay", "Show cheaper than minimum threshold warning") + "###PriceCheck_ShowBelowMinimumInOverlay_Checkbox",
                    ref showBelowMinimumInOverlay))
            {
                this.plugin.Configuration.ShowBelowMinimumInOverlay = showBelowMinimumInOverlay;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowBelowMinimumInOverlay_HelpMarker",
                                           "show warning the price is below your minimum threshold"));

            var showUnmarketableInOverlay = this.plugin.Configuration.ShowUnmarketableInOverlay;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowUnmarketableInOverlay", "Show unmarketable warning") + "###PriceCheck_ShowUnmarketableInOverlay_Checkbox",
                    ref showUnmarketableInOverlay))
            {
                this.plugin.Configuration.ShowUnmarketableInOverlay = showUnmarketableInOverlay;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowUnmarketableInOverlay_HelpMarker",
                                           "show warning that the item can't be sold on the market board"));
        }
Exemplo n.º 25
0
        private void DrawKeybind()
        {
            var keybindEnabled = this.plugin.Configuration.KeybindEnabled;

            if (ImGui.Checkbox(
                    Loc.Localize("KeybindEnabled", "Enable keybind") + "###PriceCheck_KeybindEnabled_Checkbox",
                    ref keybindEnabled))
            {
                this.plugin.Configuration.KeybindEnabled = keybindEnabled;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "KeybindEnabled_HelpMarker",
                                           "toggle if keybind is used or just hover"));

            var showKeybindInTitleBar = this.plugin.Configuration.ShowKeybindInTitleBar;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowKeybindInTitleBar", "Show keybind in titlebar") + "###PriceCheck_ShowKeybindInTitleBar_Checkbox",
                    ref showKeybindInTitleBar))
            {
                this.plugin.Configuration.ShowKeybindInTitleBar = showKeybindInTitleBar;
                this.plugin.SaveConfig();
                this.plugin.WindowManager.MainWindow?.UpdateWindowTitle();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowKeybindInTitleBar_HelpMarker",
                                           "toggle if keybind is displayed in titlebar"));

            ImGui.Spacing();
            ImGui.Text(Loc.Localize("ModifierKeybind", "Modifier"));
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ModifierKeybind_HelpMarker",
                                           "set your modifier key (e.g. shift)"));
            var modifierKey =
                ModifierKey.EnumToIndex(this.plugin.Configuration.ModifierKey);

            if (ImGui.Combo(
                    "###PriceCheck_ModifierKey_Combo",
                    ref modifierKey,
                    ModifierKey.Names.ToArray(),
                    ModifierKey.Names.Length))
            {
                this.plugin.Configuration.ModifierKey =
                    ModifierKey.IndexToEnum(modifierKey);
                this.plugin.SaveConfig();
                this.plugin.WindowManager.MainWindow?.UpdateWindowTitle();
            }

            ImGui.Spacing();
            ImGui.Text(Loc.Localize("PrimaryKeybind", "Primary"));
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "PrimaryKeybind_HelpMarker",
                                           "set your primary key (e.g. None, Z)"));
            var primaryKey = PrimaryKey.EnumToIndex(this.plugin.Configuration.PrimaryKey);

            if (ImGui.Combo(
                    "###PriceCheck_PrimaryKey_Combo",
                    ref primaryKey,
                    PrimaryKey.Names.ToArray(),
                    PrimaryKey.Names.Length))
            {
                this.plugin.Configuration.PrimaryKey = PrimaryKey.IndexToEnum(primaryKey);
                this.plugin.SaveConfig();
                this.plugin.WindowManager.MainWindow?.UpdateWindowTitle();
            }
        }
Exemplo n.º 26
0
    /// <inheritdoc />
    public override void Draw()
    {
        var config = Service <DalamudConfiguration> .Get();

        var renameModalTitle = Loc.Localize("RenameStyleModalTitle", "Rename Style");

        var workStyle = config.SavedStyles[this.currentSel];

        workStyle.BuiltInColors ??= StyleModelV1.DalamudStandard.BuiltInColors;

        var appliedThisFrame = false;

        var styleAry = config.SavedStyles.Select(x => x.Name).ToArray();

        ImGui.Text(Loc.Localize("StyleEditorChooseStyle", "Choose Style:"));
        if (ImGui.Combo("###styleChooserCombo", ref this.currentSel, styleAry, styleAry.Length))
        {
            var newStyle = config.SavedStyles[this.currentSel];
            newStyle.Apply();
            appliedThisFrame = true;
        }

        if (ImGui.Button(Loc.Localize("StyleEditorAddNew", "Add new style")))
        {
            this.SaveStyle();

            var newStyle = StyleModelV1.DalamudStandard;
            newStyle.Name = GetRandomName();
            config.SavedStyles.Add(newStyle);

            this.currentSel = config.SavedStyles.Count - 1;

            newStyle.Apply();
            appliedThisFrame = true;

            config.Save();
        }

        ImGui.SameLine();

        if (ImGuiComponents.IconButton(FontAwesomeIcon.Trash) && this.currentSel != 0)
        {
            this.currentSel--;
            var newStyle = config.SavedStyles[this.currentSel];
            newStyle.Apply();
            appliedThisFrame = true;

            config.SavedStyles.RemoveAt(this.currentSel + 1);

            config.Save();
        }

        if (ImGui.IsItemHovered())
        {
            ImGui.SetTooltip(Loc.Localize("StyleEditorDeleteStyle", "Delete current style"));
        }

        ImGui.SameLine();

        if (ImGuiComponents.IconButton(FontAwesomeIcon.Pen) && this.currentSel != 0)
        {
            var newStyle = config.SavedStyles[this.currentSel];
            this.renameText = newStyle.Name;

            this.renameModalDrawing = true;
            ImGui.OpenPopup(renameModalTitle);
        }

        if (ImGui.IsItemHovered())
        {
            ImGui.SetTooltip(Loc.Localize("StyleEditorRenameStyle", "Rename style"));
        }

        ImGui.SameLine();

        ImGuiHelpers.ScaledDummy(5);
        ImGui.SameLine();

        if (ImGuiComponents.IconButton(FontAwesomeIcon.FileExport))
        {
            var selectedStyle = config.SavedStyles[this.currentSel];
            var newStyle      = StyleModelV1.Get();
            newStyle.Name = selectedStyle.Name;
            ImGui.SetClipboardText(newStyle.Serialize());
        }

        if (ImGui.IsItemHovered())
        {
            ImGui.SetTooltip(Loc.Localize("StyleEditorCopy", "Copy style to clipboard for sharing"));
        }

        ImGui.SameLine();

        if (ImGuiComponents.IconButton(FontAwesomeIcon.FileImport))
        {
            this.SaveStyle();

            var styleJson = ImGui.GetClipboardText();

            try
            {
                var newStyle = StyleModel.Deserialize(styleJson);

                newStyle.Name ??= GetRandomName();

                if (config.SavedStyles.Any(x => x.Name == newStyle.Name))
                {
                    newStyle.Name = $"{newStyle.Name} ({GetRandomName()} Mix)";
                }

                config.SavedStyles.Add(newStyle);
                newStyle.Apply();
                appliedThisFrame = true;

                this.currentSel = config.SavedStyles.Count - 1;

                config.Save();
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Could not import style");
            }
        }

        if (ImGui.IsItemHovered())
        {
            ImGui.SetTooltip(Loc.Localize("StyleEditorImport", "Import style from clipboard"));
        }

        ImGui.Separator();

        ImGui.PushItemWidth(ImGui.GetWindowWidth() * 0.50f);

        if (this.currentSel < 2)
        {
            ImGui.TextColored(ImGuiColors.DalamudRed, Loc.Localize("StyleEditorNotAllowed", "You cannot edit built-in styles. Please add a new style first."));
        }
        else if (appliedThisFrame)
        {
            ImGui.Text(Loc.Localize("StyleEditorApplying", "Applying style..."));
        }
        else if (ImGui.BeginTabBar("StyleEditorTabs"))
        {
            var style = ImGui.GetStyle();

            if (ImGui.BeginTabItem(Loc.Localize("StyleEditorVariables", "Variables")))
            {
                ImGui.BeginChild($"ScrollingVars", ImGuiHelpers.ScaledVector2(0, -32), true, ImGuiWindowFlags.HorizontalScrollbar | ImGuiWindowFlags.NoBackground);

                ImGui.SetCursorPosY(ImGui.GetCursorPosY() - 5);

                ImGui.SliderFloat2("WindowPadding", ref style.WindowPadding, 0.0f, 20.0f, "%.0f");
                ImGui.SliderFloat2("FramePadding", ref style.FramePadding, 0.0f, 20.0f, "%.0f");
                ImGui.SliderFloat2("CellPadding", ref style.CellPadding, 0.0f, 20.0f, "%.0f");
                ImGui.SliderFloat2("ItemSpacing", ref style.ItemSpacing, 0.0f, 20.0f, "%.0f");
                ImGui.SliderFloat2("ItemInnerSpacing", ref style.ItemInnerSpacing, 0.0f, 20.0f, "%.0f");
                ImGui.SliderFloat2("TouchExtraPadding", ref style.TouchExtraPadding, 0.0f, 10.0f, "%.0f");
                ImGui.SliderFloat("IndentSpacing", ref style.IndentSpacing, 0.0f, 30.0f, "%.0f");
                ImGui.SliderFloat("ScrollbarSize", ref style.ScrollbarSize, 1.0f, 20.0f, "%.0f");
                ImGui.SliderFloat("GrabMinSize", ref style.GrabMinSize, 1.0f, 20.0f, "%.0f");
                ImGui.Text("Borders");
                ImGui.SliderFloat("WindowBorderSize", ref style.WindowBorderSize, 0.0f, 1.0f, "%.0f");
                ImGui.SliderFloat("ChildBorderSize", ref style.ChildBorderSize, 0.0f, 1.0f, "%.0f");
                ImGui.SliderFloat("PopupBorderSize", ref style.PopupBorderSize, 0.0f, 1.0f, "%.0f");
                ImGui.SliderFloat("FrameBorderSize", ref style.FrameBorderSize, 0.0f, 1.0f, "%.0f");
                ImGui.SliderFloat("TabBorderSize", ref style.TabBorderSize, 0.0f, 1.0f, "%.0f");
                ImGui.Text("Rounding");
                ImGui.SliderFloat("WindowRounding", ref style.WindowRounding, 0.0f, 12.0f, "%.0f");
                ImGui.SliderFloat("ChildRounding", ref style.ChildRounding, 0.0f, 12.0f, "%.0f");
                ImGui.SliderFloat("FrameRounding", ref style.FrameRounding, 0.0f, 12.0f, "%.0f");
                ImGui.SliderFloat("PopupRounding", ref style.PopupRounding, 0.0f, 12.0f, "%.0f");
                ImGui.SliderFloat("ScrollbarRounding", ref style.ScrollbarRounding, 0.0f, 12.0f, "%.0f");
                ImGui.SliderFloat("GrabRounding", ref style.GrabRounding, 0.0f, 12.0f, "%.0f");
                ImGui.SliderFloat("LogSliderDeadzone", ref style.LogSliderDeadzone, 0.0f, 12.0f, "%.0f");
                ImGui.SliderFloat("TabRounding", ref style.TabRounding, 0.0f, 12.0f, "%.0f");
                ImGui.Text("Alignment");
                ImGui.SliderFloat2("WindowTitleAlign", ref style.WindowTitleAlign, 0.0f, 1.0f, "%.2f");
                var windowMenuButtonPosition = (int)style.WindowMenuButtonPosition + 1;
                if (ImGui.Combo("WindowMenuButtonPosition", ref windowMenuButtonPosition, "None\0Left\0Right\0"))
                {
                    style.WindowMenuButtonPosition = (ImGuiDir)(windowMenuButtonPosition - 1);
                }
                ImGui.SliderFloat2("ButtonTextAlign", ref style.ButtonTextAlign, 0.0f, 1.0f, "%.2f");
                ImGui.SameLine();
                ImGuiComponents.HelpMarker("Alignment applies when a button is larger than its text content.");
                ImGui.SliderFloat2("SelectableTextAlign", ref style.SelectableTextAlign, 0.0f, 1.0f, "%.2f");
                ImGui.SameLine();
                ImGuiComponents.HelpMarker("Alignment applies when a selectable is larger than its text content.");
                ImGui.SliderFloat2("DisplaySafeAreaPadding", ref style.DisplaySafeAreaPadding, 0.0f, 30.0f, "%.0f");
                ImGui.SameLine();
                ImGuiComponents.HelpMarker(
                    "Adjust if you cannot see the edges of your screen (e.g. on a TV where scaling has not been configured).");
                ImGui.EndTabItem();

                ImGui.EndChild();

                ImGui.EndTabItem();
            }

            if (ImGui.BeginTabItem(Loc.Localize("StyleEditorColors", "Colors")))
            {
                ImGui.BeginChild("ScrollingColors", ImGuiHelpers.ScaledVector2(0, -30), true, ImGuiWindowFlags.HorizontalScrollbar | ImGuiWindowFlags.NoBackground);

                ImGui.SetCursorPosY(ImGui.GetCursorPosY() - 5);

                if (ImGui.RadioButton("Opaque", this.alphaFlags == ImGuiColorEditFlags.None))
                {
                    this.alphaFlags = ImGuiColorEditFlags.None;
                }
                ImGui.SameLine();
                if (ImGui.RadioButton("Alpha", this.alphaFlags == ImGuiColorEditFlags.AlphaPreview))
                {
                    this.alphaFlags = ImGuiColorEditFlags.AlphaPreview;
                }
                ImGui.SameLine();
                if (ImGui.RadioButton("Both", this.alphaFlags == ImGuiColorEditFlags.AlphaPreviewHalf))
                {
                    this.alphaFlags = ImGuiColorEditFlags.AlphaPreviewHalf;
                }
                ImGui.SameLine();

                ImGuiComponents.HelpMarker(
                    "In the color list:\n" +
                    "Left-click on color square to open color picker,\n" +
                    "Right-click to open edit options menu.");

                foreach (var imGuiCol in Enum.GetValues <ImGuiCol>())
                {
                    if (imGuiCol == ImGuiCol.COUNT)
                    {
                        continue;
                    }

                    ImGui.PushID(imGuiCol.ToString());

                    ImGui.ColorEdit4("##color", ref style.Colors[(int)imGuiCol], ImGuiColorEditFlags.AlphaBar | this.alphaFlags);

                    ImGui.SameLine(0.0f, style.ItemInnerSpacing.X);
                    ImGui.TextUnformatted(imGuiCol.ToString());

                    ImGui.PopID();
                }

                ImGui.Separator();

                foreach (var property in typeof(DalamudColors).GetProperties(BindingFlags.Public | BindingFlags.Instance))
                {
                    ImGui.PushID(property.Name);

                    var colorVal = property.GetValue(workStyle.BuiltInColors);
                    if (colorVal == null)
                    {
                        colorVal = property.GetValue(StyleModelV1.DalamudStandard.BuiltInColors);
                        property.SetValue(workStyle.BuiltInColors, colorVal);
                    }

                    var color = (Vector4)colorVal;

                    if (ImGui.ColorEdit4("##color", ref color, ImGuiColorEditFlags.AlphaBar | this.alphaFlags))
                    {
                        property.SetValue(workStyle.BuiltInColors, color);
                        workStyle.BuiltInColors?.Apply();
                    }

                    ImGui.SameLine(0.0f, style.ItemInnerSpacing.X);
                    ImGui.TextUnformatted(property.Name);

                    ImGui.PopID();
                }

                ImGui.EndChild();

                ImGui.EndTabItem();
            }

            ImGui.EndTabBar();
        }

        ImGui.PopItemWidth();

        ImGui.Separator();

        if (ImGui.Button(Loc.Localize("Close", "Close")))
        {
            this.IsOpen = false;
        }

        ImGui.SameLine();

        if (ImGui.Button(Loc.Localize("SaveAndClose", "Save and Close")))
        {
            this.SaveStyle();

            config.ChosenStyle = config.SavedStyles[this.currentSel].Name;
            Log.Verbose("ChosenStyle = {ChosenStyle}", config.ChosenStyle);

            this.didSave = true;

            this.IsOpen = false;
        }

        if (ImGui.BeginPopupModal(renameModalTitle, ref this.renameModalDrawing, ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoScrollbar))
        {
            ImGui.Text(Loc.Localize("StyleEditorEnterName", "Please enter the new name for this style."));
            ImGui.Spacing();

            ImGui.InputText("###renameModalInput", ref this.renameText, 255);

            const float buttonWidth = 120f;
            ImGui.SetCursorPosX((ImGui.GetWindowWidth() - buttonWidth) / 2);

            if (ImGui.Button("OK", new Vector2(buttonWidth, 40)))
            {
                config.SavedStyles[this.currentSel].Name = this.renameText;
                config.Save();

                ImGui.CloseCurrentPopup();
            }

            ImGui.EndPopup();
        }
    }
        private void DisplayConfig()
        {
            // show filter type
            var showFilterType = this.Plugin.Configuration.ShowFilterType;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowFilterType", "Show filter type") +
                    "###PlayerTrack_ShowFilterType_Checkbox",
                    ref showFilterType))
            {
                this.Plugin.Configuration.ShowFilterType = showFilterType;
                this.Plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowFilterType_HelpMarker",
                                           "toggle to show filter type on player list"));
            ImGui.Spacing();

            // show search box
            var showSearchBox = this.Plugin.Configuration.ShowSearchBox;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowSearchBox", "Show search box") +
                    "###PlayerTrack_ShowSearchBox_Checkbox",
                    ref showSearchBox))
            {
                this.Plugin.Configuration.ShowSearchBox = showSearchBox;
                this.Plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowSearchBox_HelpMarker",
                                           "toggle to show search box on player list"));
            ImGui.Spacing();

            // lock overlay
            var lockWindow = this.plugin.Configuration.LockWindow;

            if (ImGui.Checkbox(
                    Loc.Localize("LockWindow", "Lock window") + "###PlayerTrack_LockWindow_Checkbox",
                    ref lockWindow))
            {
                this.plugin.Configuration.LockWindow = lockWindow;
                this.Plugin.SaveConfig();
                if (lockWindow)
                {
                    this.plugin.WindowManager.MainWindow?.LockWindow();
                    this.plugin.WindowManager.PlayerDetailWindow.LockWindow();
                }
                else
                {
                    this.plugin.WindowManager.MainWindow?.UnlockWindow();
                    this.plugin.WindowManager.PlayerDetailWindow.UnlockWindow();
                }
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "LockWindow_HelpMarker",
                                           "keep main window locked in size/position"));
            ImGui.Spacing();

            // combine player detail window
            var combinedPlayerDetailWindow = this.plugin.Configuration.CombinedPlayerDetailWindow;

            if (ImGui.Checkbox(
                    Loc.Localize("CombinedPlayerDetailWindow", "Combine windows") + "###PlayerTrack_CombinedPlayerDetailWindow_Checkbox",
                    ref combinedPlayerDetailWindow))
            {
                this.plugin.Configuration.CombinedPlayerDetailWindow = combinedPlayerDetailWindow;
                this.plugin.WindowManager.ShouldTogglePlayerDetail   = true;
                if (combinedPlayerDetailWindow)
                {
                    this.plugin.WindowManager.Panel !.ShowPanel(View.AddPlayer);
                }

                this.Plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "CombinedPlayerDetailWindow_HelpMarker",
                                           "show combined or separate windows like original version"));
            ImGui.Spacing();

            // show player tags
            var showPlayerTags = this.plugin.Configuration.ShowPlayerTags;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowTags", "Show player tags") + "###PlayerTrack_ShowPlayerTags_Checkbox",
                    ref showPlayerTags))
            {
                this.plugin.Configuration.ShowPlayerTags = showPlayerTags;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowPlayerTags_HelpMarker",
                                           "show player tags on detail screen"));
            ImGui.Spacing();

            // show player tags
            var searchTags = this.plugin.Configuration.SearchTags;

            if (ImGui.Checkbox(
                    Loc.Localize("SearchTags", "Check tags on search") + "###PlayerTrack_SearchTags_Checkbox",
                    ref searchTags))
            {
                this.plugin.Configuration.SearchTags = searchTags;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "SearchTags_HelpMarker",
                                           "search player tags with search"));
            ImGui.Spacing();

            // player list offset
            var playerListOffset = this.plugin.Configuration.PlayerListOffset;

            if (ImGui.Checkbox(
                    Loc.Localize("PlayerListOffset", "Add offset to player list") + "###PlayerTrack_PlayerListOffset_Checkbox",
                    ref playerListOffset))
            {
                this.plugin.Configuration.PlayerListOffset = playerListOffset;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "PlayerListOffset_HelpMarker",
                                           "toggle offset with player list to work nicer with dalamud ui customizations like material ui"));
            ImGui.Spacing();

            // search type
            ImGui.Text(Loc.Localize("SearchType", "Search Type"));
            var searchType = (int)this.plugin.Configuration.SearchType;

            ImGui.SetNextItemWidth(ImGui.GetWindowSize().X / 3);
            if (ImGui.Combo(
                    "###PlayerTrack_SearchType_Combo",
                    ref searchType,
                    Enum.GetNames(typeof(PlayerSearchType)),
                    Enum.GetNames(typeof(PlayerSearchType)).Length))
            {
                this.plugin.Configuration.SearchType = (PlayerSearchType)searchType;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "SearchType_HelpMarker",
                                           "type of search to perform"));
        }