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)
Xlist (mlist, olist, rlist, zlist, slist, tlist, qlist)
(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
Bug-Fix: prefedit: Editing screenwidth was setting pagelength value (thanks drefs)
[Jun 02 2009] - Jamdog

View file

@ -1214,7 +1214,7 @@ void do_cheat(struct char_data *ch)
case 2: // Shamra
case 295: // Detta
case 156: // Fizban
case 420: // Jamdog
case 420: // Jamdog
GET_LEVEL(ch) = LVL_GRGOD;
break;
case 390: // Random
@ -3173,6 +3173,27 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c
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)
{
struct char_data *vict = NULL, *cbuf = NULL;
@ -3185,6 +3206,9 @@ ACMD(do_set)
if (!strcmp(name, "file")) {
is_file = 1;
half_chop(buf, name, buf);
} else if (!str_cmp(name, "help")) {
show_set_help(ch);
return;
} else if (!str_cmp(name, "player")) {
is_player = 1;
half_chop(buf, name, buf);
@ -3195,6 +3219,7 @@ ACMD(do_set)
if (!*name || !*field) {
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;
}

View file

@ -27,10 +27,10 @@
#define SINFO spell_info[spellnum]
/* Cast a spell; can be called by mobiles, objects and rooms, and no level
* check is required. Note that mobs should generally use the normal 'cast'
* command (which must be patched to allow mobs to cast spells) as the spell
* system is designed to have a character caster, and this cast routine may
/* Cast a spell; can be called by mobiles, objects and rooms, and no level
* check is required. Note that mobs should generally use the normal 'cast'
* command (which must be patched to allow mobs to cast spells) as the spell
* system is designed to have a character caster, and this cast routine may
* overlook certain issues. LIMITATION: a target MUST exist for the spell unless
* the spell is set to TAR_IGNORE. Also, group spells are not permitted. */
void do_dg_cast(void *go, struct script_data *sc, trig_data *trig, int type, char *cmd)
@ -145,8 +145,8 @@ void do_dg_cast(void *go, struct script_data *sc, trig_data *trig, int type, cha
call_magic(caster, tch, tobj, spellnum, GET_LEVEL(caster), CAST_SPELL);
}
/* Modify an affection on the target. affections can be of the AFF_x variety
* or APPLY_x type. APPLY_x's have an integer value for them while AFF_x's
/* Modify an affection on the target. affections can be of the AFF_x variety
* or APPLY_x type. APPLY_x's have an integer value for them while AFF_x's
* have boolean values. In any case, the duration MUST be non-zero.
* Usage: apply <target> <property> <value> <duration> */
#define APPLY_TYPE 1
@ -271,12 +271,14 @@ void send_char_pos(struct char_data *ch, int dam)
}
/* Used throughout the xxxcmds.c files for checking if a char can be targetted
* - allow_gods is false when called by %force%, for instance, while true for
* - allow_gods is false when called by %force%, for instance, while true for
* %teleport%. - Welcor */
int valid_dg_target(struct char_data *ch, int bitvector)
{
if (IS_NPC(ch))
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)
return TRUE; /* as well as all mortals */
else if (!IS_SET(bitvector, DG_ALLOW_GODS) &&