Skip to content

feat: staff admin commands for factions and guilds - #207

Draft
XxFran10xX wants to merge 3 commits into
mainfrom
feat/staff-faction-tools
Draft

XxFran10xX wants to merge 3 commits into
mainfrom
feat/staff-faction-tools

Conversation

@XxFran10xX

Copy link
Copy Markdown
Contributor

Why

Staff could not change a faction or guild whose leader is away or stuck. Every rename, colour, banner, capital and kick command only checks "is this player the leader", so a request like "rename our capital from Research Tower of the Castle to Sunsora Castle" needed the leader online, or a hand edit of the faction file with the server stopped.

What

Two staff command groups, permission simplefactions.admin. The staff versions skip the leader check and any price, and nothing else: names, colours and membership follow the same rules as the player commands. Anything that doesn't need a location or a held item also works from the console. Every change is written to the server log as [StaffAdmin] <who> ran /<command>: <result>.

/faction admin

Subcommand What it does
info <faction> Leader, members, provinces, colour, culture/religion/ruling system/ruler title, capital and its settlement, other settlements (with their ids), guilds, bank balance, capital changes made
who <character> Which faction and guild a character is in, and whether they lead it (name or character ID, online or not)
rename <faction> <name...> Faction display name (id unchanged), redraws the map
renamesettlement <faction> <settlement|capital> <name...> Renames any settlement; capital picks the faction capital. Settlement ids match without regard to case. Free, and doesn't use up the faction's free capital change
movecapital <faction> [name...] Previews moving the capital to the province the staff member stands in, including any provinces that would be cut off. A name is needed only when no settlement exists there. It can also re-found a capital whose settlement is gone
confirm Applies the previewed move within 60 s, only if the capital hasn't changed and the staff member is still in that province. It goes through the same journaled treasury path as /faction setcapital, at no cost, and does not count as a capital move
setcolour <faction> <R,G,B> Same validation and uniqueness as the player command
setbanner <faction> Uses the banner in hand
set <faction> <culture|religion|rulingsystem|rulertitle> <value...> Free-text fields
kick <faction> <character> Removes a member from the faction and any guild in it. Refuses the faction leader and guild leaders (use forceleader first)
quarantine ... Unchanged, now routed through the same entry point

/guild admin: info, rename, setcolour, setbanner, kick (back to the faction's main guild). The main guild is refused with a pointer to the /faction admin equivalent.

Tab completion covers subcommands, faction and guild ids, settlement ids (plus capital), current colour, set fields and member names (multi-word too).

TreasuryTopology.capital gains an overload with countMove; the existing signature passes true, so player moves are unchanged.

Known limitation (shared with the player commands)

/faction admin kick and /guild admin kick remove the member exactly as /faction kick and /guild kick do. Like those, they don't clear council, election or movement entries, dividend eligibility or warband membership; the death path does. Office holders such as the Spymaster are re-checked when used, so nothing breaks, but stale entries can remain. Fixing this belongs in the shared kick path, not just the staff one.

Testing

  • Unit: StaffAdminServiceTest (20) and StaffAdminCommandTest (15), with 100% line coverage of the new classes, plus a TreasuryTopologyTest case showing a staff move is free and leaves capital moves unchanged. Routing and completion tests were updated.
  • Local full suite: on Windows, main already has 515 failing tests (fsync and POSIX permissions). This branch adds only the new TreasuryTopologyTest case, which fails on Windows the same way as its sibling capitalLossRevalidates.... Linux CI is authoritative.
  • Review: three rounds. Fixed along the way:
    • confirm threw when staff had no character session;
    • a capital province with no settlement couldn't be repaired;
    • banner-pattern items passed the banner check;
    • <placeholder> values were accepted;
    • clearer refusals outside any province.
  • Dev (TFMCDev01), with a mineflayer staff bot and a target bot on Dev's copy of Sunsora: 54/54 checks passed.
    • Permission refusal, usage and tab completion.
    • Console renamesettlement Sunsora capital Sunsora_Castle; the web map export then showed "Sunsora Castle".
    • Lowercase settlement id; faction rename, colour (reserved and spaced input), culture, banner (with and without a banner in hand).
    • Guild info, rename, main-guild refusal, bad colour; refused leader kicks.
    • who → guild kick → faction kick, with the target told each time.
    • Capital move refusals ("already the capital", wrong province on confirm), then a move to Neo Nordbaum and back. Capital changes made stayed at 0.
    • 25 [StaffAdmin] log lines and no SimpleFactions errors. Dev's SimpleFactions data was restored afterwards.

No wiki change: these are staff-only tools.

🤖 Generated with Claude Code

XxFran10xX and others added 3 commits October 24, 2026 23:19
Adds /faction admin and /guild admin (simplefactions.admin) so staff can
fix realms whose leader is away: info, who, rename, renamesettlement,
movecapital + confirm, setcolour, setbanner, set culture/religion/
rulingsystem/rulertitle and kick for factions; info, rename, setcolour,
setbanner and kick for guilds. They skip the leader check and any price
and keep every other rule. Changes are logged as [StaffAdmin].

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Staff can found the settlement again in a capital province that lost
  it, as /faction setcapital <name> does for leaders.
- A capital move through the treasury needs the staff member to be
  playing a character; say so instead of throwing on confirm.
- Only *_BANNER items count as banners (not banner patterns).
- /faction admin set refuses a <placeholder> value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Standing outside any province says so, and only a capital move that
goes through the treasury asks the staff member to play a character;
founding a first capital or repairing one in place does not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 24, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the size:XL 500-999 effective changed lines (tests excluded in mixed PRs). label Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500-999 effective changed lines (tests excluded in mixed PRs).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant