Write help for corp commands.

This commit is contained in:
Condorra 2023-04-01 23:31:42 +11:00
parent 1cf13413e8
commit a9693803ef
3 changed files with 85 additions and 3 deletions

View File

@ -66,7 +66,7 @@ impl From<Row> for SendqueueItem {
pub struct OnlineInfo {
pub username: String,
pub corp: Option<String>,
pub time: Option<DateTime<Utc>>
pub time: Option<DateTime<Utc>>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]

View File

@ -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: <bold>corp promote<reset> username <bold>in<reset> corpname <bold>to<reset> title <bold>privileges<reset> permissions\n\
ansi!("Usage: <bold>corp promote<reset> username <bold>in<reset> corpname <bold>to<reset> title <bold>privileges<reset> 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()
);

View File

@ -142,7 +142,88 @@ static REGISTERED_HELP_PAGES: phf::Map<&'static str, &'static str> = phf_map! {
\t<bold>disallow<reset> action <bold>from<reset> player\n\
Consent for fight can be revoked similarly if the consent used the <bold>allow revoke<reset> option. \
Otherwise, attempting to revoke informs the other player, and it is revoked when they also issue a \
disallow command.")
disallow command."),
"corp" =>
ansi!("<bold>corp<reset> is the entry point to commands related to corps. It supports the following subcommands:\n\
\t<bold>corp hire<reset> username <bold>into<reset> corpname\n\t\tHires a player into your corp.\n\
\t<bold>corp join<reset> corpname\n\t\tAccepts an offer to hire you.\n\
\t<bold>corp list<reset>\n\t\tList the corps you belong to.\n\
\t<bold>corp leave<reset> corpname\n\t\tResign from a corp.\n\
\t<bold>corp fire<reset> username <bold>from<reset> corpname\n\t\tFires a player from your corp.\n\
\t<bold>corp promote<reset> username <bold>in<reset> corpname <bold>to<reset> title <bold>privileges<reset> privileges\n\
\t\tPromotes/demotes a player within your corp.\n\
\t<bold>corp info<reset> corpname\n\t\tGet information about a corp.\n\
\t<bold>corp allow combat<reset>\n\t\tAllow the corp to consent to combat on your behalf.\n\
\t<bold>corp disallow combat<reset>\n\t\tDon't allow the corp to consent to combat on your behalf.\n\
\t<bold>corp config<reset> corpname setting\n\t\tConfigure corp settings.\n\
\t<bold>corp sub<reset> type <bold>from<reset> corpname\n\
\t\t\tSubscribe to corp broadcasts.\n\
\t<bold>corp unsub<reset> type <bold>from<reset> corpname\n\
\t\tUnsubscribe from corp broadcasts.\n\
\t<bold>corp order<reset> corpname <bold>as<reset> number\n\
\t\tSet the position of the corp in your list.\n\
Help is available for many individual corp commands, e.g. try <bold>help corp hire<reset>"),
"corp hire" =>
ansi!("<bold>corp hire<reset> username <bold>into<reset> corpname\tHires a player into your corp."),
"corp join" =>
ansi!("<bold>corp join<reset> corpname\tAccepts an offer to hire you."),
"corp list" =>
ansi!("<bold>corp list<reset>\tList the corps you belong to."),
"corp leave" =>
ansi!("<bold>corp leave<reset> corpname\tResign from a corp."),
"corp fire" =>
ansi!("<bold>corp fire<reset> username <bold>from<reset> corpname\tFires a player from your corp."),
"corp promote" =>
ansi!("<bold>corp promote<reset> username <bold>in<reset> corpname <bold>to<reset> title <bold>privileges<reset> privileges\n\
Promotes or demotes a player to a specific title within a corp, and modifies their privileges.\n\
<bold>username<reset> - the player you want to promote.\n\
<bold>corpname<reset> - the name of the corporation you want to promote the player within.\n\
<bold>title<reset> - the title you want to assign to the player.\n\
<bold>privileges<reset> - the privileges you want to grant or remove from the player, prefixed with + or - \
respectively, separated by spaces.\n\
The following privileges exist:\n\
\t<bold>holder<reset> - The owner of the corp (implies all other privileges).\n\
\t<bold>hire<reset> - Can hire new people into the corp.\n\
\t<bold>fire<reset> - Can fire people from the corp.\n\
\t<bold>promote<reset> - Can promote/demote people.\n\
\t<bold>war<reset> - Can declare war against other corps on behalf of the corp.\n\
\t<bold>configure<reset> - Can change the settings of the corp.\n\
\t<bold>finance<reset> - Can access (or embezzle!) the corps funds."),
"corp info" =>
ansi!("<bold>corp info<reset> corpname\tGet information about a corp."),
"corp allow combat" =>
ansi!("<bold>corp allow combat<reset>\tAllow the corp to consent to combat on your behalf."),
"corp disallow combat" =>
ansi!("<bold>corp disallow combat<reset>\tDon't allow the corp to consent to combat on your behalf."),
"corp config" =>
ansi!("<bold>corp config<reset> corpname setting\n\
\tConfigure various settings for your corp, such as member privileges and combat consent requirements.\n\
\t<bold>corpname<reset> - the name of your corp.\n\
\t<bold>setting<reset> - one of the following options:\n\
\t\t<bold>allow combat required<reset> - Requires that all new members have the allow combat setting.\n\
\t\t<bold>allow combat not required<reset> - Stops requiring that new members have allow combat on.\n\
\t\t<bold>base privileges privilege_name privilege_name<reset> - Sets the privileges that new members \
receive when they join the corporation. See <bold>help corp promote<reset> for privileges."),
"corp sub" =>
ansi!("<bold>corp sub<reset> type <bold>from<reset> 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!("<bold>corp unsub<reset> type <bold>from<reset> 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!("<bold>corp order<reset> corpname <bold>as<reset> 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 {