diff --git a/HighRollerClassic/Configuration.cs b/HighRollerClassic/Configuration.cs
index 6912fd2..425b67d 100644
--- a/HighRollerClassic/Configuration.cs
+++ b/HighRollerClassic/Configuration.cs
@@ -1,16 +1,16 @@
-using Dalamud.Configuration;
-using System;
+using System;
+using Dalamud.Configuration;
+using HighRollerClassic.DataStructures;
namespace HighRollerClassic;
[Serializable]
public class Configuration : IPluginConfiguration
{
+ public PlayerManager players = new();
+ public Settings settings;
public int Version { get; set; } = 0;
- public bool IsConfigWindowMovable { get; set; } = true;
- public bool SomePropertyToBeSavedAndWithADefault { get; set; } = true;
-
// The below exists just to make saving less cumbersome
public void Save()
{
diff --git a/HighRollerClassic/DataStructures/Roll.cs b/HighRollerClassic/DataStructures/Roll.cs
new file mode 100644
index 0000000..d5cb468
--- /dev/null
+++ b/HighRollerClassic/DataStructures/Roll.cs
@@ -0,0 +1,8 @@
+namespace HighRollerClassic.DataStructures;
+
+public struct Roll
+{
+ private uint value;
+ private uint multiplier;
+ private uint sum;
+}
diff --git a/HighRollerClassic/DataStructures/Settings.cs b/HighRollerClassic/DataStructures/Settings.cs
new file mode 100644
index 0000000..3482a9e
--- /dev/null
+++ b/HighRollerClassic/DataStructures/Settings.cs
@@ -0,0 +1,21 @@
+using System.Collections.Generic;
+
+namespace HighRollerClassic.DataStructures;
+
+public struct Settings
+{
+ ///
+ /// Contains data about each multiplier, roll, etc.
+ ///
+ private List rolls;
+
+ ///
+ /// Maximum bet that will be allowed to set
+ ///
+ private uint max_bet;
+
+ ///
+ /// How much the bet will change when user adjusts their bet via +/- keys
+ ///
+ private uint step;
+}
diff --git a/HighRollerClassic/DataStructures/SettingsRolls.cs b/HighRollerClassic/DataStructures/SettingsRolls.cs
new file mode 100644
index 0000000..f0c5248
--- /dev/null
+++ b/HighRollerClassic/DataStructures/SettingsRolls.cs
@@ -0,0 +1,11 @@
+using System.Numerics;
+
+namespace HighRollerClassic.DataStructures;
+
+public struct SettingsRolls
+{
+ private uint multiplier;
+ private uint roll;
+ private bool exact;
+ private Vector4 color;
+}
diff --git a/HighRollerClassic/Player.cs b/HighRollerClassic/Player.cs
index 21d5e51..ec705b0 100644
--- a/HighRollerClassic/Player.cs
+++ b/HighRollerClassic/Player.cs
@@ -1,17 +1,14 @@
using Dalamud.Game.Gui.ContextMenu;
+using HighRollerClassic.DataStructures;
namespace HighRollerClassic;
-public class Player
+public class Player(MenuTargetDefault target)
{
- private int balance;
- private ulong content_id;
- private string name;
+ private Roll rolls = new();
+ public int Bank { get; private set; } = 0;
+ public string Name { get; private set; } = target.TargetName;
+ // todo maybe remove it and tie it to dalamud's api to get accurate character name once per session
- public Player(MenuTargetDefault target)
- {
- content_id = target.TargetContentId;
- name = target.TargetName;
- // get balance from DB
- }
+ public ulong ContentId { get; private set; } = target.TargetContentId;
}
diff --git a/HighRollerClassic/PlayerManager.cs b/HighRollerClassic/PlayerManager.cs
new file mode 100644
index 0000000..6108d4b
--- /dev/null
+++ b/HighRollerClassic/PlayerManager.cs
@@ -0,0 +1,20 @@
+using System.Collections.Generic;
+using System.Linq;
+using Dalamud.Game.Gui.ContextMenu;
+
+namespace HighRollerClassic;
+
+public class PlayerManager
+{
+ private List Players { get; set; } = [];
+
+ public Player GetPlayer(MenuTargetDefault target)
+ {
+ foreach (var player in Players)
+ if (player.ContentId == target.TargetContentId)
+ return player;
+
+ Players.Add(new Player(target));
+ return Players.Last();
+ }
+}
diff --git a/HighRollerClassic/Plugin.cs b/HighRollerClassic/Plugin.cs
index 5eb0eca..3939e24 100644
--- a/HighRollerClassic/Plugin.cs
+++ b/HighRollerClassic/Plugin.cs
@@ -21,10 +21,10 @@ public sealed class Plugin : IDalamudPlugin
{
Configuration = PluginInterface.GetPluginConfig() as Configuration ?? new Configuration();
- ConfigWindow = new ConfigWindow(this);
+ SettingsWindow = new SettingsWindow(this);
MainWindow = new MainWindow(this, state);
- WindowSystem.AddWindow(ConfigWindow);
+ WindowSystem.AddWindow(SettingsWindow);
WindowSystem.AddWindow(MainWindow);
CommandManager.AddHandler(CommandName, new CommandInfo(OnCommand)
@@ -76,7 +76,7 @@ public sealed class Plugin : IDalamudPlugin
internal static IContextMenu ContextMenu { get; private set; } = null!;
public Configuration Configuration { get; init; }
- private ConfigWindow ConfigWindow { get; init; }
+ private SettingsWindow SettingsWindow { get; init; }
private MainWindow MainWindow { get; init; }
public void Dispose()
@@ -88,7 +88,7 @@ public sealed class Plugin : IDalamudPlugin
WindowSystem.RemoveAllWindows();
- ConfigWindow.Dispose();
+ SettingsWindow.Dispose();
MainWindow.Dispose();
CommandManager.RemoveHandler(CommandName);
@@ -100,12 +100,11 @@ public sealed class Plugin : IDalamudPlugin
{
// In response to the slash command, toggle the display status of our main ui
MainWindow.Toggle();
- MainWindow.Draw();
}
public void ToggleConfigUi()
{
- ConfigWindow.Toggle();
+ SettingsWindow.Toggle();
}
public void ToggleMainUi()
@@ -113,6 +112,11 @@ public sealed class Plugin : IDalamudPlugin
MainWindow.Toggle();
}
+ public bool PlayerIsLoaded()
+ {
+ return PlayerState.IsLoaded;
+ }
+
private void OnContextMenuOpened(IMenuOpenedArgs args)
{
if (args.MenuType == ContextMenuType.Inventory) return;
diff --git a/HighRollerClassic/Windows/ConfigWindow.cs b/HighRollerClassic/Windows/ConfigWindow.cs
deleted file mode 100644
index 9044174..0000000
--- a/HighRollerClassic/Windows/ConfigWindow.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System;
-using System.Numerics;
-using Dalamud.Bindings.ImGui;
-using Dalamud.Interface.Windowing;
-
-namespace HighRollerClassic.Windows;
-
-public class ConfigWindow : Window, IDisposable
-{
- private readonly Configuration configuration;
-
- // We give this window a constant ID using ###.
- // This allows for labels to be dynamic, like "{FPS Counter}fps###XYZ counter window",
- // and the window ID will always be "###XYZ counter window" for ImGui
- public ConfigWindow(Plugin plugin) : base("A Wonderful Configuration Window###With a constant ID")
- {
- Flags = ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollbar |
- ImGuiWindowFlags.NoScrollWithMouse;
-
- Size = new Vector2(232, 90);
- SizeCondition = ImGuiCond.Always;
-
- configuration = plugin.Configuration;
- }
-
- public void Dispose() { }
-
- public override void PreDraw()
- {
- // Flags must be added or removed before Draw() is being called, or they won't apply
- if (configuration.IsConfigWindowMovable)
- Flags &= ~ImGuiWindowFlags.NoMove;
- else
- Flags |= ImGuiWindowFlags.NoMove;
- }
-
- public override void Draw()
- {
- // Can't ref a property, so use a local copy
- var configValue = configuration.SomePropertyToBeSavedAndWithADefault;
- if (ImGui.Checkbox("Random Config Bool", ref configValue))
- {
- configuration.SomePropertyToBeSavedAndWithADefault = configValue;
- // Can save immediately on change if you don't want to provide a "Save and Close" button
- configuration.Save();
- }
-
- var movable = configuration.IsConfigWindowMovable;
- if (ImGui.Checkbox("Movable Config Window", ref movable))
- {
- configuration.IsConfigWindowMovable = movable;
- configuration.Save();
- }
- }
-}
diff --git a/HighRollerClassic/Windows/MainWindow.cs b/HighRollerClassic/Windows/MainWindow.cs
index b7d4910..024c31e 100644
--- a/HighRollerClassic/Windows/MainWindow.cs
+++ b/HighRollerClassic/Windows/MainWindow.cs
@@ -7,12 +7,10 @@ namespace HighRollerClassic.Windows;
public class MainWindow : Window, IDisposable
{
+ private readonly Configuration configuration;
private readonly Plugin plugin;
private readonly PluginState state;
- // We give this window a hidden ID using ##.
- // The user will see "My Amazing Window" as window title,
- // but for ImGui the ID is "My Amazing Window##With a hidden ID"
public MainWindow(Plugin plugin, PluginState state)
: base($"High Roller Classic###{state.Target?.TargetName ?? "null"}",
ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse)
@@ -24,6 +22,7 @@ public class MainWindow : Window, IDisposable
};
this.plugin = plugin;
+ configuration = this.plugin.Configuration;
this.state = state;
}
@@ -32,10 +31,32 @@ public class MainWindow : Window, IDisposable
public override void Draw()
{
// TODO check if local player is null and if it is do not load anything
- // TODO check if all settings are set
+
+ if (!plugin.PlayerIsLoaded())
+ {
+ ImGui.Text("Player must be loaded in the world in order for the plugin to function");
+ return;
+ }
+
+ /* TODO check if all settings are set
+ roll settings
+ message/macro settings
+ */
// TODO create player project and clear the existing shared state
- if (state.Target != null)
- ImGui.Text($"Current selected target is {state.Target?.TargetName}");
+ if (state.Target == null)
+ {
+ ImGui.Text(
+ "No target selected, please open HRC by right clicking the player and choosing the 'High Roller Classic' option");
+ return;
+ }
+
+ var player = configuration.players.GetPlayer(state.Target);
+ state.Target = null;
+
+ ImGui.Text($"Player: {player}");
+ ImGui.Spacing();
+
+ ImGui.Text($"Bank balance: {player.Bank} gil");
}
}
diff --git a/HighRollerClassic/Windows/SettingsWindow.cs b/HighRollerClassic/Windows/SettingsWindow.cs
new file mode 100644
index 0000000..6383032
--- /dev/null
+++ b/HighRollerClassic/Windows/SettingsWindow.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Numerics;
+using Dalamud.Bindings.ImGui;
+using Dalamud.Interface.Windowing;
+using HighRollerClassic.DataStructures;
+
+namespace HighRollerClassic.Windows;
+
+public class SettingsWindow : Window, IDisposable
+{
+ private readonly Configuration configuration;
+
+ // We give this window a constant ID using ###.
+ // This allows for labels to be dynamic, like "{FPS Counter}fps###XYZ counter window",
+ // and the window ID will always be "###XYZ counter window" for ImGui
+ public SettingsWindow(Plugin plugin) : base("Settings###HRC")
+ {
+ Flags = ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollbar |
+ ImGuiWindowFlags.NoScrollWithMouse;
+
+ Size = new Vector2(232, 90);
+ SizeCondition = ImGuiCond.Always;
+
+ configuration = plugin.Configuration;
+ }
+
+ public void Dispose() { }
+
+ public override void PreDraw() { }
+
+ public override void Draw()
+ {
+ Settings settings;
+
+ // todo set up multiplier, roll, color, etc
+ // todo add button for rolls
+
+ // todo setup max bet, change
+
+ // todo save button which will copy our settings to configuration and invoke .Save() to save configuration to disk
+ }
+}