diff --git a/src/act.h b/src/act.h index 8d556ac..8f4470e 100644 --- a/src/act.h +++ b/src/act.h @@ -190,37 +190,39 @@ ACMD(do_rescue); /* Functions with subcommands */ /* do_gen_tog */ ACMD(do_gen_tog); -#define SCMD_NOSUMMON 0 -#define SCMD_NOHASSLE 1 -#define SCMD_BRIEF 2 -#define SCMD_COMPACT 3 -#define SCMD_NOTELL 4 -#define SCMD_NOAUCTION 5 -#define SCMD_NOSHOUT 6 -#define SCMD_NOGOSSIP 7 -#define SCMD_NOGRATZ 8 -#define SCMD_NOWIZ 9 -#define SCMD_QUEST 10 -#define SCMD_SHOWVNUMS 11 -#define SCMD_NOREPEAT 12 -#define SCMD_HOLYLIGHT 13 -#define SCMD_SLOWNS 14 -#define SCMD_AUTOEXIT 15 -#define SCMD_TRACK 16 -#define SCMD_CLS 17 -#define SCMD_BUILDWALK 18 -#define SCMD_AFK 19 -#define SCMD_COLOR 20 -#define SCMD_SYSLOG 21 -#define SCMD_WIMPY 22 -#define SCMD_PAGELENGTH 23 -#define SCMD_AUTOLOOT 24 /**< Placeholder, currently unused */ -#define SCMD_AUTOGOLD 25 /**< Placeholder, currently unused */ -#define SCMD_AUTOSPLIT 26 /**< Placeholder, currently unused */ -#define SCMD_AUTOSAC 27 /**< Placeholder, currently unused */ -#define SCMD_AUTOASSIST 28 /**< Placeholder, currently unused */ -#define SCMD_SCREENWIDTH 29 -#define SCMD_AUTOMAP 30 +#define SCMD_NOSUMMON 0 +#define SCMD_NOHASSLE 1 +#define SCMD_BRIEF 2 +#define SCMD_COMPACT 3 +#define SCMD_NOTELL 4 +#define SCMD_NOAUCTION 5 +#define SCMD_NOSHOUT 6 +#define SCMD_NOGOSSIP 7 +#define SCMD_NOGRATZ 8 +#define SCMD_NOWIZ 9 +#define SCMD_QUEST 10 +#define SCMD_SHOWVNUMS 11 +#define SCMD_NOREPEAT 12 +#define SCMD_HOLYLIGHT 13 +#define SCMD_SLOWNS 14 +#define SCMD_AUTOEXIT 15 +#define SCMD_TRACK 16 +#define SCMD_CLS 17 +#define SCMD_BUILDWALK 18 +#define SCMD_AFK 19 +#define SCMD_AUTOLOOT 20 +#define SCMD_AUTOGOLD 21 +#define SCMD_AUTOSPLIT 22 +#define SCMD_AUTOSAC 23 +#define SCMD_AUTOASSIST 24 +#define SCMD_AUTOMAP 25 +#define SCMD_AUTOKEY 26 +#define SCMD_AUTODOOR 27 +#define SCMD_COLOR 28 +#define SCMD_SYSLOG 29 +#define SCMD_WIMPY 30 +#define SCMD_PAGELENGTH 31 +#define SCMD_SCREENWIDTH 32 /* do_gen_write */ ACMD(do_gen_write); diff --git a/src/act.informative.c b/src/act.informative.c index 416185b..87fdc37 100644 --- a/src/act.informative.c +++ b/src/act.informative.c @@ -1895,6 +1895,12 @@ ACMD(do_toggle) {"automap", PRF_AUTOMAP, 1, "You will no longer see the mini-map.\r\n", "You will now see a mini-map at the side of room descriptions.\r\n"}, + {"autokey", PRF_AUTOKEY, 0, + "You will now have to unlock doors manually before opening.\r\n", + "You will now automatically unlock doors when opening them (if you have the key).\r\n"}, + {"autodoor", PRF_AUTODOOR, 0, + "You will now need to specify a door direction when opening, closing and unlocking.\r\n", + "You will now find the next available door when opening, closing or unlocking.\r\n"}, {"\n", 0, -1, "\n", "\n"} /* must be last */ }; @@ -1972,6 +1978,8 @@ ACMD(do_toggle) " Screenwidth: %-3d " " AFK: %-3s\r\n" + " Autokey: %-3s " + " Autodoor: %-3s " " Color: %s \r\n ", ONOFF(PRF_FLAGGED(ch, PRF_DISPHP)), @@ -2006,6 +2014,8 @@ ACMD(do_toggle) GET_SCREEN_WIDTH(ch), ONOFF(PRF_FLAGGED(ch, PRF_AFK)), + ONOFF(PRF_FLAGGED(ch, PRF_AUTOKEY)), + ONOFF(PRF_FLAGGED(ch, PRF_AUTODOOR)), types[COLOR_LEV(ch)]); return; } diff --git a/src/act.movement.c b/src/act.movement.c index 3f4bf67..e834f09 100644 --- a/src/act.movement.c +++ b/src/act.movement.c @@ -412,12 +412,48 @@ static int find_door(struct char_data *ch, const char *type, char *dir, const ch return (-1); } for (door = 0; door < NUM_OF_DIRS; door++) + { if (EXIT(ch, door)) - if (EXIT(ch, door)->keyword) - if (is_name(type, EXIT(ch, door)->keyword)) - return (door); + { + if (EXIT(ch, door)->keyword) + { + if (isname(type, EXIT(ch, door)->keyword)) + { + if ((!IS_NPC(ch)) && (!PRF_FLAGGED(ch, PRF_AUTODOOR))) + return door; + else if (is_abbrev(cmdname, "open")) + { + if (IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED)) + return door; + else if (IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED)) + return door; + } + else if ((is_abbrev(cmdname, "close")) && (!(IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED))) ) + return door; + else if ((is_abbrev(cmdname, "lock")) && (!(IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED))) ) + return door; + else if ((is_abbrev(cmdname, "unlock")) && (IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED)) ) + return door; + else if ((is_abbrev(cmdname, "pick")) && (IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED)) ) + return door; + } + } + } + } + + if ((!IS_NPC(ch)) && (!PRF_FLAGGED(ch, PRF_AUTODOOR))) + send_to_char(ch, "There doesn't seem to be %s %s here.\r\n", AN(type), type); + else if (is_abbrev(cmdname, "open")) + send_to_char(ch, "There doesn't seem to be %s %s that can be opened.\r\n", AN(type), type); + else if (is_abbrev(cmdname, "close")) + send_to_char(ch, "There doesn't seem to be %s %s that can be closed.\r\n", AN(type), type); + else if (is_abbrev(cmdname, "lock")) + send_to_char(ch, "There doesn't seem to be %s %s that can be locked.\r\n", AN(type), type); + else if (is_abbrev(cmdname, "unlock")) + send_to_char(ch, "There doesn't seem to be %s %s that can be unlocked.\r\n", AN(type), type); + else + send_to_char(ch, "There doesn't seem to be %s %s that can be picked.\r\n", AN(type), type); - send_to_char(ch, "There doesn't seem to be %s %s here.\r\n", AN(type), type); return (-1); } } @@ -620,6 +656,16 @@ ACMD(do_gen_door) else if (!(DOOR_IS_LOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_LOCKED)) send_to_char(ch, "Oh.. it wasn't locked, after all..\r\n"); + else if (!(DOOR_IS_UNLOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_UNLOCKED) && (PRF_FLAGGED(ch, PRF_AUTOKEY)) && (has_key(ch, keynum)) ) + { + send_to_char(ch, "It is locked, but you have the key.\r\n"); + send_to_char(ch, "*Click*\r\n"); + do_doorcmd(ch, obj, door, subcmd); + } + else if (!(DOOR_IS_UNLOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_UNLOCKED) && (PRF_FLAGGED(ch, PRF_AUTOKEY)) && (!has_key(ch, keynum)) ) + { + send_to_char(ch, "It is locked, and you do not have the key!\r\n"); + } else if (!(DOOR_IS_UNLOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_UNLOCKED) && (GET_LEVEL(ch) < LVL_IMMORT || !PRF_FLAGGED(ch, PRF_NOHASSLE))) diff --git a/src/act.other.c b/src/act.other.c index 4244d9f..549e8cd 100644 --- a/src/act.other.c +++ b/src/act.other.c @@ -60,7 +60,7 @@ ACMD(do_quit) send_to_char(ch, "Goodbye, friend.. Come back soon!\r\n"); /* We used to check here for duping attempts, but we may as well do it right - * in extract_char(), since there is no check if a player rents out and it + * in extract_char(), since there is no check if a player rents out and it * can leave them in an equally screwy situation. */ if (CONFIG_FREE_RENT) @@ -92,7 +92,7 @@ ACMD(do_save) GET_LOADROOM(ch) = GET_ROOM_VNUM(IN_ROOM(ch)); } -/* Generic function for commands which are normally overridden by special +/* Generic function for commands which are normally overridden by special * procedures - i.e., shop commands, mail commands, etc. */ ACMD(do_not_here) { @@ -599,7 +599,7 @@ ACMD(do_use) return; default: log("SYSERR: Unknown subcmd %d passed to do_use.", subcmd); - /* SYSERR_DESC: This is the same as the unhandled case in do_gen_ps(), + /* SYSERR_DESC: This is the same as the unhandled case in do_gen_ps(), * but in the function which handles 'quaff', 'recite', and 'use'. */ return; } @@ -725,7 +725,7 @@ ACMD(do_gen_write) if (stat(filename, &fbuf) < 0) { perror("SYSERR: Can't stat() file"); - /* SYSERR_DESC: This is from do_gen_write() and indicates that it cannot + /* SYSERR_DESC: This is from do_gen_write() and indicates that it cannot * call the stat() system call on the file required. The error string at * the end of the line should explain what the problem is. */ return; @@ -737,7 +737,7 @@ ACMD(do_gen_write) if (!(fl = fopen(filename, "a"))) { perror("SYSERR: do_gen_write"); /* SYSERR_DESC: This is from do_gen_write(), and will be output if the file - * in question cannot be opened for appending to. The error string at the + * in question cannot be opened for appending to. The error string at the * end of the line should explain what the problem is. */ send_to_char(ch, "Could not open the file. Sorry.\r\n"); @@ -795,7 +795,23 @@ ACMD(do_gen_tog) {"Buildwalk Off.\r\n", "Buildwalk On.\r\n"}, {"AFK flag is now off.\r\n", - "AFK flag is now on.\r\n"} + "AFK flag is now on.\r\n"}, + {"Autoloot disabled.\r\n", + "Autoloot enabled.\r\n"}, + {"Autogold disabled.\r\n", + "Autogold enabled.\r\n"}, + {"Autosplit disabled.\r\n", + "Autosplit enabled.\r\n"}, + {"Autosacrifice disabled.\r\n", + "Autosacrifice enabled.\r\n"}, + {"Autoassist disabled.\r\n", + "Autoassist enabled.\r\n"}, + {"Automap disabled.\r\n", + "Automap enabled.\r\n"}, + {"Autokey disabled.\r\n", + "Autokey enabled.\r\n"}, + {"Autodoor disabled.\r\n", + "Autodoor enabled.\r\n"} }; if (IS_NPC(ch)) @@ -873,6 +889,30 @@ ACMD(do_gen_tog) send_to_char(ch, "You have mail waiting.\r\n"); } break; + case SCMD_AUTOLOOT: + result = PRF_TOG_CHK(ch, PRF_AUTOLOOT); + break; + case SCMD_AUTOGOLD: + result = PRF_TOG_CHK(ch, PRF_AUTOGOLD); + break; + case SCMD_AUTOSPLIT: + result = PRF_TOG_CHK(ch, PRF_AUTOSPLIT); + break; + case SCMD_AUTOSAC: + result = PRF_TOG_CHK(ch, PRF_AUTOSAC); + break; + case SCMD_AUTOASSIST: + result = PRF_TOG_CHK(ch, PRF_AUTOASSIST); + break; + case SCMD_AUTOMAP: + result = PRF_TOG_CHK(ch, PRF_AUTOMAP); + break; + case SCMD_AUTOKEY: + result = PRF_TOG_CHK(ch, PRF_AUTOKEY); + break; + case SCMD_AUTODOOR: + result = PRF_TOG_CHK(ch, PRF_AUTODOOR); + break; default: log("SYSERR: Unknown subcmd %d in do_gen_toggle.", subcmd); return; diff --git a/src/constants.c b/src/constants.c index 0ff9ddc..5c618a4 100644 --- a/src/constants.c +++ b/src/constants.c @@ -226,6 +226,8 @@ const char *preference_bits[] = { "AUTOSAC", "AUTOASSIST", "AUTOMAP", + "AUTOKEY", + "AUTODOOR", "\n" }; diff --git a/src/interpreter.c b/src/interpreter.c index 6f36114..b0d86d0 100644 --- a/src/interpreter.c +++ b/src/interpreter.c @@ -82,6 +82,14 @@ cpp_extern const struct command_info cmd_info[] = { { "attach" , "attach" , POS_DEAD , do_attach , LVL_BUILDER, 0 }, { "auction" , "auc" , POS_SLEEPING, do_gen_comm , 0, SCMD_AUCTION }, { "autoexits" , "autoex" , POS_DEAD , do_gen_tog , 0, SCMD_AUTOEXIT }, + { "autoassist","autoass" , POS_DEAD , do_gen_tog , 0, SCMD_AUTOASSIST }, + { "autodoor" , "autodoor", POS_DEAD , do_gen_tog , 0, SCMD_AUTODOOR }, + { "autogold" , "autogold", POS_DEAD , do_gen_tog , 0, SCMD_AUTOGOLD }, + { "autokey" , "autokey" , POS_DEAD , do_gen_tog , 0, SCMD_AUTOKEY }, + { "autoloot" , "autoloot", POS_DEAD , do_gen_tog , 0, SCMD_AUTOLOOT }, + { "automap" , "automap" , POS_DEAD , do_gen_tog , 0, SCMD_AUTOMAP }, + { "autosac" , "autosac" , POS_DEAD , do_gen_tog , 0, SCMD_AUTOSAC }, + { "autosplit", "autospl" , POS_DEAD , do_gen_tog , 0, SCMD_AUTOSPLIT }, { "backstab" , "ba" , POS_STANDING, do_backstab , 1, 0 }, { "ban" , "ban" , POS_DEAD , do_ban , LVL_GRGOD, 0 }, diff --git a/src/structs.h b/src/structs.h index 6eae312..d2293e8 100644 --- a/src/structs.h +++ b/src/structs.h @@ -250,8 +250,10 @@ #define PRF_AUTOSAC 29 /**< Sacrifice a corpse */ #define PRF_AUTOASSIST 30 /**< Auto-assist toggle */ #define PRF_AUTOMAP 31 /**< Show map at the side of room descs */ +#define PRF_AUTOKEY 32 /**< Automatically unlock locked doors when opening */ +#define PRF_AUTODOOR 33 /**< Use the next available door */ /** Total number of available PRF flags */ -#define NUM_PRF_FLAGS 32 +#define NUM_PRF_FLAGS 34 /* Affect bits: used in char_data.char_specials.saved.affected_by */ /* WARNING: In the world files, NEVER set the bits marked "R" ("Reserved") */