| 1 | /*----------------------------------------------------------------- |
|---|
| 2 | * Local stuff |
|---|
| 3 | * |
|---|
| 4 | * This file contains custom stuff, and some of the items here are |
|---|
| 5 | * called from within PennMUSH at specific times. |
|---|
| 6 | */ |
|---|
| 7 | |
|---|
| 8 | /* Here are some includes you're likely to need or want. |
|---|
| 9 | */ |
|---|
| 10 | #include "copyrite.h" |
|---|
| 11 | #include "config.h" |
|---|
| 12 | #include <string.h> |
|---|
| 13 | #include "conf.h" |
|---|
| 14 | #include "externs.h" |
|---|
| 15 | #include "parse.h" |
|---|
| 16 | #include "htab.h" |
|---|
| 17 | #include "flags.h" |
|---|
| 18 | #include "command.h" |
|---|
| 19 | #include "cmds.h" |
|---|
| 20 | #include "confmagic.h" |
|---|
| 21 | |
|---|
| 22 | extern HASHTAB htab_reserved_aliases; |
|---|
| 23 | |
|---|
| 24 | /* Called during the command init sequence before any commands are |
|---|
| 25 | * added (including local_commands, below). This is where you |
|---|
| 26 | * want to reserve any strings that you *don't* want any command |
|---|
| 27 | * to alias to (because you want to preserve it for matching exits |
|---|
| 28 | * or globals) |
|---|
| 29 | */ |
|---|
| 30 | void |
|---|
| 31 | reserve_aliases(void) |
|---|
| 32 | { |
|---|
| 33 | #ifdef EXAMPLE |
|---|
| 34 | /* Example: Don't alias any commands to cardinal directions. |
|---|
| 35 | * Remove the #ifdef EXAMPLE and #endif to use this code |
|---|
| 36 | */ |
|---|
| 37 | reserve_alias("W"); |
|---|
| 38 | reserve_alias("E"); |
|---|
| 39 | reserve_alias("S"); |
|---|
| 40 | reserve_alias("N"); |
|---|
| 41 | reserve_alias("NW"); |
|---|
| 42 | reserve_alias("NE"); |
|---|
| 43 | reserve_alias("SW"); |
|---|
| 44 | reserve_alias("SE"); |
|---|
| 45 | reserve_alias("U"); |
|---|
| 46 | reserve_alias("D"); |
|---|
| 47 | #endif |
|---|
| 48 | } |
|---|
| 49 | |
|---|
| 50 | #ifdef EXAMPLE |
|---|
| 51 | COMMAND(cmd_local_silly) |
|---|
| 52 | { |
|---|
| 53 | if (SW_ISSET(sw, SWITCH_NOISY)) |
|---|
| 54 | notify_format(player, "Noisy silly with %s", arg_left); |
|---|
| 55 | notify_format(player, "SillyCommand %s", arg_left); |
|---|
| 56 | } |
|---|
| 57 | #endif |
|---|
| 58 | |
|---|
| 59 | |
|---|
| 60 | /* Called during the command init sequence. |
|---|
| 61 | * This is where you'd put calls to command_add to insert a local |
|---|
| 62 | * command into the command hash table. Any command you add here |
|---|
| 63 | * will be auto-aliased for you. |
|---|
| 64 | * The way to call command_add is illustrated below. The arguments are: |
|---|
| 65 | * Name of the command, a string ("@SILLY") |
|---|
| 66 | * Command parsing modifiers, a bitmask (see hdrs/command.h) |
|---|
| 67 | * Flags to restrict command to, a string ("WIZARD ROYALTY") or NULL |
|---|
| 68 | * (Someone with *any* one of these flags can use the command) |
|---|
| 69 | * Powers to restrict command to, a string ("SEE_ALL") or NULL |
|---|
| 70 | * (Someone with this power can use the command) |
|---|
| 71 | * Switches the command can take, a string or NULL ("NOISY NOEVAL") |
|---|
| 72 | * Hardcoded function the command should call (cmd_local_silly) |
|---|
| 73 | */ |
|---|
| 74 | void |
|---|
| 75 | local_commands(void) |
|---|
| 76 | { |
|---|
| 77 | #ifdef EXAMPLE |
|---|
| 78 | command_add("@SILLY", CMD_T_ANY, "WIZARD ROYALTY", "SEE_ALL", "NOISY NOEVAL", |
|---|
| 79 | cmd_local_silly); |
|---|
| 80 | #endif |
|---|
| 81 | } |
|---|