mirror of
https://github.com/tbamud/tbamud.git
synced 2025-12-21 01:30:12 +01:00
Added autodoor and autokey toggles, and all auto toggle commands
This commit is contained in:
parent
13d58bc333
commit
85ea93c818
7 changed files with 152 additions and 42 deletions
64
src/act.h
64
src/act.h
|
|
@ -190,37 +190,39 @@ ACMD(do_rescue);
|
||||||
/* Functions with subcommands */
|
/* Functions with subcommands */
|
||||||
/* do_gen_tog */
|
/* do_gen_tog */
|
||||||
ACMD(do_gen_tog);
|
ACMD(do_gen_tog);
|
||||||
#define SCMD_NOSUMMON 0
|
#define SCMD_NOSUMMON 0
|
||||||
#define SCMD_NOHASSLE 1
|
#define SCMD_NOHASSLE 1
|
||||||
#define SCMD_BRIEF 2
|
#define SCMD_BRIEF 2
|
||||||
#define SCMD_COMPACT 3
|
#define SCMD_COMPACT 3
|
||||||
#define SCMD_NOTELL 4
|
#define SCMD_NOTELL 4
|
||||||
#define SCMD_NOAUCTION 5
|
#define SCMD_NOAUCTION 5
|
||||||
#define SCMD_NOSHOUT 6
|
#define SCMD_NOSHOUT 6
|
||||||
#define SCMD_NOGOSSIP 7
|
#define SCMD_NOGOSSIP 7
|
||||||
#define SCMD_NOGRATZ 8
|
#define SCMD_NOGRATZ 8
|
||||||
#define SCMD_NOWIZ 9
|
#define SCMD_NOWIZ 9
|
||||||
#define SCMD_QUEST 10
|
#define SCMD_QUEST 10
|
||||||
#define SCMD_SHOWVNUMS 11
|
#define SCMD_SHOWVNUMS 11
|
||||||
#define SCMD_NOREPEAT 12
|
#define SCMD_NOREPEAT 12
|
||||||
#define SCMD_HOLYLIGHT 13
|
#define SCMD_HOLYLIGHT 13
|
||||||
#define SCMD_SLOWNS 14
|
#define SCMD_SLOWNS 14
|
||||||
#define SCMD_AUTOEXIT 15
|
#define SCMD_AUTOEXIT 15
|
||||||
#define SCMD_TRACK 16
|
#define SCMD_TRACK 16
|
||||||
#define SCMD_CLS 17
|
#define SCMD_CLS 17
|
||||||
#define SCMD_BUILDWALK 18
|
#define SCMD_BUILDWALK 18
|
||||||
#define SCMD_AFK 19
|
#define SCMD_AFK 19
|
||||||
#define SCMD_COLOR 20
|
#define SCMD_AUTOLOOT 20
|
||||||
#define SCMD_SYSLOG 21
|
#define SCMD_AUTOGOLD 21
|
||||||
#define SCMD_WIMPY 22
|
#define SCMD_AUTOSPLIT 22
|
||||||
#define SCMD_PAGELENGTH 23
|
#define SCMD_AUTOSAC 23
|
||||||
#define SCMD_AUTOLOOT 24 /**< Placeholder, currently unused */
|
#define SCMD_AUTOASSIST 24
|
||||||
#define SCMD_AUTOGOLD 25 /**< Placeholder, currently unused */
|
#define SCMD_AUTOMAP 25
|
||||||
#define SCMD_AUTOSPLIT 26 /**< Placeholder, currently unused */
|
#define SCMD_AUTOKEY 26
|
||||||
#define SCMD_AUTOSAC 27 /**< Placeholder, currently unused */
|
#define SCMD_AUTODOOR 27
|
||||||
#define SCMD_AUTOASSIST 28 /**< Placeholder, currently unused */
|
#define SCMD_COLOR 28
|
||||||
#define SCMD_SCREENWIDTH 29
|
#define SCMD_SYSLOG 29
|
||||||
#define SCMD_AUTOMAP 30
|
#define SCMD_WIMPY 30
|
||||||
|
#define SCMD_PAGELENGTH 31
|
||||||
|
#define SCMD_SCREENWIDTH 32
|
||||||
|
|
||||||
/* do_gen_write */
|
/* do_gen_write */
|
||||||
ACMD(do_gen_write);
|
ACMD(do_gen_write);
|
||||||
|
|
|
||||||
|
|
@ -1895,6 +1895,12 @@ ACMD(do_toggle)
|
||||||
{"automap", PRF_AUTOMAP, 1,
|
{"automap", PRF_AUTOMAP, 1,
|
||||||
"You will no longer see the mini-map.\r\n",
|
"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"},
|
"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 */
|
{"\n", 0, -1, "\n", "\n"} /* must be last */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1972,6 +1978,8 @@ ACMD(do_toggle)
|
||||||
" Screenwidth: %-3d "
|
" Screenwidth: %-3d "
|
||||||
" AFK: %-3s\r\n"
|
" AFK: %-3s\r\n"
|
||||||
|
|
||||||
|
" Autokey: %-3s "
|
||||||
|
" Autodoor: %-3s "
|
||||||
" Color: %s \r\n ",
|
" Color: %s \r\n ",
|
||||||
|
|
||||||
ONOFF(PRF_FLAGGED(ch, PRF_DISPHP)),
|
ONOFF(PRF_FLAGGED(ch, PRF_DISPHP)),
|
||||||
|
|
@ -2006,6 +2014,8 @@ ACMD(do_toggle)
|
||||||
GET_SCREEN_WIDTH(ch),
|
GET_SCREEN_WIDTH(ch),
|
||||||
ONOFF(PRF_FLAGGED(ch, PRF_AFK)),
|
ONOFF(PRF_FLAGGED(ch, PRF_AFK)),
|
||||||
|
|
||||||
|
ONOFF(PRF_FLAGGED(ch, PRF_AUTOKEY)),
|
||||||
|
ONOFF(PRF_FLAGGED(ch, PRF_AUTODOOR)),
|
||||||
types[COLOR_LEV(ch)]);
|
types[COLOR_LEV(ch)]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -412,12 +412,48 @@ static int find_door(struct char_data *ch, const char *type, char *dir, const ch
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
for (door = 0; door < NUM_OF_DIRS; door++)
|
for (door = 0; door < NUM_OF_DIRS; door++)
|
||||||
|
{
|
||||||
if (EXIT(ch, door))
|
if (EXIT(ch, door))
|
||||||
if (EXIT(ch, door)->keyword)
|
{
|
||||||
if (is_name(type, EXIT(ch, door)->keyword))
|
if (EXIT(ch, door)->keyword)
|
||||||
return (door);
|
{
|
||||||
|
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);
|
return (-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -620,6 +656,16 @@ ACMD(do_gen_door)
|
||||||
else if (!(DOOR_IS_LOCKED(ch, obj, door)) &&
|
else if (!(DOOR_IS_LOCKED(ch, obj, door)) &&
|
||||||
IS_SET(flags_door[subcmd], NEED_LOCKED))
|
IS_SET(flags_door[subcmd], NEED_LOCKED))
|
||||||
send_to_char(ch, "Oh.. it wasn't locked, after all..\r\n");
|
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)) &&
|
else if (!(DOOR_IS_UNLOCKED(ch, obj, door)) &&
|
||||||
IS_SET(flags_door[subcmd], NEED_UNLOCKED) &&
|
IS_SET(flags_door[subcmd], NEED_UNLOCKED) &&
|
||||||
(GET_LEVEL(ch) < LVL_IMMORT || !PRF_FLAGGED(ch, PRF_NOHASSLE)))
|
(GET_LEVEL(ch) < LVL_IMMORT || !PRF_FLAGGED(ch, PRF_NOHASSLE)))
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ ACMD(do_quit)
|
||||||
send_to_char(ch, "Goodbye, friend.. Come back soon!\r\n");
|
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
|
/* 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. */
|
* can leave them in an equally screwy situation. */
|
||||||
|
|
||||||
if (CONFIG_FREE_RENT)
|
if (CONFIG_FREE_RENT)
|
||||||
|
|
@ -92,7 +92,7 @@ ACMD(do_save)
|
||||||
GET_LOADROOM(ch) = GET_ROOM_VNUM(IN_ROOM(ch));
|
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. */
|
* procedures - i.e., shop commands, mail commands, etc. */
|
||||||
ACMD(do_not_here)
|
ACMD(do_not_here)
|
||||||
{
|
{
|
||||||
|
|
@ -599,7 +599,7 @@ ACMD(do_use)
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
log("SYSERR: Unknown subcmd %d passed to do_use.", subcmd);
|
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'. */
|
* but in the function which handles 'quaff', 'recite', and 'use'. */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -725,7 +725,7 @@ ACMD(do_gen_write)
|
||||||
|
|
||||||
if (stat(filename, &fbuf) < 0) {
|
if (stat(filename, &fbuf) < 0) {
|
||||||
perror("SYSERR: Can't stat() file");
|
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
|
* call the stat() system call on the file required. The error string at
|
||||||
* the end of the line should explain what the problem is. */
|
* the end of the line should explain what the problem is. */
|
||||||
return;
|
return;
|
||||||
|
|
@ -737,7 +737,7 @@ ACMD(do_gen_write)
|
||||||
if (!(fl = fopen(filename, "a"))) {
|
if (!(fl = fopen(filename, "a"))) {
|
||||||
perror("SYSERR: do_gen_write");
|
perror("SYSERR: do_gen_write");
|
||||||
/* SYSERR_DESC: This is from do_gen_write(), and will be output if the file
|
/* 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. */
|
* end of the line should explain what the problem is. */
|
||||||
|
|
||||||
send_to_char(ch, "Could not open the file. Sorry.\r\n");
|
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 Off.\r\n",
|
||||||
"Buildwalk On.\r\n"},
|
"Buildwalk On.\r\n"},
|
||||||
{"AFK flag is now off.\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))
|
if (IS_NPC(ch))
|
||||||
|
|
@ -873,6 +889,30 @@ ACMD(do_gen_tog)
|
||||||
send_to_char(ch, "You have mail waiting.\r\n");
|
send_to_char(ch, "You have mail waiting.\r\n");
|
||||||
}
|
}
|
||||||
break;
|
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:
|
default:
|
||||||
log("SYSERR: Unknown subcmd %d in do_gen_toggle.", subcmd);
|
log("SYSERR: Unknown subcmd %d in do_gen_toggle.", subcmd);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -226,6 +226,8 @@ const char *preference_bits[] = {
|
||||||
"AUTOSAC",
|
"AUTOSAC",
|
||||||
"AUTOASSIST",
|
"AUTOASSIST",
|
||||||
"AUTOMAP",
|
"AUTOMAP",
|
||||||
|
"AUTOKEY",
|
||||||
|
"AUTODOOR",
|
||||||
"\n"
|
"\n"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,14 @@ cpp_extern const struct command_info cmd_info[] = {
|
||||||
{ "attach" , "attach" , POS_DEAD , do_attach , LVL_BUILDER, 0 },
|
{ "attach" , "attach" , POS_DEAD , do_attach , LVL_BUILDER, 0 },
|
||||||
{ "auction" , "auc" , POS_SLEEPING, do_gen_comm , 0, SCMD_AUCTION },
|
{ "auction" , "auc" , POS_SLEEPING, do_gen_comm , 0, SCMD_AUCTION },
|
||||||
{ "autoexits" , "autoex" , POS_DEAD , do_gen_tog , 0, SCMD_AUTOEXIT },
|
{ "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 },
|
{ "backstab" , "ba" , POS_STANDING, do_backstab , 1, 0 },
|
||||||
{ "ban" , "ban" , POS_DEAD , do_ban , LVL_GRGOD, 0 },
|
{ "ban" , "ban" , POS_DEAD , do_ban , LVL_GRGOD, 0 },
|
||||||
|
|
|
||||||
|
|
@ -250,8 +250,10 @@
|
||||||
#define PRF_AUTOSAC 29 /**< Sacrifice a corpse */
|
#define PRF_AUTOSAC 29 /**< Sacrifice a corpse */
|
||||||
#define PRF_AUTOASSIST 30 /**< Auto-assist toggle */
|
#define PRF_AUTOASSIST 30 /**< Auto-assist toggle */
|
||||||
#define PRF_AUTOMAP 31 /**< Show map at the side of room descs */
|
#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 */
|
/** 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 */
|
/* Affect bits: used in char_data.char_specials.saved.affected_by */
|
||||||
/* WARNING: In the world files, NEVER set the bits marked "R" ("Reserved") */
|
/* WARNING: In the world files, NEVER set the bits marked "R" ("Reserved") */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue