using HSUI.Config; using HSUI.Config.Attributes; using HSUI.Enums; using HSUI.Interface; using System.Numerics; using Dalamud.Bindings.ImGui; namespace HSUI.Interface.GeneralElements { /// /// Config for a single hotbar (1-10). HotbarIndex is set by the containing config. /// public class HotbarBarConfig : AnchorablePluginConfigObject { internal int HotbarIndex { get; set; } = 1; [RadioSelector("12×1", "6×2", "4×3", "3×4", "2×6", "1×12", Label = "Bar Layout")] [Order(20)] public int BarLayout = 0; // 0=12x1, 1=6x2, 2=4x3, 3=3x4, 4=2x6, 5=1x12 /// Get (columns, rows) for the current BarLayout. public (int Cols, int Rows) GetLayoutGrid() => BarLayout switch { 0 => (12, 1), 1 => (6, 2), 2 => (4, 3), 3 => (3, 4), 4 => (2, 6), 5 => (1, 12), _ => (12, 1) }; [DragInt("Slot Count", min = 1, max = 12)] [Order(21)] public int SlotCount = 12; [DragInt2("Slot Size", min = 24, max = 96)] [Order(22)] public Vector2 SlotSize = new Vector2(40, 40); [DragInt("Slot Padding", min = 0, max = 16)] [Order(23)] public int SlotPadding = 2; [Checkbox("Show Cooldown Overlay")] [Order(24)] public bool ShowCooldownOverlay = true; [Checkbox("Show Cooldown Numbers")] [Order(25)] public bool ShowCooldownNumbers = true; [Checkbox("Show Border")] [Order(26)] public bool ShowBorder = true; [Checkbox("Show Tooltips")] [Order(27)] public bool ShowTooltips = true; [Checkbox("Show Keybinds")] [Order(28)] public bool ShowSlotNumbers = true; [Checkbox("Show Combo Highlight")] [Order(29)] public bool ShowComboHighlight = true; [Checkbox("Debug Drag & Drop")] [Order(30)] public bool DebugDragDrop = false; [NestedConfig("Visibility", 70)] public VisibilityConfig VisibilityConfig = new VisibilityConfig(); public static HotbarBarConfig DefaultConfig(int hotbarIndex) { var config = new HotbarBarConfig { HotbarIndex = hotbarIndex }; ApplyDefaults(config, hotbarIndex); return config; } protected static void ApplyDefaults(HotbarBarConfig config, int hotbarIndex) { var viewport = ImGui.GetMainViewport().Size; float yOffset = 60 + (hotbarIndex - 1) * 50; config.Position = new Vector2(0, -viewport.Y * 0.5f + yOffset); config.Anchor = DrawAnchor.Top; config.Size = new Vector2(12 * 40 + 11 * 2, 40); config.HotbarIndex = hotbarIndex; } } [Exportable(false)] [Section("Hotbars", true)] [SubSection("General", 0)] public class HotbarsConfig : PluginConfigObject { [Checkbox("Use HSUI Hotbars", help = "When enabled, HSUI hotbars replace the default game hotbars.")] [Order(1, collapseWith = null)] public new bool Enabled = true; [NestedConfig("Drag & Drop Options", 5, separator = true, collapseWith = null)] public HotbarsGeneralOptionsConfig GeneralOptions = new(); public new static HotbarsConfig DefaultConfig() => new HotbarsConfig(); } public class HotbarsGeneralOptionsConfig : PluginConfigObject { [Checkbox("Enable drag and drop from game UI", help = "When enabled, you can drag actions, macros, and items from the Actions menu, Macro menu, and Inventory onto HSUI hotbars.")] [Order(1)] public bool EnableDragDropFromGame = true; [Checkbox("Enable Shift+drag to rearrange", help = "When enabled, holding Shift and dragging a hotbar slot lets you swap it with another slot or rearrange your hotbar.")] [Order(2)] public bool EnableShiftDragToRearrange = true; [Checkbox("Enable release outside to clear slot", help = "When enabled, releasing a picked-up icon outside of HSUI hotbars clears that slot.")] [Order(3)] public bool EnableReleaseOutsideToClear = true; public new static HotbarsGeneralOptionsConfig DefaultConfig() => new(); } [Exportable(false)] [Section("Hotbars", true)] [SubSection("Hotbar 1", 0)] public class Hotbar1BarConfig : HotbarBarConfig { public Hotbar1BarConfig() => HotbarIndex = 1; public new static Hotbar1BarConfig DefaultConfig() { var c = new Hotbar1BarConfig(); ApplyDefaults(c, 1); return c; } } [Exportable(false)] [Section("Hotbars", true)] [SubSection("Hotbar 2", 0)] public class Hotbar2BarConfig : HotbarBarConfig { public Hotbar2BarConfig() => HotbarIndex = 2; public new static Hotbar2BarConfig DefaultConfig() { var c = new Hotbar2BarConfig(); ApplyDefaults(c, 2); return c; } } [Exportable(false)] [Section("Hotbars", true)] [SubSection("Hotbar 3", 0)] public class Hotbar3BarConfig : HotbarBarConfig { public Hotbar3BarConfig() => HotbarIndex = 3; public new static Hotbar3BarConfig DefaultConfig() { var c = new Hotbar3BarConfig(); ApplyDefaults(c, 3); return c; } } [Exportable(false)] [Section("Hotbars", true)] [SubSection("Hotbar 4", 0)] public class Hotbar4BarConfig : HotbarBarConfig { public Hotbar4BarConfig() => HotbarIndex = 4; public new static Hotbar4BarConfig DefaultConfig() { var c = new Hotbar4BarConfig(); ApplyDefaults(c, 4); return c; } } [Exportable(false)] [Section("Hotbars", true)] [SubSection("Hotbar 5", 0)] public class Hotbar5BarConfig : HotbarBarConfig { public Hotbar5BarConfig() => HotbarIndex = 5; public new static Hotbar5BarConfig DefaultConfig() { var c = new Hotbar5BarConfig(); ApplyDefaults(c, 5); return c; } } [Exportable(false)] [Section("Hotbars", true)] [SubSection("Hotbar 6", 0)] public class Hotbar6BarConfig : HotbarBarConfig { public Hotbar6BarConfig() => HotbarIndex = 6; public new static Hotbar6BarConfig DefaultConfig() { var c = new Hotbar6BarConfig(); ApplyDefaults(c, 6); return c; } } [Exportable(false)] [Section("Hotbars", true)] [SubSection("Hotbar 7", 0)] public class Hotbar7BarConfig : HotbarBarConfig { public Hotbar7BarConfig() => HotbarIndex = 7; public new static Hotbar7BarConfig DefaultConfig() { var c = new Hotbar7BarConfig(); ApplyDefaults(c, 7); return c; } } [Exportable(false)] [Section("Hotbars", true)] [SubSection("Hotbar 8", 0)] public class Hotbar8BarConfig : HotbarBarConfig { public Hotbar8BarConfig() => HotbarIndex = 8; public new static Hotbar8BarConfig DefaultConfig() { var c = new Hotbar8BarConfig(); ApplyDefaults(c, 8); return c; } } [Exportable(false)] [Section("Hotbars", true)] [SubSection("Hotbar 9", 0)] public class Hotbar9BarConfig : HotbarBarConfig { public Hotbar9BarConfig() => HotbarIndex = 9; public new static Hotbar9BarConfig DefaultConfig() { var c = new Hotbar9BarConfig(); ApplyDefaults(c, 9); return c; } } [Exportable(false)] [Section("Hotbars", true)] [SubSection("Hotbar 10", 0)] public class Hotbar10BarConfig : HotbarBarConfig { public Hotbar10BarConfig() => HotbarIndex = 10; public new static Hotbar10BarConfig DefaultConfig() { var c = new Hotbar10BarConfig(); ApplyDefaults(c, 10); return c; } } }