Snapshot for release 2026.10.29.2 (internal 6c69cb8)

This commit is contained in:
Tom Bohar 2026-10-29 07:19:19 -04:00
commit 6c15f65e94
8 changed files with 41 additions and 8 deletions

View file

@ -105,6 +105,12 @@ internal sealed class DefSettings
public KindFilter PreferredKind = KindFilter.All;
/// <summary>Weapon swaps are refused while RynthAi's macro runs (it picks the weapon itself); this lets them through.</summary>
public bool SwapWhileBotRuns;
/// <summary>
/// The Weapons button (the sword) in the Shortcuts bar's title (2026-10-29). Off (the default): the
/// title holds only edit, settings and hide, so a click aimed at one doesn't open the weapon picker;
/// the picker opens from the settings window, the bar's right-click menu and /rdef weapons.
/// </summary>
public bool WeaponsButtonOnBar;
public bool BarOpen;
public bool PickerOpen;

View file

@ -66,6 +66,7 @@ internal sealed class DefStore
st.ShowCounts = Bool(s, "showCounts", st.ShowCounts);
st.PreferredKind = (KindFilter)Int(s, "preferredKind", (int)st.PreferredKind);
st.SwapWhileBotRuns = Bool(s, "swapWhileBotRuns", st.SwapWhileBotRuns);
st.WeaponsButtonOnBar = Bool(s, "weaponsButtonOnBar", st.WeaponsButtonOnBar); // missing (a file from before 2026-10-29): off
st.IndependentBar = Bool(s, "independentBar", st.IndependentBar); // missing (a file from before 2026-10-27): off
st.BarOpen = Bool(s, "barOpen", st.BarOpen);
st.PickerOpen = Bool(s, "pickerOpen", st.PickerOpen);
@ -163,6 +164,7 @@ internal sealed class DefStore
w.WriteBoolean("showCounts", s.ShowCounts);
w.WriteNumber("preferredKind", (int)s.PreferredKind);
w.WriteBoolean("swapWhileBotRuns", s.SwapWhileBotRuns);
w.WriteBoolean("weaponsButtonOnBar", s.WeaponsButtonOnBar);
w.WriteBoolean("independentBar", s.IndependentBar);
w.WriteBoolean("barOpen", s.BarOpen);
w.WriteBoolean("pickerOpen", s.PickerOpen);

View file

@ -96,6 +96,7 @@ public sealed partial class RynthDefectivePlugin : RynthPluginBase
WindowShown = PanelShown,
ShowWindow = (title, show) => Host.SetPanelOpen(title, show ? RynthPanelOpen.Open : RynthPanelOpen.Close),
Tell = text => { _session.SetStatus(text); Print(text); _nextBarBuildMs = 0; },
ShowWeapons = () => ShowPicker(true),
};
_settingsWindow = _ui.Add(new UiWindow("RynthDefective/Settings", "Defective Settings")
{

View file

@ -48,10 +48,11 @@ internal sealed record BarSlot(
/// <summary>
/// The bar as drawn. Independent: every slot is RynthDefective's own (DefSettings.IndependentBar).
/// Spells: the character's spells, A-Z, for "Put a spell here..." (empty when they can't be read);
/// CanCast: the engine casts for plugins.
/// CanCast: the engine casts for plugins. WeaponsButton: the title shows the Weapons button
/// (DefSettings.WeaponsButtonOnBar).
/// </summary>
internal sealed record BarSnapshot(BarSlot[] Slots, bool Ready, int IconSize, bool Independent = false,
IReadOnlyList<SpellInfo>? Spells = null, bool CanCast = false)
IReadOnlyList<SpellInfo>? Spells = null, bool CanCast = false, bool WeaponsButton = false)
{
public static readonly BarSnapshot NotReady = new(Array.Empty<BarSlot>(), false, 36);
@ -98,7 +99,7 @@ internal sealed class BarSnapshotBuilder
// Every slot is RynthDefective's own: AC's toolbar isn't read or shown (BarMapping).
var own = new BarSlot[st.BarSlots];
for (int n = 1; n <= st.BarSlots; n++) own[n - 1] = Own(n, BarMapping.OwnSlot(n, true), true, session, items, spells, _host);
return new BarSnapshot(own, true, st.ButtonSize, true, spells, canCast);
return new BarSnapshot(own, true, st.ButtonSize, true, spells, canCast, st.WeaponsButtonOnBar);
}
if (_host.GetShortcuts(_ids, _spells) == 0) return BarSnapshot.NotReady;
RefreshKeys(now);
@ -108,7 +109,7 @@ internal sealed class BarSnapshotBuilder
var slots = new BarSlot[st.BarSlots];
for (int n = 1; n <= st.BarSlots; n++)
slots[n - 1] = BarMapping.IsRetail(n, false) ? Retail(n, byId) : Own(n, BarMapping.OwnSlot(n, false), false, session, items, spells, _host);
return new BarSnapshot(slots, true, st.ButtonSize, false, spells, canCast);
return new BarSnapshot(slots, true, st.ButtonSize, false, spells, canCast, st.WeaponsButtonOnBar);
}
private BarSlot Retail(int n, Dictionary<uint, CarriedItem> byId)

View file

@ -184,7 +184,8 @@ internal sealed class ShortcutBarWindow
private float Header(ImDrawListPtr dl, BarSnapshot view, float x0, float y, float w)
{
float h = Px(HeaderH), chip = Px(ChipSize);
const int chips = 4;
// The Weapons button only when the settings ask for it (DefSettings.WeaponsButtonOnBar).
int chips = view.WeaponsButton ? 4 : 3;
float chipsW = chips * chip + (chips - 1) * Px(1);
ImGui.SetCursorScreenPos(new Vector2(x0, y));
@ -207,9 +208,12 @@ internal sealed class ShortcutBarWindow
_edit ? "Done editing." : "Edit: the slot numbers, and - / + to take a slot off or add one.", _edit))
_edit = !_edit;
cx += chip + Px(1);
if (Chip("##sb_weapons", RynthIcons.Sword, new Vector2(cx, cy), _faint, "Weapons: every weapon and wand you carry, wield one with a click."))
_act.ShowWeapons();
cx += chip + Px(1);
if (view.WeaponsButton)
{
if (Chip("##sb_weapons", RynthIcons.Sword, new Vector2(cx, cy), _faint, "Weapons: every weapon and wand you carry, wield one with a click."))
_act.ShowWeapons();
cx += chip + Px(1);
}
if (Chip("##sb_settings", RynthIcons.Gear, new Vector2(cx, cy), _faint,
"Settings (/rdef settings): weapon swaps under RynthAi, a bar independent of the game's toolbar,\nand showing the Game Panels buttons and the Selection window."))
_act.ShowSettings();

View file

@ -26,6 +26,8 @@ internal sealed class BarSettingsView
public Action<string, bool> ShowWindow = (_, _) => { };
/// <summary>A message for the player (the chat, and the status line).</summary>
public Action<string> Tell = _ => { };
/// <summary>Opens the weapon picker (/rdef weapons).</summary>
public Action ShowWeapons = () => { };
public BarSettingsView(DefSession session) => _s = session;
@ -74,6 +76,10 @@ internal sealed class BarSettingsView
w.Tooltip("Ctrl+wheel over the bar's title makes the whole bar bigger or smaller.");
w.SeparatorText("Weapons");
w.SmallButton("Weapon picker...", "set.weapons", () => ShowWeapons());
w.Tooltip("Every weapon and wand you carry, wield one with a click (/rdef weapons, or Weapons... in the bar's right-click menu).");
w.Checkbox("Weapons button on the bar", "set.weaponsbtn", st.WeaponsButtonOnBar, v => { st.WeaponsButtonOnBar = v; Changed(); });
w.Tooltip("Shows the sword button in the Shortcuts bar's title, next to edit, settings and hide. Off (the default): the picker opens from here.");
w.Checkbox("Allow weapon swaps while RynthAi's macro runs", "set.swap", st.SwapWhileBotRuns, v => { st.SwapWhileBotRuns = v; Changed(); });
w.Tooltip("Off (the default): a weapon, wand or shield is not wielded while the RynthAi macro runs - it picks the weapon itself and would swap back. Kits, potions and other items always work.");
w.SliderInt("Weapon picker row icon", "set.picker", st.PickerIconSize, DefSettings.PickerIconMin, DefSettings.PickerIconMax, v => { st.PickerIconSize = v; Changed(); });