Fixed dg-script crash bug (forcing dead players) and added set help command

This commit is contained in:
JamDog
2009-06-08 19:00:17 +00:00
parent 6121aed5b9
commit eac2c08bf1
3 changed files with 38 additions and 8 deletions

View File

@@ -34,6 +34,9 @@ OLC copy and delete options.
export (QQ's a zone into a tarball) export (QQ's a zone into a tarball)
Xlist (mlist, olist, rlist, zlist, slist, tlist, qlist) Xlist (mlist, olist, rlist, zlist, slist, tlist, qlist)
(lots of major bugfixes too) (lots of major bugfixes too)
[Jun 08 2009] - Jamdog
Bug-Fix: DG-Scripts: If %actor% dies during a script, then %force% %actor% no longer crashes the MUD.
Added 'set help' now displays a list of available set options (thanks Super)
[Jun 06 2009] - Jamdog [Jun 06 2009] - Jamdog
Bug-Fix: prefedit: Editing screenwidth was setting pagelength value (thanks drefs) Bug-Fix: prefedit: Editing screenwidth was setting pagelength value (thanks drefs)
[Jun 02 2009] - Jamdog [Jun 02 2009] - Jamdog

View File

@@ -3173,6 +3173,27 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c
return (1); return (1);
} }
void show_set_help(struct char_data *ch)
{
const char *set_levels[] = {"Imm", "God", "GrGod", "IMP"};
const char *set_targets[] = {"PC", "NPC", "BOTH"};
const char *set_types[] = {"MISC", "BINARY", "NUMBER"};
char buf[MAX_STRING_LENGTH];
int i, len=0, add_len=0;
len = snprintf(buf, sizeof(buf), "%sCommand Lvl Who? Type%s\r\n", CCCYN(ch, C_NRM), CCNRM(ch, C_NRM));
for (i = 0; *(set_fields[i].cmd) != '\n'; i++) {
if (set_fields[i].level <= GET_LEVEL(ch)) {
add_len = snprintf(buf+len, sizeof(buf)-len, "%-20s%-5s %-4s %-6s\r\n", set_fields[i].cmd,
set_levels[((int)(set_fields[i].level) - LVL_IMMORT)],
set_targets[(int)(set_fields[i].pcnpc)-1],
set_types[(int)(set_fields[i].type)]);
len += add_len;
}
}
page_string(ch->desc, buf, TRUE);
}
ACMD(do_set) ACMD(do_set)
{ {
struct char_data *vict = NULL, *cbuf = NULL; struct char_data *vict = NULL, *cbuf = NULL;
@@ -3185,6 +3206,9 @@ ACMD(do_set)
if (!strcmp(name, "file")) { if (!strcmp(name, "file")) {
is_file = 1; is_file = 1;
half_chop(buf, name, buf); half_chop(buf, name, buf);
} else if (!str_cmp(name, "help")) {
show_set_help(ch);
return;
} else if (!str_cmp(name, "player")) { } else if (!str_cmp(name, "player")) {
is_player = 1; is_player = 1;
half_chop(buf, name, buf); half_chop(buf, name, buf);
@@ -3195,6 +3219,7 @@ ACMD(do_set)
if (!*name || !*field) { if (!*name || !*field) {
send_to_char(ch, "Usage: set <victim> <field> <value>\r\n"); send_to_char(ch, "Usage: set <victim> <field> <value>\r\n");
send_to_char(ch, " %sset help%s will display valid fields\r\n", CCYEL(ch, C_NRM), CCNRM(ch, C_NRM));
return; return;
} }

View File

@@ -277,6 +277,8 @@ int valid_dg_target(struct char_data *ch, int bitvector)
{ {
if (IS_NPC(ch)) if (IS_NPC(ch))
return TRUE; /* all npcs are allowed as targets */ return TRUE; /* all npcs are allowed as targets */
else if ((STATE(ch->desc) != CON_PLAYING))
return FALSE; /* Only PC's who are playing can be targetted */
else if (GET_LEVEL(ch) < LVL_IMMORT) else if (GET_LEVEL(ch) < LVL_IMMORT)
return TRUE; /* as well as all mortals */ return TRUE; /* as well as all mortals */
else if (!IS_SET(bitvector, DG_ALLOW_GODS) && else if (!IS_SET(bitvector, DG_ALLOW_GODS) &&