feat(gm): /set + /setskill (instance-direct, auto-discovered commands) #87

Merged
marco merged 1 commit from feat/gm-set-commands into main 2026-07-19 11:57:57 +02:00
Owner

Closes #81. Two GM dev commands to tune a targeted mobile for testing, plus two architecture rules the owner asked to persist.

Commands

  • /set <hits|mana|str|dex|int> — clamped (hits [1..MaxHits], mana [0..MaxMana], stats [1..1000]); a stat change re-clamps hits/mana to the new maxima.
  • /setskill <0-1000> — value in tenths (1000 = 100.0); unknown skills listed back.

Both target a Mobile (targeting cursor, no LOS) and can target yourself.

Act on the instance (no indirection layer)

The setters live on Mobile (SetHits/SetMana/SetStat/SetSkill, self-clamping — ModernUO-style), and World.FindMobile is public so the command edits the instance directly. No MobileEditor, no World.SetHits delegation. World stays thin; the clamp invariant lives with the data it guards.

Auto-discovered commands (no manual list)

Program.cs scans the assembly for concrete BaseCommand types and registers them in DI (which resolves each ctor dependency, e.g. SpawnCommand's CreatureRegistry), injected into CommandRegistry. Adding a command is just adding the class — the hand-maintained list is gone.

Persisted rules

CLAUDE.md gains a Design principles section: auto-discovery beats manual registration, and act on the instance / minimize indirection. docs/gm-commands.md updated.

Definition of Done

  • As admin, /set hits 30 sets HP to 30 (clamped to max); /set str 100 raises max HP; /setskill magery 1000 sets Magery to 100.0.
  • A non-admin is refused; unknown attr/skill returns a listed hint.
  • No command registered by hand — a new BaseCommand subclass is discovered automatically.
  • Suite green (157 GameServer), whole solution builds, zero warnings.
Closes #81. Two GM dev commands to tune a targeted mobile for testing, plus two architecture rules the owner asked to persist. ### Commands - /set <hits|mana|str|dex|int> <n> — clamped (hits [1..MaxHits], mana [0..MaxMana], stats [1..1000]); a stat change re-clamps hits/mana to the new maxima. - /setskill <skill> <0-1000> — value in tenths (1000 = 100.0); unknown skills listed back. Both target a Mobile (targeting cursor, no LOS) and can target yourself. ### Act on the instance (no indirection layer) The setters live on Mobile (SetHits/SetMana/SetStat/SetSkill, self-clamping — ModernUO-style), and World.FindMobile is public so the command edits the instance directly. No MobileEditor, no World.SetHits delegation. World stays thin; the clamp invariant lives with the data it guards. ### Auto-discovered commands (no manual list) Program.cs scans the assembly for concrete BaseCommand types and registers them in DI (which resolves each ctor dependency, e.g. SpawnCommand's CreatureRegistry), injected into CommandRegistry. Adding a command is just adding the class — the hand-maintained list is gone. ### Persisted rules CLAUDE.md gains a Design principles section: auto-discovery beats manual registration, and act on the instance / minimize indirection. docs/gm-commands.md updated. ## Definition of Done - [ ] As admin, /set hits 30 sets HP to 30 (clamped to max); /set str 100 raises max HP; /setskill magery 1000 sets Magery to 100.0. - [ ] A non-admin is refused; unknown attr/skill returns a listed hint. - [ ] No command registered by hand — a new BaseCommand subclass is discovered automatically. - [ ] Suite green (157 GameServer), whole solution builds, zero warnings.
feat(gm): /set and /setskill, acting on the mobile instance
All checks were successful
ci / Lint & Test (pull_request) Successful in 1m35s
2f572a2776
Two GM dev commands to tune a targeted mobile for testing:
- /set <hits|mana|str|dex|int> <n>
- /setskill <skill> <0-1000>  (tenths, 1000 = 100.0)

Both target a Mobile and edit the instance directly: the setters live ON Mobile
(SetHits/SetMana/SetStat/SetSkill, self-clamping, ModernUO-style), and World
exposes the instance via FindMobile — no intermediate editor layer, no World
delegation. Setting a stat re-clamps hits/mana to the new maxima.

Commands are now auto-discovered: Program.cs scans the assembly for concrete
BaseCommand types and registers them in DI (which resolves their ctor deps),
injected into CommandRegistry — adding a command is just adding the class, no
hand-maintained list.

Persist the two design rules (auto-discovery over manual registration; act on
the instance, minimize indirection) in CLAUDE.md. docs/gm-commands.md updated.
marco merged commit c457429820 into main 2026-07-19 11:57:57 +02:00
marco deleted branch feat/gm-set-commands 2026-07-19 11:57:57 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
marco/IsoMmo!87
No description provided.