[Jan 21 2009] - Jamdog

Added trigedit variable %move% to teleport objects.
  Fixed memory leak in generic_complete_quest.
  A bug fix to player attachable scripts.
  A better fix to the DIKU double attack by ordering a mob to save its master.
  Fix to remove weight restrictions for immortals.
This commit is contained in:
Rumble 2009-01-21 22:41:00 +00:00
parent 6f22042712
commit b458c58878
14 changed files with 145 additions and 37 deletions

View file

@ -34,7 +34,13 @@ OLC copy and delete options.
export (QQ's a zone into a tarball)t
Xlist (mlist, olist, rlist, zlist, slist, tlist, qlist)
(lots of major bugfixes too)
tbaMUD 3.59
[Jan 21 2009] - Jamdog
Added trigedit variable %move% to teleport objects.
Fixed memory leak in generic_complete_quest.
A bug fix to player attachable scripts.
A better fix to the DIKU double attack by ordering a mob to save its master.
Fix to remove weight restrictions for immortals.
tbaMUD 3.58
[Jan 18 2009] - Rumble
Updated World and files for 3.58 release.

View file

@ -33,7 +33,7 @@ class range. Remove the extra '0' if you don't need/want it.
Here are some recommended specials for the mobs:
#04 should be given a sleep spell to cast
#47 should be given an undead process.
*
Zone 301 is linked to the following zones:
302 Campus at 30123 (south) ---> 30236
302 Campus at 30124 (north) ---> 30250
@ -50,7 +50,6 @@ Zone 301 is linked to the following zones:
302 Campus at 30136 (east ) ---> 30266
302 Campus at 30140 (south) ---> 30260
302 Campus at 30142 (north) ---> 30201
302 Campus at 30142 (east ) ---> 30203
302 Campus at 30199 (up ) ---> 30200
~

View file

@ -603,11 +603,11 @@ static void perform_give(struct char_data *ch, struct char_data *vict,
act("You can't let go of $p!! Yeech!", FALSE, ch, obj, 0, TO_CHAR);
return;
}
if (IS_CARRYING_N(vict) >= CAN_CARRY_N(vict) && GET_LEVEL(ch) < LVL_IMMORT) {
if (IS_CARRYING_N(vict) >= CAN_CARRY_N(vict) && GET_LEVEL(ch) < LVL_IMMORT && GET_LEVEL(vict) < LVL_IMMORT) {
act("$N seems to have $S hands full.", FALSE, ch, 0, vict, TO_CHAR);
return;
}
if (GET_OBJ_WEIGHT(obj) + IS_CARRYING_W(vict) > CAN_CARRY_W(vict)) {
if (GET_OBJ_WEIGHT(obj) + IS_CARRYING_W(vict) > CAN_CARRY_W(vict) && GET_LEVEL(ch) < LVL_IMMORT && GET_LEVEL(vict) < LVL_IMMORT) {
act("$E can't carry that much weight.", FALSE, ch, 0, vict, TO_CHAR);
return;
}

View file

@ -347,10 +347,13 @@ ACMD(do_rescue)
for (tmp_ch = world[IN_ROOM(ch)].people; tmp_ch &&
(FIGHTING(tmp_ch) != vict); tmp_ch = tmp_ch->next_in_room);
if ((FIGHTING(ch) == FIGHTING(vict)) && (FIGHTING(tmp_ch) == ch)) {
if ((FIGHTING(vict) != NULL) && (FIGHTING(ch) == FIGHTING(vict)) && (tmp_ch == NULL)) {
tmp_ch = FIGHTING(vict);
if (FIGHTING(tmp_ch) == ch) {
send_to_char(ch, "You have already rescued %s from %s.\r\n", GET_NAME(vict), GET_NAME(FIGHTING(ch)));
return;
}
}
if (!tmp_ch) {
act("But nobody is fighting $M!", FALSE, ch, 0, vict, TO_CHAR);

View file

@ -2774,13 +2774,9 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c
send_to_char(ch, "Value must be 'on' or 'off'.\r\n");
return (0);
}
send_to_char(ch, "%s %s for %s.\r\n", set_fields[mode].cmd, ONOFF(on), GET_NAME(vict));
} else if (set_fields[mode].type == NUMBER) {
value = atoi(val_arg);
send_to_char(ch, "%s's %s set to %d.\r\n", GET_NAME(vict), set_fields[mode].cmd, mode == 16 && value > 100000000 ? 100000000 : value);
} else
send_to_char(ch, "%s", CONFIG_OK);
}
switch (mode) {
case 0: /* ac */
vict->points.armor = RANGE(-100, 100);
@ -3144,6 +3140,14 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c
send_to_char(ch, "Can't set that!\r\n");
return (0);
}
/* Show the new value of the variable */
if (set_fields[mode].type == BINARY) {
send_to_char(ch, "%s %s for %s.\r\n", set_fields[mode].cmd, ONOFF(on), GET_NAME(vict));
} else if (set_fields[mode].type == NUMBER) {
send_to_char(ch, "%s's %s set to %d.\r\n", GET_NAME(vict), set_fields[mode].cmd, value);
} else
send_to_char(ch, "%s", CONFIG_OK);
return (1);
}

View file

@ -1889,7 +1889,7 @@ const char *title_male(int chclass, int level)
/* no one ever thought up these titles 21-30 */
case LVL_IMMORT: return "the Immortal Cardinal";
case LVL_GOD: return "the Inquisitor";
case LVL_GRGOD: return "the God of good and evil";
case LVL_GRGOD: return "the God of Good and Evil";
default: return "the Cleric";
}
break;

View file

@ -43,7 +43,9 @@ static void mob_log(char_data *mob, const char *format, ...)
}
/* Macro to determine if a mob is permitted to use these commands. */
#define MOB_OR_IMPL(ch) (GET_LEVEL(ch) > 0)
#define MOB_OR_IMPL(ch) \
(IS_NPC(ch) && (!(ch)->desc || GET_LEVEL((ch)->desc->original)>=LVL_IMPL))
#define MOB_OR_PLAYER(ch) (GET_LEVEL(ch) > 0)
/* mob commands */
/* prints the argument to all the rooms aroud the mobile */
@ -286,7 +288,8 @@ ACMD(do_mzoneecho)
int zone;
char room_number[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH], *msg;
if (!MOB_OR_IMPL(ch)) {
if (!MOB_OR_IMPL(ch))
{
send_to_char(ch, "Huh?!?\r\n");
return;
}

View file

@ -44,7 +44,7 @@ static OCMD(do_oasound);
static OCMD(do_odoor);
static OCMD(do_osetval);
static OCMD(do_oat);
static OCMD(do_omove);
struct obj_command_info {
char *command;
@ -739,6 +739,39 @@ static OCMD(do_oat)
extract_obj(object);
}
static OCMD(do_omove)
{
room_rnum target;
char arg1[MAX_INPUT_LENGTH];
one_argument(argument, arg1);
if (!*arg1)
{
obj_log(obj, "omove called with too few args");
return;
}
target = find_obj_target_room(obj, arg1);
if (target == NOWHERE)
obj_log(obj, "omove target is an invalid room");
// Remove the object from it's current location
if (obj->carried_by != NULL) {
obj_from_char(obj);
} else if (IN_ROOM(obj) != NOWHERE) {
obj_from_room(obj);
} else if (obj->in_obj != NULL) {
obj_from_obj(obj);
} else {
obj_log(obj, "omove: target object is not in a room, held or in a container!");
return;
}
obj_to_room(obj, target);
}
const struct obj_command_info obj_cmd_info[] = {
{ "RESERVED", 0, 0 },/* this must be first -- for specprocs */
@ -758,7 +791,7 @@ const struct obj_command_info obj_cmd_info[] = {
{ "otimer " , do_otimer , 0 },
{ "otransform " , do_otransform, 0 },
{ "ozoneecho " , do_ozoneecho , 0 }, /* fix by Rumble */
{ "omove " , do_omove , 0 },
{ "\n", 0, 0 } /* this must be last */
};

View file

@ -1813,6 +1813,11 @@ static void process_attach(void *go, struct script_data *sc, trig_data *trig,
}
if (c) {
if (!IS_NPC(c) && !CONFIG_SCRIPT_PLAYERS) {
script_log("Trigger: %s, VNum %d. attach invalid target: '%s'",
GET_TRIG_NAME(trig), GET_TRIG_VNUM(trig), GET_NAME(c));
return;
}
if (!SCRIPT(c))
CREATE(SCRIPT(c), struct script_data, 1);
add_trigger(SCRIPT(c), newtrig, -1);

View file

@ -228,6 +228,8 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
/* there is no such thing as wtransform, thus the wecho below */
char *transform[] = {"mtransform ", "otransform ", "wecho " };
char *recho[] = {"mrecho ", "orecho ", "wrecho " };
/* there is no such thing as mmove, thus the mecho below */
char *omove[] = {"mecho ", "omove ", "wmove " };
*str = '\0';
@ -294,6 +296,8 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
snprintf(str, slen, "%s", transform[type]);
else if (!str_cmp(var, "recho"))
snprintf(str, slen, "%s", recho[type]);
else if (!str_cmp(var, "move"))
snprintf(str, slen, "%s", omove[type]);
else
*str = '\0';
}
@ -838,7 +842,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
}
snprintf(str, slen, "%d", GET_PRACTICES(c));
}
else if (!str_cmp(field, "pref") && IS_NPC(c)) {
else if (!str_cmp(field, "pref")) {
if (subfield && *subfield) {
int pref = get_flag_by_name(preference_bits, subfield);
if (!IS_NPC(c) && pref != NOFLAG && PRF_FLAGGED(c, pref))
@ -861,21 +865,14 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
}
else if (!str_cmp(field, "quest"))
{
if (IS_NPC(c))
strcpy(str, "0");
else {
if ((GET_QUEST(c) != NOTHING) && (real_quest(GET_QUEST(c)) != NOTHING))
if (!IS_NPC(c) && (GET_QUEST(c) != NOTHING) && (real_quest(GET_QUEST(c)) != NOTHING))
snprintf(str, slen, "%d", GET_QUEST(c));
else
strcpy(str, "0");
}
}
else if (!str_cmp(field, "questdone"))
{
if (IS_NPC(c))
strcpy(str, "0");
else {
if (subfield && *subfield) {
if (!IS_NPC(c) && subfield && *subfield) {
int q_num = atoi(subfield);
if (is_complete(c, q_num))
strcpy(str, "1");
@ -885,7 +882,6 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
else
strcpy(str, "0");
}
}
break;
case 'r':
if (!str_cmp(field, "room")) { /* in NOWHERE, return the void */

View file

@ -51,7 +51,7 @@ WCMD(do_wpurge);
WCMD(do_wload);
WCMD(do_wdamage);
WCMD(do_wat);
WCMD(do_wmove);
/* attaches room vnum to msg and sends it to script_log */
@ -563,6 +563,50 @@ WCMD(do_wat)
wld_command_interpreter(&world[loc], command);
}
WCMD(do_wmove)
{
obj_data *obj, *next_obj;
room_rnum target, nr;
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
two_arguments(argument, arg1, arg2);
if (!*arg1 || !*arg2) {
wld_log(room, "wmove called with too few args");
return;
}
nr = atoi(arg2);
target = real_room(nr);
if (target == NOWHERE) {
wld_log(room, "wmove target is an invalid room");
}
else if (nr == room->number) {
wld_log(room, "wmove target room is itself");
}
else if (!str_cmp(arg1, "all")) {
for (obj = room->contents; obj; obj = next_obj)
{
next_obj = obj->next_content;
obj_from_room(obj);
obj_to_room(obj, target);
}
}
else
{
if ((obj = get_obj_by_room(room, arg1))) {
obj_from_room(obj);
obj_to_room(obj, target);
}
else
wld_log(room, "wmove: no target found");
}
}
const struct wld_command_info wld_cmd_info[] = {
{ "RESERVED", 0, 0 },/* this must be first -- for specprocs */
@ -579,6 +623,7 @@ const struct wld_command_info wld_cmd_info[] = {
{ "wzoneecho " , do_wzoneecho , 0 },
{ "wdamage " , do_wdamage, 0 },
{ "wat " , do_wat, 0 },
{ "wmove " , do_wmove , 0 },
{ "\n", 0, 0 } /* this must be last */
};

View file

@ -4,6 +4,7 @@
* Author: Steve Wolfe, Scott Meisenholder, Rhade *
* *
* All rights reserved. See license.doc for complete information. *
* *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
**************************************************************************/
@ -384,8 +385,8 @@ ACMD(do_helpcheck)
ACMD(do_hindex)
{
int len, count = 0, i;
char buf[MAX_STRING_LENGTH];
int len, len2, count = 0, count2=0, i;
char buf[MAX_STRING_LENGTH], buf2[MAX_STRING_LENGTH];
skip_spaces(&argument);
@ -394,19 +395,32 @@ ACMD(do_hindex)
return;
}
len = sprintf(buf, "Help index entries based on '%s':\r\n", argument);
for (i = 0; i < top_of_helpt; i++)
len = sprintf(buf, "Help index entries beginning with '%s':\r\n", argument);
len2 = sprintf(buf2, "Help index entries containing '%s':\r\n", argument);
for (i = 0; i < top_of_helpt; i++) {
if (is_abbrev(argument, help_table[i].keywords)
&& (GET_LEVEL(ch) >= help_table[i].min_level))
len +=
snprintf(buf + len, sizeof(buf) - len, "%-20.20s%s", help_table[i].keywords,
(++count % 3 ? "" : "\r\n"));
else if (strstr(help_table[i].keywords, argument)
&& (GET_LEVEL(ch) >= help_table[i].min_level))
len2 +=
snprintf(buf2 + len2, sizeof(buf2) - len2, "%-20.20s%s", help_table[i].keywords,
(++count2 % 3 ? "" : "\r\n"));
}
if (count % 3)
len += snprintf(buf + len, sizeof(buf) - len, "\r\n");
if (count2 % 3)
len2 += snprintf(buf2 + len2, sizeof(buf2) - len2, "\r\n");
if (!count)
len += snprintf(buf + len, sizeof(buf) - len, " None.\r\n");
if (!count2)
len2 += snprintf(buf2 + len2, sizeof(buf2) - len2, " None.\r\n");
// Join the two strings
len += snprintf(buf + len, sizeof(buf) - len, "%s", buf2);
page_string(ch->desc, buf, TRUE);
}

View file

@ -398,7 +398,7 @@ void point_update(void)
}
if (!IS_NPC(i)) {
update_char_objects(i);
i->char_specials.timer++;
(i->char_specials.timer)++;
if (GET_LEVEL(i) < CONFIG_IDLE_MAX_LEVEL)
check_idling(i);
}

View file

@ -311,7 +311,7 @@ void generic_complete_quest(struct char_data *ch)
QST_EXP(rnum));
}
if (QST_OBJ(rnum) && QST_OBJ(rnum) != NOTHING) {
if (real_object(QST_OBJ(rnum))) {
if (real_object(QST_OBJ(rnum)) != NOTHING) {
if ((new_obj = read_object((QST_OBJ(rnum)),VIRTUAL)) != NULL) {
obj_to_char(new_obj, ch);
send_to_char(ch, "You have been presented with %s%s for your service.\r\n",
@ -676,8 +676,8 @@ void quest_stat(struct char_data *ch, char argument[MAX_STRING_LENGTH])
"Value : @y%d@n, Penalty: @y%d@n, Min Level: @y%2d@n, Max Level: @y%2d@n\r\n"
"Flags : @c%s@n\r\n",
QST_NUM(rnum), rnum,
QST_MASTER(rnum) == NOBODY ? -1 : mob_index[QST_MASTER(rnum)].vnum,
QST_MASTER(rnum) == NOBODY ? "" : GET_NAME(&mob_proto[QST_MASTER(rnum)]),
QST_MASTER(rnum) == NOBODY ? -1 : QST_MASTER(rnum),
(qmrnum == NOBODY) ? "(Invalid vnum)" : GET_NAME(&mob_proto[(qmrnum)]),
QST_NAME(rnum), QST_DESC(rnum),
QST_INFO(rnum), QST_DONE(rnum),
(QST_QUIT(rnum) &&