From ea220fa33db7854b13f08744f450b61d9056f53c Mon Sep 17 00:00:00 2001 From: Asriel Camora Date: Mon, 13 Nov 2023 22:42:03 -0800 Subject: [PATCH] Add level caps on splendorous and specialist --- Craftimizer/Windows/MacroEditor.cs | 35 +++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/Craftimizer/Windows/MacroEditor.cs b/Craftimizer/Windows/MacroEditor.cs index 27166e6..99ecc99 100644 --- a/Craftimizer/Windows/MacroEditor.cs +++ b/Craftimizer/Windows/MacroEditor.cs @@ -397,24 +397,39 @@ public sealed class MacroEditor : Window, IDisposable var imageButtonPadding = (int)(ImGui.GetStyle().FramePadding.Y / 2f); var imageButtonSize = imageSize - imageButtonPadding * 2; { - var v = CharacterStats.HasSplendorousBuff; - var tint = v ? Vector4.One : disabledTint; - if (ImGui.ImageButton(SplendorousBadge.ImGuiHandle, new Vector2(imageButtonSize), default, Vector2.One, imageButtonPadding, default, tint)) - CharacterStats = CharacterStats with { HasSplendorousBuff = !v }; - if (ImGui.IsItemHovered()) + var splendorousLevel = 90; + if (CharacterStats.HasSplendorousBuff && splendorousLevel > CharacterStats.Level) + CharacterStats = CharacterStats with { HasSplendorousBuff = false }; + + using (var d = ImRaii.Disabled(splendorousLevel > CharacterStats.Level)) + { + var v = CharacterStats.HasSplendorousBuff; + var tint = v ? Vector4.One : disabledTint; + if (ImGui.ImageButton(SplendorousBadge.ImGuiHandle, new Vector2(imageButtonSize), default, Vector2.One, imageButtonPadding, default, tint)) + CharacterStats = CharacterStats with { HasSplendorousBuff = !v }; + } + if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled)) ImGui.SetTooltip(CharacterStats.HasSplendorousBuff ? $"Splendorous Tool" : "No Splendorous Tool"); } ImGui.SameLine(0, 5); bool? newIsSpecialist = null; { var v = CharacterStats.IsSpecialist; - var tint = new Vector4(0.99f, 0.97f, 0.62f, 1f) * (v ? Vector4.One : disabledTint); - if (ImGui.ImageButton(SpecialistBadge.ImGuiHandle, new Vector2(imageButtonSize), default, Vector2.One, imageButtonPadding, default, tint)) + + var specialistLevel = 55; + if (CharacterStats.IsSpecialist && specialistLevel > CharacterStats.Level) + newIsSpecialist = v = false; + + using (var d = ImRaii.Disabled(specialistLevel > CharacterStats.Level)) { - v = !v; - newIsSpecialist = v; + var tint = new Vector4(0.99f, 0.97f, 0.62f, 1f) * (v ? Vector4.One : disabledTint); + if (ImGui.ImageButton(SpecialistBadge.ImGuiHandle, new Vector2(imageButtonSize), default, Vector2.One, imageButtonPadding, default, tint)) + { + v = !v; + newIsSpecialist = v; + } } - if (ImGui.IsItemHovered()) + if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled)) ImGui.SetTooltip(v ? $"Specialist" : "Not a Specialist"); } ImGui.SameLine(0, 5);