diff --git a/src/RynthCore.Engine/ImGui/Panels/ItemsFace.cs b/src/RynthCore.Engine/ImGui/Panels/ItemsFace.cs
index 18af241..9e84bf0 100644
--- a/src/RynthCore.Engine/ImGui/Panels/ItemsFace.cs
+++ b/src/RynthCore.Engine/ImGui/Panels/ItemsFace.cs
@@ -5,6 +5,9 @@
// and mana stone tapping (on/off, keep count, min max-mana to tap). A listed
// weapon the character no longer carries (RynthAi's missingIds) shows in amber
// with a warning icon and "(missing)", and says what to do in its tooltip.
+// A shield row (Action "Shield") from a RynthAi that sends noBuff shows a
+// "No buff" toggle in place of its element column: on = RynthAi never buffs
+// that shield. Weapon rows are unchanged.
//
// Edits change a private copy and save the whole payload (ItemsCommands,
// pump thread). A newer snapshot replaces the copy; snapshots from before
@@ -91,8 +94,15 @@ internal sealed class ItemsFace : IImGuiPanel
int i = idx[k];
ItemsPanel.WeaponEntry wpn = _data.Weapons[i];
ImGuiNET.ImGui.PushID("w" + i);
- int r = Row(wpn.Name, wpn.Element, shown++, bw, _data.MissingIds.Contains(wpn.Id), k > 0, k < idx.Count - 1);
+ int r = Row(wpn.Name, wpn.Element, shown++, bw, _data.MissingIds.Contains(wpn.Id), k > 0, k < idx.Count - 1,
+ wpn.ShowsNoBuff ? wpn.NoBuff : null);
ImGuiNET.ImGui.PopID();
+ if (r == 5)
+ {
+ wpn.NoBuff = !(wpn.NoBuff ?? false);
+ Save();
+ continue;
+ }
// Up / down inside its group: the order is RynthAi's preference (the buff wand, the
// first weapon of a kind), and it couldn't be changed but by removing and re-adding.
if (r == 3 || r == 4)
@@ -273,13 +283,18 @@ internal sealed class ItemsFace : IImGuiPanel
// The up / down buttons' width in a row (two 20 px buttons and their gaps).
private const float MoveW = 46;
+ private const string NoBuffTip = "Never buff this shield - for a shield that already carries its buffs.";
+
///
/// Name | up | down | [value picker] | Del. Returns 1 when the picker was clicked, 2 for Del,
- /// 3 for up, 4 for down, else 0. Up / down are drawn dim and do nothing at the ends.
- /// : the item isn't carried any more (amber, a warning icon,
- /// "(missing)" and a tooltip saying what to do).
+ /// 3 for up, 4 for down, 5 for the "No buff" toggle, else 0. Up / down are drawn dim and do
+ /// nothing at the ends. : the item isn't carried any more (amber, a
+ /// warning icon, "(missing)" and a tooltip saying what to do).
+ /// non-null (a shield row, RynthAi sending noBuff): the value column is the "No buff" toggle
+ /// instead of the picker (a shield has no element; its column only said "Shield").
///
- private static int Row(string name, string value, int index, float w, bool missing, bool canUp = false, bool canDown = false)
+ private static int Row(string name, string value, int index, float w, bool missing, bool canUp = false, bool canDown = false,
+ bool? noBuff = null)
{
Vector2 p = ImGuiNET.ImGui.GetCursorScreenPos();
var dl = ImGuiNET.ImGui.GetWindowDrawList();
@@ -311,7 +326,14 @@ internal sealed class ItemsFace : IImGuiPanel
if (IconButton("##down", PhosphorIcons.CaretDown, new Vector2(bx + 22, p.Y + 2), new Vector2(20, 20), canDown ? Teal : Mute, BtnFill) && canDown) result = 4;
ImGuiNET.ImGui.SetItemTooltip("Move down");
bx += MoveW;
- if (Button("##pick", value, new Vector2(bx, p.Y + 2), new Vector2(96, 20), Text, BtnFill)) result = 1;
+ if (noBuff is bool nb)
+ {
+ // The tapping toggle's look: lit while the shield is excluded.
+ if (Button("##nobuff", (nb ? PhosphorIcons.CheckSquare : PhosphorIcons.Square) + " No buff", new Vector2(bx, p.Y + 2), new Vector2(96, 20),
+ nb ? OnText : Mute, nb ? OnBg : BtnFill)) result = 5;
+ ImGuiNET.ImGui.SetItemTooltip(NoBuffTip);
+ }
+ else if (Button("##pick", value, new Vector2(bx, p.Y + 2), new Vector2(96, 20), Text, BtnFill)) result = 1;
if (IconButton("##del", PhosphorIcons.Trash, new Vector2(bx + 100, p.Y + 2), new Vector2(42, 20), Red, BtnFill)) result = 2;
ImGuiNET.ImGui.SetItemTooltip("Remove");
NextLine(p, 24);
diff --git a/src/RynthCore.Engine/UI/Panels/ItemsPanel.cs b/src/RynthCore.Engine/UI/Panels/ItemsPanel.cs
index fae56c5..1a92c6d 100644
--- a/src/RynthCore.Engine/UI/Panels/ItemsPanel.cs
+++ b/src/RynthCore.Engine/UI/Panels/ItemsPanel.cs
@@ -82,8 +82,18 @@ internal static class ItemsPanel
// Melee, Missile, "War Magic", "Void Magic", Shield, Ammo, or "" (not known). Set by RynthAi for
// display (the Items face groups by it); sent back untouched and ignored there.
[JsonPropertyName("kind")] public string Kind { get; set; } = string.Empty;
+ // True = "Exclude from buffing" (RynthAi ItemRule.KeepBuffed off), sent for every entry by
+ // RynthAi and applied back by it for shield entries only. Null = the plugin
+ // predates it: no toggle is drawn, and none is written back (RynthAi keeps its saved value).
+ [JsonPropertyName("noBuff")]
+ [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
+ public bool? NoBuff { get; set; }
public bool IsShield => string.Equals(Action, ItemsCommands.ShieldAction, StringComparison.OrdinalIgnoreCase);
+
+ /// The Items face draws its "No buff" toggle: a shield entry (Action "Shield", the
+ /// only kind RynthAi applies it to) from a plugin that sends the field.
+ [JsonIgnore] public bool ShowsNoBuff => IsShield && NoBuff.HasValue;
}
internal sealed class ConsumableEntry
@@ -874,7 +884,8 @@ internal static class ItemsPanel
if (a.Count != b.Count) return true;
for (int i = 0; i < a.Count; i++)
if (a[i].Id != b[i].Id || a[i].Name != b[i].Name || a[i].Element != b[i].Element
- || !string.Equals(a[i].Action, b[i].Action, StringComparison.OrdinalIgnoreCase)) return true;
+ || !string.Equals(a[i].Action, b[i].Action, StringComparison.OrdinalIgnoreCase)
+ || a[i].NoBuff != b[i].NoBuff) return true; // so this panel never saves back a stale noBuff
return false;
}
diff --git a/tools/ItemsNoBuffTests/ItemsNoBuffTests.csproj b/tools/ItemsNoBuffTests/ItemsNoBuffTests.csproj
new file mode 100644
index 0000000..fb885cf
--- /dev/null
+++ b/tools/ItemsNoBuffTests/ItemsNoBuffTests.csproj
@@ -0,0 +1,28 @@
+
+
+
+
+ Exe
+ net10.0-windows
+ x86
+ win-x86
+ false
+ x86
+ enable
+ enable
+ true
+ ItemsNoBuffTests
+
+
+
+
+
+
+
diff --git a/tools/ItemsNoBuffTests/Program.cs b/tools/ItemsNoBuffTests/Program.cs
new file mode 100644
index 0000000..52d48a3
--- /dev/null
+++ b/tools/ItemsNoBuffTests/Program.cs
@@ -0,0 +1,79 @@
+using System.Reflection;
+using System.Text.Json;
+using System.Text.Json.Serialization.Metadata;
+using System.Text.RegularExpressions;
+
+namespace ItemsNoBuffTests
+{
+ // The engine half of the shield "No buff" toggle, against what RynthAi's Items bridge writes
+ // (ItemsBridgePayload: PascalCase names, indented, "noBuff" on every weapon entry) and reads
+ // (case-insensitive; noBuff applied for Action "Shield" entries only, absent = unchanged).
+ internal static class Program
+ {
+ private static int _fails, _asserts;
+ private static void Check(bool cond, string msg)
+ {
+ _asserts++;
+ if (!cond) { _fails++; Console.WriteLine($" [FAIL] {msg}"); }
+ }
+
+ private const string Ns = "RynthCore.Engine.UI.Panels.";
+ private const BindingFlags All = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance;
+
+ private static int Main()
+ {
+ Assembly engine = Assembly.Load("RynthCore.Engine");
+ Type ctxType = engine.GetType(Ns + "ItemsPanelJsonContext", throwOnError: true)!;
+ object ctx = ctxType.GetProperty("Default", All)!.GetValue(null)!;
+ var info = (JsonTypeInfo)ctxType.GetProperty("Payload", All)!.GetValue(ctx)!;
+ Type payloadType = engine.GetType(Ns + "ItemsPanel+Payload", throwOnError: true)!;
+ Type entryType = engine.GetType(Ns + "ItemsPanel+WeaponEntry", throwOnError: true)!;
+
+ List