diff --git a/ScoutHelper/Images/toggle-body-active.png b/ScoutHelper/Images/toggle-body-active.png
new file mode 100644
index 0000000..7b3a500
Binary files /dev/null and b/ScoutHelper/Images/toggle-body-active.png differ
diff --git a/ScoutHelper/Images/toggle-body-inactive.png b/ScoutHelper/Images/toggle-body-inactive.png
new file mode 100644
index 0000000..4906a29
Binary files /dev/null and b/ScoutHelper/Images/toggle-body-inactive.png differ
diff --git a/ScoutHelper/Images/toggle-cap-active.png b/ScoutHelper/Images/toggle-cap-active.png
new file mode 100644
index 0000000..215c2f2
Binary files /dev/null and b/ScoutHelper/Images/toggle-cap-active.png differ
diff --git a/ScoutHelper/Images/toggle-cap-inactive.png b/ScoutHelper/Images/toggle-cap-inactive.png
new file mode 100644
index 0000000..47aeb22
Binary files /dev/null and b/ScoutHelper/Images/toggle-cap-inactive.png differ
diff --git a/ScoutHelper/Plugin.cs b/ScoutHelper/Plugin.cs
index 8fb42a2..064a9e1 100644
--- a/ScoutHelper/Plugin.cs
+++ b/ScoutHelper/Plugin.cs
@@ -44,7 +44,7 @@ public Plugin() {
Conf.Initialize(PluginInterface);
HuntHelperManager = new HuntHelperManager();
- BearManager = new BearManager(Utils.DataFilePath("Bear.json"));
+ BearManager = new BearManager(Utils.PluginFilePath(@"Data\Bear.json"));
ConfigWindow = new ConfigWindow();
MainWindow = new MainWindow(HuntHelperManager, BearManager);
diff --git a/ScoutHelper/ScoutHelper.csproj b/ScoutHelper/ScoutHelper.csproj
index 23431ad..c4e7969 100644
--- a/ScoutHelper/ScoutHelper.csproj
+++ b/ScoutHelper/ScoutHelper.csproj
@@ -16,6 +16,22 @@
ResXFileCodeGenerator
Strings.Designer.cs
+
+
+ PreserveNewest
+
+
+
+ PreserveNewest
+
+
+
+ PreserveNewest
+
+
+
+ PreserveNewest
+
diff --git a/ScoutHelper/Utils.cs b/ScoutHelper/Utils.cs
index 663c735..41d15df 100644
--- a/ScoutHelper/Utils.cs
+++ b/ScoutHelper/Utils.cs
@@ -1,25 +1,26 @@
-using Dalamud.Plugin.Services;
-using ImGuiNET;
-using System;
+using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
+using Dalamud.Plugin.Services;
+using FFXIVClientStructs.FFXIV.Common.Math;
+using ImGuiNET;
using ScoutHelper.Models;
namespace ScoutHelper;
public static class Utils {
- public static string WorldName => Plugin.ClientState.LocalPlayer?.CurrentWorld?.GameData?.Name.ToString() ?? "Not Found";
+ public static string WorldName =>
+ Plugin.ClientState.LocalPlayer?.CurrentWorld?.GameData?.Name.ToString() ?? "Not Found";
- public static string DataFilePath(string dataFilename) => Path.Combine(
+ public static string PluginFilePath(string dataFilename) => Path.Combine(
Plugin.PluginInterface.AssemblyLocation.Directory?.FullName!,
- "Data",
dataFilename
);
-
+
public static void CreateTooltip(string text, float width = 12f) {
ImGui.BeginTooltip();
ImGui.PushTextWrapPos(ImGui.GetFontSize() * width);
@@ -28,8 +29,9 @@ public static void CreateTooltip(string text, float width = 12f) {
ImGui.EndTooltip();
}
+ public static Vector2 V2(float x, float y) => new(x, y);
+
public static string FormatTemplate(string textTemplate, IList trainList, string bear, string url) {
-
var regex = new Regex(@"\\?\{[^}]+\\?\}", RegexOptions.Compiled | RegexOptions.IgnoreCase);
var matches = regex.Matches(textTemplate);
@@ -37,6 +39,11 @@ public static string FormatTemplate(string textTemplate, IList trainLi
return textTemplate;
}
+ var variables = new Dictionary() {
+ { "#", trainList.Count.ToString() },
+ { "#available", trainList.Count.ToString() },
+ }.AsReadOnly();
+
var s = new StringBuilder(textTemplate.Length);
var i = 0;
foreach (Match match in matches) {
@@ -56,6 +63,7 @@ public static string FormatTemplate(string textTemplate, IList trainLi
}
#region extensions
+
public static void TaggedPrint(this IChatGui chatGui, string message) {
chatGui.Print(message, Plugin.Name);
}
@@ -64,12 +72,15 @@ public static void TaggedPrintError(this IChatGui chatGui, string message) {
chatGui.PrintError(message, Plugin.Name);
}
- public static IReadOnlyDictionary VerifyEnumDictionary(this IDictionary enumDict) where K : struct, Enum {
+ public static IReadOnlyDictionary VerifyEnumDictionary(this IDictionary enumDict)
+ where K : struct, Enum {
var allEnumsAreInDict = (Enum.GetValuesAsUnderlyingType() as K[])!.All(enumDict.ContainsKey);
if (!allEnumsAreInDict) {
throw new Exception($"All values of enum [{typeof(K).Name}] must be in the dictionary.");
}
+
return enumDict.ToImmutableDictionary();
}
+
#endregion
}
diff --git a/ScoutHelper/Windows/MainWindow.cs b/ScoutHelper/Windows/MainWindow.cs
index a7e790f..da2d0b3 100644
--- a/ScoutHelper/Windows/MainWindow.cs
+++ b/ScoutHelper/Windows/MainWindow.cs
@@ -9,6 +9,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
+using Dalamud.Interface.Utility.Raii;
namespace ScoutHelper.Windows;
@@ -74,6 +75,8 @@ private unsafe void DrawModeButtons() {
var modeLinkColor = modeLink ? activeColor : inactiveColor;
var modeFullColor = modeFull ? activeColor : inactiveColor;
+ using var rounding = ImRaii.PushStyle(ImGuiStyleVar.FrameRounding, 0f);
+
ImGui.PushStyleColor(ImGuiCol.Button, modeLinkColor);
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, modeLinkColor);
ImGui.PushStyleColor(ImGuiCol.ButtonActive, modeLinkColor*0.9f);
@@ -92,6 +95,8 @@ private unsafe void DrawModeButtons() {
_copyFormattedText = !_copyFormattedText;
}
ImGui.PopStyleColor(3);
+
+ ToggleButton.Draw(_buttonSize);
}
private void DrawGeneratorButtons() {
diff --git a/ScoutHelper/Windows/ToggleButton.cs b/ScoutHelper/Windows/ToggleButton.cs
new file mode 100644
index 0000000..80b3c61
--- /dev/null
+++ b/ScoutHelper/Windows/ToggleButton.cs
@@ -0,0 +1,23 @@
+using System.Numerics;
+using Dalamud.Interface.Internal;
+using ImGuiNET;
+
+namespace ScoutHelper.Windows;
+
+public static class ToggleButton {
+
+ private static IDalamudTextureWrap _imCapActive =
+ Plugin.PluginInterface.UiBuilder.LoadImage(Utils.PluginFilePath(@"Images\toggle-cap-active"));
+ private static IDalamudTextureWrap _imCapInactive =
+ Plugin.PluginInterface.UiBuilder.LoadImage(Utils.PluginFilePath(@"Images\toggle-cap-inactive"));
+ private static IDalamudTextureWrap _imBodyActive =
+ Plugin.PluginInterface.UiBuilder.LoadImage(Utils.PluginFilePath(@"Images\toggle-body-active"));
+ private static IDalamudTextureWrap _imBodyInactive =
+ Plugin.PluginInterface.UiBuilder.LoadImage(Utils.PluginFilePath(@"Images\toggle-body-inactive"));
+
+ public static void Draw(Vector2 size) {
+
+ ImGui.InvisibleButton("abc", size);
+ ImGui.Image(_imCapActive.ImGuiHandle, new Vector2(size.Y/2, size.Y));
+ }
+}