diff --git a/src/AcDream.Plugins.MossTank/MossTankPanel.cs b/src/AcDream.Plugins.MossTank/MossTankPanel.cs index 45075ab2c..46a7aa3d8 100644 --- a/src/AcDream.Plugins.MossTank/MossTankPanel.cs +++ b/src/AcDream.Plugins.MossTank/MossTankPanel.cs @@ -216,6 +216,13 @@ internal sealed partial class MossTankPanel private int _metaNumber; private int _metaSecondaryNumber; private string _metaNotice = "Add a rule or select one to edit."; + // Fix round B item 5: the rule editor (State/Condition/Action drafts, + // Apply/Remove/Move) moved off the Meta tab into its own popup + // (mosstank-metaeditor.xml), opened by a grid text-cell click or the + // tab's own "Create" button, closed by the popup's own Apply/Cancel — + // same StartVisible=true/ShowInSidePanel=false pattern as the buff + // picker (MossTankPlugin.cs). + private bool _metaEditorVisible; private bool _applyingProfileOptions; private bool _initialized; private bool _firstRunGuidancePending; @@ -982,7 +989,30 @@ internal sealed partial class MossTankPanel _meta.SetEnabled(!_meta.Enabled); _combatSettings.MetaState = _meta.CurrentState; }; - public Action SelectMetaRule => SelectMetaRuleCore; + // Fix round B item 5: clicking a State/Condition/Action grid cell opens + // the rule editor popup (SelectMetaRuleCore alone still populates the + // draft fields for DeleteMetaRuleAt/MoveMetaRuleUpAt/MoveMetaRuleDownAt, + // which call it directly and must NOT pop the editor open). + public Action SelectMetaRule => row => + { + SelectMetaRuleCore(row); + _metaEditorVisible = true; + }; + public bool MetaEditorVisible => _metaEditorVisible; + public Action HideMetaEditor => () => _metaEditorVisible = false; + // VTank's own cmbMetaCurrentState (docs/research/vtank-kb/08-ui-views.md + // §1 "Tab: Meta") is a SETTABLE current-state choice, not a read-only + // label — MetaEngine.Transition(string) and .States already existed + // (used internally for state-machine transitions), so this just exposes + // them: choosing a state here forces the live engine into it, exactly + // like retail's own manual state override. + public IReadOnlyList MetaCurrentStateNames => _meta.States.ToArray(); + public string SelectedMetaCurrentState => _meta.CurrentState; + public Action SetMetaCurrentState => value => + { + _meta.Transition(value); + _combatSettings.MetaState = _meta.CurrentState; + }; public Action SelectMetaCondition => value => { if (Enum.TryParse(value, ignoreCase: true, out MetaConditionKind parsed)) @@ -1005,7 +1035,22 @@ internal sealed partial class MossTankPanel public Action MetaSecondaryNumberDown => () => _metaSecondaryNumber--; public Action MetaSecondaryNumberUp => () => _metaSecondaryNumber++; public Action AddMetaRule => AddMetaRuleCore; - public Action ApplyMetaRule => ApplyMetaRuleCore; + // The Meta tab's own "Create" button (VTank's cmdMetaCreate, renamed + // from "Add" — item 5): appends a default rule exactly like AddMetaRule + // and immediately opens the editor popup so the new rule isn't left + // silently default-valued in the grid. + public Action CreateMetaRule => () => + { + AddMetaRuleCore(); + _metaEditorVisible = true; + }; + // Apply/Cancel both close the popup (item 5) — Apply persists first, + // Cancel (HideMetaEditor) discards the in-progress draft. + public Action ApplyMetaRule => () => + { + ApplyMetaRuleCore(); + _metaEditorVisible = false; + }; public Action RemoveMetaRule => RemoveMetaRuleCore; public Action MoveMetaRuleUp => () => MoveMetaRule(-1); public Action MoveMetaRuleDown => () => MoveMetaRule(1); diff --git a/src/AcDream.Plugins.MossTank/MossTankPlugin.cs b/src/AcDream.Plugins.MossTank/MossTankPlugin.cs index 51e3c064e..3b150a4d2 100644 --- a/src/AcDream.Plugins.MossTank/MossTankPlugin.cs +++ b/src/AcDream.Plugins.MossTank/MossTankPlugin.cs @@ -113,6 +113,17 @@ public sealed class MossTankPlugin : IAcDreamPlugin }, Path.Combine(directory, "mosstank-buffpicker.xml"), _panel); + // Fix round B item 5: the Meta tab's inline rule editor moved to its + // own popup, same StartVisible=true/ShowInSidePanel=false pattern + // as the three panels above. + _host.Ui.AddPanel( + new PluginPanelDescriptor("meta-editor", "MossTank Meta Rule Editor") + { + StartVisible = true, + ShowInSidePanel = false, + }, + Path.Combine(directory, "mosstank-metaeditor.xml"), + _panel); _commandRegistration = _host.Commands.Register( "vt", diff --git a/src/AcDream.Plugins.MossTank/mosstank-metaeditor.xml b/src/AcDream.Plugins.MossTank/mosstank-metaeditor.xml new file mode 100644 index 000000000..779cfaea3 --- /dev/null +++ b/src/AcDream.Plugins.MossTank/mosstank-metaeditor.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + +