diff --git a/HighRollerClassic/DataStructures/Roll.cs b/HighRollerClassic/DataStructures/RollHistory.cs similarity index 82% rename from HighRollerClassic/DataStructures/Roll.cs rename to HighRollerClassic/DataStructures/RollHistory.cs index d5cb468..eb8a0eb 100644 --- a/HighRollerClassic/DataStructures/Roll.cs +++ b/HighRollerClassic/DataStructures/RollHistory.cs @@ -1,6 +1,6 @@ namespace HighRollerClassic.DataStructures; -public struct Roll +public struct RollHistory { private uint value; private uint multiplier; diff --git a/HighRollerClassic/DataStructures/Settings.cs b/HighRollerClassic/DataStructures/Settings.cs index 1517f3c..eb5dba0 100644 --- a/HighRollerClassic/DataStructures/Settings.cs +++ b/HighRollerClassic/DataStructures/Settings.cs @@ -7,7 +7,7 @@ public struct Settings() /// /// Contains data about each multiplier, roll, etc. /// - public readonly List rolls = []; + public readonly List rolls = []; /// /// Contains messages such as announcements etc. diff --git a/HighRollerClassic/DataStructures/SettingsRolls.cs b/HighRollerClassic/DataStructures/SettingsRoll.cs similarity index 74% rename from HighRollerClassic/DataStructures/SettingsRolls.cs rename to HighRollerClassic/DataStructures/SettingsRoll.cs index f0c5248..f616e90 100644 --- a/HighRollerClassic/DataStructures/SettingsRolls.cs +++ b/HighRollerClassic/DataStructures/SettingsRoll.cs @@ -2,10 +2,9 @@ using System.Numerics; namespace HighRollerClassic.DataStructures; -public struct SettingsRolls +public struct SettingsRoll { private uint multiplier; private uint roll; - private bool exact; private Vector4 color; } diff --git a/HighRollerClassic/Player.cs b/HighRollerClassic/Player.cs index 460ea2b..8d2a42b 100644 --- a/HighRollerClassic/Player.cs +++ b/HighRollerClassic/Player.cs @@ -5,7 +5,7 @@ namespace HighRollerClassic; public class Player(MenuTargetDefault target) { - private Roll rolls = new(); + private RollHistory rollsHistory = new(); public int Bank { get; private set; } = 0; public ulong ContentId { get; private set; } = target.TargetContentId; diff --git a/HighRollerClassic/Windows/GambaWindow.cs b/HighRollerClassic/Windows/GambaWindow.cs index a2d0452..7385554 100644 --- a/HighRollerClassic/Windows/GambaWindow.cs +++ b/HighRollerClassic/Windows/GambaWindow.cs @@ -18,7 +18,7 @@ public class GambaWindow : Window, IDisposable private bool SettingsSet => configuration.Settings is { maxBet: not null, step: not null, rolls.Count: > 0, macros.Count: > 0 }; public GambaWindow(Plugin plugin, MenuTargetDefault target) - : base($"High Roller Classic - {target.TargetName}###HRC{target.TargetContentId}", + : base($"High Roller Classic - {target.TargetName}##HRC{target.TargetContentId}", ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse) { SizeConstraints = new WindowSizeConstraints diff --git a/HighRollerClassic/Windows/SettingsWindow.cs b/HighRollerClassic/Windows/SettingsWindow.cs index b25f708..d8ced25 100644 --- a/HighRollerClassic/Windows/SettingsWindow.cs +++ b/HighRollerClassic/Windows/SettingsWindow.cs @@ -1,6 +1,7 @@ using System; using System.Numerics; using Dalamud.Bindings.ImGui; +using Dalamud.Interface.Components; using Dalamud.Interface.Windowing; using HighRollerClassic.DataStructures; @@ -12,6 +13,8 @@ public class SettingsWindow : Window, IDisposable private const int Spacing = 5; private const int InputWidth = 105; private const int InputMaxLen = 11; + + private const uint RollSettingInputWidth = 50; private const uint MaxAllowedGil = 999_999_999; private readonly Configuration configuration; @@ -21,12 +24,12 @@ public class SettingsWindow : Window, IDisposable private bool stepFormatValid = true; // todo proper implementation it's just a placeholder - private bool NoTempRolls => true; - private Roll? new_roll; + private bool TempRoll => newRoll.HasValue; + private SettingsRoll? newRoll; private (uint min, uint max) rollInterval = (1, 999); - public SettingsWindow(Plugin plugin) : base("Settings###HRC Settings") + public SettingsWindow(Plugin plugin) : base("Settings##HRC Settings") { Flags = ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse; @@ -48,10 +51,10 @@ public class SettingsWindow : Window, IDisposable // todo set up multiplier, roll, color, etc // todo add button for rolls - if (ImGui.Button("Add roll") && NoTempRolls) + if (ImGui.Button("Add roll") && TempRoll) { // TODO no new rolls must be there - + newRoll = new SettingsRoll(); } if (ImGui.CollapsingHeader("Rolls###settings", ImGuiTreeNodeFlags.DefaultOpen)) { @@ -91,6 +94,63 @@ public class SettingsWindow : Window, IDisposable } + /// + /// Returns false if the roll is to be removed + /// + /// gil multiplication in case of a roll + /// if roll is checked on less/less or equal comparison + /// how much user rolls + /// colours the rolls in main window, depending on their value + /// tracks which roll we're setting so input fields don't have the same ids + private bool? DisplayRollSetting(ref uint multiplier, ref bool exact, ref uint roll, ref Vector4 colour, ref uint id) + { + ImGui.SetNextItemWidth(RollSettingInputWidth); + ImGui.InputUInt($"##multiplier{id}", ref multiplier); + + ImGui.SameLine(); + + ImGui.Text("x"); + ImGui.SameLine(); + + ImGui.SetNextItemWidth(RollSettingInputWidth); + ImGui.InputUInt($"##roll{id}", ref roll); + + ImGui.SameLine(); + var newColour = ImGuiComponents.ColorPickerWithPalette( + (int)id, "placeholder", colour); + + if (ImGui.Button("-")) + { + // signals to the colour to remove this roll setting + return null; + } + + // TODO verify input + // we need to verify if data inputted is "good" + + return ValidateRollSetting(); + + } + + private bool ValidateRollSetting() + { + // multiplier must not already exist + + // roll must be between 1 and 999 + + // roll must not already exist + + return true; + } + + /// + /// Returns true if valid, false if invalid or null if validity has no changed + /// + /// id of the label field + /// text for the label input field + /// id of the input field + /// new value if parsing was successful + /// private static bool? NewInput(string labelId, string labelText, string inputId, ref uint? result) { bool? valid = null;