ConfigurationWindow.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. using System.Numerics;
  2. using Dalamud.Interface.Utility;
  3. using Dalamud.Interface.Windowing;
  4. using HuntBuddy.Utils;
  5. using ImGuiNET;
  6. namespace HuntBuddy.Windows;
  7. /// <summary>
  8. /// Configuration window.
  9. /// </summary>
  10. public class ConfigurationWindow: Window {
  11. public const int BaseTooltipWidth = 450;
  12. public ConfigurationWindow() : base(
  13. $"{Plugin.Instance.Name} configuration",
  14. ImGuiWindowFlags.NoDocking,
  15. true) {
  16. this.Size = Vector2.Zero;
  17. this.SizeCondition = ImGuiCond.Always;
  18. }
  19. public override void PreOpenCheck() {
  20. if (Plugin.Instance.Configuration.LockWindowPositions) {
  21. this.Flags |= ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove;
  22. }
  23. else {
  24. this.Flags &= ~(ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove);
  25. }
  26. }
  27. public override void Draw() {
  28. bool save = false;
  29. if (Plugin.EspConsumer?.IsAvailable == true) { // probably shouldn't name a 3pp if it's not installed
  30. save |= ImGui.Checkbox("Enable XivEsp plugin integration?", ref Plugin.Instance.Configuration.EnableXivEspIntegration);
  31. ImGui.Indent();
  32. save |= ImGui.Checkbox("Set XivEsp search when using '/phb next' command?", ref Plugin.Instance.Configuration.AutoSetEspSearchOnNextHuntCommand);
  33. ImGui.Unindent();
  34. if (ImGui.IsItemHovered()) {
  35. InterfaceUtil.DrawWrappedTooltip(ImGuiHelpers.GlobalScale * BaseTooltipWidth,
  36. "If enabled and XivEsp is available, the '/phb next' command will automatically set XivEsp's search"
  37. + "to the name of the chosen mark, EVEN IF you already have a custom search active.");
  38. }
  39. }
  40. ImGui.Spacing();
  41. save |= ImGui.Checkbox("Lock plugin window positions and sizes",
  42. ref Plugin.Instance.Configuration.LockWindowPositions);
  43. save |= ImGui.Checkbox("Include hunt area on map by default",
  44. ref Plugin.Instance.Configuration.IncludeAreaOnMap);
  45. if (ImGui.IsItemHovered()) {
  46. InterfaceUtil.DrawWrappedTooltip(ImGuiHelpers.GlobalScale * BaseTooltipWidth,
  47. $"{Plugin.Instance.Name} can show an approximate general area for hunt mobs around the flagged location."
  48. + "You can always hold SHIFT to toggle this when you click the button to flag a target on your map.");
  49. }
  50. save |= ImGui.Checkbox("Show hunts in local area",
  51. ref Plugin.Instance.Configuration.ShowLocalHunts);
  52. if (ImGui.IsItemHovered()) {
  53. InterfaceUtil.DrawWrappedTooltip(ImGuiHelpers.GlobalScale * BaseTooltipWidth,
  54. $"If enabled, {Plugin.Instance.Name} will display an extra window with the hunt targets in your current map zone.");
  55. }
  56. save |= ImGui.Checkbox("Show icons of hunts in local area",
  57. ref Plugin.Instance.Configuration.ShowLocalHuntIcons);
  58. if (ImGui.IsItemHovered()) {
  59. InterfaceUtil.DrawWrappedTooltip(ImGuiHelpers.GlobalScale * BaseTooltipWidth,
  60. "These icons are taken from the hunt mark bills the game displays, and so may not be the clearest images available.");
  61. }
  62. save |= ImGui.Checkbox("Hide background of local hunts window",
  63. ref Plugin.Instance.Configuration.HideLocalHuntBackground);
  64. save |= ImGui.Checkbox("Hide completed targets in local hunts window",
  65. ref Plugin.Instance.Configuration.HideCompletedHunts);
  66. save |= ImGui.Checkbox("Suppress chat warning about B-ranks not having locations",
  67. ref Plugin.Instance.Configuration.SuppressEliteMarkLocationWarning);
  68. if (ImGui.IsItemHovered()) {
  69. InterfaceUtil.DrawWrappedTooltip(ImGuiHelpers.GlobalScale * BaseTooltipWidth,
  70. $"When the '/phb next' command selects a B-rank mark, a warning is printed in your chat log that {Plugin.Instance.Name}"
  71. + " DOES NOT provide locations for B-rank hunt marks. If this warning annoys you, you can turn it off.\n"
  72. + "\n"
  73. + "Do not ask for B-rank locations to be provided.");
  74. }
  75. ImGui.Spacing();
  76. save |= ImGui.SliderFloat("Hunt icon scale", ref Plugin.Instance.Configuration.IconScale, 0.2f, 2f, "%.2f");
  77. if (ImGui.ColorEdit4("Hunt icon background colour", ref Plugin.Instance.Configuration.IconBackgroundColour)) {
  78. Plugin.Instance.Configuration.IconBackgroundColourU32 =
  79. ImGui.ColorConvertFloat4ToU32(Plugin.Instance.Configuration.IconBackgroundColour);
  80. save = true;
  81. }
  82. if (save) {
  83. Plugin.Instance.Configuration.Save();
  84. }
  85. }
  86. }