Split ResetAdvanced into two parts.

This commit is contained in:
Ottermandias 2025-05-21 17:09:41 +02:00
parent e4b32343ae
commit 081ac6bf8b
6 changed files with 120 additions and 26 deletions

View file

@ -19,14 +19,15 @@ namespace Glamourer.Gui;
[Flags]
public enum QdbButtons
{
ApplyDesign = 0x01,
RevertAll = 0x02,
RevertAutomation = 0x04,
RevertAdvanced = 0x08,
RevertEquip = 0x10,
RevertCustomize = 0x20,
ReapplyAutomation = 0x40,
ResetSettings = 0x80,
ApplyDesign = 0x01,
RevertAll = 0x02,
RevertAutomation = 0x04,
RevertAdvancedDyes = 0x08,
RevertEquip = 0x10,
RevertCustomize = 0x20,
ReapplyAutomation = 0x40,
ResetSettings = 0x80,
RevertAdvancedCustomization = 0x100,
}
public sealed class DesignQuickBar : Window, IDisposable
@ -124,6 +125,7 @@ public sealed class DesignQuickBar : Window, IDisposable
DrawRevertEquipButton(buttonSize);
DrawRevertCustomizeButton(buttonSize);
DrawRevertAdvancedCustomization(buttonSize);
DrawRevertAdvancedDyes(buttonSize);
DrawRevertAutomationButton(buttonSize);
DrawReapplyAutomationButton(buttonSize);
DrawResetSettingsButton(buttonSize);
@ -318,7 +320,7 @@ public sealed class DesignQuickBar : Window, IDisposable
private void DrawRevertAdvancedCustomization(Vector2 buttonSize)
{
if (!_config.QdbButtons.HasFlag(QdbButtons.RevertAdvanced))
if (!_config.QdbButtons.HasFlag(QdbButtons.RevertAdvancedCustomization))
return;
var available = 0;
@ -327,7 +329,7 @@ public sealed class DesignQuickBar : Window, IDisposable
if (_playerIdentifier.IsValid && _playerState is { IsLocked: false } && _playerData.Valid)
{
available |= 1;
_tooltipBuilder.Append("Left-Click: Revert the advanced customizations and dyes of the player character to their game state.");
_tooltipBuilder.Append("Left-Click: Revert the advanced customizations of the player character to their game state.");
}
if (_targetIdentifier.IsValid && _targetState is { IsLocked: false } && _targetData.Valid)
@ -335,7 +337,40 @@ public sealed class DesignQuickBar : Window, IDisposable
if (available != 0)
_tooltipBuilder.Append('\n');
available |= 2;
_tooltipBuilder.Append("Right-Click: Revert the advanced customizations and dyes of ")
_tooltipBuilder.Append("Right-Click: Revert the advanced customizations of ")
.Append(_targetIdentifier)
.Append(" to their game state.");
}
if (available == 0)
_tooltipBuilder.Append("Neither player character nor target are available or their state is locked.");
var (clicked, _, _, state) = ResolveTarget(FontAwesomeIcon.PaintBrush, buttonSize, available);
ImGui.SameLine();
if (clicked)
_stateManager.ResetAdvancedCustomizations(state!, StateSource.Manual);
}
private void DrawRevertAdvancedDyes(Vector2 buttonSize)
{
if (!_config.QdbButtons.HasFlag(QdbButtons.RevertAdvancedDyes))
return;
var available = 0;
_tooltipBuilder.Clear();
if (_playerIdentifier.IsValid && _playerState is { IsLocked: false } && _playerData.Valid)
{
available |= 1;
_tooltipBuilder.Append("Left-Click: Revert the advanced dyes of the player character to their game state.");
}
if (_targetIdentifier.IsValid && _targetState is { IsLocked: false } && _targetData.Valid)
{
if (available != 0)
_tooltipBuilder.Append('\n');
available |= 2;
_tooltipBuilder.Append("Right-Click: Revert the advanced dyes of ")
.Append(_targetIdentifier)
.Append(" to their game state.");
}
@ -346,7 +381,7 @@ public sealed class DesignQuickBar : Window, IDisposable
var (clicked, _, _, state) = ResolveTarget(FontAwesomeIcon.Palette, buttonSize, available);
ImGui.SameLine();
if (clicked)
_stateManager.ResetAdvancedState(state!, StateSource.Manual);
_stateManager.ResetAdvancedDyes(state!, StateSource.Manual);
}
private void DrawRevertCustomizeButton(Vector2 buttonSize)
@ -501,7 +536,7 @@ public sealed class DesignQuickBar : Window, IDisposable
++_numButtons;
}
if (_config.QdbButtons.HasFlag(QdbButtons.RevertAdvanced))
if (_config.QdbButtons.HasFlag(QdbButtons.RevertAdvancedCustomization))
++_numButtons;
if (_config.QdbButtons.HasFlag(QdbButtons.RevertCustomize))
++_numButtons;

View file

@ -251,7 +251,7 @@ public class SettingsTab(
private void DrawQuickDesignBoxes()
{
var showAuto = config.EnableAutoDesigns;
var numColumns = 8 - (showAuto ? 0 : 2) - (config.UseTemporarySettings ? 0 : 1);
var numColumns = 9 - (showAuto ? 0 : 2) - (config.UseTemporarySettings ? 0 : 1);
ImGui.NewLine();
ImUtf8.Text("Show the Following Buttons in the Quick Design Bar:"u8);
ImGui.Dummy(Vector2.Zero);
@ -268,7 +268,8 @@ public class SettingsTab(
("Reapply Auto", showAuto, QdbButtons.ReapplyAutomation),
("Revert Equip", true, QdbButtons.RevertEquip),
("Revert Customize", true, QdbButtons.RevertCustomize),
("Revert Advanced", true, QdbButtons.RevertAdvanced),
("Revert Advanced Customization", true, QdbButtons.RevertAdvancedCustomization),
("Revert Advanced Dyes", true, QdbButtons.RevertAdvancedDyes),
("Reset Settings", config.UseTemporarySettings, QdbButtons.ResetSettings),
];