From a9693803ef18d6cea8b7bb2f9e09e3b51f4fd263 Mon Sep 17 00:00:00 2001 From: Condorra Date: Sat, 1 Apr 2023 23:31:42 +1100 Subject: [PATCH] Write help for corp commands. --- blastmud_game/src/db.rs | 2 +- .../src/message_handler/user_commands/corp.rs | 2 +- .../src/message_handler/user_commands/help.rs | 84 ++++++++++++++++++- 3 files changed, 85 insertions(+), 3 deletions(-) diff --git a/blastmud_game/src/db.rs b/blastmud_game/src/db.rs index 2772080c..8320fd62 100644 --- a/blastmud_game/src/db.rs +++ b/blastmud_game/src/db.rs @@ -66,7 +66,7 @@ impl From for SendqueueItem { pub struct OnlineInfo { pub username: String, pub corp: Option, - pub time: Option> + pub time: Option>, } #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/blastmud_game/src/message_handler/user_commands/corp.rs b/blastmud_game/src/message_handler/user_commands/corp.rs index da659b7e..345f6853 100644 --- a/blastmud_game/src/message_handler/user_commands/corp.rs +++ b/blastmud_game/src/message_handler/user_commands/corp.rs @@ -263,7 +263,7 @@ async fn corp_fire(ctx: &mut VerbContext<'_>, remaining: &str) -> UResult<()> { async fn corp_promote(ctx: &mut VerbContext<'_>, remaining: &str) -> UResult<()> { let usage_error = || user_error( - ansi!("Usage: corp promote username in corpname to title privileges permissions\n\ + ansi!("Usage: corp promote username in corpname to title privileges privileges\n\ Title can be any plain text up to 20 characters long.\n\ Permissions start with + or - (to add or take away) followed immediately by a permission name (e.g. holder, hire, fire, war)").to_owned() ); diff --git a/blastmud_game/src/message_handler/user_commands/help.rs b/blastmud_game/src/message_handler/user_commands/help.rs index f587bd09..762a9b94 100644 --- a/blastmud_game/src/message_handler/user_commands/help.rs +++ b/blastmud_game/src/message_handler/user_commands/help.rs @@ -142,7 +142,88 @@ static REGISTERED_HELP_PAGES: phf::Map<&'static str, &'static str> = phf_map! { \tdisallow action from player\n\ Consent for fight can be revoked similarly if the consent used the allow revoke option. \ Otherwise, attempting to revoke informs the other player, and it is revoked when they also issue a \ - disallow command.") + disallow command."), + "corp" => + ansi!("corp is the entry point to commands related to corps. It supports the following subcommands:\n\ + \tcorp hire username into corpname\n\t\tHires a player into your corp.\n\ + \tcorp join corpname\n\t\tAccepts an offer to hire you.\n\ + \tcorp list\n\t\tList the corps you belong to.\n\ + \tcorp leave corpname\n\t\tResign from a corp.\n\ + \tcorp fire username from corpname\n\t\tFires a player from your corp.\n\ + \tcorp promote username in corpname to title privileges privileges\n\ + \t\tPromotes/demotes a player within your corp.\n\ + \tcorp info corpname\n\t\tGet information about a corp.\n\ + \tcorp allow combat\n\t\tAllow the corp to consent to combat on your behalf.\n\ + \tcorp disallow combat\n\t\tDon't allow the corp to consent to combat on your behalf.\n\ + \tcorp config corpname setting\n\t\tConfigure corp settings.\n\ + \tcorp sub type from corpname\n\ + \t\t\tSubscribe to corp broadcasts.\n\ + \tcorp unsub type from corpname\n\ + \t\tUnsubscribe from corp broadcasts.\n\ + \tcorp order corpname as number\n\ + \t\tSet the position of the corp in your list.\n\ + Help is available for many individual corp commands, e.g. try help corp hire"), + "corp hire" => + ansi!("corp hire username into corpname\tHires a player into your corp."), + "corp join" => + ansi!("corp join corpname\tAccepts an offer to hire you."), + "corp list" => + ansi!("corp list\tList the corps you belong to."), + "corp leave" => + ansi!("corp leave corpname\tResign from a corp."), + "corp fire" => + ansi!("corp fire username from corpname\tFires a player from your corp."), + "corp promote" => + ansi!("corp promote username in corpname to title privileges privileges\n\ + Promotes or demotes a player to a specific title within a corp, and modifies their privileges.\n\ + username - the player you want to promote.\n\ + corpname - the name of the corporation you want to promote the player within.\n\ + title - the title you want to assign to the player.\n\ + privileges - the privileges you want to grant or remove from the player, prefixed with + or - \ + respectively, separated by spaces.\n\ + The following privileges exist:\n\ + \tholder - The owner of the corp (implies all other privileges).\n\ + \thire - Can hire new people into the corp.\n\ + \tfire - Can fire people from the corp.\n\ + \tpromote - Can promote/demote people.\n\ + \twar - Can declare war against other corps on behalf of the corp.\n\ + \tconfigure - Can change the settings of the corp.\n\ + \tfinance - Can access (or embezzle!) the corp’s funds."), + "corp info" => + ansi!("corp info corpname\tGet information about a corp."), + "corp allow combat" => + ansi!("corp allow combat\tAllow the corp to consent to combat on your behalf."), + "corp disallow combat" => + ansi!("corp disallow combat\tDon't allow the corp to consent to combat on your behalf."), + "corp config" => + ansi!("corp config corpname setting\n\ + \tConfigure various settings for your corp, such as member privileges and combat consent requirements.\n\ + \tcorpname - the name of your corp.\n\ + \tsetting - one of the following options:\n\ + \t\tallow combat required - Requires that all new members have the allow combat setting.\n\ + \t\tallow combat not required - Stops requiring that new members have allow combat on.\n\ + \t\tbase privileges privilege_name privilege_name - Sets the privileges that new members \ + receive when they join the corporation. See help corp promote for privileges."), + "corp sub" => + ansi!("corp sub type from corpname\n\ + Subscribes to corp broadcasts. Type is one of:\n\ + \tchat - Messages from users.\n\ + \tnotice - Important corp notices.\n\ + \tconnect - Connecting players.\n\ + \treward - Rewards paid to the corp.\n\ + \tdeath - Deaths of players in the corp.\n\ + \tconsent - Changes to corp consents (war declarations)."), + "corp unsub" => + ansi!("corp unsub type from corpname\n\ + Unsubscribe from corp broadcasts. Type is one of:\n\ + \tchat - Messages from users.\n\ + \tnotice - Important corp notices.\n\ + \tconnect - Connecting players.\n\ + \treward - Rewards paid to the corp.\n\ + \tdeath - Deaths of players in the corp.\n\ + \tconsent - Changes to corp consents (war declarations)."), + "corp order" => + ansi!("corp order corpname as number\tSet the position of the corp in your list.") }; static EXPLICIT_HELP_PAGES: phf::Map<&'static str, &'static str> = phf_map! { @@ -188,6 +269,7 @@ impl UserVerb for Verb { None => true, Some(user_dat) => !user_dat.terms.terms_complete }; + let remaining = remaining.trim(); if is_unregistered { help = help.or_else(|| UNREGISTERED_HELP_PAGES.get(remaining)); } else {