Skip to content

Commit

Permalink
Add warnings about unsupported B-rank/ARR hunts
Browse files Browse the repository at this point in the history
The `/phb next` command now prints a (suppressable) warning to your chat when an elite mark is chosen, informing you that such targets do not have locations in the plugin. The main window also warns of this, as well as the fact that hunts from A Realm Reborn are not supported.

Hopefully this will make users stop sending feedback asking for those two things to be added.

Also, my friend recently had a good five minutes of angry confusion about why their map flag wasn't updating when HB picked a new mark for them, and it wasn't until I thought to ask "does it say it picked an ELITE mark?" that the problem was found. Shoutout to you, buddy. You've been anonymously immortalised in a git commit message.
  • Loading branch information
PrincessRTFM committed Mar 16, 2024
1 parent 1499c7b commit 31c3850
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 15 deletions.
1 change: 1 addition & 0 deletions HuntBuddy/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public int Version {
public bool ShowLocalHuntIcons;
public bool HideLocalHuntBackground;
public bool HideCompletedHunts;
public bool SuppressEliteMarkLocationWarning;
public float IconScale = 1f;
public Vector4 IconBackgroundColour = new(0.76f, 0.75f, 0.76f, 0.8f);

Expand Down
4 changes: 4 additions & 0 deletions HuntBuddy/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ bool filterPredicate(MobHuntEntry entry) => entry.IsEliteMark ||
if (chosen != null) {
if (chosen.IsEliteMark) {
Service.Chat.Print($"Hunting elite mark {chosen.Name} in {chosen.TerritoryName}");
if (!this.Configuration.SuppressEliteMarkLocationWarning) {
Service.Chat.Print("Elite mark spawn locations are not available, since there are so many possibilities and the mob will only ever be in one place at a time."
+ "\n(You can suppress this warning in the plugin settings)");
}
}
else {
long remaining = chosen.NeededKills -
Expand Down
25 changes: 25 additions & 0 deletions HuntBuddy/Utils/InterfaceUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,29 @@ public static bool IconButton(FontAwesomeIcon icon, string? id) {
/// <param name="icon">Desired <see cref="FontAwesomeIcon"/> to be rendered.</param>
/// <returns>True if pressed.</returns>
public static bool IconButton(FontAwesomeIcon icon) => IconButton(icon, null);

/// <summary>
/// Draws horizontally-centered text in an ImGui window.
/// </summary>
/// <param name="text">The text to draw. Should be a single line.</param>
// I hate centering text in ImGui
public static void DrawCenteredText(string text) {
float width = ImGui.CalcTextSize(text).X;
float space = ImGui.GetContentRegionAvail().X;
ImGui.SetCursorPosX((space / 2) - (width / 2));
ImGui.Text(text);
}

/// <summary>
/// Draw a tooltip with simple text content, using the specified text wrapping position.
/// </summary>
/// <param name="maxWidth">The textwrap position for the tooltip text.</param>
/// <param name="text">The text of the tooltip.</param>
public static void DrawWrappedTooltip(float maxWidth, string text) {
ImGui.BeginTooltip();
ImGui.PushTextWrapPos(maxWidth);
ImGui.Text(text);
ImGui.PopTextWrapPos();
ImGui.EndTooltip();
}
}
64 changes: 52 additions & 12 deletions HuntBuddy/Windows/ConfigurationWindow.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using System.Numerics;

using Dalamud.Interface.Utility;
using Dalamud.Interface.Windowing;

using HuntBuddy.Utils;

using ImGuiNET;

namespace HuntBuddy.Windows;
Expand All @@ -10,7 +13,8 @@ namespace HuntBuddy.Windows;
/// Configuration window.
/// </summary>
public class ConfigurationWindow: Window {
public ConfigurationWindow(): base(
public const int BaseTooltipWidth = 450;
public ConfigurationWindow() : base(
$"{Plugin.Instance.Name} configuration",
ImGuiWindowFlags.NoDocking,
true) {
Expand All @@ -20,9 +24,7 @@ public ConfigurationWindow(): base(

public override void PreOpenCheck() {
if (Plugin.Instance.Configuration.LockWindowPositions) {
if (!this.Flags.HasFlag(ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove)) {
this.Flags |= ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove;
}
this.Flags |= ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove;
}
else {
this.Flags &= ~(ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove);
Expand All @@ -33,27 +35,65 @@ public override void Draw() {
bool save = false;

ImGui.BeginDisabled(Plugin.EspConsumer?.IsAvailable == false);

save |= ImGui.Checkbox("Enable XivEsp plugin integration?", ref Plugin.Instance.Configuration.EnableXivEspIntegration);

ImGui.Indent();
save |= ImGui.Checkbox("Set XivEsp search when using '/phb next' command?", ref Plugin.Instance.Configuration.AutoSetEspSearchOnNextHuntCommand);
ImGui.Unindent();
if (ImGui.IsItemHovered()) {
InterfaceUtil.DrawWrappedTooltip(ImGuiHelpers.GlobalScale * BaseTooltipWidth,
"If enabled and XivEsp is available, the '/phb next' command will automatically set XivEsp's search"
+ "to the name of the chosen mark, EVEN IF you already have a custom search active.");
}

ImGui.EndDisabled();

ImGui.Spacing();

save |= ImGui.Checkbox("Lock plugin window positions", ref Plugin.Instance.Configuration.LockWindowPositions);
save |= ImGui.Checkbox("Lock plugin window positions and sizes",
ref Plugin.Instance.Configuration.LockWindowPositions);

save |= ImGui.Checkbox("Include hunt area on map by default",
ref Plugin.Instance.Configuration.IncludeAreaOnMap);
save |= ImGui.Checkbox("Show hunts in local area", ref Plugin.Instance.Configuration.ShowLocalHunts);
save |= ImGui.Checkbox(
"Show icons of hunts in local area",
if (ImGui.IsItemHovered()) {
InterfaceUtil.DrawWrappedTooltip(ImGuiHelpers.GlobalScale * BaseTooltipWidth,
$"{Plugin.Instance.Name} can show an approximate general area for hunt mobs around the flagged location."
+ "You can always hold SHIFT to toggle this when you click the button to flag a target on your map.");
}

save |= ImGui.Checkbox("Show hunts in local area",
ref Plugin.Instance.Configuration.ShowLocalHunts);
if (ImGui.IsItemHovered()) {
InterfaceUtil.DrawWrappedTooltip(ImGuiHelpers.GlobalScale * BaseTooltipWidth,
$"If enabled, {Plugin.Instance.Name} will display an extra window with the hunt targets in your current map zone.");
}

save |= ImGui.Checkbox("Show icons of hunts in local area",
ref Plugin.Instance.Configuration.ShowLocalHuntIcons);
save |= ImGui.Checkbox(
"Hide background of local hunts window",
if (ImGui.IsItemHovered()) {
InterfaceUtil.DrawWrappedTooltip(ImGuiHelpers.GlobalScale * BaseTooltipWidth,
"These icons are taken from the hunt mark bills the game displays, and so may not be the clearest images available.");
}

save |= ImGui.Checkbox("Hide background of local hunts window",
ref Plugin.Instance.Configuration.HideLocalHuntBackground);
save |= ImGui.Checkbox(
"Hide completed targets in local hunts window",

save |= ImGui.Checkbox("Hide completed targets in local hunts window",
ref Plugin.Instance.Configuration.HideCompletedHunts);

save |= ImGui.Checkbox("Suppress chat warning about B-ranks not having locations",
ref Plugin.Instance.Configuration.SuppressEliteMarkLocationWarning);
if (ImGui.IsItemHovered()) {
InterfaceUtil.DrawWrappedTooltip(ImGuiHelpers.GlobalScale * BaseTooltipWidth,
$"When the '/phb next' command selects a B-rank mark, a warning is printed in your chat log that {Plugin.Instance.Name}"
+ " DOES NOT provide locations for B-rank hunt marks. If this warning annoys you, you can turn it off.\n"
+ "\n"
+ "Do not ask for B-rank locations to be provided.");
}

ImGui.Spacing();

save |= ImGui.SliderFloat("Hunt icon scale", ref Plugin.Instance.Configuration.IconScale, 0.2f, 2f, "%.2f");
if (ImGui.ColorEdit4("Hunt icon background colour", ref Plugin.Instance.Configuration.IconBackgroundColour)) {
Plugin.Instance.Configuration.IconBackgroundColourU32 =
Expand Down
21 changes: 18 additions & 3 deletions HuntBuddy/Windows/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Threading.Tasks;

using Dalamud.Interface;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Windowing;

using HuntBuddy.Utils;
Expand All @@ -26,9 +27,7 @@ public MainWindow() : base(

public override void PreOpenCheck() {
if (Plugin.Instance.Configuration.LockWindowPositions) {
if (!this.Flags.HasFlag(ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove)) {
this.Flags |= ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove;
}
this.Flags |= ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove;
}
else {
this.Flags &= ~(ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove);
Expand All @@ -41,6 +40,22 @@ public override unsafe void Draw() {
return;
}

ImGui.BeginGroup();
ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(0.8f, 0.2f, 0.2f, 1));
InterfaceUtil.DrawCenteredText("B-RANK AND ARR HUNT MARK");
InterfaceUtil.DrawCenteredText("LOCATIONS ARE NOT SUPPORTED");
ImGui.PopStyleColor();
ImGui.EndGroup();
if (ImGui.IsItemHovered()) {
InterfaceUtil.DrawWrappedTooltip(ImGuiHelpers.GlobalScale * 400,
"B-rank marks have a varying number of potential spawn locations, and will only ever exist in one of them at a time."
+ $" {Plugin.Instance.Name} has no way to know which location a given mob is in, and as such cannot direct you to it."
+ " You can look up spawn maps online to find the possible spots for your target.\n"
+ "\n"
+ "Several ARR hunt marks are FATE mobs, which means they aren't always available."
+ $" Since {Plugin.Instance.Name} has no way to know if the FATE is up or not, ARR marks are not part of the plugin.");
}

if (InterfaceUtil.IconButton(FontAwesomeIcon.Redo, "Reload")) {
Plugin.Instance.MobHuntEntriesReady = false;
Task.Run(Plugin.Instance.ReloadData);
Expand Down

0 comments on commit 31c3850

Please sign in to comment.