From fdb6ff377137946238c38d7918da097467552bd2 Mon Sep 17 00:00:00 2001 From: welcor <357770+welcor@users.noreply.github.com> Date: Tue, 1 Oct 2024 00:09:30 +0200 Subject: [PATCH] act-files formatted --- .clang-format | 4 +- src/act.comm.c | 168 ++- src/act.h | 3 +- src/act.informative.c | 1055 +++++++------ src/act.item.c | 649 ++++---- src/act.movement.c | 190 ++- src/act.offensive.c | 126 +- src/act.other.c | 472 +++--- src/act.social.c | 86 +- src/act.wizard.c | 3337 +++++++++++++++++++++-------------------- src/aedit.c | 1503 ++++++++++--------- src/utils.h | 19 +- 12 files changed, 3855 insertions(+), 3757 deletions(-) diff --git a/.clang-format b/.clang-format index 7be6d65..c450d15 100644 --- a/.clang-format +++ b/.clang-format @@ -40,7 +40,7 @@ IncludeCategories: Priority: 3 IncludeIsMainRegex: '([-_](test|unittest))?$' IndentCaseBlocks: true -IndentWidth: 4 +IndentWidth: 2 InsertNewlineAtEOF: true MacroBlockBegin: '' MacroBlockEnd: '' @@ -51,5 +51,5 @@ SpacesInAngles: false SpacesInConditionalStatement: false SpacesInCStyleCastParentheses: false SpacesInParentheses: false -TabWidth: 4 +TabWidth: 2 ... diff --git a/src/act.comm.c b/src/act.comm.c index 84e0449..a8cf286 100644 --- a/src/act.comm.c +++ b/src/act.comm.c @@ -22,15 +22,15 @@ #include "act.h" #include "modify.h" -static bool legal_communication(char * arg); +static bool legal_communication(char *arg); -static bool legal_communication(char * arg) +static bool legal_communication(char *arg) { while (*arg) { if (*arg == '@') { arg++; if (*arg == '(' || *arg == ')' || *arg == '<' || *arg == '>') - return FALSE; + return FALSE; } arg++; } @@ -46,7 +46,7 @@ ACMD(do_say) else { char buf[MAX_INPUT_LENGTH + 14], *msg; struct char_data *vict; - + if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument)) parse_at(argument); @@ -74,7 +74,7 @@ ACMD(do_say) ACMD(do_gsay) { skip_spaces(&argument); - + if (!GROUP(ch)) { send_to_char(ch, "But you are not a member of a group!\r\n"); return; @@ -82,17 +82,18 @@ ACMD(do_gsay) if (!*argument) send_to_char(ch, "Yes, but WHAT do you want to group-say?\r\n"); else { - + if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument)) - parse_at(argument); - - send_to_group(ch, ch->group, "%s%s%s says, '%s'%s\r\n", CCGRN(ch, C_NRM), CCGRN(ch, C_NRM), GET_NAME(ch), argument, CCNRM(ch, C_NRM)); - + parse_at(argument); + + send_to_group(ch, ch->group, "%s%s%s says, '%s'%s\r\n", CCGRN(ch, C_NRM), CCGRN(ch, C_NRM), GET_NAME(ch), + argument, CCNRM(ch, C_NRM)); + if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT)) send_to_char(ch, "%s", CONFIG_OK); else send_to_char(ch, "%sYou group-say, '%s'%s\r\n", CCGRN(ch, C_NRM), argument, CCNRM(ch, C_NRM)); - } + } } static void perform_tell(struct char_data *ch, struct char_data *vict, char *arg) @@ -107,7 +108,7 @@ static void perform_tell(struct char_data *ch, struct char_data *vict, char *arg send_to_char(ch, "%s", CONFIG_OK); else { snprintf(buf, sizeof(buf), "%sYou tell $N, '%s'%s", CCRED(ch, C_NRM), arg, CCNRM(ch, C_NRM)); - msg = act(buf, FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP); + msg = act(buf, FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP); add_history(ch, msg, HIST_TELL); } @@ -127,11 +128,12 @@ static int is_tell_ok(struct char_data *ch, struct char_data *vict) send_to_char(ch, "You can't tell other people while you have notell on.\r\n"); else if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_SOUNDPROOF) && (GET_LEVEL(ch) < LVL_GOD)) send_to_char(ch, "The walls seem to absorb your words.\r\n"); - else if (!IS_NPC(vict) && !vict->desc) /* linkless */ + else if (!IS_NPC(vict) && !vict->desc) /* linkless */ act("$E's linkless at the moment.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP); else if (PLR_FLAGGED(vict, PLR_WRITING)) act("$E's writing a message right now; try again later.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP); - else if ((!IS_NPC(vict) && PRF_FLAGGED(vict, PRF_NOTELL)) || (ROOM_FLAGGED(IN_ROOM(vict), ROOM_SOUNDPROOF) && (GET_LEVEL(ch) < LVL_GOD))) + else if ((!IS_NPC(vict) && PRF_FLAGGED(vict, PRF_NOTELL)) || ( + ROOM_FLAGGED(IN_ROOM(vict), ROOM_SOUNDPROOF) && (GET_LEVEL(ch) < LVL_GOD))) act("$E can't hear you.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP); else return (TRUE); @@ -144,7 +146,7 @@ static int is_tell_ok(struct char_data *ch, struct char_data *vict) ACMD(do_tell) { struct char_data *vict = NULL; - char buf[MAX_INPUT_LENGTH + 25], buf2[MAX_INPUT_LENGTH]; // +25 to make room for constants + char buf[MAX_INPUT_LENGTH + 25], buf2[MAX_INPUT_LENGTH]; // +25 to make room for constants half_chop(argument, buf, buf2); @@ -168,7 +170,7 @@ ACMD(do_tell) } /* Only a-z and +/- allowed. */ - for (p = buf2, q = word; *p ; p++) + for (p = buf2, q = word; *p; p++) if ((LOWER(*p) <= 'z' && LOWER(*p) >= 'a') || (*p == '+') || (*p == '-')) *q++ = *p; @@ -178,7 +180,7 @@ ACMD(do_tell) send_to_char(ch, "Sorry, only letters and +/- are allowed characters.\r\n"); return; } - snprintf(buf, sizeof(buf), "../bin/webster %s %d &", word, (int) getpid()); + snprintf(buf, sizeof(buf), "../bin/webster %s %d &", word, (int)getpid()); last_webster_teller = GET_IDNUM(ch); send_to_char(ch, "You look up '%s' in Merriam-Webster.\r\n", word); #endif /* platform specific part */ @@ -190,7 +192,7 @@ ACMD(do_tell) if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument)) parse_at(buf2); perform_tell(ch, vict, buf2); - } + } } ACMD(do_reply) @@ -210,8 +212,8 @@ ACMD(do_reply) /* Make sure the person you're replying to is still playing by searching * for them. Note, now last tell is stored as player IDnum instead of * a pointer, which is much better because it's safer, plus will still - * work if someone logs out and back in again. A descriptor list based - * search would be faster although we could not find link dead people. + * work if someone logs out and back in again. A descriptor list based + * search would be faster although we could not find link dead people. * Not that they can hear tells anyway. :) -gg 2/24/98 */ while (tch && (IS_NPC(tch) || GET_IDNUM(tch) != GET_LAST_TELL(ch))) tch = tch->next; @@ -222,7 +224,7 @@ ACMD(do_reply) if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument)) parse_at(argument); perform_tell(ch, tch, argument); - } + } } } @@ -269,7 +271,7 @@ ACMD(do_spec_comm) snprintf(buf1, sizeof(buf1), "$n %s you, '%s'", action_plur, buf2); act(buf1, FALSE, ch, 0, vict, TO_VICT); - if ((!IS_NPC(ch)) && (PRF_FLAGGED(ch, PRF_NOREPEAT))) + if ((!IS_NPC(ch)) && (PRF_FLAGGED(ch, PRF_NOREPEAT))) send_to_char(ch, "%s", CONFIG_OK); else send_to_char(ch, "You %s %s, '%s'\r\n", action_sing, GET_NAME(vict), buf2); @@ -374,19 +376,19 @@ ACMD(do_page) snprintf(buf, sizeof(buf), "\007\007*$n* %s", buf2); if (!str_cmp(arg, "all")) { if (GET_LEVEL(ch) > LVL_GOD) { - for (d = descriptor_list; d; d = d->next) - if (STATE(d) == CON_PLAYING && d->character) - act(buf, FALSE, ch, 0, d->character, TO_VICT); + for (d = descriptor_list; d; d = d->next) + if (STATE(d) == CON_PLAYING && d->character) + act(buf, FALSE, ch, 0, d->character, TO_VICT); } else - send_to_char(ch, "You will never be godly enough to do that!\r\n"); + send_to_char(ch, "You will never be godly enough to do that!\r\n"); return; } if ((vict = get_char_vis(ch, arg, NULL, FIND_CHAR_WORLD))) { act(buf, FALSE, ch, 0, vict, TO_VICT); if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT)) - send_to_char(ch, "%s", CONFIG_OK); + send_to_char(ch, "%s", CONFIG_OK); else - act(buf, FALSE, ch, 0, vict, TO_CHAR); + act(buf, FALSE, ch, 0, vict, TO_CHAR); } else send_to_char(ch, "There is no such person in the game!\r\n"); } @@ -397,26 +399,26 @@ ACMD(do_gen_comm) { struct descriptor_data *i; char color_on[24]; - char buf1[MAX_INPUT_LENGTH], buf2[MAX_INPUT_LENGTH + 50], *msg; // + 50 to make room for color codes + char buf1[MAX_INPUT_LENGTH], buf2[MAX_INPUT_LENGTH + 50], *msg; // + 50 to make room for color codes bool emoting = FALSE; /* Array of flags which must _not_ be set in order for comm to be heard. */ int channels[] = { - 0, - PRF_NOSHOUT, - PRF_NOGOSS, - PRF_NOAUCT, - PRF_NOGRATZ, - PRF_NOGOSS, - 0 + 0, + PRF_NOSHOUT, + PRF_NOGOSS, + PRF_NOAUCT, + PRF_NOGRATZ, + PRF_NOGOSS, + 0 }; int hist_type[] = { - HIST_HOLLER, - HIST_SHOUT, - HIST_GOSSIP, - HIST_AUCTION, - HIST_GRATS, + HIST_HOLLER, + HIST_SHOUT, + HIST_GOSSIP, + HIST_AUCTION, + HIST_GRATS, }; /* com_msgs: [0] Message if you can't perform the action because of noshout @@ -424,35 +426,42 @@ ACMD(do_gen_comm) * [2] message if you're not on the channel * [3] a color string. */ const char *com_msgs[][4] = { - {"You cannot holler!!\r\n", - "holler", - "", - KYEL}, - - {"You cannot shout!!\r\n", - "shout", - "Turn off your noshout flag first!\r\n", - KYEL}, - - {"You cannot gossip!!\r\n", - "gossip", - "You aren't even on the channel!\r\n", - KYEL}, - - {"You cannot auction!!\r\n", - "auction", - "You aren't even on the channel!\r\n", - KMAG}, - - {"You cannot congratulate!\r\n", - "congrat", - "You aren't even on the channel!\r\n", - KGRN}, - - {"You cannot gossip your emotions!\r\n", - "gossip", - "You aren't even on the channel!\r\n", - KYEL} + { + "You cannot holler!!\r\n", + "holler", + "", + KYEL + }, + { + "You cannot shout!!\r\n", + "shout", + "Turn off your noshout flag first!\r\n", + KYEL + }, + { + "You cannot gossip!!\r\n", + "gossip", + "You aren't even on the channel!\r\n", + KYEL + }, + { + "You cannot auction!!\r\n", + "auction", + "You aren't even on the channel!\r\n", + KMAG + }, + { + "You cannot congratulate!\r\n", + "congrat", + "You aren't even on the channel!\r\n", + KGRN + }, + { + "You cannot gossip your emotions!\r\n", + "gossip", + "You aren't even on the channel!\r\n", + KYEL + } }; if (PLR_FLAGGED(ch, PLR_NOSHOUT)) { @@ -475,7 +484,8 @@ ACMD(do_gen_comm) /* Level_can_shout defined in config.c. */ if (GET_LEVEL(ch) < CONFIG_LEVEL_CAN_SHOUT) { - send_to_char(ch, "You must be at least level %d before you can %s.\r\n", CONFIG_LEVEL_CAN_SHOUT, com_msgs[subcmd][1]); + send_to_char(ch, "You must be at least level %d before you can %s.\r\n", CONFIG_LEVEL_CAN_SHOUT, + com_msgs[subcmd][1]); return; } /* Make sure the char is on the channel. */ @@ -506,12 +516,12 @@ ACMD(do_gen_comm) if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT)) send_to_char(ch, "%s", CONFIG_OK); else { - if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument)) + if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument)) parse_at(argument); - + snprintf(buf1, sizeof(buf1), "%sYou %s, '%s%s'%s", COLOR_LEV(ch) >= C_CMP ? color_on : "", - com_msgs[subcmd][1], argument, COLOR_LEV(ch) >= C_CMP ? color_on : "", CCNRM(ch, C_CMP)); - + com_msgs[subcmd][1], argument, COLOR_LEV(ch) >= C_CMP ? color_on : "", CCNRM(ch, C_CMP)); + msg = act(buf1, FALSE, ch, 0, 0, TO_CHAR | TO_SLEEP); add_history(ch, msg, hist_type[subcmd]); } @@ -520,7 +530,7 @@ ACMD(do_gen_comm) /* Now send all the strings out. */ for (i = descriptor_list; i; i = i->next) { - if (STATE(i) != CON_PLAYING || i == ch->desc || !i->character ) + if (STATE(i) != CON_PLAYING || i == ch->desc || !i->character) continue; if (!IS_NPC(ch) && (PRF_FLAGGED(i->character, channels[subcmd]) || PLR_FLAGGED(i->character, PLR_WRITING))) continue; @@ -529,10 +539,10 @@ ACMD(do_gen_comm) continue; if (subcmd == SCMD_SHOUT && ((world[IN_ROOM(ch)].zone != world[IN_ROOM(i->character)].zone) || - !AWAKE(i->character))) + !AWAKE(i->character))) continue; - snprintf(buf2, sizeof(buf2), "%s%s%s", (COLOR_LEV(i->character) >= C_NRM) ? color_on : "", buf1, KNRM); + snprintf(buf2, sizeof(buf2), "%s%s%s", (COLOR_LEV(i->character) >= C_NRM) ? color_on : "", buf1, KNRM); msg = act(buf2, FALSE, ch, 0, i->character, TO_VICT | TO_SLEEP); add_history(i->character, msg, hist_type[subcmd]); } @@ -551,7 +561,7 @@ ACMD(do_qcomm) else { char buf[MAX_STRING_LENGTH]; struct descriptor_data *i; - + if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument)) parse_at(argument); diff --git a/src/act.h b/src/act.h index 93cce58..9b650a7 100644 --- a/src/act.h +++ b/src/act.h @@ -268,7 +268,6 @@ ACMD(do_action); ACMD(do_gmote); - /***************************************************************************** * Begin Functions and defines for act.wizard.c ****************************************************************************/ @@ -327,7 +326,7 @@ ACMD(do_plist); ACMD(do_purge); ACMD(do_recent); ACMD(do_restore); -void return_to_char(struct char_data * ch); +void return_to_char(struct char_data *ch); ACMD(do_return); ACMD(do_saveall); ACMD(do_send); diff --git a/src/act.informative.c b/src/act.informative.c index 5298e1c..ecdcbf8 100644 --- a/src/act.informative.c +++ b/src/act.informative.c @@ -77,8 +77,8 @@ static void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mod found++; } if (found) { - send_to_char(ch, "You are %s upon %s.", GET_POS(ch) == POS_SITTING ? "sitting" : - "resting", obj->short_description); + send_to_char(ch, "You are %s upon %s.", GET_POS(ch) == POS_SITTING ? "sitting" : "resting", + obj->short_description); goto end; } } @@ -125,7 +125,7 @@ static void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mod snprintf(notebuf, sizeof(notebuf), "There is something written on it:\r\n\r\n%s", obj->action_description); page_string(ch->desc, notebuf, TRUE); } else - send_to_char(ch, "It's blank.\r\n"); + send_to_char(ch, "It's blank.\r\n"); return; case ITEM_DRINKCON: @@ -140,14 +140,14 @@ static void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mod default: log("SYSERR: Bad display mode (%d) in show_obj_to_char().", mode); - /* SYSERR_DESC: show_obj_to_char() has some predefined 'mode's (argument - * #3) to tell it what to display to the character when it is called. If - * the mode is not one of these, it will output this error, and indicate - * what mode was passed to it. To correct it, you will need to find the - * call with the incorrect mode and change it to an acceptable mode. */ + /* SYSERR_DESC: show_obj_to_char() has some predefined 'mode's (argument + * #3) to tell it what to display to the character when it is called. If + * the mode is not one of these, it will output this error, and indicate + * what mode was passed to it. To correct it, you will need to find the + * call with the incorrect mode and change it to an acceptable mode. */ return; } - end: +end: show_obj_modifiers(obj, ch); send_to_char(ch, "\r\n"); @@ -205,7 +205,7 @@ static void list_obj_to_char(struct obj_data *list, struct char_data *ch, int mo /* When looking in room, hide objects starting with '.', except for holylight */ if (num > 0 && (mode != SHOW_OBJ_LONG || *display->description != '.' || - (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_HOLYLIGHT)))) { + (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_HOLYLIGHT)))) { if (mode == SHOW_OBJ_LONG) send_to_char(ch, "%s", CCGRN(ch, C_NRM)); if (num != 1) @@ -221,26 +221,27 @@ static void list_obj_to_char(struct obj_data *list, struct char_data *ch, int mo static void diag_char_to_char(struct char_data *i, struct char_data *ch) { - struct { + struct + { byte percent; const char *text; } diagnosis[] = { - { 100, "is in excellent condition." }, - { 90, "has a few scratches." }, - { 75, "has some small wounds and bruises." }, - { 50, "has quite a few wounds." }, - { 30, "has some big nasty wounds and scratches." }, - { 15, "looks pretty hurt." }, - { 0, "is in awful condition." }, - { -1, "is bleeding awfully from big wounds." }, - }; + {100, "is in excellent condition."}, + {90, "has a few scratches."}, + {75, "has some small wounds and bruises."}, + {50, "has quite a few wounds."}, + {30, "has some big nasty wounds and scratches."}, + {15, "looks pretty hurt."}, + {0, "is in awful condition."}, + {-1, "is bleeding awfully from big wounds."}, + }; int percent, ar_index; const char *pers = PERS(i, ch); if (GET_MAX_HIT(i) > 0) percent = (100 * GET_HIT(i)) / GET_MAX_HIT(i); else - percent = -1; /* How could MAX_HIT be < 1?? */ + percent = -1; /* How could MAX_HIT be < 1?? */ for (ar_index = 0; diagnosis[ar_index].percent >= 0; ar_index++) if (percent >= diagnosis[ar_index].percent) @@ -256,7 +257,7 @@ static void look_at_char(struct char_data *i, struct char_data *ch) if (!ch->desc) return; - if (i->player.description) + if (i->player.description) send_to_char(ch, "%s", i->player.description); else act("You see nothing special about $m.", FALSE, i, 0, ch, TO_VICT); @@ -269,7 +270,7 @@ static void look_at_char(struct char_data *i, struct char_data *ch) found = TRUE; if (found) { - send_to_char(ch, "\r\n"); /* act() does capitalization. */ + send_to_char(ch, "\r\n"); /* act() does capitalization. */ act("$n is using:", FALSE, i, 0, ch, TO_VICT); for (j = 0; j < NUM_WEARS; j++) if (GET_EQ(i, j) && CAN_SEE_OBJ(ch, GET_EQ(i, j))) { @@ -287,15 +288,15 @@ static void list_one_char(struct char_data *i, struct char_data *ch) { struct obj_data *furniture; const char *positions[] = { - " is lying here, dead.", - " is lying here, mortally wounded.", - " is lying here, incapacitated.", - " is lying here, stunned.", - " is sleeping here.", - " is resting here.", - " is sitting here.", - "!FIGHTING!", - " is standing here." + " is lying here, dead.", + " is lying here, mortally wounded.", + " is lying here, incapacitated.", + " is lying here, stunned.", + " is sleeping here.", + " is resting here.", + " is sitting here.", + "!FIGHTING!", + " is standing here." }; if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS)) { @@ -312,12 +313,12 @@ static void list_one_char(struct char_data *i, struct char_data *ch) if (GROUP(i)) { if (GROUP(i) == GROUP(ch)) send_to_char(ch, "(%s%s%s) ", CBGRN(ch, C_NRM), - GROUP_LEADER(GROUP(i)) == i ? "leader" : "group", - CCNRM(ch, C_NRM)); + GROUP_LEADER(GROUP(i)) == i ? "leader" : "group", + CCNRM(ch, C_NRM)); else send_to_char(ch, "(%s%s%s) ", CBRED(ch, C_NRM), - GROUP_LEADER(GROUP(i)) == i ? "leader" : "group", - CCNRM(ch, C_NRM)); + GROUP_LEADER(GROUP(i)) == i ? "leader" : "group", + CCNRM(ch, C_NRM)); } if (IS_NPC(i) && i->player.long_descr && GET_POS(i) == GET_DEFAULT_POS(i)) { @@ -360,12 +361,12 @@ static void list_one_char(struct char_data *i, struct char_data *ch) if (GET_POS(i) != POS_FIGHTING) { if (!SITTING(i)) - send_to_char(ch, "%s", positions[(int) GET_POS(i)]); + send_to_char(ch, "%s", positions[(int)GET_POS(i)]); else { furniture = SITTING(i); - send_to_char(ch, " is %s upon %s.", (GET_POS(i) == POS_SLEEPING ? - "sleeping" : (GET_POS(i) == POS_RESTING ? "resting" : "sitting")), - OBJS(furniture, ch)); + send_to_char(ch, " is %s upon %s.", + (GET_POS(i) == POS_SLEEPING ? "sleeping" : (GET_POS(i) == POS_RESTING ? "resting" : "sitting")), + OBJS(furniture, ch)); } } else { if (FIGHTING(i)) { @@ -376,9 +377,9 @@ static void list_one_char(struct char_data *i, struct char_data *ch) if (IN_ROOM(i) == IN_ROOM(FIGHTING(i))) send_to_char(ch, "%s!", PERS(FIGHTING(i), ch)); else - send_to_char(ch, "someone who has already left!"); + send_to_char(ch, "someone who has already left!"); } - } else /* NIL fighting pointer */ + } else /* NIL fighting pointer */ send_to_char(ch, " is here struggling with thin air."); } @@ -402,13 +403,13 @@ static void list_char_to_char(struct char_data *list, struct char_data *ch) if (ch != i) { /* hide npcs whose description starts with a '.' from non-holylighted people - Idea from Elaseth of TBA */ if (!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_HOLYLIGHT) && - IS_NPC(i) && i->player.long_descr && *i->player.long_descr == '.') + IS_NPC(i) && i->player.long_descr && *i->player.long_descr == '.') continue; send_to_char(ch, "%s", CCYEL(ch, C_NRM)); if (CAN_SEE(ch, i)) list_one_char(i, ch); else if (IS_DARK(IN_ROOM(ch)) && !CAN_SEE_IN_DARK(ch) && - AFF_FLAGGED(i, AFF_INFRAVISION)) + AFF_FLAGGED(i, AFF_INFRAVISION)) send_to_char(ch, "You see a pair of glowing red eyes looking your way.\r\n"); send_to_char(ch, "%s", CCNRM(ch, C_NRM)); } @@ -428,7 +429,8 @@ static void do_auto_exits(struct char_data *ch) if (EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) && !PRF_FLAGGED(ch, PRF_HOLYLIGHT)) continue; if (EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED)) - send_to_char(ch, "%s(%s)%s ", EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? CCWHT(ch, C_NRM) : CCRED(ch, C_NRM), autoexits[door], CCCYN(ch, C_NRM)); + send_to_char(ch, "%s(%s)%s ", EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? CCWHT(ch, C_NRM) : CCRED(ch, C_NRM), + autoexits[door], CCCYN(ch, C_NRM)); else if (EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN)) send_to_char(ch, "%s%s%s ", CCWHT(ch, C_NRM), autoexits[door], CCCYN(ch, C_NRM)); else @@ -443,16 +445,14 @@ ACMD(do_exits) { int door, len = 0; - if (AFF_FLAGGED(ch, AFF_BLIND) && GET_LEVEL(ch) < LVL_IMMORT) - { + if (AFF_FLAGGED(ch, AFF_BLIND) && GET_LEVEL(ch) < LVL_IMMORT) { send_to_char(ch, "You can't see a damned thing, you're blind!\r\n"); return; } send_to_char(ch, "Obvious exits:\r\n"); - for (door = 0; door < DIR_COUNT; door++) - { + for (door = 0; door < DIR_COUNT; door++) { if (!EXIT(ch, door) || EXIT(ch, door)->to_room == NOWHERE) continue; if (EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) && !CONFIG_DISP_CLOSED_DOORS) @@ -462,31 +462,28 @@ ACMD(do_exits) len++; - if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS) && !EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED)) - { + if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS) && !EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED)) { send_to_char(ch, "%-5s -[%5d]%s %s\r\n", dirs[door], GET_ROOM_VNUM(EXIT(ch, door)->to_room), - EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? "[HIDDEN]" : "", world[EXIT(ch, door)->to_room].name); - } - else if (CONFIG_DISP_CLOSED_DOORS && EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED)) - { + EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? "[HIDDEN]" : "", world[EXIT(ch, door)->to_room].name); + } else if (CONFIG_DISP_CLOSED_DOORS && EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED)) { /*But we tell them the door is closed */ send_to_char(ch, "%-5s - The %s is closed%s\r\n", dirs[door], - (EXIT(ch, door)->keyword) ? fname(EXIT(ch, door)->keyword) : "opening", - EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? " and hidden." : "."); - } - else - { + (EXIT(ch, door)->keyword) ? fname(EXIT(ch, door)->keyword) : "opening", + EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? " and hidden." : "."); + } else { send_to_char(ch, "%-5s - %s\r\n", dirs[door], IS_DARK(EXIT(ch, door)->to_room) && - !CAN_SEE_IN_DARK(ch) ? "Too dark to tell." : world[EXIT(ch, door)->to_room].name); + !CAN_SEE_IN_DARK(ch) + ? "Too dark to tell." + : world[EXIT(ch, door)->to_room].name); } } - if (!len) - send_to_char(ch, " None.\r\n"); + if (!len) + send_to_char(ch, " None.\r\n"); } void look_at_room(struct char_data *ch, int ignore_brief) { - trig_data * t; + trig_data *t; struct room_data *rm = &world[IN_ROOM(ch)]; room_vnum target_room; @@ -495,11 +492,10 @@ void look_at_room(struct char_data *ch, int ignore_brief) if (!ch->desc) return; - if (IS_DARK(IN_ROOM(ch)) && !CAN_SEE_IN_DARK(ch)){ + if (IS_DARK(IN_ROOM(ch)) && !CAN_SEE_IN_DARK(ch)) { send_to_char(ch, "It is pitch black...\r\n"); return; - } - else if (AFF_FLAGGED(ch, AFF_BLIND) && GET_LEVEL(ch) < LVL_IMMORT) { + } else if (AFF_FLAGGED(ch, AFF_BLIND) && GET_LEVEL(ch) < LVL_IMMORT) { send_to_char(ch, "You see nothing but infinite darkness...\r\n"); return; } @@ -518,18 +514,17 @@ void look_at_room(struct char_data *ch, int ignore_brief) send_to_char(ch, " %d", GET_TRIG_VNUM(t)); send_to_char(ch, "]"); } - } - else + } else send_to_char(ch, "%s", world[IN_ROOM(ch)].name); send_to_char(ch, "%s\r\n", CCNRM(ch, C_NRM)); if ((!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_BRIEF)) || ignore_brief || - ROOM_FLAGGED(IN_ROOM(ch), ROOM_DEATH)) { + ROOM_FLAGGED(IN_ROOM(ch), ROOM_DEATH)) { if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOMAP) && can_see_map(ch)) str_and_map(world[target_room].description, ch, target_room); else - send_to_char(ch, "%s", world[IN_ROOM(ch)].description); + send_to_char(ch, "%s", world[IN_ROOM(ch)].description); } @@ -567,11 +562,11 @@ static void look_in_obj(struct char_data *ch, char *arg) if (!*arg) send_to_char(ch, "Look in what?\r\n"); else if (!(bits = generic_find(arg, FIND_OBJ_INV | FIND_OBJ_ROOM | - FIND_OBJ_EQUIP, ch, &dummy, &obj))) { + FIND_OBJ_EQUIP, ch, &dummy, &obj))) { send_to_char(ch, "There doesn't seem to be %s %s here.\r\n", AN(arg), arg); } else if ((GET_OBJ_TYPE(obj) != ITEM_DRINKCON) && - (GET_OBJ_TYPE(obj) != ITEM_FOUNTAIN) && - (GET_OBJ_TYPE(obj) != ITEM_CONTAINER)) + (GET_OBJ_TYPE(obj) != ITEM_FOUNTAIN) && + (GET_OBJ_TYPE(obj) != ITEM_CONTAINER)) send_to_char(ch, "There's nothing inside that!\r\n"); else { if (GET_OBJ_TYPE(obj) == ITEM_CONTAINER) { @@ -593,20 +588,17 @@ static void look_in_obj(struct char_data *ch, char *arg) list_obj_to_char(obj->contains, ch, SHOW_OBJ_SHORT, TRUE); } - } else { /* item must be a fountain or drink container */ + } else { /* item must be a fountain or drink container */ if ((GET_OBJ_VAL(obj, 1) == 0) && (GET_OBJ_VAL(obj, 0) != -1)) send_to_char(ch, "It is empty.\r\n"); else { - if (GET_OBJ_VAL(obj, 0) < 0) - { + if (GET_OBJ_VAL(obj, 0) < 0) { char buf2[MAX_STRING_LENGTH]; sprinttype(GET_OBJ_VAL(obj, 2), color_liquid, buf2, sizeof(buf2)); send_to_char(ch, "It's full of a %s liquid.\r\n", buf2); - } - else if (GET_OBJ_VAL(obj,1)>GET_OBJ_VAL(obj,0)) + } else if (GET_OBJ_VAL(obj, 1) > GET_OBJ_VAL(obj, 0)) send_to_char(ch, "Its contents seem somewhat murky.\r\n"); /* BUG */ - else - { + else { char buf2[MAX_STRING_LENGTH]; amt = (GET_OBJ_VAL(obj, 1) * 3) / GET_OBJ_VAL(obj, 0); sprinttype(GET_OBJ_VAL(obj, 2), color_liquid, buf2, sizeof(buf2)); @@ -648,14 +640,14 @@ static void look_at_target(struct char_data *ch, char *arg) } bits = generic_find(arg, FIND_OBJ_INV | FIND_OBJ_ROOM | FIND_OBJ_EQUIP | - FIND_CHAR_ROOM, ch, &found_char, &found_obj); + FIND_CHAR_ROOM, ch, &found_char, &found_obj); /* Is the target a character? */ if (found_char != NULL) { look_at_char(found_char, ch); if (ch != found_char) { if (CAN_SEE(found_char, ch)) - act("$n looks at you.", TRUE, ch, 0, found_char, TO_VICT); + act("$n looks at you.", TRUE, ch, 0, found_char, TO_VICT); act("$n looks at $N.", TRUE, ch, 0, found_char, TO_NOTVICT); } return; @@ -677,16 +669,16 @@ static void look_at_target(struct char_data *ch, char *arg) for (j = 0; j < NUM_WEARS && !found; j++) if (GET_EQ(ch, j) && CAN_SEE_OBJ(ch, GET_EQ(ch, j))) if ((desc = find_exdesc(arg, GET_EQ(ch, j)->ex_description)) != NULL && ++i == fnum) { - send_to_char(ch, "%s", desc); - found = TRUE; + send_to_char(ch, "%s", desc); + found = TRUE; } /* Does the argument match an extra desc in the char's inventory? */ for (obj = ch->carrying; obj && !found; obj = obj->next_content) { if (CAN_SEE_OBJ(ch, obj)) if ((desc = find_exdesc(arg, obj->ex_description)) != NULL && ++i == fnum) { - send_to_char(ch, "%s", desc); - found = TRUE; + send_to_char(ch, "%s", desc); + found = TRUE; } } @@ -694,8 +686,8 @@ static void look_at_target(struct char_data *ch, char *arg) for (obj = world[IN_ROOM(ch)].contents; obj && !found; obj = obj->next_content) if (CAN_SEE_OBJ(ch, obj)) if ((desc = find_exdesc(arg, obj->ex_description)) != NULL && ++i == fnum) { - send_to_char(ch, "%s", desc); - found = TRUE; + send_to_char(ch, "%s", desc); + found = TRUE; } /* If an object was found back in generic_find */ @@ -725,7 +717,7 @@ ACMD(do_look) send_to_char(ch, "You can't see a damned thing, you're blind!\r\n"); else if (IS_DARK(IN_ROOM(ch)) && !CAN_SEE_IN_DARK(ch)) { send_to_char(ch, "It is pitch black...\r\n"); - list_char_to_char(world[IN_ROOM(ch)].people, ch); /* glowing red eyes */ + list_char_to_char(world[IN_ROOM(ch)].people, ch); /* glowing red eyes */ } else { char arg[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH]; @@ -733,16 +725,16 @@ ACMD(do_look) if (subcmd == SCMD_READ) { if (!*arg) - send_to_char(ch, "Read what?\r\n"); + send_to_char(ch, "Read what?\r\n"); else - look_at_target(ch, strcpy(tempsave, arg)); + look_at_target(ch, strcpy(tempsave, arg)); return; } - if (!*arg) /* "look" alone, without an argument at all */ + if (!*arg) /* "look" alone, without an argument at all */ look_at_room(ch, 1); else if (is_abbrev(arg, "in")) look_in_obj(ch, arg2); - /* did the char type 'look ?' */ + /* did the char type 'look ?' */ else if ((look_type = search_block(arg, dirs, FALSE)) >= 0) look_in_direction(ch, look_type); else if (is_abbrev(arg, "at")) @@ -753,12 +745,12 @@ ACMD(do_look) for (i = world[IN_ROOM(ch)].ex_description; i; i = i->next) { if (*i->keyword != '.') { send_to_char(ch, "%s%s:\r\n%s", - (found ? "\r\n" : ""), i->keyword, i->description); + (found ? "\r\n" : ""), i->keyword, i->description); found = 1; } } if (!found) - send_to_char(ch, "You couldn't find anything noticeable.\r\n"); + send_to_char(ch, "You couldn't find anything noticeable.\r\n"); } else look_at_target(ch, strcpy(tempsave, arg)); } @@ -778,15 +770,15 @@ ACMD(do_examine) } /* look_at_target() eats the number. */ - look_at_target(ch, strcpy(tempsave, arg)); /* strcpy: OK */ + look_at_target(ch, strcpy(tempsave, arg)); /* strcpy: OK */ generic_find(arg, FIND_OBJ_INV | FIND_OBJ_ROOM | FIND_CHAR_ROOM | - FIND_OBJ_EQUIP, ch, &tmp_char, &tmp_object); + FIND_OBJ_EQUIP, ch, &tmp_char, &tmp_object); if (tmp_object) { if ((GET_OBJ_TYPE(tmp_object) == ITEM_DRINKCON) || - (GET_OBJ_TYPE(tmp_object) == ITEM_FOUNTAIN) || - (GET_OBJ_TYPE(tmp_object) == ITEM_CONTAINER)) { + (GET_OBJ_TYPE(tmp_object) == ITEM_FOUNTAIN) || + (GET_OBJ_TYPE(tmp_object) == ITEM_CONTAINER)) { send_to_char(ch, "When you look inside, you see:\r\n"); look_in_obj(ch, arg); } @@ -818,43 +810,42 @@ ACMD(do_score) send_to_char(ch, "\r\n"); send_to_char(ch, "You have %d(%d) hit, %d(%d) mana and %d(%d) movement points.\r\n", - GET_HIT(ch), GET_MAX_HIT(ch), GET_MANA(ch), GET_MAX_MANA(ch), - GET_MOVE(ch), GET_MAX_MOVE(ch)); + GET_HIT(ch), GET_MAX_HIT(ch), GET_MANA(ch), GET_MAX_MANA(ch), + GET_MOVE(ch), GET_MAX_MOVE(ch)); send_to_char(ch, "Your armor class is %d/10, and your alignment is %d.\r\n", - compute_armor_class(ch), GET_ALIGNMENT(ch)); + compute_armor_class(ch), GET_ALIGNMENT(ch)); send_to_char(ch, "You have %d exp, %d gold coins, and %d questpoints.\r\n", - GET_EXP(ch), GET_GOLD(ch), GET_QUESTPOINTS(ch)); + GET_EXP(ch), GET_GOLD(ch), GET_QUESTPOINTS(ch)); if (GET_LEVEL(ch) < LVL_IMMORT) send_to_char(ch, "You need %d exp to reach your next level.\r\n", - level_exp(GET_CLASS(ch), GET_LEVEL(ch) + 1) - GET_EXP(ch)); + level_exp(GET_CLASS(ch), GET_LEVEL(ch) + 1) - GET_EXP(ch)); send_to_char(ch, "You have earned %d quest points.\r\n", GET_QUESTPOINTS(ch)); send_to_char(ch, "You have completed %d quest%s, ", - GET_NUM_QUESTS(ch), - GET_NUM_QUESTS(ch) == 1 ? "" : "s"); + GET_NUM_QUESTS(ch), + GET_NUM_QUESTS(ch) == 1 ? "" : "s"); if (GET_QUEST(ch) == NOTHING) send_to_char(ch, "and you are not on a quest at the moment.\r\n"); - else - { + else { send_to_char(ch, "and your current quest is: %s", QST_NAME(real_quest(GET_QUEST(ch)))); if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS)) - send_to_char(ch, " [%d]\r\n", GET_QUEST(ch)); + send_to_char(ch, " [%d]\r\n", GET_QUEST(ch)); else - send_to_char(ch, "\r\n"); + send_to_char(ch, "\r\n"); } playing_time = *real_time_passed((time(0) - ch->player.time.logon) + - ch->player.time.played, 0); + ch->player.time.played, 0); send_to_char(ch, "You have been playing for %d day%s and %d hour%s.\r\n", - playing_time.day, playing_time.day == 1 ? "" : "s", - playing_time.hours, playing_time.hours == 1 ? "" : "s"); + playing_time.day, playing_time.day == 1 ? "" : "s", + playing_time.hours, playing_time.hours == 1 ? "" : "s"); send_to_char(ch, "This ranks you as %s %s (level %d).\r\n", - GET_NAME(ch), GET_TITLE(ch), GET_LEVEL(ch)); + GET_NAME(ch), GET_TITLE(ch), GET_LEVEL(ch)); switch (GET_POS(ch)) { case POS_DEAD: @@ -942,7 +933,7 @@ ACMD(do_score) send_to_char(ch, "%sPOOFOUT: %s%s disappears in a puff of smoke.%s\r\n", QYEL, QCYN, GET_NAME(ch), QNRM); send_to_char(ch, "Your current zone: %s%d%s\r\n", CCCYN(ch, C_NRM), GET_OLC_ZONE(ch), - CCNRM(ch, C_NRM)); + CCNRM(ch, C_NRM)); } } @@ -985,8 +976,8 @@ ACMD(do_time) weekday = ((35 * time_info.month) + day) % 7; send_to_char(ch, "It is %d o'clock %s, on %s.\r\n", - (time_info.hours % 12 == 0) ? 12 : (time_info.hours % 12), - time_info.hours >= 12 ? "pm" : "am", weekdays[weekday]); + (time_info.hours % 12 == 0) ? 12 : (time_info.hours % 12), + time_info.hours >= 12 ? "pm" : "am", weekdays[weekday]); /* Peter Ajamian supplied the following as a fix for a bug introduced in the * ordinal display that caused 11, 12, and 13 to be incorrectly displayed as @@ -1008,31 +999,30 @@ ACMD(do_time) } } send_to_char(ch, "The %d%s Day of the %s, Year %d.\r\n", - day, suf, month_name[time_info.month], time_info.year); + day, suf, month_name[time_info.month], time_info.year); } ACMD(do_weather) { const char *sky_look[] = { - "cloudless", - "cloudy", - "rainy", - "lit by flashes of lightning" + "cloudless", + "cloudy", + "rainy", + "lit by flashes of lightning" }; - if (OUTSIDE(ch)) - { + if (OUTSIDE(ch)) { send_to_char(ch, "The sky is %s and %s.\r\n", sky_look[weather_info.sky], - weather_info.change >= 0 ? "you feel a warm wind from south" : - "your foot tells you bad weather is due"); + weather_info.change >= 0 + ? "you feel a warm wind from south" + : "your foot tells you bad weather is due"); if (GET_LEVEL(ch) >= LVL_GOD) send_to_char(ch, "Pressure: %d (change: %d), Sky: %d (%s)\r\n", - weather_info.pressure, - weather_info.change, - weather_info.sky, - sky_look[weather_info.sky]); - } - else + weather_info.pressure, + weather_info.change, + weather_info.sky, + sky_look[weather_info.sky]); + } else send_to_char(ch, "You have no feeling about the weather at all.\r\n"); } @@ -1047,16 +1037,16 @@ int search_help(const char *argument, int level) { int chk, bot, top, mid, minlen; - bot = 0; - top = top_of_helpt; - minlen = strlen(argument); + bot = 0; + top = top_of_helpt; + minlen = strlen(argument); while (bot <= top) { mid = (bot + top) / 2; - if (!(chk = strn_cmp(argument, help_table[mid].keywords, minlen))) { + if (!(chk = strn_cmp(argument, help_table[mid].keywords, minlen))) { while ((mid > 0) && !strn_cmp(argument, help_table[mid - 1].keywords, minlen)) - mid--; + mid--; while (level < help_table[mid].min_level && mid < (bot + top) / 2) mid++; @@ -1064,8 +1054,7 @@ int search_help(const char *argument, int level) break; return (mid); - } - else if (chk > 0) + } else if (chk > 0) bot = mid + 1; else top = mid - 1; @@ -1078,7 +1067,7 @@ ACMD(do_help) int mid = 0; int i, found = 0; - if (!ch->desc) + if (!ch->desc) return; skip_spaces(&argument); @@ -1101,8 +1090,8 @@ ACMD(do_help) if ((mid = search_help(argument, GET_LEVEL(ch))) == NOWHERE) { send_to_char(ch, "There is no help on that word.\r\n"); mudlog(NRM, MIN(LVL_IMPL, GET_INVIS_LEV(ch)), TRUE, - "%s tried to get help on %s", GET_NAME(ch), argument); - for (i = 0; i < top_of_helpt; i++) { + "%s tried to get help on %s", GET_NAME(ch), argument); + for (i = 0; i < top_of_helpt; i++) { if (help_table[i].min_level > GET_LEVEL(ch)) continue; /* To help narrow down results, if they don't start with the same letters, move on. */ @@ -1136,19 +1125,23 @@ ACMD(do_who) int showclass = 0, short_list = 0, outlaws = 0; int who_room = 0, showgroup = 0, showleader = 0; - struct { + struct + { char *disp; int min_level; int max_level; int count; /* must always start as 0 */ } rank[] = { - { "Immortals\r\n---------\r\n", LVL_IMMORT, LVL_IMPL, 0}, - { "Mortals\r\n-------\r\n", 1, LVL_IMMORT - 1, 0 }, - { "\n", 0, 0, 0 } - }; + { + "Immortals\r\n---------\r\n", LVL_IMMORT, LVL_IMPL, 0}, + { + "Mortals\r\n-------\r\n", 1, LVL_IMMORT - 1, 0}, + { + "\n", 0, 0, 0} + }; skip_spaces(&argument); - strcpy(buf, argument); /* strcpy: OK (sizeof: argument == buf) */ + strcpy(buf, argument); /* strcpy: OK (sizeof: argument == buf) */ name_search[0] = '\0'; while (*buf) { @@ -1157,32 +1150,32 @@ ACMD(do_who) half_chop(buf, arg, buf1); if (isdigit(*arg)) { sscanf(arg, "%d-%d", &low, &high); - strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ + strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ } else if (*arg == '-') { - mode = *(arg + 1); /* just in case; we destroy arg in the switch */ + mode = *(arg + 1); /* just in case; we destroy arg in the switch */ switch (mode) { case 'k': outlaws = 1; - strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ + strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ break; case 'z': localwho = 1; - strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ + strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ break; case 's': short_list = 1; - strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ + strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ break; case 'q': questwho = 1; - strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ + strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ break; case 'n': half_chop(buf1, name_search, buf); break; case 'r': who_room = 1; - strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ + strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ break; case 'c': half_chop(buf1, arg, buf); @@ -1190,11 +1183,11 @@ ACMD(do_who) break; case 'l': showleader = 1; - strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ + strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ break; case 'g': showgroup = 1; - strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ + strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ break; default: send_to_char(ch, "%s", WHO_FORMAT); @@ -1279,16 +1272,16 @@ ACMD(do_who) if (short_list) { send_to_char(ch, "%s[%2d %s] %-12.12s%s%s", - (GET_LEVEL(tch) >= LVL_IMMORT ? CCYEL(ch, C_SPR) : ""), - GET_LEVEL(tch), CLASS_ABBR(tch), GET_NAME(tch), - CCNRM(ch, C_SPR), ((!(++num_can_see % 4)) ? "\r\n" : "")); + (GET_LEVEL(tch) >= LVL_IMMORT ? CCYEL(ch, C_SPR) : ""), + GET_LEVEL(tch), CLASS_ABBR(tch), GET_NAME(tch), + CCNRM(ch, C_SPR), ((!(++num_can_see % 4)) ? "\r\n" : "")); } else { num_can_see++; send_to_char(ch, "%s[%2d %s] %s%s%s%s", - (GET_LEVEL(tch) >= LVL_IMMORT ? CCYEL(ch, C_SPR) : ""), - GET_LEVEL(tch), CLASS_ABBR(tch), - GET_NAME(tch), (*GET_TITLE(tch) ? " " : ""), GET_TITLE(tch), - CCNRM(ch, C_SPR)); + (GET_LEVEL(tch) >= LVL_IMMORT ? CCYEL(ch, C_SPR) : ""), + GET_LEVEL(tch), CLASS_ABBR(tch), + GET_NAME(tch), (*GET_TITLE(tch) ? " " : ""), GET_TITLE(tch), + CCNRM(ch, C_SPR)); if (GET_INVIS_LEV(tch)) send_to_char(ch, " (i%d)", GET_INVIS_LEV(tch)); @@ -1361,7 +1354,7 @@ ACMD(do_who) else send_to_char(ch, "%d characters displayed.\r\n", num_can_see); - if (IS_HAPPYHOUR > 0){ + if (IS_HAPPYHOUR > 0) { send_to_char(ch, "It's a Happy Hour! Type \tRhappyhour\tW to see the current bonuses.\r\n"); } } @@ -1382,59 +1375,59 @@ ACMD(do_users) host_search[0] = name_search[0] = '\0'; - strcpy(buf, argument); /* strcpy: OK (sizeof: argument == buf) */ + strcpy(buf, argument); /* strcpy: OK (sizeof: argument == buf) */ while (*buf) { char buf1[MAX_INPUT_LENGTH]; half_chop(buf, arg, buf1); if (*arg == '-') { - mode = *(arg + 1); /* just in case; we destroy arg in the switch */ + mode = *(arg + 1); /* just in case; we destroy arg in the switch */ switch (mode) { case 'o': case 'k': - outlaws = 1; - playing = 1; - strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ - break; + outlaws = 1; + playing = 1; + strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ + break; case 'p': - playing = 1; - strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ - break; + playing = 1; + strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ + break; case 'd': - deadweight = 1; - strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ - break; + deadweight = 1; + strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ + break; case 'l': - playing = 1; - half_chop(buf1, arg, buf); - sscanf(arg, "%d-%d", &low, &high); - break; + playing = 1; + half_chop(buf1, arg, buf); + sscanf(arg, "%d-%d", &low, &high); + break; case 'n': - playing = 1; - half_chop(buf1, name_search, buf); - break; + playing = 1; + half_chop(buf1, name_search, buf); + break; case 'h': - playing = 1; - half_chop(buf1, host_search, buf); - break; + playing = 1; + half_chop(buf1, host_search, buf); + break; case 'c': - playing = 1; - half_chop(buf1, arg, buf); - showclass = find_class_bitvector(arg); - break; + playing = 1; + half_chop(buf1, arg, buf); + showclass = find_class_bitvector(arg); + break; default: - send_to_char(ch, "%s", USERS_FORMAT); - return; - } /* end of switch */ + send_to_char(ch, "%s", USERS_FORMAT); + return; + } /* end of switch */ - } else { /* endif */ + } else { /* endif */ send_to_char(ch, "%s", USERS_FORMAT); return; } - } /* end while (parser) */ + } /* end while (parser) */ send_to_char(ch, - "Num Class Name State Idl Login\t* Site\r\n" - "--- ------- ------------ -------------- ----- -------- ------------------------\r\n"); + "Num Class Name State Idl Login\t* Site\r\n" + "--- ------- ------------ -------------- ----- -------- ------------------------\r\n"); one_argument(argument, arg); @@ -1456,7 +1449,7 @@ ACMD(do_users) if (!CAN_SEE(ch, tch) || GET_LEVEL(tch) < low || GET_LEVEL(tch) > high) continue; if (outlaws && !PLR_FLAGGED(tch, PLR_KILLER) && - !PLR_FLAGGED(tch, PLR_THIEF)) + !PLR_FLAGGED(tch, PLR_THIEF)) continue; if (showclass && !(showclass & (1 << GET_CLASS(tch)))) continue; @@ -1464,11 +1457,11 @@ ACMD(do_users) continue; if (d->original) - sprintf(classname, "[%2d %s]", GET_LEVEL(d->original), - CLASS_ABBR(d->original)); + sprintf(classname, "[%2d %s]", GET_LEVEL(d->original), + CLASS_ABBR(d->original)); else - sprintf(classname, "[%2d %s]", GET_LEVEL(d->character), - CLASS_ABBR(d->character)); + sprintf(classname, "[%2d %s]", GET_LEVEL(d->character), + CLASS_ABBR(d->character)); } else strcpy(classname, " - "); @@ -1481,15 +1474,17 @@ ACMD(do_users) if (d->character && STATE(d) == CON_PLAYING) sprintf(idletime, "%5d", d->character->char_specials.timer * - SECS_PER_MUD_HOUR / SECS_PER_REAL_MIN); + SECS_PER_MUD_HOUR / SECS_PER_REAL_MIN); else strcpy(idletime, " "); sprintf(line, "%3d %-7s %-12s %-14s %-3s %-8s ", d->desc_num, classname, - d->original && d->original->player.name ? d->original->player.name : - d->character && d->character->player.name ? d->character->player.name : - "UNDEFINED", - state, idletime, timestr); + d->original && d->original->player.name + ? d->original->player.name + : d->character && d->character->player.name + ? d->character->player.name + : "UNDEFINED", + state, idletime, timestr); if (*d->host) sprintf(line + strlen(line), "[%s]\r\n", d->host); @@ -1558,12 +1553,12 @@ ACMD(do_gen_ps) break; default: log("SYSERR: Unhandled case in do_gen_ps. (%d)", subcmd); - /* SYSERR_DESC: General page string function for such things as 'credits', - * 'news', 'wizlist', 'clear', 'version'. This occurs when a call is made - * to this routine that is not one of the predefined calls. To correct it, - * either a case needs to be added into the function to account for the - * subcmd that is being passed to it, or the call to the function needs to - * have the correct subcmd put into place. */ + /* SYSERR_DESC: General page string function for such things as 'credits', + * 'news', 'wizlist', 'clear', 'version'. This occurs when a call is made + * to this routine that is not one of the predefined calls. To correct it, + * either a case needs to be added into the function to account for the + * subcmd that is being passed to it, or the call to the function needs to + * have the correct subcmd put into place. */ return; } } @@ -1579,23 +1574,23 @@ static void perform_mortal_where(struct char_data *ch, char *arg) send_to_char(ch, "Players in %s\tn.\r\n--------------------\r\n", zone_table[j].name); for (d = descriptor_list; d; d = d->next) { if (STATE(d) != CON_PLAYING || d->character == ch) - continue; + continue; if ((i = (d->original ? d->original : d->character)) == NULL) - continue; + continue; if (IN_ROOM(i) == NOWHERE || !CAN_SEE(ch, i)) - continue; + continue; if (world[IN_ROOM(ch)].zone != world[IN_ROOM(i)].zone) - continue; + continue; send_to_char(ch, "%-20s%s - %s%s\r\n", GET_NAME(i), QNRM, world[IN_ROOM(i)].name, QNRM); } - } else { /* print only FIRST char, not all. */ + } else { /* print only FIRST char, not all. */ for (i = character_list; i; i = i->next) { if (IN_ROOM(i) == NOWHERE || i == ch) - continue; + continue; if (!CAN_SEE(ch, i) || world[IN_ROOM(i)].zone != world[IN_ROOM(ch)].zone) - continue; + continue; if (!isname(arg, i->player.name)) - continue; + continue; send_to_char(ch, "%-25s%s - %s%s\r\n", GET_NAME(i), QNRM, world[IN_ROOM(i)].name, QNRM); return; } @@ -1604,7 +1599,7 @@ static void perform_mortal_where(struct char_data *ch, char *arg) } static void print_object_location(int num, struct obj_data *obj, struct char_data *ch, - int recur) + int recur) { if (num > 0) send_to_char(ch, "O%3d. %-25s%s - ", num, obj->short_description, QNRM); @@ -1648,13 +1643,13 @@ static void perform_immort_where(struct char_data *ch, char *arg) if (i && CAN_SEE(ch, i) && (IN_ROOM(i) != NOWHERE)) { if (d->original) send_to_char(ch, "%-8s%s - [%5d] %s%s (in %s%s)\r\n", - GET_NAME(i), QNRM, GET_ROOM_VNUM(IN_ROOM(d->character)), - world[IN_ROOM(d->character)].name, QNRM, GET_NAME(d->character), QNRM); + GET_NAME(i), QNRM, GET_ROOM_VNUM(IN_ROOM(d->character)), + world[IN_ROOM(d->character)].name, QNRM, GET_NAME(d->character), QNRM); else send_to_char(ch, "%-8s%s %s[%s%5d%s]%s %-*s%s %s%s\r\n", GET_NAME(i), QNRM, - QCYN, QYEL, GET_ROOM_VNUM(IN_ROOM(i)), QCYN, QNRM, - 30+count_color_chars(world[IN_ROOM(i)].name), world[IN_ROOM(i)].name, QNRM, - zone_table[(world[IN_ROOM(i)].zone)].name, QNRM); + QCYN, QYEL, GET_ROOM_VNUM(IN_ROOM(i)), QCYN, QNRM, + 30 + count_color_chars(world[IN_ROOM(i)].name), world[IN_ROOM(i)].name, QNRM, + zone_table[(world[IN_ROOM(i)].zone)].name, QNRM); } } } else { @@ -1662,7 +1657,7 @@ static void perform_immort_where(struct char_data *ch, char *arg) if (CAN_SEE(ch, i) && IN_ROOM(i) != NOWHERE && isname(arg, i->player.name)) { found = 1; send_to_char(ch, "M%3d. %-25s%s - [%5d] %-25s%s", ++num, GET_NAME(i), QNRM, - GET_ROOM_VNUM(IN_ROOM(i)), world[IN_ROOM(i)].name, QNRM); + GET_ROOM_VNUM(IN_ROOM(i)), world[IN_ROOM(i)].name, QNRM); if (SCRIPT(i) && TRIGGERS(SCRIPT(i))) { if (!TRIGGERS(SCRIPT(i))->next) send_to_char(ch, "[T%d] ", GET_TRIG_VNUM(TRIGGERS(SCRIPT(i)))); @@ -1697,7 +1692,7 @@ ACMD(do_levels) { char buf[MAX_STRING_LENGTH], arg[MAX_STRING_LENGTH]; size_t len = 0, nlen; - int i, ret, min_lev=1, max_lev=LVL_IMMORT, val; + int i, ret, min_lev = 1, max_lev = LVL_IMMORT, val; if (IS_NPC(ch)) { send_to_char(ch, "You ain't nothin' but a hound-dog.\r\n"); @@ -1712,24 +1707,20 @@ ACMD(do_levels) /* No valid args found */ min_lev = 1; max_lev = LVL_IMMORT; - } - else if (ret == 1) { + } else if (ret == 1) { /* One arg = range is (num) either side of current level */ val = min_lev; max_lev = MIN(GET_LEVEL(ch) + val, LVL_IMMORT); min_lev = MAX(GET_LEVEL(ch) - val, 1); - } - else if (ret == 2) { + } else if (ret == 2) { /* Two args = min-max range limit - just do sanity checks */ min_lev = MAX(min_lev, 1); max_lev = MIN(max_lev + 1, LVL_IMMORT); } - } - else - { + } else { send_to_char(ch, "Usage: %slevels [- | ]%s\r\n\r\n", QYEL, QNRM); send_to_char(ch, "Displays exp required for levels.\r\n"); - send_to_char(ch, "%slevels %s- shows all levels (1-%d)\r\n", QCYN, QNRM, (LVL_IMMORT-1)); + send_to_char(ch, "%slevels %s- shows all levels (1-%d)\r\n", QCYN, QNRM, (LVL_IMMORT - 1)); send_to_char(ch, "%slevels 5 %s- shows 5 levels either side of your current level\r\n", QCYN, QNRM); send_to_char(ch, "%slevels 10-40 %s- shows level 10 to level 40\r\n",QCYN, QNRM); return; @@ -1738,7 +1729,7 @@ ACMD(do_levels) for (i = min_lev; i < max_lev; i++) { nlen = snprintf(buf + len, sizeof(buf) - len, "[%2d] %8d-%-8d : ", (int)i, - level_exp(GET_CLASS(ch), i), level_exp(GET_CLASS(ch), i + 1) - 1); + level_exp(GET_CLASS(ch), i), level_exp(GET_CLASS(ch), i + 1) - 1); if (len + nlen >= sizeof(buf)) break; len += nlen; @@ -1762,7 +1753,7 @@ ACMD(do_levels) if (len < sizeof(buf) && max_lev == LVL_IMMORT) snprintf(buf + len, sizeof(buf) - len, "[%2d] %8d : Immortality\r\n", - LVL_IMMORT, level_exp(GET_CLASS(ch), LVL_IMMORT)); + LVL_IMMORT, level_exp(GET_CLASS(ch), LVL_IMMORT)); page_string(ch->desc, buf, TRUE); } @@ -1836,109 +1827,180 @@ ACMD(do_toggle) { char buf2[4], arg[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH]; int toggle, tp, wimp_lev, result = 0, len = 0, i; - const char *types[] = { "off", "brief", "normal", "on", "\n" }; + const char *types[] = {"off", "brief", "normal", "on", "\n"}; - const struct { + const struct + { char *command; bitvector_t toggle; /* this needs changing once hashmaps are implemented */ char min_level; char *disable_msg; char *enable_msg; } tog_messages[] = { - {"summonable", PRF_SUMMONABLE, 0, - "You are now safe from summoning by other players.\r\n", - "You may now be summoned by other players.\r\n"}, - {"nohassle", PRF_NOHASSLE, LVL_IMMORT, - "Nohassle disabled.\r\n", - "Nohassle enabled.\r\n"}, - {"brief", PRF_BRIEF, 0, - "Brief mode off.\r\n", - "Brief mode on.\r\n"}, - {"compact", PRF_COMPACT, 0, - "Compact mode off.\r\n", - "Compact mode on.\r\n"}, - {"notell", PRF_NOTELL, 0, - "You can now hear tells.\r\n", - "You are now deaf to tells.\r\n"}, - {"noauction", PRF_NOAUCT, 0, - "You can now hear auctions.\r\n", - "You are now deaf to auctions.\r\n"}, - {"noshout", PRF_NOSHOUT, 0, - "You can now hear shouts.\r\n", - "You are now deaf to shouts.\r\n"}, - {"nogossip", PRF_NOGOSS, 0, - "You can now hear gossip.\r\n", - "You are now deaf to gossip.\r\n"}, - {"nograts", PRF_NOGRATZ, 0, - "You can now hear gratz.\r\n", - "You are now deaf to gratz.\r\n"}, - {"nowiz", PRF_NOWIZ, LVL_IMMORT, - "You can now hear the Wiz-channel.\r\n", - "You are now deaf to the Wiz-channel.\r\n"}, - {"quest", PRF_QUEST, 0, - "You are no longer part of the Quest.\r\n", - "Okay, you are part of the Quest.\r\n"}, - {"showvnums", PRF_SHOWVNUMS, LVL_IMMORT, - "You will no longer see the vnums.\r\n", - "You will now see the vnums.\r\n"}, - {"norepeat", PRF_NOREPEAT, 0, - "You will now have your communication repeated.\r\n", - "You will no longer have your communication repeated.\r\n"}, - {"holylight", PRF_HOLYLIGHT, LVL_IMMORT, - "HolyLight mode off.\r\n", - "HolyLight mode on.\r\n"}, - {"slownameserver", 0, LVL_IMPL, - "Nameserver_is_slow changed to OFF; IP addresses will now be resolved.\r\n", - "Nameserver_is_slow changed to ON; sitenames will no longer be resolved.\r\n"}, - {"autoexits", PRF_AUTOEXIT, 0, - "Autoexits disabled.\r\n", - "Autoexits enabled.\r\n"}, - {"trackthru", 0, LVL_IMPL, - "Players can no longer track through doors.\r\n", - "Players can now track through doors.\r\n"}, - {"clsolc", PRF_CLS, LVL_BUILDER, - "You will no longer clear screen in OLC.\r\n", - "You will now clear screen in OLC.\r\n"}, - {"buildwalk", PRF_BUILDWALK, LVL_BUILDER, - "Buildwalk is now Off.\r\n", - "Buildwalk is now On.\r\n"}, - {"afk", PRF_AFK, 0, - "AFK is now Off.\r\n", - "AFK is now On.\r\n"}, - {"autoloot", PRF_AUTOLOOT, 0, - "Autoloot disabled.\r\n", - "Autoloot enabled.\r\n"}, - {"autogold", PRF_AUTOGOLD, 0, - "Autogold disabled.\r\n", - "Autogold enabled.\r\n"}, - {"autosplit", PRF_AUTOSPLIT, 0, - "Autosplit disabled.\r\n", - "Autosplit enabled.\r\n"}, - {"autosac", PRF_AUTOSAC, 0, - "Autosac disabled.\r\n", - "Autosac enabled.\r\n"}, - {"autoassist", PRF_AUTOASSIST, 0, - "Autoassist disabled.\r\n", - "Autoassist enabled.\r\n"}, - {"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"}, - {"zoneresets", PRF_ZONERESETS, LVL_IMPL, - "You will no longer see zone resets.\r\n", - "You will now see zone resets.\r\n"}, - {"syslog", 0, LVL_IMMORT, "\n", "\n"}, - {"wimpy", 0, 0, "\n", "\n"}, - {"pagelength", 0, 0, "\n", "\n"}, - {"screenwidth", 0, 0, "\n", "\n"}, - {"color", 0, 0, "\n", "\n"}, - {"\n", 0, -1, "\n", "\n"} /* must be last */ - }; + { + "summonable", PRF_SUMMONABLE, 0, + "You are now safe from summoning by other players.\r\n", + "You may now be summoned by other players.\r\n" + }, + { + "nohassle", PRF_NOHASSLE, LVL_IMMORT, + "Nohassle disabled.\r\n", + "Nohassle enabled.\r\n" + }, + { + "brief", PRF_BRIEF, 0, + "Brief mode off.\r\n", + "Brief mode on.\r\n" + }, + { + "compact", PRF_COMPACT, 0, + "Compact mode off.\r\n", + "Compact mode on.\r\n" + }, + { + "notell", PRF_NOTELL, 0, + "You can now hear tells.\r\n", + "You are now deaf to tells.\r\n" + }, + { + "noauction", PRF_NOAUCT, 0, + "You can now hear auctions.\r\n", + "You are now deaf to auctions.\r\n" + }, + { + "noshout", PRF_NOSHOUT, 0, + "You can now hear shouts.\r\n", + "You are now deaf to shouts.\r\n" + }, + { + "nogossip", PRF_NOGOSS, 0, + "You can now hear gossip.\r\n", + "You are now deaf to gossip.\r\n" + }, + { + "nograts", PRF_NOGRATZ, 0, + "You can now hear gratz.\r\n", + "You are now deaf to gratz.\r\n" + }, + { + "nowiz", PRF_NOWIZ, LVL_IMMORT, + "You can now hear the Wiz-channel.\r\n", + "You are now deaf to the Wiz-channel.\r\n" + }, + { + "quest", PRF_QUEST, 0, + "You are no longer part of the Quest.\r\n", + "Okay, you are part of the Quest.\r\n" + }, + { + "showvnums", PRF_SHOWVNUMS, LVL_IMMORT, + "You will no longer see the vnums.\r\n", + "You will now see the vnums.\r\n" + }, + { + "norepeat", PRF_NOREPEAT, 0, + "You will now have your communication repeated.\r\n", + "You will no longer have your communication repeated.\r\n" + }, + { + "holylight", PRF_HOLYLIGHT, LVL_IMMORT, + "HolyLight mode off.\r\n", + "HolyLight mode on.\r\n" + }, + { + "slownameserver", 0, LVL_IMPL, + "Nameserver_is_slow changed to OFF; IP addresses will now be resolved.\r\n", + "Nameserver_is_slow changed to ON; sitenames will no longer be resolved.\r\n" + }, + { + "autoexits", PRF_AUTOEXIT, 0, + "Autoexits disabled.\r\n", + "Autoexits enabled.\r\n" + }, + { + "trackthru", 0, LVL_IMPL, + "Players can no longer track through doors.\r\n", + "Players can now track through doors.\r\n" + }, + { + "clsolc", PRF_CLS, LVL_BUILDER, + "You will no longer clear screen in OLC.\r\n", + "You will now clear screen in OLC.\r\n" + }, + { + "buildwalk", PRF_BUILDWALK, LVL_BUILDER, + "Buildwalk is now Off.\r\n", + "Buildwalk is now On.\r\n" + }, + { + "afk", PRF_AFK, 0, + "AFK is now Off.\r\n", + "AFK is now On.\r\n" + }, + { + "autoloot", PRF_AUTOLOOT, 0, + "Autoloot disabled.\r\n", + "Autoloot enabled.\r\n" + }, + { + "autogold", PRF_AUTOGOLD, 0, + "Autogold disabled.\r\n", + "Autogold enabled.\r\n" + }, + { + "autosplit", PRF_AUTOSPLIT, 0, + "Autosplit disabled.\r\n", + "Autosplit enabled.\r\n" + }, + { + "autosac", PRF_AUTOSAC, 0, + "Autosac disabled.\r\n", + "Autosac enabled.\r\n" + }, + { + "autoassist", PRF_AUTOASSIST, 0, + "Autoassist disabled.\r\n", + "Autoassist enabled.\r\n" + }, + { + "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" + }, + { + "zoneresets", PRF_ZONERESETS, LVL_IMPL, + "You will no longer see zone resets.\r\n", + "You will now see zone resets.\r\n" + }, + { + "syslog", 0, LVL_IMMORT, "\n", "\n" + }, + { + "wimpy", 0, 0, "\n", "\n" + }, + { + "pagelength", 0, 0, "\n", "\n" + }, + { + "screenwidth", 0, 0, "\n", "\n" + }, + { + "color", 0, 0, "\n", "\n" + }, + { + "\n", 0, -1, "\n", "\n" + } /* must be last */ + }; if (IS_NPC(ch)) return; @@ -1948,117 +2010,117 @@ ACMD(do_toggle) if (!*arg) { if (!GET_WIMP_LEV(ch)) - strcpy(buf2, "OFF"); /* strcpy: OK */ + strcpy(buf2, "OFF"); /* strcpy: OK */ else - sprintf(buf2, "%-3.3d", GET_WIMP_LEV(ch)); /* sprintf: OK */ + sprintf(buf2, "%-3.3d", GET_WIMP_LEV(ch)); /* sprintf: OK */ if (GET_LEVEL(ch) == LVL_IMPL) { send_to_char(ch, - " SlowNameserver: %-3s " - " " - " Trackthru Doors: %-3s\r\n", + " SlowNameserver: %-3s " + " " + " Trackthru Doors: %-3s\r\n", - ONOFF(CONFIG_NS_IS_SLOW), - ONOFF(CONFIG_TRACK_T_DOORS)); + ONOFF(CONFIG_NS_IS_SLOW), + ONOFF(CONFIG_TRACK_T_DOORS)); } if (GET_LEVEL(ch) >= LVL_IMMORT) { send_to_char(ch, - " Buildwalk: %-3s " - " NoWiz: %-3s " - " ClsOLC: %-3s\r\n" - " NoHassle: %-3s " - " Holylight: %-3s " - " ShowVnums: %-3s\r\n" - " Syslog: %-3s%s ", + " Buildwalk: %-3s " + " NoWiz: %-3s " + " ClsOLC: %-3s\r\n" + " NoHassle: %-3s " + " Holylight: %-3s " + " ShowVnums: %-3s\r\n" + " Syslog: %-3s%s ", - ONOFF(PRF_FLAGGED(ch, PRF_BUILDWALK)), - ONOFF(PRF_FLAGGED(ch, PRF_NOWIZ)), - ONOFF(PRF_FLAGGED(ch, PRF_CLS)), - ONOFF(PRF_FLAGGED(ch, PRF_NOHASSLE)), - ONOFF(PRF_FLAGGED(ch, PRF_HOLYLIGHT)), - ONOFF(PRF_FLAGGED(ch, PRF_SHOWVNUMS)), - types[(PRF_FLAGGED(ch, PRF_LOG1) ? 1 : 0) + (PRF_FLAGGED(ch, PRF_LOG2) ? 2 : 0)], - GET_LEVEL(ch) == LVL_IMPL ? "" : "\r\n"); + ONOFF(PRF_FLAGGED(ch, PRF_BUILDWALK)), + ONOFF(PRF_FLAGGED(ch, PRF_NOWIZ)), + ONOFF(PRF_FLAGGED(ch, PRF_CLS)), + ONOFF(PRF_FLAGGED(ch, PRF_NOHASSLE)), + ONOFF(PRF_FLAGGED(ch, PRF_HOLYLIGHT)), + ONOFF(PRF_FLAGGED(ch, PRF_SHOWVNUMS)), + types[(PRF_FLAGGED(ch, PRF_LOG1) ? 1 : 0) + (PRF_FLAGGED(ch, PRF_LOG2) ? 2 : 0)], + GET_LEVEL(ch) == LVL_IMPL ? "" : "\r\n"); } if (GET_LEVEL(ch) >= LVL_IMPL) { send_to_char(ch, - " ZoneResets: %-3s\r\n", - ONOFF(PRF_FLAGGED(ch, PRF_ZONERESETS))); + " ZoneResets: %-3s\r\n", + ONOFF(PRF_FLAGGED(ch, PRF_ZONERESETS))); } - send_to_char(ch, - "Hit Pnt Display: %-3s " - " Brief: %-3s " - " Summonable: %-3s\r\n" + send_to_char(ch, + "Hit Pnt Display: %-3s " + " Brief: %-3s " + " Summonable: %-3s\r\n" - " Move Display: %-3s " - " Compact: %-3s " - " Quest: %-3s\r\n" + " Move Display: %-3s " + " Compact: %-3s " + " Quest: %-3s\r\n" - " Mana Display: %-3s " - " NoTell: %-3s " - " NoRepeat: %-3s\r\n" + " Mana Display: %-3s " + " NoTell: %-3s " + " NoRepeat: %-3s\r\n" - " AutoExits: %-3s " - " NoShout: %-3s " - " Wimpy: %-3s\r\n" + " AutoExits: %-3s " + " NoShout: %-3s " + " Wimpy: %-3s\r\n" - " NoGossip: %-3s " - " NoAuction: %-3s " - " NoGrats: %-3s\r\n" + " NoGossip: %-3s " + " NoAuction: %-3s " + " NoGrats: %-3s\r\n" - " AutoLoot: %-3s " - " AutoGold: %-3s " - " AutoSplit: %-3s\r\n" + " AutoLoot: %-3s " + " AutoGold: %-3s " + " AutoSplit: %-3s\r\n" - " AutoSac: %-3s " - " AutoAssist: %-3s " - " AutoMap: %-3s\r\n" + " AutoSac: %-3s " + " AutoAssist: %-3s " + " AutoMap: %-3s\r\n" - " Pagelength: %-3d " - " Screenwidth: %-3d " - " AFK: %-3s\r\n" + " Pagelength: %-3d " + " Screenwidth: %-3d " + " AFK: %-3s\r\n" - " Autokey: %-3s " - " Autodoor: %-3s " - " Color: %s \r\n ", + " Autokey: %-3s " + " Autodoor: %-3s " + " Color: %s \r\n ", - ONOFF(PRF_FLAGGED(ch, PRF_DISPHP)), - ONOFF(PRF_FLAGGED(ch, PRF_BRIEF)), - ONOFF(PRF_FLAGGED(ch, PRF_SUMMONABLE)), + ONOFF(PRF_FLAGGED(ch, PRF_DISPHP)), + ONOFF(PRF_FLAGGED(ch, PRF_BRIEF)), + ONOFF(PRF_FLAGGED(ch, PRF_SUMMONABLE)), - ONOFF(PRF_FLAGGED(ch, PRF_DISPMOVE)), - ONOFF(PRF_FLAGGED(ch, PRF_COMPACT)), - ONOFF(PRF_FLAGGED(ch, PRF_QUEST)), + ONOFF(PRF_FLAGGED(ch, PRF_DISPMOVE)), + ONOFF(PRF_FLAGGED(ch, PRF_COMPACT)), + ONOFF(PRF_FLAGGED(ch, PRF_QUEST)), - ONOFF(PRF_FLAGGED(ch, PRF_DISPMANA)), - ONOFF(PRF_FLAGGED(ch, PRF_NOTELL)), - ONOFF(PRF_FLAGGED(ch, PRF_NOREPEAT)), + ONOFF(PRF_FLAGGED(ch, PRF_DISPMANA)), + ONOFF(PRF_FLAGGED(ch, PRF_NOTELL)), + ONOFF(PRF_FLAGGED(ch, PRF_NOREPEAT)), - ONOFF(PRF_FLAGGED(ch, PRF_AUTOEXIT)), - ONOFF(PRF_FLAGGED(ch, PRF_NOSHOUT)), - buf2, + ONOFF(PRF_FLAGGED(ch, PRF_AUTOEXIT)), + ONOFF(PRF_FLAGGED(ch, PRF_NOSHOUT)), + buf2, - ONOFF(PRF_FLAGGED(ch, PRF_NOGOSS)), - ONOFF(PRF_FLAGGED(ch, PRF_NOAUCT)), - ONOFF(PRF_FLAGGED(ch, PRF_NOGRATZ)), + ONOFF(PRF_FLAGGED(ch, PRF_NOGOSS)), + ONOFF(PRF_FLAGGED(ch, PRF_NOAUCT)), + ONOFF(PRF_FLAGGED(ch, PRF_NOGRATZ)), - ONOFF(PRF_FLAGGED(ch, PRF_AUTOLOOT)), - ONOFF(PRF_FLAGGED(ch, PRF_AUTOGOLD)), - ONOFF(PRF_FLAGGED(ch, PRF_AUTOSPLIT)), + ONOFF(PRF_FLAGGED(ch, PRF_AUTOLOOT)), + ONOFF(PRF_FLAGGED(ch, PRF_AUTOGOLD)), + ONOFF(PRF_FLAGGED(ch, PRF_AUTOSPLIT)), - ONOFF(PRF_FLAGGED(ch, PRF_AUTOSAC)), - ONOFF(PRF_FLAGGED(ch, PRF_AUTOASSIST)), - ONOFF(PRF_FLAGGED(ch, PRF_AUTOMAP)), + ONOFF(PRF_FLAGGED(ch, PRF_AUTOSAC)), + ONOFF(PRF_FLAGGED(ch, PRF_AUTOASSIST)), + ONOFF(PRF_FLAGGED(ch, PRF_AUTOMAP)), - GET_PAGE_LENGTH(ch), - GET_SCREEN_WIDTH(ch), - ONOFF(PRF_FLAGGED(ch, PRF_AFK)), + GET_PAGE_LENGTH(ch), + 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)]); + ONOFF(PRF_FLAGGED(ch, PRF_AUTOKEY)), + ONOFF(PRF_FLAGGED(ch, PRF_AUTODOOR)), + types[COLOR_LEV(ch)]); return; } @@ -2085,15 +2147,17 @@ ACMD(do_toggle) } REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_COLOR_1); REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_COLOR_2); - if (tp & 1) SET_BIT_AR(PRF_FLAGS(ch), PRF_COLOR_1); - if (tp & 2) SET_BIT_AR(PRF_FLAGS(ch), PRF_COLOR_2); + if (tp & 1) + SET_BIT_AR(PRF_FLAGS(ch), PRF_COLOR_1); + if (tp & 2) + SET_BIT_AR(PRF_FLAGS(ch), PRF_COLOR_2); send_to_char(ch, "Your %scolor%s is now %s.\r\n", CCRED(ch, C_SPR), CCNRM(ch, C_OFF), types[tp]); return; case SCMD_SYSLOG: if (!*arg2) { send_to_char(ch, "Your syslog is currently %s.\r\n", - types[(PRF_FLAGGED(ch, PRF_LOG1) ? 1 : 0) + (PRF_FLAGGED(ch, PRF_LOG2) ? 2 : 0)]); + types[(PRF_FLAGGED(ch, PRF_LOG1) ? 1 : 0) + (PRF_FLAGGED(ch, PRF_LOG2) ? 2 : 0)]); return; } if (((tp = search_block(arg2, types, FALSE)) == -1)) { @@ -2102,8 +2166,10 @@ ACMD(do_toggle) } REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_LOG1); REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_LOG2); - if (tp & 1) SET_BIT_AR(PRF_FLAGS(ch), PRF_LOG1); - if (tp & 2) SET_BIT_AR(PRF_FLAGS(ch), PRF_LOG2); + if (tp & 1) + SET_BIT_AR(PRF_FLAGS(ch), PRF_LOG1); + if (tp & 2) + SET_BIT_AR(PRF_FLAGS(ch), PRF_LOG2); send_to_char(ch, "Your syslog is now %s.\r\n", types[tp]); return; @@ -2120,11 +2186,11 @@ ACMD(do_toggle) } result = PRF_TOG_CHK(ch, PRF_BUILDWALK); if (PRF_FLAGGED(ch, PRF_BUILDWALK)) { - for (i=0; *arg2 && *(sector_types[i]) != '\n'; i++) + for (i = 0; *arg2 && *(sector_types[i]) != '\n'; i++) if (is_abbrev(arg2, sector_types[i])) break; if (*(sector_types[i]) == '\n') - i=0; + i = 0; GET_BUILDWALK_SECTOR(ch) = i; send_to_char(ch, "Default sector type is %s\r\n", sector_types[i]); mudlog(CMP, GET_LEVEL(ch), TRUE, @@ -2308,7 +2374,7 @@ ACMD(do_history) struct txt_block *tmp; for (tmp = GET_HISTORY(ch, type); tmp; tmp = tmp->next) send_to_char(ch, "%s", tmp->text); -/* Make this a 1 if you want history to clear after viewing */ + /* Make this a 1 if you want history to clear after viewing */ #if 0 free_history(ch, type); #endif @@ -2317,6 +2383,7 @@ ACMD(do_history) } #define HIST_LENGTH 100 + void add_history(struct char_data *ch, char *str, int type) { int i = 0; @@ -2336,8 +2403,7 @@ void add_history(struct char_data *ch, char *str, int type) if (!tmp) { CREATE(GET_HISTORY(ch, type), struct txt_block, 1); GET_HISTORY(ch, type)->text = strdup(buf); - } - else { + } else { while (tmp->next) tmp = tmp->next; CREATE(tmp->next, struct txt_block, 1); @@ -2372,30 +2438,29 @@ ACMD(do_whois) return; } - if (!(victim=get_player_vis(ch, buf, NULL, FIND_CHAR_WORLD))) - { - CREATE(victim, struct char_data, 1); - clear_char(victim); + if (!(victim = get_player_vis(ch, buf, NULL, FIND_CHAR_WORLD))) { + CREATE(victim, struct char_data, 1); + clear_char(victim); - new_mobile_data(victim); + new_mobile_data(victim); - CREATE(victim->player_specials, struct player_special_data, 1); + CREATE(victim->player_specials, struct player_special_data, 1); - if (load_char(buf, victim) > -1) - got_from_file = 1; - else { - send_to_char (ch, "There is no such player.\r\n"); - free_char (victim); - return; - } + if (load_char(buf, victim) > -1) + got_from_file = 1; + else { + send_to_char(ch, "There is no such player.\r\n"); + free_char(victim); + return; + } } /* We either have our victim from file or he's playing or function has returned. */ sprinttype(GET_SEX(victim), genders, buf, sizeof(buf)); send_to_char(ch, "Name: %s %s\r\nSex: %s\r\n", GET_NAME(victim), - (victim->player.title ? victim->player.title : ""), buf); + (victim->player.title ? victim->player.title : ""), buf); - sprinttype (victim->player.chclass, pc_class_types, buf, sizeof(buf)); + sprinttype(victim->player.chclass, pc_class_types, buf, sizeof(buf)); send_to_char(ch, "Class: %s\r\n", buf); send_to_char(ch, "Level: %d\r\n", GET_LEVEL(victim)); @@ -2407,7 +2472,7 @@ ACMD(do_whois) if (!got_from_file) { send_to_char(ch, "Last Logon: Playing now! (Idle %d Minutes)", - victim->char_specials.timer * SECS_PER_MUD_HOUR / SECS_PER_REAL_MIN); + victim->char_specials.timer * SECS_PER_MUD_HOUR / SECS_PER_REAL_MIN); if (!victim->desc) send_to_char(ch, " (Linkless)\r\n"); @@ -2415,27 +2480,32 @@ ACMD(do_whois) send_to_char(ch, "\r\n"); if (PRF_FLAGGED(victim, PRF_AFK)) - send_to_char(ch, "%s%s is afk right now, so %s may not respond to communication.%s\r\n", CBGRN(ch, C_NRM), GET_NAME(victim), HSSH(victim), CCNRM(ch, C_NRM)); - } - else if (hours > 0) - send_to_char(ch, "Last Logon: %s (%d days & %d hours ago.)\r\n", buf, hours/24, hours%24); + send_to_char(ch, "%s%s is afk right now, so %s may not respond to communication.%s\r\n", CBGRN(ch, C_NRM), + GET_NAME(victim), HSSH(victim), CCNRM(ch, C_NRM)); + } else if (hours > 0) + send_to_char(ch, "Last Logon: %s (%d days & %d hours ago.)\r\n", buf, hours / 24, hours % 24); else send_to_char(ch, "Last Logon: %s (0 hours & %d minutes ago.)\r\n", - buf, (int)(time(0) - victim->player.time.logon)/60); + buf, (int)(time(0) - victim->player.time.logon) / 60); } if (has_mail(GET_IDNUM(victim))) - act("$E$u has mail waiting.", FALSE, ch, 0, victim, TO_CHAR); + act("$E$u has mail waiting.", FALSE, ch, 0, victim, TO_CHAR); else - act("$E$u has no mail waiting.", FALSE, ch, 0, victim, TO_CHAR); + act("$E$u has no mail waiting.", FALSE, ch, 0, victim, TO_CHAR); if (PLR_FLAGGED(victim, PLR_DELETED)) - send_to_char (ch, "***DELETED***\r\n"); + send_to_char(ch, "***DELETED***\r\n"); if (!got_from_file && victim->desc != NULL && GET_LEVEL(ch) >= LVL_GOD) { - protocol_t * prot = victim->desc->pProtocol; - send_to_char(ch, "Client: %s [%s]\r\n", prot->pVariables[eMSDP_CLIENT_ID]->pValueString, prot->pVariables[eMSDP_CLIENT_VERSION]->pValueString ? prot->pVariables[eMSDP_CLIENT_VERSION]->pValueString : "Unknown"); - send_to_char(ch, "Color: %s\r\n", prot->pVariables[eMSDP_XTERM_256_COLORS]->ValueInt ? "Xterm" : (prot->pVariables[eMSDP_ANSI_COLORS]->ValueInt ? "Ansi" : "None")); + protocol_t *prot = victim->desc->pProtocol; + send_to_char(ch, "Client: %s [%s]\r\n", prot->pVariables[eMSDP_CLIENT_ID]->pValueString, + prot->pVariables[eMSDP_CLIENT_VERSION]->pValueString + ? prot->pVariables[eMSDP_CLIENT_VERSION]->pValueString + : "Unknown"); + send_to_char(ch, "Color: %s\r\n", prot->pVariables[eMSDP_XTERM_256_COLORS]->ValueInt + ? "Xterm" + : (prot->pVariables[eMSDP_ANSI_COLORS]->ValueInt ? "Ansi" : "None")); send_to_char(ch, "MXP: %s\r\n", prot->bMXP ? "Yes" : "No"); send_to_char(ch, "Charset: %s\r\n", prot->bCHARSET ? "Yes" : "No"); send_to_char(ch, "MSP: %s\r\n", prot->bMSP ? "Yes" : "No"); @@ -2444,7 +2514,7 @@ ACMD(do_whois) } if (got_from_file) - free_char (victim); + free_char(victim); } static bool get_zone_levels(zone_rnum znum, char *buf) @@ -2471,7 +2541,7 @@ static bool get_zone_levels(zone_rnum znum, char *buf) ACMD(do_areas) { - int i, hilev=-1, lolev=-1, zcount=0, lev_set, len=0, tmp_len=0; + int i, hilev = -1, lolev = -1, zcount = 0, lev_set, len = 0, tmp_len = 0; char arg[MAX_INPUT_LENGTH], *second, lev_str[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH]; bool show_zone = FALSE, overlap = FALSE, overlap_shown = FALSE; @@ -2488,20 +2558,20 @@ ACMD(do_areas) lolev = atoi(arg); /* Check for 2nd value */ - if (*(second+1) == '\0' || !isdigit(*(second+1)) ) + if (*(second + 1) == '\0' || !isdigit(*(second+1))) hilev = 100; else - hilev = atoi(second+1); + hilev = atoi(second + 1); } else { /* No range - single number */ lolev = atoi(arg); - hilev = -1; /* No high level - indicates single level */ + hilev = -1; /* No high level - indicates single level */ } } if (hilev != -1 && lolev > hilev) { /* Swap hi and lo lev if needed */ - i = lolev; + i = lolev; lolev = hilev; hilev = i; } @@ -2512,11 +2582,11 @@ ACMD(do_areas) else len = snprintf(buf, sizeof(buf), "Checking all areas.\r\n"); - for (i = 0; i <= top_of_zone_table; i++) { /* Go through the whole zone table */ + for (i = 0; i <= top_of_zone_table; i++) { /* Go through the whole zone table */ show_zone = FALSE; overlap = FALSE; - if (ZONE_FLAGGED(i, ZONE_GRID)) { /* Is this zone 'on the grid' ? */ + if (ZONE_FLAGGED(i, ZONE_GRID)) { /* Is this zone 'on the grid' ? */ if (lolev == -1) { /* No range supplied, show all zones */ show_zone = TRUE; @@ -2526,7 +2596,8 @@ ACMD(do_areas) } else if ((hilev != -1) && (lolev >= ZONE_MINLVL(i)) && (hilev <= ZONE_MAXLVL(i))) { /* Range supplied, it's completely within this zone's range (no overlap) */ show_zone = TRUE; - } else if ((hilev != -1) && ((lolev >= ZONE_MINLVL(i) && lolev <= ZONE_MAXLVL(i)) || (hilev <= ZONE_MAXLVL(i) && hilev >= ZONE_MINLVL(i)))) { + } else if ((hilev != -1) && ((lolev >= ZONE_MINLVL(i) && lolev <= ZONE_MAXLVL(i)) || ( + hilev <= ZONE_MAXLVL(i) && hilev >= ZONE_MINLVL(i)))) { /* Range supplied, it overlaps this zone's range */ show_zone = TRUE; overlap = TRUE; @@ -2541,19 +2612,23 @@ ACMD(do_areas) } if (show_zone) { - if (overlap) overlap_shown = TRUE; + if (overlap) + overlap_shown = TRUE; lev_set = get_zone_levels(i, lev_str); - tmp_len = snprintf(buf+len, sizeof(buf)-len, "\tn(%3d) %s%-*s\tn %s%s\tn\r\n", ++zcount, overlap ? QRED : QCYN, - count_color_chars(zone_table[i].name)+30, zone_table[i].name, - lev_set ? "\tc" : "\tn", lev_set ? lev_str : "All Levels"); + tmp_len = snprintf(buf + len, sizeof(buf) - len, "\tn(%3d) %s%-*s\tn %s%s\tn\r\n", ++zcount, + overlap ? QRED : QCYN, + count_color_chars(zone_table[i].name) + 30, zone_table[i].name, + lev_set ? "\tc" : "\tn", lev_set ? lev_str : "All Levels"); len += tmp_len; } } - tmp_len = snprintf(buf+len, sizeof(buf)-len, "%s%d%s area%s found.\r\n", QYEL, zcount, QNRM, zcount == 1 ? "" : "s"); + tmp_len = snprintf(buf + len, sizeof(buf) - len, "%s%d%s area%s found.\r\n", QYEL, zcount, QNRM, + zcount == 1 ? "" : "s"); len += tmp_len; if (overlap_shown) { - snprintf(buf+len, sizeof(buf)-len, "Areas shown in \trred\tn may have some creatures outside the specified range.\r\n"); + snprintf(buf + len, sizeof(buf) - len, + "Areas shown in \trred\tn may have some creatures outside the specified range.\r\n"); } if (zcount == 0) @@ -2562,40 +2637,40 @@ ACMD(do_areas) page_string(ch->desc, buf, TRUE); } -static void list_scanned_chars(struct char_data * list, struct char_data * ch, int -distance, int door) +static void list_scanned_chars(struct char_data *list, struct char_data *ch, int + distance, int door) { char buf[MAX_STRING_LENGTH], buf2[MAX_STRING_LENGTH - 1]; const char *how_far[] = { - "close by", - "a ways off", - "far off to the" + "close by", + "a ways off", + "far off to the" }; struct char_data *i; int count = 0; *buf = '\0'; -/* this loop is a quick, easy way to help make a grammatical sentence - (i.e., "You see x, x, y, and z." with commas, "and", etc.) */ + /* this loop is a quick, easy way to help make a grammatical sentence + (i.e., "You see x, x, y, and z." with commas, "and", etc.) */ for (i = list; i; i = i->next_in_room) -/* put any other conditions for scanning someone in this if statement - - i.e., if (CAN_SEE(ch, i) && condition2 && condition3) or whatever */ + /* put any other conditions for scanning someone in this if statement - + i.e., if (CAN_SEE(ch, i) && condition2 && condition3) or whatever */ if (CAN_SEE(ch, i)) - count++; + count++; if (!count) return; for (i = list; i; i = i->next_in_room) { -/* make sure to add changes to the if statement above to this one also, using - or's to join them.. i.e., - if (!CAN_SEE(ch, i) || !condition2 || !condition3) */ + /* make sure to add changes to the if statement above to this one also, using + or's to join them.. i.e., + if (!CAN_SEE(ch, i) || !condition2 || !condition3) */ if (!CAN_SEE(ch, i)) continue; @@ -2619,7 +2694,7 @@ distance, int door) ACMD(do_scan) { int door; - bool found=FALSE; + bool found = FALSE; int range; int maxrange = 3; @@ -2632,29 +2707,29 @@ ACMD(do_scan) } for (door = 0; door < DIR_COUNT; door++) { - for (range = 1; range<= maxrange; range++) { + for (range = 1; range <= maxrange; range++) { if (world[scanned_room].dir_option[door] && world[scanned_room].dir_option[door]->to_room != NOWHERE && - !IS_SET(world[scanned_room].dir_option[door]->exit_info, EX_CLOSED) && - !IS_SET(world[scanned_room].dir_option[door]->exit_info, EX_HIDDEN)) { + !IS_SET(world[scanned_room].dir_option[door]->exit_info, EX_CLOSED) && + !IS_SET(world[scanned_room].dir_option[door]->exit_info, EX_HIDDEN)) { scanned_room = world[scanned_room].dir_option[door]->to_room; if (IS_DARK(scanned_room) && !CAN_SEE_IN_DARK(ch)) { if (world[scanned_room].people) send_to_char(ch, "%s: It's too dark to see, but you can hear shuffling.\r\n", dirs[door]); else send_to_char(ch, "%s: It is too dark to see anything.\r\n", dirs[door]); - found=TRUE; + found = TRUE; } else { if (world[scanned_room].people) { list_scanned_chars(world[scanned_room].people, ch, range - 1, door); - found=TRUE; + found = TRUE; } } - } // end of if + } // end of if else break; - } // end of range + } // end of range scanned_room = IN_ROOM(ch); - } // end of directions + } // end of directions if (!found) { send_to_char(ch, "You don't see anything nearby!\r\n"); } diff --git a/src/act.item.c b/src/act.item.c index 793226a..2948e5a 100644 --- a/src/act.item.c +++ b/src/act.item.c @@ -48,8 +48,6 @@ static void perform_wear(struct char_data *ch, struct obj_data *obj, int where); static void wear_message(struct char_data *ch, struct obj_data *obj, int where); - - static void perform_put(struct char_data *ch, struct obj_data *obj, struct obj_data *cont) { long object_id = obj_script_id(obj); @@ -75,7 +73,7 @@ static void perform_put(struct char_data *ch, struct obj_data *obj, struct obj_d if (OBJ_FLAGGED(obj, ITEM_NODROP) && !OBJ_FLAGGED(cont, ITEM_NODROP)) { SET_BIT_AR(GET_OBJ_EXTRA(cont), ITEM_NODROP); act("You get a strange feeling as you put $p in $P.", FALSE, - ch, obj, cont, TO_CHAR); + ch, obj, cont, TO_CHAR); } else act("You put $p in $P.", FALSE, ch, obj, cont, TO_CHAR); } @@ -97,7 +95,7 @@ ACMD(do_put) int obj_dotmode, cont_dotmode, found = 0, howmany = 1; char *theobj, *thecont; - one_argument(two_arguments(argument, arg1, arg2), arg3); /* three_arguments */ + one_argument(two_arguments(argument, arg1, arg2), arg3); /* three_arguments */ if (*arg3 && is_number(arg1)) { howmany = atoi(arg1); @@ -125,36 +123,36 @@ ACMD(do_put) else if (OBJVAL_FLAGGED(cont, CONT_CLOSED) && (GET_LEVEL(ch) < LVL_IMMORT || !PRF_FLAGGED(ch, PRF_NOHASSLE))) send_to_char(ch, "You'd better open it first!\r\n"); else { - if (obj_dotmode == FIND_INDIV) { /* put */ - if (!(obj = get_obj_in_list_vis(ch, theobj, NULL, ch->carrying))) - send_to_char(ch, "You aren't carrying %s %s.\r\n", AN(theobj), theobj); - else if (obj == cont && howmany == 1) - send_to_char(ch, "You attempt to fold it into itself, but fail.\r\n"); - else { - while (obj && howmany) { - next_obj = obj->next_content; + if (obj_dotmode == FIND_INDIV) { /* put */ + if (!((obj = get_obj_in_list_vis(ch, theobj, NULL, ch->carrying)))) + send_to_char(ch, "You aren't carrying %s %s.\r\n", AN(theobj), theobj); + else if (obj == cont && howmany == 1) + send_to_char(ch, "You attempt to fold it into itself, but fail.\r\n"); + else { + while (obj && howmany) { + next_obj = obj->next_content; if (obj != cont) { howmany--; - perform_put(ch, obj, cont); + perform_put(ch, obj, cont); } - obj = get_obj_in_list_vis(ch, theobj, NULL, next_obj); - } - } + obj = get_obj_in_list_vis(ch, theobj, NULL, next_obj); + } + } } else { - for (obj = ch->carrying; obj; obj = next_obj) { - next_obj = obj->next_content; - if (obj != cont && CAN_SEE_OBJ(ch, obj) && - (obj_dotmode == FIND_ALL || isname(theobj, obj->name))) { - found = 1; - perform_put(ch, obj, cont); - } - } - if (!found) { - if (obj_dotmode == FIND_ALL) - send_to_char(ch, "You don't seem to have anything to put in it.\r\n"); - else - send_to_char(ch, "You don't seem to have any %ss.\r\n", theobj); - } + for (obj = ch->carrying; obj; obj = next_obj) { + next_obj = obj->next_content; + if (obj != cont && CAN_SEE_OBJ(ch, obj) && + (obj_dotmode == FIND_ALL || isname(theobj, obj->name))) { + found = 1; + perform_put(ch, obj, cont); + } + } + if (!found) { + if (obj_dotmode == FIND_ALL) + send_to_char(ch, "You don't seem to have anything to put in it.\r\n"); + else + send_to_char(ch, "You don't seem to have any %ss.\r\n", theobj); + } } } } @@ -162,26 +160,26 @@ ACMD(do_put) static int can_take_obj(struct char_data *ch, struct obj_data *obj) { -if (!(CAN_WEAR(obj, ITEM_WEAR_TAKE))) { - act("$p: you can't take that!", FALSE, ch, obj, 0, TO_CHAR); - return (0); + if (!(CAN_WEAR(obj, ITEM_WEAR_TAKE))) { + act("$p: you can't take that!", FALSE, ch, obj, 0, TO_CHAR); + return (0); } -if (!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_NOHASSLE)) { - if (IS_CARRYING_N(ch) >= CAN_CARRY_N(ch)) { - act("$p: you can't carry that many items.", FALSE, ch, obj, 0, TO_CHAR); - return (0); - } else if ((IS_CARRYING_W(ch) + GET_OBJ_WEIGHT(obj)) > CAN_CARRY_W(ch)) { - act("$p: you can't carry that much weight.", FALSE, ch, obj, 0, TO_CHAR); - return (0); + if (!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_NOHASSLE)) { + if (IS_CARRYING_N(ch) >= CAN_CARRY_N(ch)) { + act("$p: you can't carry that many items.", FALSE, ch, obj, 0, TO_CHAR); + return (0); + } else if ((IS_CARRYING_W(ch) + GET_OBJ_WEIGHT(obj)) > CAN_CARRY_W(ch)) { + act("$p: you can't carry that much weight.", FALSE, ch, obj, 0, TO_CHAR); + return (0); + } } -} - - if (OBJ_SAT_IN_BY(obj)){ + + if (OBJ_SAT_IN_BY(obj)) { act("It appears someone is sitting on $p..", FALSE, ch, obj, 0, TO_CHAR); return (0); } - + return (1); } @@ -203,7 +201,7 @@ static void get_check_money(struct char_data *ch, struct obj_data *obj) } static void perform_get_from_container(struct char_data *ch, struct obj_data *obj, - struct obj_data *cont, int mode) + struct obj_data *cont, int mode) { if (mode == FIND_OBJ_INV || can_take_obj(ch, obj)) { if (IS_CARRYING_N(ch) >= CAN_CARRY_N(ch)) @@ -219,7 +217,7 @@ static void perform_get_from_container(struct char_data *ch, struct obj_data *ob } void get_from_container(struct char_data *ch, struct obj_data *cont, - char *arg, int mode, int howmany) + char *arg, int mode, int howmany) { struct obj_data *obj, *next_obj; int obj_dotmode, found = 0; @@ -250,19 +248,19 @@ void get_from_container(struct char_data *ch, struct obj_data *cont, for (obj = cont->contains; obj; obj = next_obj) { next_obj = obj->next_content; if (CAN_SEE_OBJ(ch, obj) && - (obj_dotmode == FIND_ALL || isname(arg, obj->name))) { - found = 1; - perform_get_from_container(ch, obj, cont, mode); + (obj_dotmode == FIND_ALL || isname(arg, obj->name))) { + found = 1; + perform_get_from_container(ch, obj, cont, mode); } } if (!found) { if (obj_dotmode == FIND_ALL) - act("$p seems to be empty.", FALSE, ch, cont, 0, TO_CHAR); + act("$p seems to be empty.", FALSE, ch, cont, 0, TO_CHAR); else { char buf[MAX_STRING_LENGTH]; - snprintf(buf, sizeof(buf), "You can't seem to find any %ss in $p.", arg); - act(buf, FALSE, ch, cont, 0, TO_CHAR); + snprintf(buf, sizeof(buf), "You can't seem to find any %ss in $p.", arg); + act(buf, FALSE, ch, cont, 0, TO_CHAR); } } } @@ -290,16 +288,16 @@ static void get_from_room(struct char_data *ch, char *arg, int howmany) if (dotmode == FIND_INDIV) { if (!(obj = get_obj_in_list_vis(ch, arg, NULL, world[IN_ROOM(ch)].contents))) { - /* Are they trying to take something in a room extra description? */ - if (find_exdesc(arg, world[IN_ROOM(ch)].ex_description) != NULL) { - send_to_char(ch, "You can't take %s %s.\r\n", AN(arg), arg); - return; - } + /* Are they trying to take something in a room extra description? */ + if (find_exdesc(arg, world[IN_ROOM(ch)].ex_description) != NULL) { + send_to_char(ch, "You can't take %s %s.\r\n", AN(arg), arg); + return; + } send_to_char(ch, "You don't see %s %s here.\r\n", AN(arg), arg); } else { struct obj_data *obj_next; - while(obj && howmany--) { - obj_next = obj->next_content; + while (obj && howmany--) { + obj_next = obj->next_content; perform_get_from_room(ch, obj); obj = get_obj_in_list_vis(ch, arg, NULL, obj_next); } @@ -312,16 +310,16 @@ static void get_from_room(struct char_data *ch, char *arg, int howmany) for (obj = world[IN_ROOM(ch)].contents; obj; obj = next_obj) { next_obj = obj->next_content; if (CAN_SEE_OBJ(ch, obj) && - (dotmode == FIND_ALL || isname(arg, obj->name))) { - found = 1; - perform_get_from_room(ch, obj); + (dotmode == FIND_ALL || isname(arg, obj->name))) { + found = 1; + perform_get_from_room(ch, obj); } } if (!found) { if (dotmode == FIND_ALL) - send_to_char(ch, "There doesn't seem to be anything here.\r\n"); + send_to_char(ch, "There doesn't seem to be anything here.\r\n"); else - send_to_char(ch, "You don't see any %ss here.\r\n", arg); + send_to_char(ch, "You don't see any %ss here.\r\n", arg); } } } @@ -336,7 +334,7 @@ ACMD(do_get) struct obj_data *cont; struct char_data *tmp_char; - one_argument(two_arguments(argument, arg1, arg2), arg3); /* three_arguments */ + one_argument(two_arguments(argument, arg1, arg2), arg3); /* three_arguments */ if (!*arg1) send_to_char(ch, "Get what?\r\n"); @@ -355,43 +353,43 @@ ACMD(do_get) if (cont_dotmode == FIND_INDIV) { mode = generic_find(arg2, FIND_OBJ_INV | FIND_OBJ_ROOM, ch, &tmp_char, &cont); if (!cont) - send_to_char(ch, "You don't have %s %s.\r\n", AN(arg2), arg2); + send_to_char(ch, "You don't have %s %s.\r\n", AN(arg2), arg2); else if (GET_OBJ_TYPE(cont) != ITEM_CONTAINER) - act("$p is not a container.", FALSE, ch, cont, 0, TO_CHAR); + act("$p is not a container.", FALSE, ch, cont, 0, TO_CHAR); else - get_from_container(ch, cont, arg1, mode, amount); + get_from_container(ch, cont, arg1, mode, amount); } else { if (cont_dotmode == FIND_ALLDOT && !*arg2) { - send_to_char(ch, "Get from all of what?\r\n"); - return; + send_to_char(ch, "Get from all of what?\r\n"); + return; } for (cont = ch->carrying; cont; cont = cont->next_content) - if (CAN_SEE_OBJ(ch, cont) && - (cont_dotmode == FIND_ALL || isname(arg2, cont->name))) { - if (GET_OBJ_TYPE(cont) == ITEM_CONTAINER) { - found = 1; - get_from_container(ch, cont, arg1, FIND_OBJ_INV, amount); - } else if (cont_dotmode == FIND_ALLDOT) { - found = 1; - act("$p is not a container.", FALSE, ch, cont, 0, TO_CHAR); - } - } + if (CAN_SEE_OBJ(ch, cont) && + (cont_dotmode == FIND_ALL || isname(arg2, cont->name))) { + if (GET_OBJ_TYPE(cont) == ITEM_CONTAINER) { + found = 1; + get_from_container(ch, cont, arg1, FIND_OBJ_INV, amount); + } else if (cont_dotmode == FIND_ALLDOT) { + found = 1; + act("$p is not a container.", FALSE, ch, cont, 0, TO_CHAR); + } + } for (cont = world[IN_ROOM(ch)].contents; cont; cont = cont->next_content) - if (CAN_SEE_OBJ(ch, cont) && - (cont_dotmode == FIND_ALL || isname(arg2, cont->name))) { - if (GET_OBJ_TYPE(cont) == ITEM_CONTAINER) { - get_from_container(ch, cont, arg1, FIND_OBJ_ROOM, amount); - found = 1; - } else if (cont_dotmode == FIND_ALLDOT) { - act("$p is not a container.", FALSE, ch, cont, 0, TO_CHAR); - found = 1; - } - } + if (CAN_SEE_OBJ(ch, cont) && + (cont_dotmode == FIND_ALL || isname(arg2, cont->name))) { + if (GET_OBJ_TYPE(cont) == ITEM_CONTAINER) { + get_from_container(ch, cont, arg1, FIND_OBJ_ROOM, amount); + found = 1; + } else if (cont_dotmode == FIND_ALLDOT) { + act("$p is not a container.", FALSE, ch, cont, 0, TO_CHAR); + found = 1; + } + } if (!found) { - if (cont_dotmode == FIND_ALL) - send_to_char(ch, "You can't seem to find any containers.\r\n"); - else - send_to_char(ch, "You can't seem to find any %ss here.\r\n", arg2); + if (cont_dotmode == FIND_ALL) + send_to_char(ch, "You can't seem to find any containers.\r\n"); + else + send_to_char(ch, "You can't seem to find any %ss here.\r\n", arg2); } } } @@ -410,11 +408,11 @@ static void perform_drop_gold(struct char_data *ch, int amount, byte mode, room_ WAIT_STATE(ch, PULSE_VIOLENCE); /* to prevent coin-bombing */ obj = create_money(amount); if (mode == SCMD_DONATE) { - send_to_char(ch, "You throw some gold into the air where it disappears in a puff of smoke!\r\n"); - act("$n throws some gold into the air where it disappears in a puff of smoke!", - FALSE, ch, 0, 0, TO_ROOM); - obj_to_room(obj, RDR); - act("$p suddenly appears in a puff of orange smoke!", 0, 0, obj, 0, TO_ROOM); + send_to_char(ch, "You throw some gold into the air where it disappears in a puff of smoke!\r\n"); + act("$n throws some gold into the air where it disappears in a puff of smoke!", + FALSE, ch, 0, 0, TO_ROOM); + obj_to_room(obj, RDR); + act("$p suddenly appears in a puff of orange smoke!", 0, 0, obj, 0, TO_ROOM); } else { char buf[MAX_STRING_LENGTH]; long object_id = obj_script_id(obj); @@ -426,11 +424,11 @@ static void perform_drop_gold(struct char_data *ch, int amount, byte mode, room_ return; } - snprintf(buf, sizeof(buf), "$n drops %s.", money_desc(amount)); - act(buf, TRUE, ch, 0, 0, TO_ROOM); + snprintf(buf, sizeof(buf), "$n drops %s.", money_desc(amount)); + act(buf, TRUE, ch, 0, 0, TO_ROOM); - send_to_char(ch, "You drop some gold.\r\n"); - obj_to_room(obj, IN_ROOM(ch)); + send_to_char(ch, "You drop some gold.\r\n"); + obj_to_room(obj, IN_ROOM(ch)); } } else { char buf[MAX_STRING_LENGTH]; @@ -446,8 +444,9 @@ static void perform_drop_gold(struct char_data *ch, int amount, byte mode, room_ #define VANISH(mode) ((mode == SCMD_DONATE || mode == SCMD_JUNK) ? \ " It vanishes in a puff of smoke!" : "") + static int perform_drop(struct char_data *ch, struct obj_data *obj, - byte mode, const char *sname, room_rnum RDR) + byte mode, const char *sname, room_rnum RDR) { char buf[MAX_STRING_LENGTH]; int value; @@ -496,8 +495,8 @@ static int perform_drop(struct char_data *ch, struct obj_data *obj, return (value); default: log("SYSERR: Incorrect argument %d passed to perform_drop.", mode); - /* SYSERR_DESC: This error comes from perform_drop() and is output when - * perform_drop() is called with an illegal 'mode' argument. */ + /* SYSERR_DESC: This error comes from perform_drop() and is output when + * perform_drop() is called with an illegal 'mode' argument. */ break; } @@ -521,10 +520,10 @@ ACMD(do_drop) case SCMD_DONATE: sname = "donate"; mode = SCMD_DONATE; - /* fail + double chance for room 1 */ + /* fail + double chance for room 1 */ num_don_rooms = (CONFIG_DON_ROOM_1 != NOWHERE) * 2 + - (CONFIG_DON_ROOM_2 != NOWHERE) + - (CONFIG_DON_ROOM_3 != NOWHERE) + 1 ; + (CONFIG_DON_ROOM_2 != NOWHERE) + + (CONFIG_DON_ROOM_3 != NOWHERE) + 1; switch (rand_number(0, num_don_rooms)) { case 0: mode = SCMD_JUNK; @@ -533,8 +532,12 @@ ACMD(do_drop) case 2: RDR = real_room(CONFIG_DON_ROOM_1); break; - case 3: RDR = real_room(CONFIG_DON_ROOM_2); break; - case 4: RDR = real_room(CONFIG_DON_ROOM_3); break; + case 3: + RDR = real_room(CONFIG_DON_ROOM_2); + break; + case 4: + RDR = real_room(CONFIG_DON_ROOM_3); + break; } if (RDR == NOWHERE) { @@ -568,7 +571,8 @@ ACMD(do_drop) next_obj = get_obj_in_list_vis(ch, arg, NULL, obj->next_content); amount += perform_drop(ch, obj, mode, sname, RDR); obj = next_obj; - } while (obj && --multi); + } + while (obj && --multi); } } else { dotmode = find_all_dots(arg); @@ -576,37 +580,37 @@ ACMD(do_drop) /* Can't junk or donate all */ if ((dotmode == FIND_ALL) && (subcmd == SCMD_JUNK || subcmd == SCMD_DONATE)) { if (subcmd == SCMD_JUNK) - send_to_char(ch, "Go to the dump if you want to junk EVERYTHING!\r\n"); + send_to_char(ch, "Go to the dump if you want to junk EVERYTHING!\r\n"); else - send_to_char(ch, "Go do the donation room if you want to donate EVERYTHING!\r\n"); + send_to_char(ch, "Go do the donation room if you want to donate EVERYTHING!\r\n"); return; } if (dotmode == FIND_ALL) { if (!ch->carrying) - send_to_char(ch, "You don't seem to be carrying anything.\r\n"); + send_to_char(ch, "You don't seem to be carrying anything.\r\n"); else - for (obj = ch->carrying; obj; obj = next_obj) { - next_obj = obj->next_content; - amount += perform_drop(ch, obj, mode, sname, RDR); - } + for (obj = ch->carrying; obj; obj = next_obj) { + next_obj = obj->next_content; + amount += perform_drop(ch, obj, mode, sname, RDR); + } } else if (dotmode == FIND_ALLDOT) { if (!*arg) { - send_to_char(ch, "What do you want to %s all of?\r\n", sname); - return; + send_to_char(ch, "What do you want to %s all of?\r\n", sname); + return; } if (!(obj = get_obj_in_list_vis(ch, arg, NULL, ch->carrying))) - send_to_char(ch, "You don't seem to have any %ss.\r\n", arg); + send_to_char(ch, "You don't seem to have any %ss.\r\n", arg); while (obj) { - next_obj = get_obj_in_list_vis(ch, arg, NULL, obj->next_content); - amount += perform_drop(ch, obj, mode, sname, RDR); - obj = next_obj; + next_obj = get_obj_in_list_vis(ch, arg, NULL, obj->next_content); + amount += perform_drop(ch, obj, mode, sname, RDR); + obj = next_obj; } } else { if (!(obj = get_obj_in_list_vis(ch, arg, NULL, ch->carrying))) - send_to_char(ch, "You don't seem to have %s %s.\r\n", AN(arg), arg); + send_to_char(ch, "You don't seem to have %s %s.\r\n", AN(arg), arg); else - amount += perform_drop(ch, obj, mode, sname, RDR); + amount += perform_drop(ch, obj, mode, sname, RDR); } } @@ -618,7 +622,7 @@ ACMD(do_drop) } static void perform_give(struct char_data *ch, struct char_data *vict, - struct obj_data *obj) + struct obj_data *obj) { if (!give_otrigger(obj, ch, vict)) return; @@ -633,7 +637,8 @@ static void perform_give(struct char_data *ch, struct char_data *vict, 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) && GET_LEVEL(ch) < LVL_IMMORT && GET_LEVEL(vict) < LVL_IMMORT) { + 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; } @@ -643,7 +648,7 @@ static void perform_give(struct char_data *ch, struct char_data *vict, act("$n gives you $p.", FALSE, ch, obj, vict, TO_VICT); act("$n gives $p to $N.", TRUE, ch, obj, vict, TO_NOTVICT); - autoquest_trigger_check( ch, vict, obj, AQ_OBJ_RETURN); + autoquest_trigger_check(ch, vict, obj, AQ_OBJ_RETURN); } /* utility function for give */ @@ -665,7 +670,7 @@ static struct char_data *give_find_vict(struct char_data *ch, char *arg) } static void perform_give_gold(struct char_data *ch, struct char_data *vict, - int amount) + int amount) { char buf[MAX_STRING_LENGTH]; @@ -687,7 +692,7 @@ static void perform_give_gold(struct char_data *ch, struct char_data *vict, if (IS_NPC(ch) || (GET_LEVEL(ch) < LVL_GOD)) decrease_gold(ch, amount); - + increase_gold(vict, amount); bribe_mtrigger(vict, ch, amount); } @@ -709,7 +714,7 @@ ACMD(do_give) if (!str_cmp("coins", arg) || !str_cmp("coin", arg)) { one_argument(argument, arg); if ((vict = give_find_vict(ch, arg)) != NULL) - perform_give_gold(ch, vict, amount); + perform_give_gold(ch, vict, amount); return; } else if (!*arg) /* Give multiple code. */ send_to_char(ch, "What do you want to give %d of?\r\n", amount); @@ -719,9 +724,9 @@ ACMD(do_give) send_to_char(ch, "You don't seem to have any %ss.\r\n", arg); else { while (obj && amount--) { - next_obj = get_obj_in_list_vis(ch, arg, NULL, obj->next_content); - perform_give(ch, vict, obj); - obj = next_obj; + next_obj = get_obj_in_list_vis(ch, arg, NULL, obj->next_content); + perform_give(ch, vict, obj); + obj = next_obj; } } } else { @@ -733,23 +738,23 @@ ACMD(do_give) dotmode = find_all_dots(arg); if (dotmode == FIND_INDIV) { if (!(obj = get_obj_in_list_vis(ch, arg, NULL, ch->carrying))) - send_to_char(ch, "You don't seem to have %s %s.\r\n", AN(arg), arg); + send_to_char(ch, "You don't seem to have %s %s.\r\n", AN(arg), arg); else - perform_give(ch, vict, obj); + perform_give(ch, vict, obj); } else { if (dotmode == FIND_ALLDOT && !*arg) { - send_to_char(ch, "All of what?\r\n"); - return; + send_to_char(ch, "All of what?\r\n"); + return; } if (!ch->carrying) - send_to_char(ch, "You don't seem to be holding anything.\r\n"); + send_to_char(ch, "You don't seem to be holding anything.\r\n"); else - for (obj = ch->carrying; obj; obj = next_obj) { - next_obj = obj->next_content; - if (CAN_SEE_OBJ(ch, obj) && - ((dotmode == FIND_ALL || isname(arg, obj->name)))) - perform_give(ch, vict, obj); - } + for (obj = ch->carrying; obj; obj = next_obj) { + next_obj = obj->next_content; + if (CAN_SEE_OBJ(ch, obj) && + ((dotmode == FIND_ALL || isname(arg, obj->name)))) + perform_give(ch, vict, obj); + } } } } @@ -786,12 +791,12 @@ void name_from_drinkcon(struct obj_data *obj) return; liqname = drinknames[GET_OBJ_VAL(obj, 2)]; - + remove_from_string(obj->name, liqname); new_name = right_trim_whitespace(obj->name); free(obj->name); obj->name = new_name; - + } void name_to_drinkcon(struct obj_data *obj, int type) @@ -826,22 +831,22 @@ ACMD(do_drink) if (!*arg) { char buf[MAX_STRING_LENGTH]; switch (SECT(IN_ROOM(ch))) { - case SECT_WATER_SWIM: - case SECT_WATER_NOSWIM: - case SECT_UNDERWATER: - if ((GET_COND(ch, HUNGER) > 20) && (GET_COND(ch, THIRST) > 0)) { - send_to_char(ch, "Your stomach can't contain anymore!\r\n"); - } - snprintf(buf, sizeof(buf), "$n takes a refreshing drink."); - act(buf, TRUE, ch, 0, 0, TO_ROOM); - send_to_char(ch, "You take a refreshing drink.\r\n"); - gain_condition(ch, THIRST, 1); - if (GET_COND(ch, THIRST) > 20) - send_to_char(ch, "You don't feel thirsty any more.\r\n"); - return; - default: - send_to_char(ch, "Drink from what?\r\n"); - return; + case SECT_WATER_SWIM: + case SECT_WATER_NOSWIM: + case SECT_UNDERWATER: + if ((GET_COND(ch, HUNGER) > 20) && (GET_COND(ch, THIRST) > 0)) { + send_to_char(ch, "Your stomach can't contain anymore!\r\n"); + } + snprintf(buf, sizeof(buf), "$n takes a refreshing drink."); + act(buf, TRUE, ch, 0, 0, TO_ROOM); + send_to_char(ch, "You take a refreshing drink.\r\n"); + gain_condition(ch, THIRST, 1); + if (GET_COND(ch, THIRST) > 20) + send_to_char(ch, "You don't feel thirsty any more.\r\n"); + return; + default: + send_to_char(ch, "Drink from what?\r\n"); + return; } } if (!(temp = get_obj_in_list_vis(ch, arg, NULL, ch->carrying))) { @@ -875,7 +880,7 @@ ACMD(do_drink) return; } - if (!consume_otrigger(temp, ch, OCMD_DRINK)) /* check trigger */ + if (!consume_otrigger(temp, ch, OCMD_DRINK)) /* check trigger */ return; if (subcmd == SCMD_DRINK) { @@ -905,8 +910,8 @@ ACMD(do_drink) weight_change_object(temp, -weight); /* Subtract amount */ } - gain_condition(ch, DRUNK, drink_aff[GET_OBJ_VAL(temp, 2)][DRUNK] * amount / 4); - gain_condition(ch, HUNGER, drink_aff[GET_OBJ_VAL(temp, 2)][HUNGER] * amount / 4); + gain_condition(ch, DRUNK, drink_aff[GET_OBJ_VAL(temp, 2)][DRUNK] * amount / 4); + gain_condition(ch, HUNGER, drink_aff[GET_OBJ_VAL(temp, 2)][HUNGER] * amount / 4); gain_condition(ch, THIRST, drink_aff[GET_OBJ_VAL(temp, 2)][THIRST] * amount / 4); if (GET_COND(ch, DRUNK) > 10) @@ -961,7 +966,7 @@ ACMD(do_eat) return; } if (subcmd == SCMD_TASTE && ((GET_OBJ_TYPE(food) == ITEM_DRINKCON) || - (GET_OBJ_TYPE(food) == ITEM_FOUNTAIN))) { + (GET_OBJ_TYPE(food) == ITEM_FOUNTAIN))) { do_drink(ch, argument, 0, SCMD_SIP); return; } @@ -1081,8 +1086,7 @@ ACMD(do_pour) GET_OBJ_VAL(from_obj, 1) = 0; GET_OBJ_VAL(from_obj, 2) = 0; GET_OBJ_VAL(from_obj, 3) = 0; - } - else + } else send_to_char(ch, "You can't possibly pour that container out!\r\n"); return; @@ -1092,7 +1096,7 @@ ACMD(do_pour) return; } if ((GET_OBJ_TYPE(to_obj) != ITEM_DRINKCON) && - (GET_OBJ_TYPE(to_obj) != ITEM_FOUNTAIN)) { + (GET_OBJ_TYPE(to_obj) != ITEM_FOUNTAIN)) { send_to_char(ch, "You can't pour anything into that.\r\n"); return; } @@ -1127,11 +1131,11 @@ ACMD(do_pour) /* Then how much to pour */ if (GET_OBJ_VAL(from_obj, 0) > 0) { GET_OBJ_VAL(from_obj, 1) -= (amount = - (GET_OBJ_VAL(to_obj, 0) - GET_OBJ_VAL(to_obj, 1))); + (GET_OBJ_VAL(to_obj, 0) - GET_OBJ_VAL(to_obj, 1))); GET_OBJ_VAL(to_obj, 1) = GET_OBJ_VAL(to_obj, 0); - if (GET_OBJ_VAL(from_obj, 1) < 0) { /* There was too little */ + if (GET_OBJ_VAL(from_obj, 1) < 0) { /* There was too little */ GET_OBJ_VAL(to_obj, 1) += GET_OBJ_VAL(from_obj, 1); amount += GET_OBJ_VAL(from_obj, 1); name_from_drinkcon(from_obj); @@ -1139,14 +1143,12 @@ ACMD(do_pour) GET_OBJ_VAL(from_obj, 2) = 0; GET_OBJ_VAL(from_obj, 3) = 0; } - } - else { + } else { GET_OBJ_VAL(to_obj, 1) = GET_OBJ_VAL(to_obj, 0); amount = GET_OBJ_VAL(to_obj, 0); } /* Poisoned? */ - GET_OBJ_VAL(to_obj, 3) = (GET_OBJ_VAL(to_obj, 3) || GET_OBJ_VAL(from_obj, 3)) -; + GET_OBJ_VAL(to_obj, 3) = (GET_OBJ_VAL(to_obj, 3) || GET_OBJ_VAL(from_obj, 3)); /* Weight change, except for unlimited. */ if (GET_OBJ_VAL(from_obj, 0) > 0) { weight_change_object(from_obj, -amount); @@ -1157,59 +1159,59 @@ ACMD(do_pour) static void wear_message(struct char_data *ch, struct obj_data *obj, int where) { const char *wear_messages[][2] = { - {"$n lights $p and holds it.", - "You light $p and hold it."}, + {"$n lights $p and holds it.", + "You light $p and hold it."}, - {"$n slides $p on to $s right ring finger.", - "You slide $p on to your right ring finger."}, + {"$n slides $p on to $s right ring finger.", + "You slide $p on to your right ring finger."}, - {"$n slides $p on to $s left ring finger.", - "You slide $p on to your left ring finger."}, + {"$n slides $p on to $s left ring finger.", + "You slide $p on to your left ring finger."}, - {"$n wears $p around $s neck.", - "You wear $p around your neck."}, + {"$n wears $p around $s neck.", + "You wear $p around your neck."}, - {"$n wears $p around $s neck.", - "You wear $p around your neck."}, + {"$n wears $p around $s neck.", + "You wear $p around your neck."}, - {"$n wears $p on $s body.", - "You wear $p on your body."}, + {"$n wears $p on $s body.", + "You wear $p on your body."}, - {"$n wears $p on $s head.", - "You wear $p on your head."}, + {"$n wears $p on $s head.", + "You wear $p on your head."}, - {"$n puts $p on $s legs.", - "You put $p on your legs."}, + {"$n puts $p on $s legs.", + "You put $p on your legs."}, - {"$n wears $p on $s feet.", - "You wear $p on your feet."}, + {"$n wears $p on $s feet.", + "You wear $p on your feet."}, - {"$n puts $p on $s hands.", - "You put $p on your hands."}, + {"$n puts $p on $s hands.", + "You put $p on your hands."}, - {"$n wears $p on $s arms.", - "You wear $p on your arms."}, + {"$n wears $p on $s arms.", + "You wear $p on your arms."}, - {"$n straps $p around $s arm as a shield.", - "You start to use $p as a shield."}, + {"$n straps $p around $s arm as a shield.", + "You start to use $p as a shield."}, - {"$n wears $p about $s body.", - "You wear $p around your body."}, + {"$n wears $p about $s body.", + "You wear $p around your body."}, - {"$n wears $p around $s waist.", - "You wear $p around your waist."}, + {"$n wears $p around $s waist.", + "You wear $p around your waist."}, - {"$n puts $p on around $s right wrist.", - "You put $p on around your right wrist."}, + {"$n puts $p on around $s right wrist.", + "You put $p on around your right wrist."}, - {"$n puts $p on around $s left wrist.", - "You put $p on around your left wrist."}, + {"$n puts $p on around $s left wrist.", + "You put $p on around your left wrist."}, - {"$n wields $p.", - "You wield $p."}, + {"$n wields $p.", + "You wield $p."}, - {"$n grabs $p.", - "You grab $p."} + {"$n grabs $p.", + "You grab $p."} }; act(wear_messages[where][0], TRUE, ch, obj, 0, TO_ROOM); @@ -1225,32 +1227,32 @@ static void perform_wear(struct char_data *ch, struct obj_data *obj, int where) */ int wear_bitvectors[] = { - ITEM_WEAR_TAKE, ITEM_WEAR_FINGER, ITEM_WEAR_FINGER, ITEM_WEAR_NECK, - ITEM_WEAR_NECK, ITEM_WEAR_BODY, ITEM_WEAR_HEAD, ITEM_WEAR_LEGS, - ITEM_WEAR_FEET, ITEM_WEAR_HANDS, ITEM_WEAR_ARMS, ITEM_WEAR_SHIELD, - ITEM_WEAR_ABOUT, ITEM_WEAR_WAIST, ITEM_WEAR_WRIST, ITEM_WEAR_WRIST, - ITEM_WEAR_WIELD, ITEM_WEAR_TAKE + ITEM_WEAR_TAKE, ITEM_WEAR_FINGER, ITEM_WEAR_FINGER, ITEM_WEAR_NECK, + ITEM_WEAR_NECK, ITEM_WEAR_BODY, ITEM_WEAR_HEAD, ITEM_WEAR_LEGS, + ITEM_WEAR_FEET, ITEM_WEAR_HANDS, ITEM_WEAR_ARMS, ITEM_WEAR_SHIELD, + ITEM_WEAR_ABOUT, ITEM_WEAR_WAIST, ITEM_WEAR_WRIST, ITEM_WEAR_WRIST, + ITEM_WEAR_WIELD, ITEM_WEAR_TAKE }; const char *already_wearing[] = { - "You're already using a light.\r\n", - "YOU SHOULD NEVER SEE THIS MESSAGE. PLEASE REPORT.\r\n", - "You're already wearing something on both of your ring fingers.\r\n", - "YOU SHOULD NEVER SEE THIS MESSAGE. PLEASE REPORT.\r\n", - "You can't wear anything else around your neck.\r\n", - "You're already wearing something on your body.\r\n", - "You're already wearing something on your head.\r\n", - "You're already wearing something on your legs.\r\n", - "You're already wearing something on your feet.\r\n", - "You're already wearing something on your hands.\r\n", - "You're already wearing something on your arms.\r\n", - "You're already using a shield.\r\n", - "You're already wearing something about your body.\r\n", - "You already have something around your waist.\r\n", - "YOU SHOULD NEVER SEE THIS MESSAGE. PLEASE REPORT.\r\n", - "You're already wearing something around both of your wrists.\r\n", - "You're already wielding a weapon.\r\n", - "You're already holding something.\r\n" + "You're already using a light.\r\n", + "YOU SHOULD NEVER SEE THIS MESSAGE. PLEASE REPORT.\r\n", + "You're already wearing something on both of your ring fingers.\r\n", + "YOU SHOULD NEVER SEE THIS MESSAGE. PLEASE REPORT.\r\n", + "You can't wear anything else around your neck.\r\n", + "You're already wearing something on your body.\r\n", + "You're already wearing something on your head.\r\n", + "You're already wearing something on your legs.\r\n", + "You're already wearing something on your feet.\r\n", + "You're already wearing something on your hands.\r\n", + "You're already wearing something on your arms.\r\n", + "You're already using a shield.\r\n", + "You're already wearing something about your body.\r\n", + "You already have something around your waist.\r\n", + "YOU SHOULD NEVER SEE THIS MESSAGE. PLEASE REPORT.\r\n", + "You're already wearing something around both of your wrists.\r\n", + "You're already wielding a weapon.\r\n", + "You're already holding something.\r\n" }; /* first, make sure that the wear position is valid. */ @@ -1282,40 +1284,52 @@ int find_eq_pos(struct char_data *ch, struct obj_data *obj, char *arg) int where = -1; const char *keywords[] = { - "!RESERVED!", - "finger", - "!RESERVED!", - "neck", - "!RESERVED!", - "body", - "head", - "legs", - "feet", - "hands", - "arms", - "shield", - "about", - "waist", - "wrist", - "!RESERVED!", - "!RESERVED!", - "!RESERVED!", - "\n" + "!RESERVED!", + "finger", + "!RESERVED!", + "neck", + "!RESERVED!", + "body", + "head", + "legs", + "feet", + "hands", + "arms", + "shield", + "about", + "waist", + "wrist", + "!RESERVED!", + "!RESERVED!", + "!RESERVED!", + "\n" }; if (!arg || !*arg) { - if (CAN_WEAR(obj, ITEM_WEAR_FINGER)) where = WEAR_FINGER_R; - if (CAN_WEAR(obj, ITEM_WEAR_NECK)) where = WEAR_NECK_1; - if (CAN_WEAR(obj, ITEM_WEAR_BODY)) where = WEAR_BODY; - if (CAN_WEAR(obj, ITEM_WEAR_HEAD)) where = WEAR_HEAD; - if (CAN_WEAR(obj, ITEM_WEAR_LEGS)) where = WEAR_LEGS; - if (CAN_WEAR(obj, ITEM_WEAR_FEET)) where = WEAR_FEET; - if (CAN_WEAR(obj, ITEM_WEAR_HANDS)) where = WEAR_HANDS; - if (CAN_WEAR(obj, ITEM_WEAR_ARMS)) where = WEAR_ARMS; - if (CAN_WEAR(obj, ITEM_WEAR_SHIELD)) where = WEAR_SHIELD; - if (CAN_WEAR(obj, ITEM_WEAR_ABOUT)) where = WEAR_ABOUT; - if (CAN_WEAR(obj, ITEM_WEAR_WAIST)) where = WEAR_WAIST; - if (CAN_WEAR(obj, ITEM_WEAR_WRIST)) where = WEAR_WRIST_R; + if (CAN_WEAR(obj, ITEM_WEAR_FINGER)) + where = WEAR_FINGER_R; + if (CAN_WEAR(obj, ITEM_WEAR_NECK)) + where = WEAR_NECK_1; + if (CAN_WEAR(obj, ITEM_WEAR_BODY)) + where = WEAR_BODY; + if (CAN_WEAR(obj, ITEM_WEAR_HEAD)) + where = WEAR_HEAD; + if (CAN_WEAR(obj, ITEM_WEAR_LEGS)) + where = WEAR_LEGS; + if (CAN_WEAR(obj, ITEM_WEAR_FEET)) + where = WEAR_FEET; + if (CAN_WEAR(obj, ITEM_WEAR_HANDS)) + where = WEAR_HANDS; + if (CAN_WEAR(obj, ITEM_WEAR_ARMS)) + where = WEAR_ARMS; + if (CAN_WEAR(obj, ITEM_WEAR_SHIELD)) + where = WEAR_SHIELD; + if (CAN_WEAR(obj, ITEM_WEAR_ABOUT)) + where = WEAR_ABOUT; + if (CAN_WEAR(obj, ITEM_WEAR_WAIST)) + where = WEAR_WAIST; + if (CAN_WEAR(obj, ITEM_WEAR_WRIST)) + where = WEAR_WRIST_R; } else if ((where = search_block(arg, keywords, FALSE)) < 0) send_to_char(ch, "'%s'? What part of your body is THAT?\r\n", arg); @@ -1349,8 +1363,8 @@ ACMD(do_wear) send_to_char(ch, "You are not experienced enough to use that.\r\n"); else { items_worn++; - perform_wear(ch, obj, where); - } + perform_wear(ch, obj, where); + } } } if (!items_worn) @@ -1366,12 +1380,12 @@ ACMD(do_wear) send_to_char(ch, "You are not experienced enough to use that.\r\n"); else while (obj) { - next_obj = get_obj_in_list_vis(ch, arg1, NULL, obj->next_content); - if ((where = find_eq_pos(ch, obj, 0)) >= 0) - perform_wear(ch, obj, where); - else - act("You can't wear $p.", FALSE, ch, obj, 0, TO_CHAR); - obj = next_obj; + next_obj = get_obj_in_list_vis(ch, arg1, NULL, obj->next_content); + if ((where = find_eq_pos(ch, obj, 0)) >= 0) + perform_wear(ch, obj, where); + else + act("You can't wear $p.", FALSE, ch, obj, 0, TO_CHAR); + obj = next_obj; } } else { if (!(obj = get_obj_in_list_vis(ch, arg1, NULL, ch->carrying))) @@ -1380,9 +1394,9 @@ ACMD(do_wear) send_to_char(ch, "You are not experienced enough to use that.\r\n"); else { if ((where = find_eq_pos(ch, obj, arg2)) >= 0) - perform_wear(ch, obj, where); + perform_wear(ch, obj, where); else if (!*arg2) - act("You can't wear $p.", FALSE, ch, obj, 0, TO_CHAR); + act("You can't wear $p.", FALSE, ch, obj, 0, TO_CHAR); } } } @@ -1428,11 +1442,11 @@ ACMD(do_grab) perform_wear(ch, obj, WEAR_LIGHT); else { if (!CAN_WEAR(obj, ITEM_WEAR_HOLD) && GET_OBJ_TYPE(obj) != ITEM_WAND && - GET_OBJ_TYPE(obj) != ITEM_STAFF && GET_OBJ_TYPE(obj) != ITEM_SCROLL && - GET_OBJ_TYPE(obj) != ITEM_POTION) - send_to_char(ch, "You can't hold that.\r\n"); + GET_OBJ_TYPE(obj) != ITEM_STAFF && GET_OBJ_TYPE(obj) != ITEM_SCROLL && + GET_OBJ_TYPE(obj) != ITEM_POTION) + send_to_char(ch, "You can't hold that.\r\n"); else - perform_wear(ch, obj, WEAR_HOLD); + perform_wear(ch, obj, WEAR_HOLD); } } } @@ -1447,7 +1461,7 @@ static void perform_remove(struct char_data *ch, int pos) * (location) to remove an object from. */ else if (OBJ_FLAGGED(obj, ITEM_NODROP) && !PRF_FLAGGED(ch, PRF_NOHASSLE)) act("You can't remove $p, it must be CURSED!", FALSE, ch, obj, 0, TO_CHAR); - else if (IS_CARRYING_N(ch) >= CAN_CARRY_N(ch)&& !PRF_FLAGGED(ch, PRF_NOHASSLE)) + else if (IS_CARRYING_N(ch) >= CAN_CARRY_N(ch) && !PRF_FLAGGED(ch, PRF_NOHASSLE)) act("$p: you can't carry that many items!", FALSE, ch, obj, 0, TO_CHAR); else { if (!remove_otrigger(obj, ch)) @@ -1476,8 +1490,8 @@ ACMD(do_remove) found = 0; for (i = 0; i < NUM_WEARS; i++) if (GET_EQ(ch, i)) { - perform_remove(ch, i); - found = 1; + perform_remove(ch, i); + found = 1; } if (!found) send_to_char(ch, "You're not using anything.\r\n"); @@ -1487,13 +1501,13 @@ ACMD(do_remove) else { found = 0; for (i = 0; i < NUM_WEARS; i++) - if (GET_EQ(ch, i) && CAN_SEE_OBJ(ch, GET_EQ(ch, i)) && - isname(arg, GET_EQ(ch, i)->name)) { - perform_remove(ch, i); - found = 1; - } + if (GET_EQ(ch, i) && CAN_SEE_OBJ(ch, GET_EQ(ch, i)) && + isname(arg, GET_EQ(ch, i)->name)) { + perform_remove(ch, i); + found = 1; + } if (!found) - send_to_char(ch, "You don't seem to be using any %ss.\r\n", arg); + send_to_char(ch, "You don't seem to be using any %ss.\r\n", arg); } } else { if ((i = get_obj_pos_in_equip_vis(ch, arg, NULL, ch->equipment)) < 0) @@ -1514,8 +1528,9 @@ ACMD(do_sac) send_to_char(ch, "Sacrifice what?\n\r"); return; } - - if (!(j = get_obj_in_list_vis(ch, arg, NULL, world[IN_ROOM(ch)].contents)) && (!(j = get_obj_in_list_vis(ch, arg, NULL, ch->carrying)))) { + + if (!(j = get_obj_in_list_vis(ch, arg, NULL, world[IN_ROOM(ch)].contents)) && (!( + j = get_obj_in_list_vis(ch, arg, NULL, ch->carrying)))) { send_to_char(ch, "It doesn't seem to be here.\n\r"); return; } @@ -1525,39 +1540,43 @@ ACMD(do_sac) return; } - act("$n sacrifices $p.", FALSE, ch, j, 0, TO_ROOM); + act("$n sacrifices $p.", FALSE, ch, j, 0, TO_ROOM); switch (rand_number(0, 5)) { - case 0: - send_to_char(ch, "You sacrifice %s to the Gods.\r\nYou receive one gold coin for your humility.\r\n", GET_OBJ_SHORT(j)); - increase_gold(ch, 1); + case 0: + send_to_char(ch, "You sacrifice %s to the Gods.\r\nYou receive one gold coin for your humility.\r\n", + GET_OBJ_SHORT(j)); + increase_gold(ch, 1); break; - case 1: - send_to_char(ch, "You sacrifice %s to the Gods.\r\nThe Gods ignore your sacrifice.\r\n", GET_OBJ_SHORT(j)); + case 1: + send_to_char(ch, "You sacrifice %s to the Gods.\r\nThe Gods ignore your sacrifice.\r\n", GET_OBJ_SHORT(j)); break; - case 2: - send_to_char(ch, "You sacrifice %s to the Gods.\r\nThe gods give you %d experience points.\r\n", GET_OBJ_SHORT(j), 1+2*GET_OBJ_LEVEL(j)); - GET_EXP(ch) += (1+2*GET_OBJ_LEVEL(j)); + case 2: + send_to_char(ch, "You sacrifice %s to the Gods.\r\nThe gods give you %d experience points.\r\n", GET_OBJ_SHORT(j), + 1 + 2 * GET_OBJ_LEVEL(j)); + GET_EXP(ch) += (1 + 2 * GET_OBJ_LEVEL(j)); break; - case 3: - send_to_char(ch, "You sacrifice %s to the Gods.\r\nYou receive %d experience points.\r\n", GET_OBJ_SHORT(j), 1+GET_OBJ_LEVEL(j)); - GET_EXP(ch) += (1+GET_OBJ_LEVEL(j)); + case 3: + send_to_char(ch, "You sacrifice %s to the Gods.\r\nYou receive %d experience points.\r\n", GET_OBJ_SHORT(j), + 1 + GET_OBJ_LEVEL(j)); + GET_EXP(ch) += (1 + GET_OBJ_LEVEL(j)); break; - case 4: - send_to_char(ch, "Your sacrifice to the Gods is rewarded with %d gold coins.\r\n", 1+GET_OBJ_LEVEL(j)); - increase_gold(ch, (1+GET_OBJ_LEVEL(j))); + case 4: + send_to_char(ch, "Your sacrifice to the Gods is rewarded with %d gold coins.\r\n", 1 + GET_OBJ_LEVEL(j)); + increase_gold(ch, (1 + GET_OBJ_LEVEL(j))); break; - case 5: - send_to_char(ch, "Your sacrifice to the Gods is rewarded with %d gold coins\r\n", (1+2*GET_OBJ_LEVEL(j))); - increase_gold(ch, (1+2*GET_OBJ_LEVEL(j))); + case 5: + send_to_char(ch, "Your sacrifice to the Gods is rewarded with %d gold coins\r\n", (1 + 2 * GET_OBJ_LEVEL(j))); + increase_gold(ch, (1 + 2 * GET_OBJ_LEVEL(j))); break; - default: - send_to_char(ch, "You sacrifice %s to the Gods.\r\nYou receive one gold coin for your humility.\r\n",GET_OBJ_SHORT(j)); - increase_gold(ch, 1); + default: + send_to_char(ch, "You sacrifice %s to the Gods.\r\nYou receive one gold coin for your humility.\r\n", + GET_OBJ_SHORT(j)); + increase_gold(ch, 1); break; } for (jj = j->contains; jj; jj = next_thing2) { - next_thing2 = jj->next_content; /* Next in inventory */ + next_thing2 = jj->next_content; /* Next in inventory */ obj_from_obj(jj); if (j->carried_by) diff --git a/src/act.movement.c b/src/act.movement.c index a1ba0de..c0d0a0e 100644 --- a/src/act.movement.c +++ b/src/act.movement.c @@ -166,8 +166,7 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check) return 0; /* Charm effect: Does it override the movement? */ - if (AFF_FLAGGED(ch, AFF_CHARM) && ch->master && was_in == IN_ROOM(ch->master)) - { + if (AFF_FLAGGED(ch, AFF_CHARM) && ch->master && was_in == IN_ROOM(ch->master)) { send_to_char(ch, "The thought of leaving your master makes you weep.\r\n"); act("$n bursts into tears.", FALSE, ch, 0, 0, TO_ROOM); return (0); @@ -175,28 +174,23 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check) /* Water, No Swimming Rooms: Does the deep water prevent movement? */ if ((SECT(was_in) == SECT_WATER_NOSWIM) || - (SECT(going_to) == SECT_WATER_NOSWIM)) - { - if (!has_boat(ch)) - { + (SECT(going_to) == SECT_WATER_NOSWIM)) { + if (!has_boat(ch)) { send_to_char(ch, "You need a boat to go there.\r\n"); return (0); } } /* Flying Required: Does lack of flying prevent movement? */ - if ((SECT(was_in) == SECT_FLYING) || (SECT(going_to) == SECT_FLYING)) - { - if (!has_flight(ch)) - { + if ((SECT(was_in) == SECT_FLYING) || (SECT(going_to) == SECT_FLYING)) { + if (!has_flight(ch)) { send_to_char(ch, "You need to be flying to go there!\r\n"); return (0); } } /* Underwater Room: Does lack of underwater breathing prevent movement? */ - if ((SECT(was_in) == SECT_UNDERWATER) || (SECT(going_to) == SECT_UNDERWATER)) - { + if ((SECT(was_in) == SECT_UNDERWATER) || (SECT(going_to) == SECT_UNDERWATER)) { if (!has_scuba(ch) && !IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_NOHASSLE)) { send_to_char(ch, "You need to be able to breathe water to go there!\r\n"); return (0); @@ -204,10 +198,8 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check) } /* Houses: Can the player walk into the house? */ - if (ROOM_FLAGGED(was_in, ROOM_ATRIUM)) - { - if (!House_can_enter(ch, GET_ROOM_VNUM(going_to))) - { + if (ROOM_FLAGGED(was_in, ROOM_ATRIUM)) { + if (!House_can_enter(ch, GET_ROOM_VNUM(going_to))) { send_to_char(ch, "That's private property -- no trespassing!\r\n"); return (0); } @@ -223,15 +215,15 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check) send_to_char(ch, "A mysterious barrier forces you back! That area is off-limits.\r\n"); return (0); } - if (ZONE_FLAGGED(GET_ROOM_ZONE(going_to), ZONE_NOIMMORT) && (GET_LEVEL(ch) >= LVL_IMMORT) && (GET_LEVEL(ch) < LVL_GRGOD)) { + if (ZONE_FLAGGED(GET_ROOM_ZONE(going_to), ZONE_NOIMMORT) && (GET_LEVEL(ch) >= LVL_IMMORT) && ( + GET_LEVEL(ch) < LVL_GRGOD)) { send_to_char(ch, "A mysterious barrier forces you back! That area is off-limits.\r\n"); return (0); } /* Room Size Capacity: Is the room full of people already? */ if (ROOM_FLAGGED(going_to, ROOM_TUNNEL) && - num_pc_in_room(&(world[going_to])) >= CONFIG_TUNNEL_SIZE) - { + num_pc_in_room(&(world[going_to])) >= CONFIG_TUNNEL_SIZE) { if (CONFIG_TUNNEL_SIZE > 1) send_to_char(ch, "There isn't enough room for you to go there!\r\n"); else @@ -240,8 +232,7 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check) } /* Room Level Requirements: Is ch privileged enough to enter the room? */ - if (ROOM_FLAGGED(going_to, ROOM_GODROOM) && GET_LEVEL(ch) < LVL_GOD) - { + if (ROOM_FLAGGED(going_to, ROOM_GODROOM) && GET_LEVEL(ch) < LVL_GOD) { send_to_char(ch, "You aren't godly enough to use that room!\r\n"); return (0); } @@ -250,11 +241,10 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check) * move points. */ /* move points needed is avg. move loss for src and destination sect type */ need_movement = (movement_loss[SECT(was_in)] + - movement_loss[SECT(going_to)]) / 2; + movement_loss[SECT(going_to)]) / 2; /* Move Point Requirement Check */ - if (GET_MOVE(ch) < need_movement && !IS_NPC(ch)) - { + if (GET_MOVE(ch) < need_movement && !IS_NPC(ch)) { if (need_specials_check && ch->master) send_to_char(ch, "You are too exhausted to follow.\r\n"); else @@ -274,8 +264,7 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check) GET_MOVE(ch) -= need_movement; /* Generate the leave message and display to others in the was_in room. */ - if (!AFF_FLAGGED(ch, AFF_SNEAK)) - { + if (!AFF_FLAGGED(ch, AFF_SNEAK)) { snprintf(leave_message, sizeof(leave_message), "$n leaves %s.", dirs[dir]); act(leave_message, TRUE, ch, 0, 0, TO_ROOM); } @@ -307,9 +296,9 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check) look_at_room(ch, 0); /* ... and Kill the player if the room is a death trap. */ - if (ROOM_FLAGGED(going_to, ROOM_DEATH) && GET_LEVEL(ch) < LVL_IMMORT) - { - mudlog(BRF, LVL_IMMORT, TRUE, "%s hit death trap #%d (%s)", GET_NAME(ch), GET_ROOM_VNUM(going_to), world[going_to].name); + if (ROOM_FLAGGED(going_to, ROOM_DEATH) && GET_LEVEL(ch) < LVL_IMMORT) { + mudlog(BRF, LVL_IMMORT, TRUE, "%s hit death trap #%d (%s)", GET_NAME(ch), GET_ROOM_VNUM(going_to), + world[going_to].name); death_cry(ch); extract_char(ch); return (0); @@ -319,15 +308,13 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check) /* Fire memory and greet triggers, check and see if the greet trigger * prevents movement, and if so, move the player back to the previous room. */ entry_memory_mtrigger(ch); - if (!greet_mtrigger(ch, dir)) - { + if (!greet_mtrigger(ch, dir)) { char_from_room(ch); char_to_room(ch, was_in); look_at_room(ch, 0); /* Failed move, return a failure */ return (0); - } - else + } else greet_memory_mtrigger(ch); /*---------------------------------------------------------------------*/ /* End: Post-move operations. */ @@ -348,7 +335,8 @@ int perform_move(struct char_data *ch, int dir, int need_specials_check) send_to_char(ch, "Alas, you cannot go that way...\r\n"); else if ((!EXIT(ch, dir) && !buildwalk(ch, dir)) || EXIT(ch, dir)->to_room == NOWHERE) send_to_char(ch, "Alas, you cannot go that way...\r\n"); - else if (EXIT_FLAGGED(EXIT(ch, dir), EX_CLOSED) && (GET_LEVEL(ch) < LVL_IMMORT || (!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_NOHASSLE)))) { + else if (EXIT_FLAGGED(EXIT(ch, dir), EX_CLOSED) && (GET_LEVEL(ch) < LVL_IMMORT || ( + !IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_NOHASSLE)))) { if (EXIT(ch, dir)->keyword) send_to_char(ch, "The %s seems to be closed.\r\n", fname(EXIT(ch, dir)->keyword)); else @@ -364,9 +352,9 @@ int perform_move(struct char_data *ch, int dir, int need_specials_check) for (k = ch->followers; k; k = next) { next = k->next; if ((IN_ROOM(k->follower) == was_in) && - (GET_POS(k->follower) >= POS_STANDING)) { - act("You follow $N.\r\n", FALSE, k->follower, 0, ch, TO_CHAR); - perform_move(k->follower, dir, 1); + (GET_POS(k->follower) >= POS_STANDING)) { + act("You follow $N.\r\n", FALSE, k->follower, 0, ch, TO_CHAR); + perform_move(k->follower, dir, 1); } } return (1); @@ -384,14 +372,14 @@ static int find_door(struct char_data *ch, const char *type, char *dir, const ch { int door; - if (*dir) { /* a direction was specified */ - if ((door = search_block(dir, dirs, FALSE)) == -1) { /* Partial Match */ + if (*dir) { /* a direction was specified */ + if ((door = search_block(dir, dirs, FALSE)) == -1) { /* Partial Match */ if ((door = search_block(dir, autoexits, FALSE)) == -1) { /* Check 'short' dirs too */ send_to_char(ch, "That's not a direction.\r\n"); return (-1); } } - if (EXIT(ch, door)) { /* Braces added according to indent. -gg */ + if (EXIT(ch, door)) { /* Braces added according to indent. -gg */ if (EXIT(ch, door)->keyword) { if (is_name(type, EXIT(ch, door)->keyword)) return (door); @@ -400,40 +388,34 @@ static int find_door(struct char_data *ch, const char *type, char *dir, const ch return (-1); } } else - return (door); + return (door); } else { send_to_char(ch, "I really don't see how you can %s anything there.\r\n", cmdname); return (-1); } - } else { /* try to locate the keyword */ + } else { /* try to locate the keyword */ if (!*type) { send_to_char(ch, "What is it you want to %s?\r\n", cmdname); return (-1); } - for (door = 0; door < DIR_COUNT; door++) - { - if (EXIT(ch, door)) - { - if (EXIT(ch, door)->keyword) - { - if (isname(type, EXIT(ch, door)->keyword)) - { + for (door = 0; door < DIR_COUNT; door++) { + if (EXIT(ch, 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")) - { + 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))) ) + } 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))) ) + 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)) ) + 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)) ) + else if ((is_abbrev(cmdname, "pick")) && (IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED))) return door; } } @@ -483,20 +465,20 @@ int has_key(struct char_data *ch, obj_vnum key) /* cmd_door is required external from act.movement.c */ const char *cmd_door[] = { - "open", - "close", - "unlock", - "lock", - "pick" + "open", + "close", + "unlock", + "lock", + "pick" }; static const int flags_door[] = { - NEED_CLOSED | NEED_UNLOCKED, - NEED_OPEN, - NEED_CLOSED | NEED_LOCKED, - NEED_CLOSED | NEED_UNLOCKED, - NEED_CLOSED | NEED_LOCKED + NEED_CLOSED | NEED_UNLOCKED, + NEED_OPEN, + NEED_CLOSED | NEED_LOCKED, + NEED_CLOSED | NEED_UNLOCKED, + NEED_CLOSED | NEED_LOCKED }; #define EXITN(room, door) (world[room].dir_option[door]) @@ -576,15 +558,15 @@ static void do_doorcmd(struct char_data *ch, struct obj_data *obj, int door, int /* Notify the room. */ if (len < sizeof(buf)) snprintf(buf + len, sizeof(buf) - len, "%s%s.", - obj ? "" : "the ", obj ? "$p" : EXIT(ch, door)->keyword ? "$F" : "door"); + obj ? "" : "the ", obj ? "$p" : EXIT(ch, door)->keyword ? "$F" : "door"); if (!obj || IN_ROOM(obj) != NOWHERE) act(buf, FALSE, ch, obj, obj ? 0 : EXIT(ch, door)->keyword, TO_ROOM); /* Notify the other room */ if (back && (scmd == SCMD_OPEN || scmd == SCMD_CLOSE)) - send_to_room(EXIT(ch, door)->to_room, "The %s is %s%s from the other side.\r\n", - back->keyword ? fname(back->keyword) : "door", cmd_door[scmd], - scmd == SCMD_CLOSE ? "d" : "ed"); + send_to_room(EXIT(ch, door)->to_room, "The %s is %s%s from the other side.\r\n", + back->keyword ? fname(back->keyword) : "door", cmd_door[scmd], + scmd == SCMD_CLOSE ? "d" : "ed"); } static int ok_pick(struct char_data *ch, obj_vnum keynum, int pickproof, int scmd) @@ -655,18 +637,16 @@ ACMD(do_gen_door) send_to_char(ch, "But it's currently open!\r\n"); 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) && ((!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOKEY))) && (has_key(ch, keynum)) ) - { + else if (!(DOOR_IS_UNLOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_UNLOCKED) && (( + !IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOKEY))) && (has_key(ch, keynum))) { send_to_char(ch, "It is locked, but you have the key.\r\n"); do_doorcmd(ch, obj, door, SCMD_UNLOCK); do_doorcmd(ch, obj, door, subcmd); - } - else if (!(DOOR_IS_UNLOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_UNLOCKED) && ((!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOKEY))) && (!has_key(ch, keynum)) ) - { + } else if (!(DOOR_IS_UNLOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_UNLOCKED) && (( + !IS_NPC(ch) && 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 || (!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_NOHASSLE)))) + } else if (!(DOOR_IS_UNLOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_UNLOCKED) && + (GET_LEVEL(ch) < LVL_IMMORT || (!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_NOHASSLE)))) send_to_char(ch, "It seems to be locked.\r\n"); else if (!has_key(ch, keynum) && (GET_LEVEL(ch) < LVL_GOD) && ((subcmd == SCMD_LOCK) || (subcmd == SCMD_UNLOCK))) send_to_char(ch, "You don't seem to have the proper key.\r\n"); @@ -683,7 +663,7 @@ ACMD(do_enter) one_argument(argument, buf); - if (*buf) { /* an argument was supplied, search for door + if (*buf) { /* an argument was supplied, search for door * keyword */ for (door = 0; door < DIR_COUNT; door++) if (EXIT(ch, door)) @@ -699,12 +679,12 @@ ACMD(do_enter) /* try to locate an entrance */ for (door = 0; door < DIR_COUNT; door++) if (EXIT(ch, door)) - if (EXIT(ch, door)->to_room != NOWHERE) - if (!EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) && - ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_INDOORS)) { - perform_move(ch, door, 1); - return; - } + if (EXIT(ch, door)->to_room != NOWHERE) + if (!EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) && + ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_INDOORS)) { + perform_move(ch, door, 1); + return; + } send_to_char(ch, "You can't seem to find anything to enter.\r\n"); } } @@ -718,12 +698,12 @@ ACMD(do_leave) else { for (door = 0; door < DIR_COUNT; door++) if (EXIT(ch, door)) - if (EXIT(ch, door)->to_room != NOWHERE) - if (!EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) && - !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_INDOORS)) { - perform_move(ch, door, 1); - return; - } + if (EXIT(ch, door)->to_room != NOWHERE) + if (!EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) && + !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_INDOORS)) { + perform_move(ch, door, 1); + return; + } send_to_char(ch, "I see no obvious exits to the outside.\r\n"); } } @@ -737,16 +717,16 @@ ACMD(do_stand) case POS_SITTING: send_to_char(ch, "You stand up.\r\n"); act("$n clambers to $s feet.", TRUE, ch, 0, 0, TO_ROOM); - /* Were they sitting in something? */ + /* Were they sitting in something? */ char_from_furniture(ch); - /* Will be sitting after a successful bash and may still be fighting. */ + /* Will be sitting after a successful bash and may still be fighting. */ GET_POS(ch) = FIGHTING(ch) ? POS_FIGHTING : POS_STANDING; break; case POS_RESTING: send_to_char(ch, "You stop resting, and stand up.\r\n"); act("$n stops resting, and clambers on $s feet.", TRUE, ch, 0, 0, TO_ROOM); GET_POS(ch) = POS_STANDING; - /* Were they sitting in something. */ + /* Were they sitting in something. */ char_from_furniture(ch); break; case POS_SLEEPING: @@ -758,7 +738,7 @@ ACMD(do_stand) default: send_to_char(ch, "You stop floating around, and put your feet on the ground.\r\n"); act("$n stops floating around, and puts $s feet on the ground.", - TRUE, ch, 0, 0, TO_ROOM); + TRUE, ch, 0, 0, TO_ROOM); GET_POS(ch) = POS_STANDING; break; } @@ -799,7 +779,7 @@ ACMD(do_sit) } else { if (OBJ_SAT_IN_BY(furniture) == NULL) OBJ_SAT_IN_BY(furniture) = ch; - for (tempch = OBJ_SAT_IN_BY(furniture); tempch != ch ; tempch = NEXT_SITTING(tempch)) { + for (tempch = OBJ_SAT_IN_BY(furniture); tempch != ch; tempch = NEXT_SITTING(tempch)) { if (NEXT_SITTING(tempch)) continue; NEXT_SITTING(tempch) = ch; @@ -884,7 +864,7 @@ ACMD(do_sleep) default: send_to_char(ch, "You stop floating around, and lie down to sleep.\r\n"); act("$n stops floating around, and lie down to sleep.", - TRUE, ch, 0, 0, TO_ROOM); + TRUE, ch, 0, 0, TO_ROOM); GET_POS(ch) = POS_SLEEPING; break; } @@ -942,9 +922,9 @@ ACMD(do_follow) return; } } else { - if (ch->master != (char_data*) NULL) { - send_to_char(ch, "You are following %s.\r\n", - GET_NAME(ch->master)); + if (ch->master != (char_data *)NULL) { + send_to_char(ch, "You are following %s.\r\n", + GET_NAME(ch->master)); } else { send_to_char(ch, "Whom do you wish to follow?\r\n"); } @@ -957,7 +937,7 @@ ACMD(do_follow) } if (AFF_FLAGGED(ch, AFF_CHARM) && (ch->master)) { act("But you only feel like following $N!", FALSE, ch, 0, ch->master, TO_CHAR); - } else { /* Not Charmed follow person */ + } else { /* Not Charmed follow person */ if (leader == ch) { if (!ch->master) { send_to_char(ch, "You are already following yourself.\r\n"); @@ -980,9 +960,9 @@ ACMD(do_follow) ACMD(do_unfollow) { if (ch->master) { - if (AFF_FLAGGED(ch, AFF_CHARM)) { - send_to_char(ch, "You feel compelled to follow %s.\r\n", - GET_NAME(ch->master)); + if (AFF_FLAGGED(ch, AFF_CHARM)) { + send_to_char(ch, "You feel compelled to follow %s.\r\n", + GET_NAME(ch->master)); } else { stop_follower(ch); } diff --git a/src/act.offensive.c b/src/act.offensive.c index cb54edd..33eb6a0 100644 --- a/src/act.offensive.c +++ b/src/act.offensive.c @@ -46,14 +46,14 @@ ACMD(do_assist) opponent = FIGHTING(helpee); else for (opponent = world[IN_ROOM(ch)].people; - opponent && (FIGHTING(opponent) != helpee); - opponent = opponent->next_in_room); + opponent && (FIGHTING(opponent) != helpee); + opponent = opponent->next_in_room); if (!opponent) act("But nobody is fighting $M!", FALSE, ch, 0, helpee, TO_CHAR); else if (!CAN_SEE(ch, opponent)) act("You can't see who is fighting $M!", FALSE, ch, 0, helpee, TO_CHAR); - /* prevent accidental pkill */ + /* prevent accidental pkill */ else if (!CONFIG_PK_ALLOWED && !IS_NPC(opponent)) send_to_char(ch, "You cannot kill other players.\r\n"); else { @@ -70,7 +70,7 @@ ACMD(do_hit) char arg[MAX_INPUT_LENGTH]; struct char_data *vict; - one_argument(argument, arg); + one_argument(argument, arg); if (!*arg) send_to_char(ch, "Hit who?\r\n"); @@ -82,17 +82,18 @@ ACMD(do_hit) } else if (AFF_FLAGGED(ch, AFF_CHARM) && (ch->master == vict)) act("$N is just such a good friend, you simply can't hit $M.", FALSE, ch, 0, vict, TO_CHAR); else { - if (!CONFIG_PK_ALLOWED && !IS_NPC(vict) && !IS_NPC(ch)) + if (!CONFIG_PK_ALLOWED && !IS_NPC(vict) && !IS_NPC(ch)) check_killer(ch, vict); - if ((GET_POS(ch) == POS_STANDING) && (vict != FIGHTING(ch))) { - if (GET_DEX(ch) > GET_DEX(vict) || (GET_DEX(ch) == GET_DEX(vict) && rand_number(1, 2) == 1)) /* if faster */ - hit(ch, vict, TYPE_UNDEFINED); /* first */ - else hit(vict, ch, TYPE_UNDEFINED); /* or the victim is first */ - WAIT_STATE(ch, PULSE_VIOLENCE + 2); - } else - send_to_char(ch, "You're fighting the best you can!\r\n"); - } + if ((GET_POS(ch) == POS_STANDING) && (vict != FIGHTING(ch))) { + if (GET_DEX(ch) > GET_DEX(vict) || (GET_DEX(ch) == GET_DEX(vict) && rand_number(1, 2) == 1)) /* if faster */ + hit(ch, vict, TYPE_UNDEFINED); /* first */ + else + hit(vict, ch, TYPE_UNDEFINED); /* or the victim is first */ + WAIT_STATE(ch, PULSE_VIOLENCE + 2); + } else + send_to_char(ch, "You're fighting the best you can!\r\n"); + } } ACMD(do_kill) @@ -164,7 +165,7 @@ ACMD(do_backstab) return; } - percent = rand_number(1, 101); /* 101% is a complete failure */ + percent = rand_number(1, 101); /* 101% is a complete failure */ prob = GET_SKILL(ch, SKILL_BACKSTAB); if (AWAKE(vict) && (percent > prob)) @@ -208,7 +209,7 @@ ACMD(do_order) send_to_char(ch, "%s", CONFIG_OK); command_interpreter(vict, message); } - } else { /* This is order "followers" */ + } else { /* This is order "followers" */ char buf[MAX_STRING_LENGTH]; snprintf(buf, sizeof(buf), "$n issues the order '%s'.", message); @@ -242,22 +243,22 @@ ACMD(do_flee) for (i = 0; i < 6; i++) { attempt = rand_number(0, DIR_COUNT - 1); /* Select a random direction */ if (CAN_GO(ch, attempt) && - !ROOM_FLAGGED(EXIT(ch, attempt)->to_room, ROOM_DEATH)) { + !ROOM_FLAGGED(EXIT(ch, attempt)->to_room, ROOM_DEATH)) { act("$n panics, and attempts to flee!", TRUE, ch, 0, 0, TO_ROOM); was_fighting = FIGHTING(ch); if (do_simple_move(ch, attempt, TRUE)) { - send_to_char(ch, "You flee head over heels.\r\n"); + send_to_char(ch, "You flee head over heels.\r\n"); if (was_fighting && !IS_NPC(ch)) { - loss = GET_MAX_HIT(was_fighting) - GET_HIT(was_fighting); - loss *= GET_LEVEL(was_fighting); - gain_exp(ch, -loss); + loss = GET_MAX_HIT(was_fighting) - GET_HIT(was_fighting); + loss *= GET_LEVEL(was_fighting); + gain_exp(ch, -loss); } - if (FIGHTING(ch)) - stop_fighting(ch); - if (was_fighting && ch == FIGHTING(was_fighting)) - stop_fighting(was_fighting); + if (FIGHTING(ch)) + stop_fighting(ch); + if (was_fighting && ch == FIGHTING(was_fighting)) + stop_fighting(was_fighting); } else { - act("$n tries to flee, but can't!", TRUE, ch, 0, 0, TO_ROOM); + act("$n tries to flee, but can't!", TRUE, ch, 0, 0, TO_ROOM); } return; } @@ -302,7 +303,7 @@ ACMD(do_bash) return; } - percent = rand_number(1, 101); /* 101% is a complete failure */ + percent = rand_number(1, 101); /* 101% is a complete failure */ prob = GET_SKILL(ch, SKILL_BASH); if (MOB_FLAGGED(vict, MOB_NOBASH)) @@ -318,7 +319,7 @@ ACMD(do_bash) * first to make sure they don't flee, then we can't bash them! So now * we only set them sitting if they didn't flee. -gg 9/21/98 */ - if (damage(ch, vict, 1, SKILL_BASH) > 0) { /* -1 = dead, 0 = miss */ + if (damage(ch, vict, 1, SKILL_BASH) > 0) { /* -1 = dead, 0 = miss */ WAIT_STATE(vict, PULSE_VIOLENCE); if (IN_ROOM(ch) == IN_ROOM(vict)) GET_POS(vict) = POS_SITTING; @@ -353,21 +354,21 @@ ACMD(do_rescue) return; } for (tmp_ch = world[IN_ROOM(ch)].people; tmp_ch && - (FIGHTING(tmp_ch) != vict); tmp_ch = tmp_ch->next_in_room); + (FIGHTING(tmp_ch) != vict); tmp_ch = tmp_ch->next_in_room); 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; - } + 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); return; } - percent = rand_number(1, 101); /* 101% is a complete failure */ + percent = rand_number(1, 101); /* 101% is a complete failure */ prob = GET_SKILL(ch, SKILL_RESCUE); if (percent > prob) { @@ -397,47 +398,47 @@ EVENTFUNC(event_whirlwind) struct mud_event_data *pMudEvent; struct list_data *room_list; int count; - + /* This is just a dummy check, but we'll do it anyway */ if (event_obj == NULL) return 0; - + /* For the sake of simplicity, we will place the event data in easily - * referenced pointers */ - pMudEvent = (struct mud_event_data *) event_obj; - ch = (struct char_data *) pMudEvent->pStruct; - + * referenced pointers */ + pMudEvent = (struct mud_event_data *)event_obj; + ch = (struct char_data *)pMudEvent->pStruct; + /* When using a list, we have to make sure to allocate the list as it * uses dynamic memory */ room_list = create_list(); - + /* We search through the "next_in_room", and grab all NPCs and add them * to our list */ - for (tch = world[IN_ROOM(ch)].people; tch; tch = tch->next_in_room) + for (tch = world[IN_ROOM(ch)].people; tch; tch = tch->next_in_room) if (IS_NPC(tch)) add_to_list(tch, room_list); - + /* If our list is empty or has "0" entries, we free it from memory and - * close off our event */ + * close off our event */ if (room_list->iSize == 0) { free_list(room_list); send_to_char(ch, "There is no one in the room to whirlwind!\r\n"); return 0; } - + /* We spit out some ugly colour, making use of the new colour options, * to let the player know they are performing their whirlwind strike */ send_to_char(ch, "\t[f313]You deliver a vicious \t[f014]\t[b451]WHIRLWIND!!!\tn\r\n"); - + /* Lets grab some a random NPC from the list, and hit() them up */ for (count = dice(1, 4); count > 0; count--) { tch = random_from_list(room_list); hit(ch, tch, TYPE_UNDEFINED); } - + /* Now that our attack is done, let's free out list */ free_list(room_list); - + /* The "return" of the event function is the time until the event is called * again. If we return 0, then the event is freed and removed from the list, but * any other numerical response will be the delay until the next call */ @@ -452,12 +453,12 @@ EVENTFUNC(event_whirlwind) * mud event and list systems. */ ACMD(do_whirlwind) { - + if (IS_NPC(ch) || !GET_SKILL(ch, SKILL_WHIRLWIND)) { send_to_char(ch, "You have no idea how.\r\n"); return; } - + if ROOM_FLAGGED(IN_ROOM(ch), ROOM_PEACEFUL) { send_to_char(ch, "This room just has such a peaceful, easy feeling...\r\n"); return; @@ -465,22 +466,22 @@ ACMD(do_whirlwind) if (GET_POS(ch) < POS_FIGHTING) { send_to_char(ch, "You must be on your feet to perform a whirlwind.\r\n"); - return; + return; } /* First thing we do is check to make sure the character is not in the middle * of a whirl wind attack. - * + * * "char_had_mud_event() will sift through the character's event list to see if * an event of type "eWHIRLWIND" currently exists. */ if (char_has_mud_event(ch, eWHIRLWIND)) { send_to_char(ch, "You are already attempting that!\r\n"); - return; + return; } send_to_char(ch, "You begin to spin rapidly in circles.\r\n"); act("$n begins to rapidly spin in a circle!", FALSE, ch, 0, 0, TO_ROOM); - + /* NEW_EVENT() will add a new mud event to the event list of the character. * This function below adds a new event of "eWHIRLWIND", to "ch", and passes "NULL" as * additional data. The event will be called in "3 * PASSES_PER_SEC" or 3 seconds */ @@ -528,11 +529,10 @@ ACMD(do_kick) ACMD(do_bandage) { char arg[MAX_INPUT_LENGTH]; - struct char_data * vict; + struct char_data *vict; int percent, prob; - if (!GET_SKILL(ch, SKILL_BANDAGE)) - { + if (!GET_SKILL(ch, SKILL_BANDAGE)) { send_to_char(ch, "You are unskilled in the art of bandaging.\r\n"); return; } @@ -556,21 +556,21 @@ ACMD(do_bandage) WAIT_STATE(ch, PULSE_VIOLENCE * 2); - percent = rand_number(1, 101); /* 101% is a complete failure */ + percent = rand_number(1, 101); /* 101% is a complete failure */ prob = GET_SKILL(ch, SKILL_BANDAGE); if (percent <= prob) { act("Your attempt to bandage fails.", FALSE, ch, 0, 0, TO_CHAR); - act("$n tries to bandage $N, but fails miserably.", TRUE, ch, - 0, vict, TO_NOTVICT); + act("$n tries to bandage $N, but fails miserably.", TRUE, ch, + 0, vict, TO_NOTVICT); damage(vict, vict, 2, TYPE_SUFFERING); return; } act("You successfully bandage $N.", FALSE, ch, 0, vict, TO_CHAR); - act("$n bandages $N, who looks a bit better now.", TRUE, ch, 0, - vict, TO_NOTVICT); + act("$n bandages $N, who looks a bit better now.", TRUE, ch, 0, + vict, TO_NOTVICT); act("Someone bandages you, and you feel a bit better now.", - FALSE, ch, 0, vict, TO_VICT); + FALSE, ch, 0, vict, TO_VICT); GET_HIT(vict) = 0; } diff --git a/src/act.other.c b/src/act.other.c index 37cc284..4798105 100644 --- a/src/act.other.c +++ b/src/act.other.c @@ -33,7 +33,7 @@ /* Local defined utility functions */ /* do_group utility functions */ static void print_group(struct char_data *ch); -static void display_group_list(struct char_data * ch); +static void display_group_list(struct char_data *ch); ACMD(do_quit) { @@ -72,7 +72,7 @@ ACMD(do_quit) ch->desc->snoop_by = NULL; } - extract_char(ch); /* Char is saved before extracting. */ + extract_char(ch); /* Char is saved before extracting. */ } } @@ -109,7 +109,7 @@ ACMD(do_sneak) if (AFF_FLAGGED(ch, AFF_SNEAK)) affect_from_char(ch, SKILL_SNEAK); - percent = rand_number(1, 101); /* 101% is a complete failure */ + percent = rand_number(1, 101); /* 101% is a complete failure */ if (percent > GET_SKILL(ch, SKILL_SNEAK) + dex_app_skill[GET_DEX(ch)].sneak) return; @@ -135,7 +135,7 @@ ACMD(do_hide) if (AFF_FLAGGED(ch, AFF_HIDE)) REMOVE_BIT_AR(AFF_FLAGS(ch), AFF_HIDE); - percent = rand_number(1, 101); /* 101% is a complete failure */ + percent = rand_number(1, 101); /* 101% is a complete failure */ if (percent > GET_SKILL(ch, SKILL_HIDE) + dex_app_skill[GET_DEX(ch)].hide) return; @@ -173,73 +173,73 @@ ACMD(do_steal) percent = rand_number(1, 101) - dex_app_skill[GET_DEX(ch)].p_pocket; if (GET_POS(vict) < POS_SLEEPING) - percent = -1; /* ALWAYS SUCCESS, unless heavy object. */ + percent = -1; /* ALWAYS SUCCESS, unless heavy object. */ if (!CONFIG_PT_ALLOWED && !IS_NPC(vict)) pcsteal = 1; - if (!AWAKE(vict)) /* Easier to steal from sleeping people. */ + if (!AWAKE(vict)) /* Easier to steal from sleeping people. */ percent -= 50; /* No stealing if not allowed. If it is no stealing from Imm's or Shopkeepers. */ if (GET_LEVEL(vict) >= LVL_IMMORT || pcsteal || GET_MOB_SPEC(vict) == shop_keeper) - percent = 101; /* Failure */ + percent = 101; /* Failure */ if (str_cmp(obj_name, "coins") && str_cmp(obj_name, "gold")) { if (!(obj = get_obj_in_list_vis(ch, obj_name, NULL, vict->carrying))) { for (eq_pos = 0; eq_pos < NUM_WEARS; eq_pos++) - if (GET_EQ(vict, eq_pos) && - (isname(obj_name, GET_EQ(vict, eq_pos)->name)) && - CAN_SEE_OBJ(ch, GET_EQ(vict, eq_pos))) { - obj = GET_EQ(vict, eq_pos); - break; - } + if (GET_EQ(vict, eq_pos) && + (isname(obj_name, GET_EQ(vict, eq_pos)->name)) && + CAN_SEE_OBJ(ch, GET_EQ(vict, eq_pos))) { + obj = GET_EQ(vict, eq_pos); + break; + } if (!obj) { - act("$E hasn't got that item.", FALSE, ch, 0, vict, TO_CHAR); - return; - } else { /* It is equipment */ - if ((GET_POS(vict) > POS_STUNNED)) { - send_to_char(ch, "Steal the equipment now? Impossible!\r\n"); - return; - } else { + act("$E hasn't got that item.", FALSE, ch, 0, vict, TO_CHAR); + return; + } else { /* It is equipment */ + if ((GET_POS(vict) > POS_STUNNED)) { + send_to_char(ch, "Steal the equipment now? Impossible!\r\n"); + return; + } else { if (!give_otrigger(obj, vict, ch) || - !receive_mtrigger(ch, vict, obj) ) { + !receive_mtrigger(ch, vict, obj)) { send_to_char(ch, "Impossible!\r\n"); return; } - act("You unequip $p and steal it.", FALSE, ch, obj, 0, TO_CHAR); - act("$n steals $p from $N.", FALSE, ch, obj, vict, TO_NOTVICT); - obj_to_char(unequip_char(vict, eq_pos), ch); - } + act("You unequip $p and steal it.", FALSE, ch, obj, 0, TO_CHAR); + act("$n steals $p from $N.", FALSE, ch, obj, vict, TO_NOTVICT); + obj_to_char(unequip_char(vict, eq_pos), ch); + } } - } else { /* obj found in inventory */ + } else { /* obj found in inventory */ - percent += GET_OBJ_WEIGHT(obj); /* Make heavy harder */ + percent += GET_OBJ_WEIGHT(obj); /* Make heavy harder */ if (percent > GET_SKILL(ch, SKILL_STEAL)) { - ohoh = TRUE; - send_to_char(ch, "Oops..\r\n"); - act("$n tried to steal something from you!", FALSE, ch, 0, vict, TO_VICT); - act("$n tries to steal something from $N.", TRUE, ch, 0, vict, TO_NOTVICT); - } else { /* Steal the item */ - if (IS_CARRYING_N(ch) + 1 < CAN_CARRY_N(ch)) { + ohoh = TRUE; + send_to_char(ch, "Oops..\r\n"); + act("$n tried to steal something from you!", FALSE, ch, 0, vict, TO_VICT); + act("$n tries to steal something from $N.", TRUE, ch, 0, vict, TO_NOTVICT); + } else { /* Steal the item */ + if (IS_CARRYING_N(ch) + 1 < CAN_CARRY_N(ch)) { if (!give_otrigger(obj, vict, ch) || - !receive_mtrigger(ch, vict, obj) ) { + !receive_mtrigger(ch, vict, obj)) { send_to_char(ch, "Impossible!\r\n"); return; } - if (IS_CARRYING_W(ch) + GET_OBJ_WEIGHT(obj) < CAN_CARRY_W(ch)) { - obj_from_char(obj); - obj_to_char(obj, ch); - send_to_char(ch, "Got it!\r\n"); - } - } else - send_to_char(ch, "You cannot carry that much.\r\n"); + if (IS_CARRYING_W(ch) + GET_OBJ_WEIGHT(obj) < CAN_CARRY_W(ch)) { + obj_from_char(obj); + obj_to_char(obj, ch); + send_to_char(ch, "Got it!\r\n"); + } + } else + send_to_char(ch, "You cannot carry that much.\r\n"); } } - } else { /* Steal some coins */ + } else { /* Steal some coins */ if (AWAKE(vict) && (percent > GET_SKILL(ch, SKILL_STEAL))) { ohoh = TRUE; send_to_char(ch, "Oops..\r\n"); @@ -250,14 +250,14 @@ ACMD(do_steal) gold = (GET_GOLD(vict) * rand_number(1, 10)) / 100; gold = MIN(1782, gold); if (gold > 0) { - increase_gold(ch, gold); - decrease_gold(vict, gold); + increase_gold(ch, gold); + decrease_gold(vict, gold); if (gold > 1) - send_to_char(ch, "Bingo! You got %d gold coins.\r\n", gold); - else - send_to_char(ch, "You manage to swipe a solitary gold coin.\r\n"); + send_to_char(ch, "Bingo! You got %d gold coins.\r\n", gold); + else + send_to_char(ch, "You manage to swipe a solitary gold coin.\r\n"); } else { - send_to_char(ch, "You couldn't get any gold...\r\n"); + send_to_char(ch, "You couldn't get any gold...\r\n"); } } } @@ -317,52 +317,53 @@ ACMD(do_title) static void print_group(struct char_data *ch) { - struct char_data * k; + struct char_data *k; send_to_char(ch, "Your group consists of:\r\n"); - while ((k = (struct char_data *) simple_list(ch->group->members)) != NULL) + while ((k = (struct char_data *)simple_list(ch->group->members)) != NULL) send_to_char(ch, "%-*s: %s[%4d/%-4d]H [%4d/%-4d]M [%4d/%-4d]V%s\r\n", - count_color_chars(GET_NAME(k))+22, GET_NAME(k), - GROUP_LEADER(GROUP(ch)) == k ? CBGRN(ch, C_NRM) : CCGRN(ch, C_NRM), - GET_HIT(k), GET_MAX_HIT(k), - GET_MANA(k), GET_MAX_MANA(k), - GET_MOVE(k), GET_MAX_MOVE(k), - CCNRM(ch, C_NRM)); + count_color_chars(GET_NAME(k)) + 22, GET_NAME(k), + GROUP_LEADER(GROUP(ch)) == k ? CBGRN(ch, C_NRM) : CCGRN(ch, C_NRM), + GET_HIT(k), GET_MAX_HIT(k), + GET_MANA(k), GET_MAX_MANA(k), + GET_MOVE(k), GET_MAX_MOVE(k), + CCNRM(ch, C_NRM)); } -static void display_group_list(struct char_data * ch) +static void display_group_list(struct char_data *ch) { - struct group_data * group; + struct group_data *group; int count = 0; - + if (group_list->iSize) { send_to_char(ch, "# Group Leader # of Members In Zone\r\n" - "---------------------------------------------------\r\n"); - - while ((group = (struct group_data *) simple_list(group_list)) != NULL) { - if (IS_SET(GROUP_FLAGS(group), GROUP_NPC)) - continue; + "---------------------------------------------------\r\n"); + + while ((group = (struct group_data *)simple_list(group_list)) != NULL) { + if (IS_SET(GROUP_FLAGS(group), GROUP_NPC)) + continue; if (GROUP_LEADER(group) && !IS_SET(GROUP_FLAGS(group), GROUP_ANON)) - send_to_char(ch, "%-2d) %s%-12s %-2d %s%s\r\n", - ++count, - IS_SET(GROUP_FLAGS(group), GROUP_OPEN) ? CCGRN(ch, C_NRM) : CCRED(ch, C_NRM), - GET_NAME(GROUP_LEADER(group)), group->members->iSize, zone_table[world[IN_ROOM(GROUP_LEADER(group))].zone].name, - CCNRM(ch, C_NRM)); + send_to_char(ch, "%-2d) %s%-12s %-2d %s%s\r\n", + ++count, + IS_SET(GROUP_FLAGS(group), GROUP_OPEN) ? CCGRN(ch, C_NRM) : CCRED(ch, C_NRM), + GET_NAME(GROUP_LEADER(group)), group->members->iSize, + zone_table[world[IN_ROOM(GROUP_LEADER(group))].zone].name, + CCNRM(ch, C_NRM)); else send_to_char(ch, "%-2d) Hidden\r\n", ++count); - - } + + } } if (count) send_to_char(ch, "\r\n" - "%sSeeking Members%s\r\n" - "%sClosed%s\r\n", - CCGRN(ch, C_NRM), CCNRM(ch, C_NRM), - CCRED(ch, C_NRM), CCNRM(ch, C_NRM)); + "%sSeeking Members%s\r\n" + "%sClosed%s\r\n", + CCGRN(ch, C_NRM), CCNRM(ch, C_NRM), + CCRED(ch, C_NRM), CCNRM(ch, C_NRM)); else send_to_char(ch, "\r\n" - "Currently no groups formed.\r\n"); + "Currently no groups formed.\r\n"); } /* Vatiken's Group System: Version 1.1 */ @@ -380,7 +381,7 @@ ACMD(do_group) send_to_char(ch, "You must specify a group option, or type HELP GROUP for more info.\r\n"); return; } - + if (is_abbrev(buf, "new")) { if (GROUP(ch)) send_to_char(ch, "You are already in a group.\r\n"); @@ -405,8 +406,8 @@ ACMD(do_group) } else if (!IS_SET(GROUP_FLAGS(GROUP(vict)), GROUP_OPEN)) { send_to_char(ch, "That group isn't accepting members.\r\n"); return; - } - join_group(ch, GROUP(vict)); + } + join_group(ch, GROUP(vict)); } else if (is_abbrev(buf, "kick")) { skip_spaces(&argument); if (!(vict = get_char_vis(ch, argument, NULL, FIND_CHAR_ROOM))) { @@ -415,18 +416,18 @@ ACMD(do_group) } else if (vict == ch) { send_to_char(ch, "There are easier ways to leave the group.\r\n"); return; - } else if (!GROUP(ch) ) { + } else if (!GROUP(ch)) { send_to_char(ch, "But you are not part of a group.\r\n"); return; - } else if (GROUP_LEADER(GROUP(ch)) != ch ) { + } else if (GROUP_LEADER(GROUP(ch)) != ch) { send_to_char(ch, "Only the group's leader can kick members out.\r\n"); return; } else if (GROUP(vict) != GROUP(ch)) { act("$E$u is not a member of your group!", FALSE, ch, 0, vict, TO_CHAR); return; - } + } send_to_char(ch, "You have kicked %s out of the group.\r\n", GET_NAME(vict)); - send_to_char(vict, "You have been kicked out of the group.\r\n"); + send_to_char(vict, "You have been kicked out of the group.\r\n"); leave_group(vict); } else if (is_abbrev(buf, "regroup")) { if (!GROUP(ch)) { @@ -441,12 +442,12 @@ ACMD(do_group) join_group(ch, GROUP(vict)); } } else if (is_abbrev(buf, "leave")) { - + if (!GROUP(ch)) { send_to_char(ch, "But you aren't part of a group!\r\n"); return; } - + leave_group(ch); } else if (is_abbrev(buf, "option")) { skip_spaces(&argument); @@ -459,14 +460,16 @@ ACMD(do_group) } if (is_abbrev(argument, "open")) { TOGGLE_BIT(GROUP_FLAGS(GROUP(ch)), GROUP_OPEN); - send_to_char(ch, "The group is now %s to new members.\r\n", IS_SET(GROUP_FLAGS(GROUP(ch)), GROUP_OPEN) ? "open" : "closed"); + send_to_char(ch, "The group is now %s to new members.\r\n", + IS_SET(GROUP_FLAGS(GROUP(ch)), GROUP_OPEN) ? "open" : "closed"); } else if (is_abbrev(argument, "anonymous")) { TOGGLE_BIT(GROUP_FLAGS(GROUP(ch)), GROUP_ANON); - send_to_char(ch, "The group location is now %s to other players.\r\n", IS_SET(GROUP_FLAGS(GROUP(ch)), GROUP_ANON) ? "invisible" : "visible"); - } else + send_to_char(ch, "The group location is now %s to other players.\r\n", + IS_SET(GROUP_FLAGS(GROUP(ch)), GROUP_ANON) ? "invisible" : "visible"); + } else send_to_char(ch, "The flag options are: Open, Anonymous\r\n"); } else { - send_to_char(ch, "You must specify a group option, or type HELP GROUP for more info.\r\n"); + send_to_char(ch, "You must specify a group option, or type HELP GROUP for more info.\r\n"); } } @@ -481,10 +484,10 @@ ACMD(do_report) } send_to_group(NULL, group, "%s reports: %d/%dH, %d/%dM, %d/%dV\r\n", - GET_NAME(ch), - GET_HIT(ch), GET_MAX_HIT(ch), - GET_MANA(ch), GET_MAX_MANA(ch), - GET_MOVE(ch), GET_MAX_MOVE(ch)); + GET_NAME(ch), + GET_HIT(ch), GET_MAX_HIT(ch), + GET_MANA(ch), GET_MAX_MANA(ch), + GET_MOVE(ch), GET_MAX_MOVE(ch)); } ACMD(do_split) @@ -493,7 +496,7 @@ ACMD(do_split) int amount, num = 0, share, rest; size_t len; struct char_data *k; - + if (IS_NPC(ch)) return; @@ -509,9 +512,9 @@ ACMD(do_split) send_to_char(ch, "You don't seem to have that much gold to split.\r\n"); return; } - + if (GROUP(ch)) - while ((k = (struct char_data *) simple_list(GROUP(ch)->members)) != NULL) + while ((k = (struct char_data *)simple_list(GROUP(ch)->members)) != NULL) if (IN_ROOM(ch) == IN_ROOM(k) && !IS_NPC(k)) num++; @@ -527,25 +530,25 @@ ACMD(do_split) /* Abusing signed/unsigned to make sizeof work. */ len = snprintf(buf, sizeof(buf), "%s splits %d coins; you receive %d.\r\n", - GET_NAME(ch), amount, share); + GET_NAME(ch), amount, share); if (rest && len < sizeof(buf)) { snprintf(buf + len, sizeof(buf) - len, - "%d coin%s %s not splitable, so %s keeps the money.\r\n", rest, - (rest == 1) ? "" : "s", (rest == 1) ? "was" : "were", GET_NAME(ch)); + "%d coin%s %s not splitable, so %s keeps the money.\r\n", rest, + (rest == 1) ? "" : "s", (rest == 1) ? "was" : "were", GET_NAME(ch)); } - while ((k = (struct char_data *) simple_list(GROUP(ch)->members)) != NULL) + while ((k = (struct char_data *)simple_list(GROUP(ch)->members)) != NULL) if (k != ch && IN_ROOM(ch) == IN_ROOM(k) && !IS_NPC(k)) { - increase_gold(k, share); - send_to_char(k, "%s", buf); - } + increase_gold(k, share); + send_to_char(k, "%s", buf); + } send_to_char(ch, "You split %d coins among %d members -- %d coins each.\r\n", - amount, num, share); + amount, num, share); if (rest) { send_to_char(ch, "%d coin%s %s not splitable, so you keep the money.\r\n", - rest, (rest == 1) ? "" : "s", (rest == 1) ? "was" : "were"); + rest, (rest == 1) ? "" : "s", (rest == 1) ? "was" : "were"); } } else { send_to_char(ch, "How many coins do you wish to split with your group?\r\n"); @@ -570,8 +573,8 @@ ACMD(do_use) case SCMD_RECITE: case SCMD_QUAFF: if (!(mag_item = get_obj_in_list_vis(ch, arg, NULL, ch->carrying))) { - send_to_char(ch, "You don't seem to have %s %s.\r\n", AN(arg), arg); - return; + send_to_char(ch, "You don't seem to have %s %s.\r\n", AN(arg), arg); + return; } break; case SCMD_USE: @@ -579,8 +582,8 @@ 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(), - * but in the function which handles 'quaff', 'recite', and 'use'. */ + /* 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; } } @@ -599,7 +602,7 @@ ACMD(do_use) break; case SCMD_USE: if ((GET_OBJ_TYPE(mag_item) != ITEM_WAND) && - (GET_OBJ_TYPE(mag_item) != ITEM_STAFF)) { + (GET_OBJ_TYPE(mag_item) != ITEM_STAFF)) { send_to_char(ch, "You can't seem to figure out how to use it.\r\n"); return; } @@ -647,16 +650,16 @@ ACMD(do_display) switch (LOWER(argument[i])) { case 'h': SET_BIT_AR(PRF_FLAGS(ch), PRF_DISPHP); - break; + break; case 'm': SET_BIT_AR(PRF_FLAGS(ch), PRF_DISPMANA); - break; + break; case 'v': SET_BIT_AR(PRF_FLAGS(ch), PRF_DISPMOVE); - break; + break; default: - send_to_char(ch, "Usage: prompt { { H | M | V } | all | auto | none }\r\n"); - return; + send_to_char(ch, "Usage: prompt { { H | M | V } | all | auto | none }\r\n"); + return; } } } @@ -673,64 +676,64 @@ ACMD(do_gen_tog) char arg[MAX_INPUT_LENGTH]; const char *tog_messages[][2] = { - {"You are now safe from summoning by other players.\r\n", - "You may now be summoned by other players.\r\n"}, - {"Nohassle disabled.\r\n", - "Nohassle enabled.\r\n"}, - {"Brief mode off.\r\n", - "Brief mode on.\r\n"}, - {"Compact mode off.\r\n", - "Compact mode on.\r\n"}, - {"You can now hear tells.\r\n", - "You are now deaf to tells.\r\n"}, - {"You can now hear auctions.\r\n", - "You are now deaf to auctions.\r\n"}, - {"You can now hear shouts.\r\n", - "You are now deaf to shouts.\r\n"}, - {"You can now hear gossip.\r\n", - "You are now deaf to gossip.\r\n"}, - {"You can now hear the congratulation messages.\r\n", - "You are now deaf to the congratulation messages.\r\n"}, - {"You can now hear the Wiz-channel.\r\n", - "You are now deaf to the Wiz-channel.\r\n"}, - {"You are no longer part of the Quest.\r\n", - "Okay, you are part of the Quest!\r\n"}, - {"You will no longer see the room flags.\r\n", - "You will now see the room flags.\r\n"}, - {"You will now have your communication repeated.\r\n", - "You will no longer have your communication repeated.\r\n"}, - {"HolyLight mode off.\r\n", - "HolyLight mode on.\r\n"}, - {"Nameserver_is_slow changed to NO; IP addresses will now be resolved.\r\n", - "Nameserver_is_slow changed to YES; sitenames will no longer be resolved.\r\n"}, - {"Autoexits disabled.\r\n", - "Autoexits enabled.\r\n"}, - {"Will no longer track through doors.\r\n", - "Will now track through doors.\r\n"}, - {"Will no longer clear screen in OLC.\r\n", - "Will now clear screen in OLC.\r\n"}, - {"Buildwalk Off.\r\n", - "Buildwalk On.\r\n"}, - {"AFK flag is now off.\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"}, - {"ZoneResets disabled.\r\n", - "ZoneResets enabled.\r\n"} + {"You are now safe from summoning by other players.\r\n", + "You may now be summoned by other players.\r\n"}, + {"Nohassle disabled.\r\n", + "Nohassle enabled.\r\n"}, + {"Brief mode off.\r\n", + "Brief mode on.\r\n"}, + {"Compact mode off.\r\n", + "Compact mode on.\r\n"}, + {"You can now hear tells.\r\n", + "You are now deaf to tells.\r\n"}, + {"You can now hear auctions.\r\n", + "You are now deaf to auctions.\r\n"}, + {"You can now hear shouts.\r\n", + "You are now deaf to shouts.\r\n"}, + {"You can now hear gossip.\r\n", + "You are now deaf to gossip.\r\n"}, + {"You can now hear the congratulation messages.\r\n", + "You are now deaf to the congratulation messages.\r\n"}, + {"You can now hear the Wiz-channel.\r\n", + "You are now deaf to the Wiz-channel.\r\n"}, + {"You are no longer part of the Quest.\r\n", + "Okay, you are part of the Quest!\r\n"}, + {"You will no longer see the room flags.\r\n", + "You will now see the room flags.\r\n"}, + {"You will now have your communication repeated.\r\n", + "You will no longer have your communication repeated.\r\n"}, + {"HolyLight mode off.\r\n", + "HolyLight mode on.\r\n"}, + {"Nameserver_is_slow changed to NO; IP addresses will now be resolved.\r\n", + "Nameserver_is_slow changed to YES; sitenames will no longer be resolved.\r\n"}, + {"Autoexits disabled.\r\n", + "Autoexits enabled.\r\n"}, + {"Will no longer track through doors.\r\n", + "Will now track through doors.\r\n"}, + {"Will no longer clear screen in OLC.\r\n", + "Will now clear screen in OLC.\r\n"}, + {"Buildwalk Off.\r\n", + "Buildwalk On.\r\n"}, + {"AFK flag is now off.\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"}, + {"ZoneResets disabled.\r\n", + "ZoneResets enabled.\r\n"} }; if (IS_NPC(ch)) @@ -784,7 +787,7 @@ ACMD(do_gen_tog) break; case SCMD_CLS: result = PRF_TOG_CHK(ch, PRF_CLS); - break; + break; case SCMD_BUILDWALK: if (GET_LEVEL(ch) < LVL_BUILDER) { send_to_char(ch, "Builders only, sorry.\r\n"); @@ -793,14 +796,14 @@ ACMD(do_gen_tog) result = PRF_TOG_CHK(ch, PRF_BUILDWALK); if (PRF_FLAGGED(ch, PRF_BUILDWALK)) { one_argument(argument, arg); - for (i=0; *arg && *(sector_types[i]) != '\n'; i++) + for (i = 0; *arg && *(sector_types[i]) != '\n'; i++) if (is_abbrev(arg, sector_types[i])) break; - if (*(sector_types[i]) == '\n') - i=0; + if (*(sector_types[i]) == '\n') + i = 0; GET_BUILDWALK_SECTOR(ch) = i; send_to_char(ch, "Default sector type is %s\r\n", sector_types[i]); - + mudlog(CMP, GET_LEVEL(ch), TRUE, "OLC: %s turned buildwalk on. Allowed zone %d", GET_NAME(ch), GET_OLC_ZONE(ch)); } else @@ -862,30 +865,27 @@ static void show_happyhour(struct char_data *ch) char happyexp[80], happygold[80], happyqp[80]; int secs_left; - if ((IS_HAPPYHOUR) || (GET_LEVEL(ch) >= LVL_GRGOD)) - { - if (HAPPY_TIME) - secs_left = ((HAPPY_TIME - 1) * SECS_PER_MUD_HOUR) + next_tick; - else - secs_left = 0; + if ((IS_HAPPYHOUR) || (GET_LEVEL(ch) >= LVL_GRGOD)) { + if (HAPPY_TIME) + secs_left = ((HAPPY_TIME - 1) * SECS_PER_MUD_HOUR) + next_tick; + else + secs_left = 0; - sprintf(happyqp, "%s+%d%%%s to Questpoints per quest\r\n", CCYEL(ch, C_NRM), HAPPY_QP, CCNRM(ch, C_NRM)); - sprintf(happygold, "%s+%d%%%s to Gold gained per kill\r\n", CCYEL(ch, C_NRM), HAPPY_GOLD, CCNRM(ch, C_NRM)); - sprintf(happyexp, "%s+%d%%%s to Experience per kill\r\n", CCYEL(ch, C_NRM), HAPPY_EXP, CCNRM(ch, C_NRM)); + sprintf(happyqp, "%s+%d%%%s to Questpoints per quest\r\n", CCYEL(ch, C_NRM), HAPPY_QP, CCNRM(ch, C_NRM)); + sprintf(happygold, "%s+%d%%%s to Gold gained per kill\r\n", CCYEL(ch, C_NRM), HAPPY_GOLD, CCNRM(ch, C_NRM)); + sprintf(happyexp, "%s+%d%%%s to Experience per kill\r\n", CCYEL(ch, C_NRM), HAPPY_EXP, CCNRM(ch, C_NRM)); - send_to_char(ch, "tbaMUD Happy Hour!\r\n" - "------------------\r\n" - "%s%s%sTime Remaining: %s%d%s hours %s%d%s mins %s%d%s secs\r\n", - (IS_HAPPYEXP || (GET_LEVEL(ch) >= LVL_GOD)) ? happyexp : "", - (IS_HAPPYGOLD || (GET_LEVEL(ch) >= LVL_GOD)) ? happygold : "", - (IS_HAPPYQP || (GET_LEVEL(ch) >= LVL_GOD)) ? happyqp : "", - CCYEL(ch, C_NRM), (secs_left / 3600), CCNRM(ch, C_NRM), - CCYEL(ch, C_NRM), (secs_left % 3600) / 60, CCNRM(ch, C_NRM), - CCYEL(ch, C_NRM), (secs_left % 60), CCNRM(ch, C_NRM) ); - } - else - { - send_to_char(ch, "Sorry, there is currently no happy hour!\r\n"); + send_to_char(ch, "tbaMUD Happy Hour!\r\n" + "------------------\r\n" + "%s%s%sTime Remaining: %s%d%s hours %s%d%s mins %s%d%s secs\r\n", + (IS_HAPPYEXP || (GET_LEVEL(ch) >= LVL_GOD)) ? happyexp : "", + (IS_HAPPYGOLD || (GET_LEVEL(ch) >= LVL_GOD)) ? happygold : "", + (IS_HAPPYQP || (GET_LEVEL(ch) >= LVL_GOD)) ? happyqp : "", + CCYEL(ch, C_NRM), (secs_left / 3600), CCNRM(ch, C_NRM), + CCYEL(ch, C_NRM), (secs_left % 3600) / 60, CCNRM(ch, C_NRM), + CCYEL(ch, C_NRM), (secs_left % 60), CCNRM(ch, C_NRM)); + } else { + send_to_char(ch, "Sorry, there is currently no happy hour!\r\n"); } } @@ -894,8 +894,7 @@ ACMD(do_happyhour) char arg[MAX_INPUT_LENGTH], val[MAX_INPUT_LENGTH]; int num; - if (GET_LEVEL(ch) < LVL_GOD) - { + if (GET_LEVEL(ch) < LVL_GOD) { show_happyhour(ch); return; } @@ -903,20 +902,15 @@ ACMD(do_happyhour) /* Only Imms get here, so check args */ two_arguments(argument, arg, val); - if (is_abbrev(arg, "experience")) - { + if (is_abbrev(arg, "experience")) { num = MIN(MAX((atoi(val)), 0), 1000); HAPPY_EXP = num; send_to_char(ch, "Happy Hour Exp rate set to +%d%%\r\n", HAPPY_EXP); - } - else if ((is_abbrev(arg, "gold")) || (is_abbrev(arg, "coins"))) - { + } else if ((is_abbrev(arg, "gold")) || (is_abbrev(arg, "coins"))) { num = MIN(MAX((atoi(val)), 0), 1000); HAPPY_GOLD = num; send_to_char(ch, "Happy Hour Gold rate set to +%d%%\r\n", HAPPY_GOLD); - } - else if ((is_abbrev(arg, "time")) || (is_abbrev(arg, "ticks"))) - { + } else if ((is_abbrev(arg, "time")) || (is_abbrev(arg, "ticks"))) { num = MIN(MAX((atoi(val)), 0), 1000); if (HAPPY_TIME && !num) game_info("Happyhour has been stopped!"); @@ -925,47 +919,39 @@ ACMD(do_happyhour) HAPPY_TIME = num; send_to_char(ch, "Happy Hour Time set to %d ticks (%d hours %d mins and %d secs)\r\n", - HAPPY_TIME, - (HAPPY_TIME*SECS_PER_MUD_HOUR)/3600, - ((HAPPY_TIME*SECS_PER_MUD_HOUR)%3600) / 60, - (HAPPY_TIME*SECS_PER_MUD_HOUR)%60 ); - } - else if ((is_abbrev(arg, "qp")) || (is_abbrev(arg, "questpoints"))) - { + HAPPY_TIME, + (HAPPY_TIME * SECS_PER_MUD_HOUR) / 3600, + ((HAPPY_TIME * SECS_PER_MUD_HOUR) % 3600) / 60, + (HAPPY_TIME * SECS_PER_MUD_HOUR) % 60); + } else if ((is_abbrev(arg, "qp")) || (is_abbrev(arg, "questpoints"))) { num = MIN(MAX((atoi(val)), 0), 1000); HAPPY_QP = num; send_to_char(ch, "Happy Hour Questpoints rate set to +%d%%\r\n", HAPPY_QP); - } - else if (is_abbrev(arg, "show")) - { + } else if (is_abbrev(arg, "show")) { show_happyhour(ch); - } - else if (is_abbrev(arg, "default")) - { + } else if (is_abbrev(arg, "default")) { HAPPY_EXP = 100; HAPPY_GOLD = 50; - HAPPY_QP = 50; + HAPPY_QP = 50; HAPPY_TIME = 48; game_info("A Happyhour has started!"); - } - else - { + } else { send_to_char(ch, "Usage: %shappyhour %s- show usage (this info)\r\n" - " %shappyhour show %s- display current settings (what mortals see)\r\n" - " %shappyhour time %s- set happyhour time and start timer\r\n" - " %shappyhour qp %s- set qp percentage gain\r\n" - " %shappyhour exp %s- set exp percentage gain\r\n" - " %shappyhour gold %s- set gold percentage gain\r\n" - " \tyhappyhour default \tw- sets a default setting for happyhour\r\n\r\n" - "Configure the happyhour settings and start a happyhour.\r\n" - "Currently 1 hour IRL = %d ticks\r\n" - "If no number is specified, 0 (off) is assumed.\r\nThe command \tyhappyhour time\tn will therefore stop the happyhour timer.\r\n", - CCYEL(ch, C_NRM), CCNRM(ch, C_NRM), - CCYEL(ch, C_NRM), CCNRM(ch, C_NRM), - CCYEL(ch, C_NRM), CCNRM(ch, C_NRM), - CCYEL(ch, C_NRM), CCNRM(ch, C_NRM), - CCYEL(ch, C_NRM), CCNRM(ch, C_NRM), - CCYEL(ch, C_NRM), CCNRM(ch, C_NRM), - (3600 / SECS_PER_MUD_HOUR) ); + " %shappyhour show %s- display current settings (what mortals see)\r\n" + " %shappyhour time %s- set happyhour time and start timer\r\n" + " %shappyhour qp %s- set qp percentage gain\r\n" + " %shappyhour exp %s- set exp percentage gain\r\n" + " %shappyhour gold %s- set gold percentage gain\r\n" + " \tyhappyhour default \tw- sets a default setting for happyhour\r\n\r\n" + "Configure the happyhour settings and start a happyhour.\r\n" + "Currently 1 hour IRL = %d ticks\r\n" + "If no number is specified, 0 (off) is assumed.\r\nThe command \tyhappyhour time\tn will therefore stop the happyhour timer.\r\n", + CCYEL(ch, C_NRM), CCNRM(ch, C_NRM), + CCYEL(ch, C_NRM), CCNRM(ch, C_NRM), + CCYEL(ch, C_NRM), CCNRM(ch, C_NRM), + CCYEL(ch, C_NRM), CCNRM(ch, C_NRM), + CCYEL(ch, C_NRM), CCNRM(ch, C_NRM), + CCYEL(ch, C_NRM), CCNRM(ch, C_NRM), + (3600 / SECS_PER_MUD_HOUR)); } } diff --git a/src/act.social.c b/src/act.social.c index 3db8e8a..866bf94 100644 --- a/src/act.social.c +++ b/src/act.social.c @@ -65,7 +65,8 @@ ACMD(do_action) if (!vict) { if (action->char_obj_found) { targ = get_obj_in_list_vis(ch, arg, NULL, ch->carrying); - if (!targ) targ = get_obj_in_list_vis(ch, arg, NULL, world[IN_ROOM(ch)].contents); + if (!targ) + targ = get_obj_in_list_vis(ch, arg, NULL, world[IN_ROOM(ch)].contents); if (targ) { act(action->char_obj_found, action->hide, ch, targ, 0, TO_CHAR); act(action->others_obj_found, action->hide, ch, targ, 0, TO_ROOM); @@ -128,7 +129,8 @@ void create_command_list(void) /* count the commands in the command list */ i = 0; - while(*cmd_info[i].command != '\n') i++; + while (*cmd_info[i].command != '\n') + i++; i++; CREATE(complete_cmd_info, struct command_info, top_of_socialt + i + 2); @@ -137,21 +139,21 @@ void create_command_list(void) i = 0; j = 0; k = 0; - while ((*cmd_info[i].command != '\n') || (j <= top_of_socialt)) { + while ((*cmd_info[i].command != '\n') || (j <= top_of_socialt)) { if ((i < RESERVE_CMDS) || (j > top_of_socialt) || - (str_cmp(cmd_info[i].sort_as, soc_mess_list[j].sort_as) < 1)) + (str_cmp(cmd_info[i].sort_as, soc_mess_list[j].sort_as) < 1)) complete_cmd_info[k++] = cmd_info[i++]; else { - soc_mess_list[j].act_nr = k; - complete_cmd_info[k].command = soc_mess_list[j].command; - complete_cmd_info[k].sort_as = soc_mess_list[j].sort_as; - complete_cmd_info[k].minimum_position = soc_mess_list[j].min_char_position; - complete_cmd_info[k].command_pointer = do_action; - complete_cmd_info[k].minimum_level = soc_mess_list[j++].min_level_char; - complete_cmd_info[k++].subcmd = 0; + soc_mess_list[j].act_nr = k; + complete_cmd_info[k].command = soc_mess_list[j].command; + complete_cmd_info[k].sort_as = soc_mess_list[j].sort_as; + complete_cmd_info[k].minimum_position = soc_mess_list[j].min_char_position; + complete_cmd_info[k].command_pointer = do_action; + complete_cmd_info[k].minimum_level = soc_mess_list[j++].min_level_char; + complete_cmd_info[k++].subcmd = 0; } } - complete_cmd_info[k] = cmd_info[i]; + complete_cmd_info[k] = cmd_info[i]; log("Command info rebuilt, %d total commands.", k); } @@ -166,29 +168,45 @@ void free_social_messages(void) struct social_messg *mess; int i; - for (i = 0;i <= top_of_socialt;i++) { + for (i = 0; i <= top_of_socialt; i++) { mess = &soc_mess_list[i]; free_action(mess); } free(soc_mess_list); } -void free_action(struct social_messg *mess) { - if (mess->command) free(mess->command); - if (mess->sort_as) free(mess->sort_as); - if (mess->char_no_arg) free(mess->char_no_arg); - if (mess->others_no_arg) free(mess->others_no_arg); - if (mess->char_found) free(mess->char_found); - if (mess->others_found) free(mess->others_found); - if (mess->vict_found) free(mess->vict_found); - if (mess->char_body_found) free(mess->char_body_found); - if (mess->others_body_found) free(mess->others_body_found); - if (mess->vict_body_found) free(mess->vict_body_found); - if (mess->not_found) free(mess->not_found); - if (mess->char_auto) free(mess->char_auto); - if (mess->others_auto) free(mess->others_auto); - if (mess->char_obj_found) free(mess->char_obj_found); - if (mess->others_obj_found) free(mess->others_obj_found); +void free_action(struct social_messg *mess) +{ + if (mess->command) + free(mess->command); + if (mess->sort_as) + free(mess->sort_as); + if (mess->char_no_arg) + free(mess->char_no_arg); + if (mess->others_no_arg) + free(mess->others_no_arg); + if (mess->char_found) + free(mess->char_found); + if (mess->others_found) + free(mess->others_found); + if (mess->vict_found) + free(mess->vict_found); + if (mess->char_body_found) + free(mess->char_body_found); + if (mess->others_body_found) + free(mess->others_body_found); + if (mess->vict_body_found) + free(mess->vict_body_found); + if (mess->not_found) + free(mess->not_found); + if (mess->char_auto) + free(mess->char_auto); + if (mess->others_auto) + free(mess->others_auto); + if (mess->char_obj_found) + free(mess->char_obj_found); + if (mess->others_obj_found) + free(mess->others_obj_found); memset(mess, 0, sizeof(struct social_messg)); } @@ -226,7 +244,7 @@ ACMD(do_gmote) half_chop(argument, buf, arg); - if(subcmd) + if (subcmd) for (length = strlen(buf), cmd = 0; *complete_cmd_info[cmd].command != '\n'; cmd++) if (!strncmp(complete_cmd_info[cmd].command, buf, length)) break; @@ -242,13 +260,13 @@ ACMD(do_gmote) return; } -action = &soc_mess_list[act_nr]; + action = &soc_mess_list[act_nr]; if (!action->char_found) *arg = '\0'; if (!*arg) { - if(!action->others_no_arg || !*action->others_no_arg) { + if (!action->others_no_arg || !*action->others_no_arg) { send_to_char(ch, "Who are you going to do that to?\r\n"); return; } @@ -257,7 +275,7 @@ action = &soc_mess_list[act_nr]; send_to_char(ch, "%s\r\n", action->not_found); return; } else if (vict == ch) { - if(!action->others_auto || !*action->others_auto) { + if (!action->others_auto || !*action->others_auto) { send_to_char(ch, "%s\r\n", action->char_auto); return; } @@ -265,7 +283,7 @@ action = &soc_mess_list[act_nr]; } else { if (GET_POS(vict) < action->min_victim_position) { act("$N is not in a proper position for that.", - FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP); + FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP); return; } snprintf(buf, sizeof(buf), "Gemote: %s", action->others_found); diff --git a/src/act.wizard.c b/src/act.wizard.c index b0694ee..25f25e6 100644 --- a/src/act.wizard.c +++ b/src/act.wizard.c @@ -48,22 +48,23 @@ static struct char_data *is_in_game(long idnum); static void mob_checkload(struct char_data *ch, mob_vnum mvnum); static void obj_checkload(struct char_data *ch, obj_vnum ovnum); static void trg_checkload(struct char_data *ch, trig_vnum tvnum); -static void mod_llog_entry(struct last_entry *llast,int type); -static int get_max_recent(void); +static void mod_llog_entry(struct last_entry *llast, int type); +static int get_max_recent(void); static void clear_recent(struct recent_player *this); static struct recent_player *create_recent(void); const char *get_spec_func_name(SPECIAL(*func)); bool zedit_get_levels(struct descriptor_data *d, char *buf); /* Local Globals */ -static struct recent_player *recent_list = NULL; /** Global list of recent players */ +static struct recent_player *recent_list = NULL; /** Global list of recent players */ static int purge_room(room_rnum room) { int j; struct char_data *vict; - if (room == NOWHERE || room > top_of_world) return 0; + if (room == NOWHERE || room > top_of_world) + return 0; for (vict = world[room].people; vict; vict = vict->next_in_room) { if (!IS_NPC(vict)) @@ -89,32 +90,32 @@ static int purge_room(room_rnum room) return 1; } -ACMD(do_wizhelp) -{ - extern int *cmd_sort_info; - int no = 1, i, cmd_num; +ACMD(do_wizhelp) +{ + extern int *cmd_sort_info; + int no = 1, i, cmd_num; int level; if (!ch->desc) return; - send_to_char(ch, "The following privileged commands are available:\r\n"); - - for (level = LVL_IMPL; level >= LVL_IMMORT; level--) { - send_to_char(ch, "%sLevel %d%s:\r\n", CCCYN(ch, C_NRM), level, CCNRM(ch, C_NRM)); - for (no = 1, cmd_num = 1; complete_cmd_info[cmd_sort_info[cmd_num]].command[0] != '\n'; cmd_num++) { - i = cmd_sort_info[cmd_num]; - - if (complete_cmd_info[i].minimum_level != level) - continue; - - send_to_char(ch, "%-14s%s", complete_cmd_info[i].command, no++ % 7 == 0 ? "\r\n" : ""); - } - if (no % 7 != 1) - send_to_char(ch, "\r\n"); - if (level != LVL_IMMORT) - send_to_char(ch, "\r\n"); - } + send_to_char(ch, "The following privileged commands are available:\r\n"); + + for (level = LVL_IMPL; level >= LVL_IMMORT; level--) { + send_to_char(ch, "%sLevel %d%s:\r\n", CCCYN(ch, C_NRM), level, CCNRM(ch, C_NRM)); + for (no = 1, cmd_num = 1; complete_cmd_info[cmd_sort_info[cmd_num]].command[0] != '\n'; cmd_num++) { + i = cmd_sort_info[cmd_num]; + + if (complete_cmd_info[i].minimum_level != level) + continue; + + send_to_char(ch, "%-14s%s", complete_cmd_info[i].command, no++ % 7 == 0 ? "\r\n" : ""); + } + if (no % 7 != 1) + send_to_char(ch, "\r\n"); + if (level != LVL_IMMORT) + send_to_char(ch, "\r\n"); + } } ACMD(do_echo) @@ -131,7 +132,7 @@ ACMD(do_echo) else { strlcpy(buf, argument, sizeof(buf)); mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE, "(GC) %s echoed: %s", GET_NAME(ch), buf); - } + } act(buf, FALSE, ch, 0, 0, TO_ROOM); if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT)) @@ -271,7 +272,8 @@ ACMD(do_goto) if ((location = find_target_room(ch, argument)) == NOWHERE) return; - if (ZONE_FLAGGED(GET_ROOM_ZONE(location), ZONE_NOIMMORT) && (GET_LEVEL(ch) >= LVL_IMMORT) && (GET_LEVEL(ch) < LVL_GRGOD)) { + if (ZONE_FLAGGED(GET_ROOM_ZONE(location), ZONE_NOIMMORT) && (GET_LEVEL(ch) >= LVL_IMMORT) && ( + GET_LEVEL(ch) < LVL_GRGOD)) { send_to_char(ch, "Sorry, that zone is off-limits for immortals!"); return; } @@ -305,8 +307,8 @@ ACMD(do_trans) send_to_char(ch, "That doesn't make much sense, does it?\r\n"); else { if ((GET_LEVEL(ch) < GET_LEVEL(victim)) && !IS_NPC(victim)) { - send_to_char(ch, "Go transfer someone your own size.\r\n"); - return; + send_to_char(ch, "Go transfer someone your own size.\r\n"); + return; } act("$n disappears in a mushroom cloud.", FALSE, victim, 0, 0, TO_ROOM); char_from_room(victim); @@ -317,7 +319,7 @@ ACMD(do_trans) enter_wtrigger(&world[IN_ROOM(victim)], victim, -1); } - } else { /* Trans All */ + } else { /* Trans All */ if (GET_LEVEL(ch) < LVL_GRGOD) { send_to_char(ch, "I think not.\r\n"); return; @@ -325,15 +327,15 @@ ACMD(do_trans) for (i = descriptor_list; i; i = i->next) if (STATE(i) == CON_PLAYING && i->character && i->character != ch) { - victim = i->character; - if (GET_LEVEL(victim) >= GET_LEVEL(ch)) - continue; - act("$n disappears in a mushroom cloud.", FALSE, victim, 0, 0, TO_ROOM); - char_from_room(victim); - char_to_room(victim, IN_ROOM(ch)); - act("$n arrives from a puff of smoke.", FALSE, victim, 0, 0, TO_ROOM); - act("$n has transferred you!", FALSE, ch, 0, victim, TO_VICT); - look_at_room(victim, 0); + victim = i->character; + if (GET_LEVEL(victim) >= GET_LEVEL(ch)) + continue; + act("$n disappears in a mushroom cloud.", FALSE, victim, 0, 0, TO_ROOM); + char_from_room(victim); + char_to_room(victim, IN_ROOM(ch)); + act("$n arrives from a puff of smoke.", FALSE, victim, 0, 0, TO_ROOM); + act("$n has transferred you!", FALSE, ch, 0, victim, TO_VICT); + look_at_room(victim, 0); enter_wtrigger(&world[IN_ROOM(victim)], victim, -1); } send_to_char(ch, "%s", CONFIG_OK); @@ -364,7 +366,7 @@ ACMD(do_teleport) char_from_room(victim); char_to_room(victim, target); act("$n arrives from a puff of smoke.", FALSE, victim, 0, 0, TO_ROOM); - act("$n has teleported you!", FALSE, ch, 0, (char *) victim, TO_VICT); + act("$n has teleported you!", FALSE, ch, 0, (char *)victim, TO_VICT); look_at_room(victim, 0); enter_wtrigger(&world[IN_ROOM(victim)], victim, -1); } @@ -385,7 +387,7 @@ ACMD(do_vnum) if (!vnum_mobile(buf2, ch)) send_to_char(ch, "No mobiles by that name.\r\n"); - if (is_abbrev(buf, "obj") && (good_arg =1 )) + if (is_abbrev(buf, "obj") && (good_arg = 1)) if (!vnum_object(buf2, ch)) send_to_char(ch, "No objects by that name.\r\n"); @@ -398,8 +400,8 @@ ACMD(do_vnum) send_to_char(ch, "No triggers by that name.\r\n"); if (!good_arg) - send_to_char(ch, "Usage: vnum { obj | mob | room | trig } \r\n"); - } + send_to_char(ch, "Usage: vnum { obj | mob | room | trig } \r\n"); +} #define ZOCMD zone_table[zrnum].cmd[subcmd] @@ -419,100 +421,100 @@ static void list_zone_commands_room(struct char_data *ch, room_vnum rvnum) send_to_char(ch, "Zone commands in this room:%s\r\n", yel); while (ZOCMD.command != 'S') { switch (ZOCMD.command) { - case 'M': - case 'O': - case 'T': - case 'V': - cmd_room = ZOCMD.arg3; - break; - case 'D': - case 'R': - cmd_room = ZOCMD.arg1; - break; - default: - break; + case 'M': + case 'O': + case 'T': + case 'V': + cmd_room = ZOCMD.arg3; + break; + case 'D': + case 'R': + cmd_room = ZOCMD.arg1; + break; + default: + break; } if (cmd_room == rrnum) { count++; /* start listing */ switch (ZOCMD.command) { - case 'M': - send_to_char(ch, "%sLoad %s [%s%d%s], Max : %d\r\n", - ZOCMD.if_flag ? " then " : "", - mob_proto[ZOCMD.arg1].player.short_descr, cyn, - mob_index[ZOCMD.arg1].vnum, yel, ZOCMD.arg2 - ); - break; - case 'G': - send_to_char(ch, "%sGive it %s [%s%d%s], Max : %d\r\n", - ZOCMD.if_flag ? " then " : "", - obj_proto[ZOCMD.arg1].short_description, - cyn, obj_index[ZOCMD.arg1].vnum, yel, - ZOCMD.arg2 - ); - break; - case 'O': - send_to_char(ch, "%sLoad %s [%s%d%s], Max : %d\r\n", - ZOCMD.if_flag ? " then " : "", - obj_proto[ZOCMD.arg1].short_description, - cyn, obj_index[ZOCMD.arg1].vnum, yel, - ZOCMD.arg2 - ); - break; - case 'E': - send_to_char(ch, "%sEquip with %s [%s%d%s], %s, Max : %d\r\n", - ZOCMD.if_flag ? " then " : "", - obj_proto[ZOCMD.arg1].short_description, - cyn, obj_index[ZOCMD.arg1].vnum, yel, - equipment_types[ZOCMD.arg3], - ZOCMD.arg2 - ); - break; - case 'P': - send_to_char(ch, "%sPut %s [%s%d%s] in %s [%s%d%s], Max : %d\r\n", - ZOCMD.if_flag ? " then " : "", - obj_proto[ZOCMD.arg1].short_description, - cyn, obj_index[ZOCMD.arg1].vnum, yel, - obj_proto[ZOCMD.arg3].short_description, - cyn, obj_index[ZOCMD.arg3].vnum, yel, - ZOCMD.arg2 - ); - break; - case 'R': - send_to_char(ch, "%sRemove %s [%s%d%s] from room.\r\n", - ZOCMD.if_flag ? " then " : "", - obj_proto[ZOCMD.arg2].short_description, - cyn, obj_index[ZOCMD.arg2].vnum, yel - ); - break; - case 'D': - send_to_char(ch, "%sSet door %s as %s.\r\n", - ZOCMD.if_flag ? " then " : "", - dirs[ZOCMD.arg2], - ZOCMD.arg3 ? ((ZOCMD.arg3 == 1) ? "closed" : "locked") : "open" - ); - break; - case 'T': - send_to_char(ch, "%sAttach trigger %s%s%s [%s%d%s] to %s\r\n", - ZOCMD.if_flag ? " then " : "", - cyn, trig_index[ZOCMD.arg2]->proto->name, yel, - cyn, trig_index[ZOCMD.arg2]->vnum, yel, - ((ZOCMD.arg1 == MOB_TRIGGER) ? "mobile" : - ((ZOCMD.arg1 == OBJ_TRIGGER) ? "object" : - ((ZOCMD.arg1 == WLD_TRIGGER)? "room" : "????")))); - break; - case 'V': - send_to_char(ch, "%sAssign global %s:%d to %s = %s\r\n", - ZOCMD.if_flag ? " then " : "", - ZOCMD.sarg1, ZOCMD.arg2, - ((ZOCMD.arg1 == MOB_TRIGGER) ? "mobile" : - ((ZOCMD.arg1 == OBJ_TRIGGER) ? "object" : - ((ZOCMD.arg1 == WLD_TRIGGER)? "room" : "????"))), - ZOCMD.sarg2); - break; - default: - send_to_char(ch, "\r\n"); - break; + case 'M': + send_to_char(ch, "%sLoad %s [%s%d%s], Max : %d\r\n", + ZOCMD.if_flag ? " then " : "", + mob_proto[ZOCMD.arg1].player.short_descr, cyn, + mob_index[ZOCMD.arg1].vnum, yel, ZOCMD.arg2 + ); + break; + case 'G': + send_to_char(ch, "%sGive it %s [%s%d%s], Max : %d\r\n", + ZOCMD.if_flag ? " then " : "", + obj_proto[ZOCMD.arg1].short_description, + cyn, obj_index[ZOCMD.arg1].vnum, yel, + ZOCMD.arg2 + ); + break; + case 'O': + send_to_char(ch, "%sLoad %s [%s%d%s], Max : %d\r\n", + ZOCMD.if_flag ? " then " : "", + obj_proto[ZOCMD.arg1].short_description, + cyn, obj_index[ZOCMD.arg1].vnum, yel, + ZOCMD.arg2 + ); + break; + case 'E': + send_to_char(ch, "%sEquip with %s [%s%d%s], %s, Max : %d\r\n", + ZOCMD.if_flag ? " then " : "", + obj_proto[ZOCMD.arg1].short_description, + cyn, obj_index[ZOCMD.arg1].vnum, yel, + equipment_types[ZOCMD.arg3], + ZOCMD.arg2 + ); + break; + case 'P': + send_to_char(ch, "%sPut %s [%s%d%s] in %s [%s%d%s], Max : %d\r\n", + ZOCMD.if_flag ? " then " : "", + obj_proto[ZOCMD.arg1].short_description, + cyn, obj_index[ZOCMD.arg1].vnum, yel, + obj_proto[ZOCMD.arg3].short_description, + cyn, obj_index[ZOCMD.arg3].vnum, yel, + ZOCMD.arg2 + ); + break; + case 'R': + send_to_char(ch, "%sRemove %s [%s%d%s] from room.\r\n", + ZOCMD.if_flag ? " then " : "", + obj_proto[ZOCMD.arg2].short_description, + cyn, obj_index[ZOCMD.arg2].vnum, yel + ); + break; + case 'D': + send_to_char(ch, "%sSet door %s as %s.\r\n", + ZOCMD.if_flag ? " then " : "", + dirs[ZOCMD.arg2], + ZOCMD.arg3 ? ((ZOCMD.arg3 == 1) ? "closed" : "locked") : "open" + ); + break; + case 'T': + send_to_char(ch, "%sAttach trigger %s%s%s [%s%d%s] to %s\r\n", + ZOCMD.if_flag ? " then " : "", + cyn, trig_index[ZOCMD.arg2]->proto->name, yel, + cyn, trig_index[ZOCMD.arg2]->vnum, yel, + ((ZOCMD.arg1 == MOB_TRIGGER) + ? "mobile" + : ((ZOCMD.arg1 == OBJ_TRIGGER) ? "object" : ((ZOCMD.arg1 == WLD_TRIGGER) ? "room" : "????")))); + break; + case 'V': + send_to_char(ch, "%sAssign global %s:%d to %s = %s\r\n", + ZOCMD.if_flag ? " then " : "", + ZOCMD.sarg1, ZOCMD.arg2, + ((ZOCMD.arg1 == MOB_TRIGGER) + ? "mobile" + : ((ZOCMD.arg1 == OBJ_TRIGGER) ? "object" : ((ZOCMD.arg1 == WLD_TRIGGER) ? "room" : "????"))), + ZOCMD.sarg2); + break; + default: + send_to_char(ch, "\r\n"); + break; } } subcmd++; @@ -535,8 +537,8 @@ static void do_stat_room(struct char_data *ch, struct room_data *rm) sprinttype(rm->sector_type, sector_types, buf2, sizeof(buf2)); send_to_char(ch, "Zone: [%3d], VNum: [%s%5d%s], RNum: [%5d], IDNum: [%5ld], Type: %s\r\n", - zone_table[rm->zone].number, CCGRN(ch, C_NRM), rm->number, - CCNRM(ch, C_NRM), real_room(rm->number), room_script_id(rm), buf2); + zone_table[rm->zone].number, CCGRN(ch, C_NRM), rm->number, + CCNRM(ch, C_NRM), real_room(rm->number), room_script_id(rm), buf2); sprintbitarray(rm->room_flags, room_bits, RF_ARRAY_MAX, buf2); send_to_char(ch, "SpecProc: %s, Flags: %s\r\n", rm->func == NULL ? "None" : get_spec_func_name(rm->func), buf2); @@ -551,13 +553,13 @@ static void do_stat_room(struct char_data *ch, struct room_data *rm) } send_to_char(ch, "Chars present:%s", CCYEL(ch, C_NRM)); - column = 14; /* ^^^ strlen ^^^ */ + column = 14; /* ^^^ strlen ^^^ */ for (found = FALSE, k = rm->people; k; k = k->next_in_room) { if (!CAN_SEE(ch, k)) continue; column += send_to_char(ch, "%s %s(%s)", found++ ? "," : "", GET_NAME(k), - !IS_NPC(k) ? "PC" : (!IS_MOB(k) ? "NPC" : "MOB")); + !IS_NPC(k) ? "PC" : (!IS_MOB(k) ? "NPC" : "MOB")); if (column >= 62) { send_to_char(ch, "%s\r\n", k->next_in_room ? "," : ""); found = FALSE; @@ -568,16 +570,16 @@ static void do_stat_room(struct char_data *ch, struct room_data *rm) if (rm->contents) { send_to_char(ch, "Contents:%s", CCGRN(ch, C_NRM)); - column = 9; /* ^^^ strlen ^^^ */ + column = 9; /* ^^^ strlen ^^^ */ for (found = 0, j = rm->contents; j; j = j->next_content) { if (!CAN_SEE_OBJ(ch, j)) - continue; + continue; column += send_to_char(ch, "%s %s", found++ ? "," : "", j->short_description); if (column >= 62) { - send_to_char(ch, "%s\r\n", j->next_content ? "," : ""); - found = FALSE; + send_to_char(ch, "%s\r\n", j->next_content ? "," : ""); + found = FALSE; column = 0; } } @@ -593,15 +595,18 @@ static void do_stat_room(struct char_data *ch, struct room_data *rm) if (rm->dir_option[i]->to_room == NOWHERE) snprintf(buf1, sizeof(buf1), " %sNONE%s", CCCYN(ch, C_NRM), CCNRM(ch, C_NRM)); else - snprintf(buf1, sizeof(buf1), "%s%5d%s", CCCYN(ch, C_NRM), GET_ROOM_VNUM(rm->dir_option[i]->to_room), CCNRM(ch, C_NRM)); + snprintf(buf1, sizeof(buf1), "%s%5d%s", CCCYN(ch, C_NRM), GET_ROOM_VNUM(rm->dir_option[i]->to_room), + CCNRM(ch, C_NRM)); sprintbit(rm->dir_option[i]->exit_info, exit_bits, buf2, sizeof(buf2)); send_to_char(ch, "Exit %s%-5s%s: To: [%s], Key: [%5d], Keywords: %s, Type: %s\r\n%s", - CCCYN(ch, C_NRM), dirs[i], CCNRM(ch, C_NRM), buf1, - rm->dir_option[i]->key == NOTHING ? -1 : rm->dir_option[i]->key, - rm->dir_option[i]->keyword ? rm->dir_option[i]->keyword : "None", buf2, - rm->dir_option[i]->general_description ? rm->dir_option[i]->general_description : " No exit description.\r\n"); + CCCYN(ch, C_NRM), dirs[i], CCNRM(ch, C_NRM), buf1, + rm->dir_option[i]->key == NOTHING ? -1 : rm->dir_option[i]->key, + rm->dir_option[i]->keyword ? rm->dir_option[i]->keyword : "None", buf2, + rm->dir_option[i]->general_description + ? rm->dir_option[i]->general_description + : " No exit description.\r\n"); } /* check the room for a script */ @@ -620,22 +625,22 @@ static void do_stat_object(struct char_data *ch, struct obj_data *j) struct char_data *tempch; send_to_char(ch, "Name: '%s%s%s', Keywords: %s\r\n", CCYEL(ch, C_NRM), - j->short_description ? j->short_description : "", - CCNRM(ch, C_NRM), j->name); + j->short_description ? j->short_description : "", + CCNRM(ch, C_NRM), j->name); vnum = GET_OBJ_VNUM(j); sprinttype(GET_OBJ_TYPE(j), item_types, buf, sizeof(buf)); send_to_char(ch, "VNum: [%s%5d%s], RNum: [%5d], Idnum: [%5ld], Type: %s, SpecProc: %s\r\n", - CCGRN(ch, C_NRM), vnum, CCNRM(ch, C_NRM), GET_OBJ_RNUM(j), obj_script_id(j), buf, - GET_OBJ_SPEC(j) ? (get_spec_func_name(GET_OBJ_SPEC(j))) : "None"); + CCGRN(ch, C_NRM), vnum, CCNRM(ch, C_NRM), GET_OBJ_RNUM(j), obj_script_id(j), buf, + GET_OBJ_SPEC(j) ? (get_spec_func_name(GET_OBJ_SPEC(j))) : "None"); send_to_char(ch, "L-Desc: '%s%s%s'\r\n", CCYEL(ch, C_NRM), - j->description ? j->description : "", - CCNRM(ch, C_NRM)); + j->description ? j->description : "", + CCNRM(ch, C_NRM)); send_to_char(ch, "A-Desc: '%s%s%s'\r\n", CCYEL(ch, C_NRM), - j->action_description ? j->action_description : "", - CCNRM(ch, C_NRM)); + j->action_description ? j->action_description : "", + CCNRM(ch, C_NRM)); if (j->ex_description) { send_to_char(ch, "Extra descs:%s", CCCYN(ch, C_NRM)); @@ -654,10 +659,10 @@ static void do_stat_object(struct char_data *ch, struct obj_data *j) send_to_char(ch, "Extra flags : %s\r\n", buf); send_to_char(ch, "Weight: %d, Value: %d, Cost/day: %d, Timer: %d, Min level: %d\r\n", - GET_OBJ_WEIGHT(j), GET_OBJ_COST(j), GET_OBJ_RENT(j), GET_OBJ_TIMER(j), GET_OBJ_LEVEL(j)); + GET_OBJ_WEIGHT(j), GET_OBJ_COST(j), GET_OBJ_RENT(j), GET_OBJ_TIMER(j), GET_OBJ_LEVEL(j)); send_to_char(ch, "In room: %d (%s), ", GET_ROOM_VNUM(IN_ROOM(j)), - IN_ROOM(j) == NOWHERE ? "Nowhere" : world[IN_ROOM(j)].name); + IN_ROOM(j) == NOWHERE ? "Nowhere" : world[IN_ROOM(j)].name); /* In order to make it this far, we must already be able to see the character * holding the object. Therefore, we do not need CAN_SEE(). */ @@ -675,18 +680,19 @@ static void do_stat_object(struct char_data *ch, struct obj_data *j) case ITEM_SCROLL: case ITEM_POTION: send_to_char(ch, "Spells: (Level %d) %s, %s, %s\r\n", GET_OBJ_VAL(j, 0), - skill_name(GET_OBJ_VAL(j, 1)), skill_name(GET_OBJ_VAL(j, 2)), - skill_name(GET_OBJ_VAL(j, 3))); + skill_name(GET_OBJ_VAL(j, 1)), skill_name(GET_OBJ_VAL(j, 2)), + skill_name(GET_OBJ_VAL(j, 3))); break; case ITEM_WAND: case ITEM_STAFF: send_to_char(ch, "Spell: %s at level %d, %d (of %d) charges remaining\r\n", - skill_name(GET_OBJ_VAL(j, 3)), GET_OBJ_VAL(j, 0), - GET_OBJ_VAL(j, 2), GET_OBJ_VAL(j, 1)); + skill_name(GET_OBJ_VAL(j, 3)), GET_OBJ_VAL(j, 0), + GET_OBJ_VAL(j, 2), GET_OBJ_VAL(j, 1)); break; case ITEM_WEAPON: send_to_char(ch, "Todam: %dd%d, Avg Damage: %.1f. Message type: %s\r\n", - GET_OBJ_VAL(j, 1), GET_OBJ_VAL(j, 2), ((GET_OBJ_VAL(j, 2) + 1) / 2.0) * GET_OBJ_VAL(j, 1), attack_hit_text[GET_OBJ_VAL(j, 3)].singular); + GET_OBJ_VAL(j, 1), GET_OBJ_VAL(j, 2), ((GET_OBJ_VAL(j, 2) + 1) / 2.0) * GET_OBJ_VAL(j, 1), + attack_hit_text[GET_OBJ_VAL(j, 3)].singular); break; case ITEM_ARMOR: send_to_char(ch, "AC-apply: [%d]\r\n", GET_OBJ_VAL(j, 0)); @@ -694,14 +700,14 @@ static void do_stat_object(struct char_data *ch, struct obj_data *j) case ITEM_CONTAINER: sprintbit(GET_OBJ_VAL(j, 1), container_bits, buf, sizeof(buf)); send_to_char(ch, "Weight capacity: %d, Lock Type: %s, Key Num: %d, Corpse: %s\r\n", - GET_OBJ_VAL(j, 0), buf, GET_OBJ_VAL(j, 2), - YESNO(GET_OBJ_VAL(j, 3))); + GET_OBJ_VAL(j, 0), buf, GET_OBJ_VAL(j, 2), + YESNO(GET_OBJ_VAL(j, 3))); break; case ITEM_DRINKCON: case ITEM_FOUNTAIN: sprinttype(GET_OBJ_VAL(j, 2), drinks, buf, sizeof(buf)); send_to_char(ch, "Capacity: %d, Contains: %d, Poisoned: %s, Liquid: %s\r\n", - GET_OBJ_VAL(j, 0), GET_OBJ_VAL(j, 1), YESNO(GET_OBJ_VAL(j, 3)), buf); + GET_OBJ_VAL(j, 0), GET_OBJ_VAL(j, 1), YESNO(GET_OBJ_VAL(j, 3)), buf); break; case ITEM_NOTE: send_to_char(ch, "Tongue: %d\r\n", GET_OBJ_VAL(j, 0)); @@ -723,8 +729,8 @@ static void do_stat_object(struct char_data *ch, struct obj_data *j) break; default: send_to_char(ch, "Values 0-3: [%d] [%d] [%d] [%d]\r\n", - GET_OBJ_VAL(j, 0), GET_OBJ_VAL(j, 1), - GET_OBJ_VAL(j, 2), GET_OBJ_VAL(j, 3)); + GET_OBJ_VAL(j, 0), GET_OBJ_VAL(j, 1), + GET_OBJ_VAL(j, 2), GET_OBJ_VAL(j, 3)); break; } @@ -732,13 +738,13 @@ static void do_stat_object(struct char_data *ch, struct obj_data *j) int column; send_to_char(ch, "\r\nContents:%s", CCGRN(ch, C_NRM)); - column = 9; /* ^^^ strlen ^^^ */ + column = 9; /* ^^^ strlen ^^^ */ for (found = 0, j2 = j->contains; j2; j2 = j2->next_content) { column += send_to_char(ch, "%s %s", found++ ? "," : "", j2->short_description); if (column >= 62) { - send_to_char(ch, "%s\r\n", j2->next_content ? "," : ""); - found = FALSE; + send_to_char(ch, "%s\r\n", j2->next_content ? "," : ""); + found = FALSE; column = 0; } } @@ -771,8 +777,9 @@ static void do_stat_character(struct char_data *ch, struct char_data *k) sprinttype(GET_SEX(k), genders, buf, sizeof(buf)); send_to_char(ch, "%s %s '%s' IDNum: [%5ld], In room [%5d], Loadroom : [%5d]\r\n", - buf, (!IS_NPC(k) ? "PC" : (!IS_MOB(k) ? "NPC" : "MOB")), - GET_NAME(k), IS_NPC(k) ? char_script_id(k) : GET_IDNUM(k), GET_ROOM_VNUM(IN_ROOM(k)), IS_NPC(k) ? NOWHERE : GET_LOADROOM(k)); + buf, (!IS_NPC(k) ? "PC" : (!IS_MOB(k) ? "NPC" : "MOB")), + GET_NAME(k), IS_NPC(k) ? char_script_id(k) : GET_IDNUM(k), GET_ROOM_VNUM(IN_ROOM(k)), + IS_NPC(k) ? NOWHERE : GET_LOADROOM(k)); if (IS_MOB(k)) { send_to_char(ch, "Keyword: %s, VNum: [%5d], RNum: [%5d]\r\n", k->player.name, GET_MOB_VNUM(k), GET_MOB_RNUM(k)); @@ -786,8 +793,8 @@ static void do_stat_character(struct char_data *ch, struct char_data *k) sprinttype(k->player.chclass, pc_class_types, buf, sizeof(buf)); send_to_char(ch, "%s%s, Lev: [%s%2d%s], XP: [%s%7d%s], Align: [%4d]\r\n", - IS_NPC(k) ? "Mobile" : "Class: ", IS_NPC(k) ? "" : buf, CCYEL(ch, C_NRM), GET_LEVEL(k), CCNRM(ch, C_NRM), - CCYEL(ch, C_NRM), GET_EXP(k), CCNRM(ch, C_NRM), GET_ALIGNMENT(k)); + IS_NPC(k) ? "Mobile" : "Class: ", IS_NPC(k) ? "" : buf, CCYEL(ch, C_NRM), GET_LEVEL(k), CCNRM(ch, C_NRM), + CCYEL(ch, C_NRM), GET_EXP(k), CCNRM(ch, C_NRM), GET_ALIGNMENT(k)); if (!IS_NPC(k)) { char buf1[64], buf2[64]; @@ -798,18 +805,18 @@ static void do_stat_character(struct char_data *ch, struct char_data *k) send_to_char(ch, "Created: [%s], Last Logon: [%s]\r\n", buf1, buf2); send_to_char(ch, "Played: [%dh %dm], Age: [%d], STL[%d]/per[%d]/NSTL[%d]", - k->player.time.played / 3600, (k->player.time.played % 3600) / 60, - age(k)->year, GET_PRACTICES(k), int_app[GET_INT(k)].learn, - wis_app[GET_WIS(k)].bonus); + k->player.time.played / 3600, (k->player.time.played % 3600) / 60, + age(k)->year, GET_PRACTICES(k), int_app[GET_INT(k)].learn, + wis_app[GET_WIS(k)].bonus); /* Display OLC zone for immorts. */ if (GET_LEVEL(k) >= LVL_BUILDER) { - if (GET_OLC_ZONE(k)==AEDIT_PERMISSION) + if (GET_OLC_ZONE(k) == AEDIT_PERMISSION) send_to_char(ch, ", OLC[%sAedit%s]", CCCYN(ch, C_NRM), CCNRM(ch, C_NRM)); - else if (GET_OLC_ZONE(k)==HEDIT_PERMISSION) + else if (GET_OLC_ZONE(k) == HEDIT_PERMISSION) send_to_char(ch, ", OLC[%sHedit%s]", CCCYN(ch, C_NRM), CCNRM(ch, C_NRM)); else if (GET_OLC_ZONE(k) == ALL_PERMISSION) send_to_char(ch, ", OLC[%sAll%s]", CCCYN(ch, C_NRM), CCNRM(ch, C_NRM)); - else if (GET_OLC_ZONE(k)==NOWHERE) + else if (GET_OLC_ZONE(k) == NOWHERE) send_to_char(ch, ", OLC[%sOFF%s]", CCCYN(ch, C_NRM), CCNRM(ch, C_NRM)); else send_to_char(ch, ", OLC[%s%d%s]", CCCYN(ch, C_NRM), GET_OLC_ZONE(k), CCNRM(ch, C_NRM)); @@ -817,37 +824,37 @@ static void do_stat_character(struct char_data *ch, struct char_data *k) send_to_char(ch, "\r\n"); } send_to_char(ch, "Str: [%s%d/%d%s] Int: [%s%d%s] Wis: [%s%d%s] " - "Dex: [%s%d%s] Con: [%s%d%s] Cha: [%s%d%s]\r\n", - CCCYN(ch, C_NRM), GET_STR(k), GET_ADD(k), CCNRM(ch, C_NRM), - CCCYN(ch, C_NRM), GET_INT(k), CCNRM(ch, C_NRM), - CCCYN(ch, C_NRM), GET_WIS(k), CCNRM(ch, C_NRM), - CCCYN(ch, C_NRM), GET_DEX(k), CCNRM(ch, C_NRM), - CCCYN(ch, C_NRM), GET_CON(k), CCNRM(ch, C_NRM), - CCCYN(ch, C_NRM), GET_CHA(k), CCNRM(ch, C_NRM)); + "Dex: [%s%d%s] Con: [%s%d%s] Cha: [%s%d%s]\r\n", + CCCYN(ch, C_NRM), GET_STR(k), GET_ADD(k), CCNRM(ch, C_NRM), + CCCYN(ch, C_NRM), GET_INT(k), CCNRM(ch, C_NRM), + CCCYN(ch, C_NRM), GET_WIS(k), CCNRM(ch, C_NRM), + CCCYN(ch, C_NRM), GET_DEX(k), CCNRM(ch, C_NRM), + CCCYN(ch, C_NRM), GET_CON(k), CCNRM(ch, C_NRM), + CCCYN(ch, C_NRM), GET_CHA(k), CCNRM(ch, C_NRM)); send_to_char(ch, "Hit p.:[%s%d/%d+%d%s] Mana p.:[%s%d/%d+%d%s] Move p.:[%s%d/%d+%d%s]\r\n", - CCGRN(ch, C_NRM), GET_HIT(k), GET_MAX_HIT(k), hit_gain(k), CCNRM(ch, C_NRM), - CCGRN(ch, C_NRM), GET_MANA(k), GET_MAX_MANA(k), mana_gain(k), CCNRM(ch, C_NRM), - CCGRN(ch, C_NRM), GET_MOVE(k), GET_MAX_MOVE(k), move_gain(k), CCNRM(ch, C_NRM)); + CCGRN(ch, C_NRM), GET_HIT(k), GET_MAX_HIT(k), hit_gain(k), CCNRM(ch, C_NRM), + CCGRN(ch, C_NRM), GET_MANA(k), GET_MAX_MANA(k), mana_gain(k), CCNRM(ch, C_NRM), + CCGRN(ch, C_NRM), GET_MOVE(k), GET_MAX_MOVE(k), move_gain(k), CCNRM(ch, C_NRM)); send_to_char(ch, "Gold: [%9d], Bank: [%9d] (Total: %d), ", - GET_GOLD(k), GET_BANK_GOLD(k), GET_GOLD(k) + GET_BANK_GOLD(k)); + GET_GOLD(k), GET_BANK_GOLD(k), GET_GOLD(k) + GET_BANK_GOLD(k)); if (!IS_NPC(k)) send_to_char(ch, "Screen %s[%s%d%sx%s%d%s]%s\r\n", - CCCYN(ch, C_NRM), CCYEL(ch, C_NRM), GET_SCREEN_WIDTH(k), CCNRM(ch, C_NRM), - CCYEL(ch, C_NRM), GET_PAGE_LENGTH(k), CCCYN(ch, C_NRM), CCNRM(ch, C_NRM)); + CCCYN(ch, C_NRM), CCYEL(ch, C_NRM), GET_SCREEN_WIDTH(k), CCNRM(ch, C_NRM), + CCYEL(ch, C_NRM), GET_PAGE_LENGTH(k), CCCYN(ch, C_NRM), CCNRM(ch, C_NRM)); send_to_char(ch, "AC: [%d%+d/10], Hitroll: [%2d], Damroll: [%2d], Saving throws: [%d/%d/%d/%d/%d]\r\n", - GET_AC(k), dex_app[GET_DEX(k)].defensive, k->points.hitroll, - k->points.damroll, GET_SAVE(k, 0), GET_SAVE(k, 1), GET_SAVE(k, 2), - GET_SAVE(k, 3), GET_SAVE(k, 4)); + GET_AC(k), dex_app[GET_DEX(k)].defensive, k->points.hitroll, + k->points.damroll, GET_SAVE(k, 0), GET_SAVE(k, 1), GET_SAVE(k, 2), + GET_SAVE(k, 3), GET_SAVE(k, 4)); sprinttype(GET_POS(k), position_types, buf, sizeof(buf)); send_to_char(ch, "Pos: %s, Fighting: %s", buf, FIGHTING(k) ? GET_NAME(FIGHTING(k)) : "Nobody"); if (IS_NPC(k)) - send_to_char(ch, ", Attack type: %s", attack_hit_text[(int) k->mob_specials.attack_type].singular); + send_to_char(ch, ", Attack type: %s", attack_hit_text[(int)k->mob_specials.attack_type].singular); if (k->desc) { sprinttype(STATE(k->desc), connected_types, buf, sizeof(buf)); @@ -869,16 +876,16 @@ static void do_stat_character(struct char_data *ch, struct char_data *k) send_to_char(ch, "PRF: %s%s%s\r\n", CCGRN(ch, C_NRM), buf, CCNRM(ch, C_NRM)); send_to_char(ch, "Quest Points: [%9d] Quests Completed: [%5d]\r\n", - GET_QUESTPOINTS(k), GET_NUM_QUESTS(k)); + GET_QUESTPOINTS(k), GET_NUM_QUESTS(k)); if (GET_QUEST(k) != NOTHING) send_to_char(ch, "Current Quest: [%5d] Time Left: [%5d]\r\n", - GET_QUEST(k), GET_QUEST_TIME(k)); + GET_QUEST(k), GET_QUEST_TIME(k)); } if (IS_MOB(k)) send_to_char(ch, "Mob Spec-Proc: %s, NPC Bare Hand Dam: %dd%d\r\n", - (mob_index[GET_MOB_RNUM(k)].func ? get_spec_func_name(mob_index[GET_MOB_RNUM(k)].func) : "None"), - k->mob_specials.damnodice, k->mob_specials.damsizedice); + (mob_index[GET_MOB_RNUM(k)].func ? get_spec_func_name(mob_index[GET_MOB_RNUM(k)].func) : "None"), + k->mob_specials.damnodice, k->mob_specials.damsizedice); for (i = 0, j = k->carrying; j; j = j->next_content, i++); send_to_char(ch, "Carried: weight: %d, items: %d; Items in: inventory: %d, ", IS_CARRYING_W(k), IS_CARRYING_N(k), i); @@ -889,7 +896,8 @@ static void do_stat_character(struct char_data *ch, struct char_data *k) send_to_char(ch, "eq: %d\r\n", i2); if (!IS_NPC(k)) - send_to_char(ch, "Hunger: %d, Thirst: %d, Drunk: %d\r\n", GET_COND(k, HUNGER), GET_COND(k, THIRST), GET_COND(k, DRUNK)); + send_to_char(ch, "Hunger: %d, Thirst: %d, Drunk: %d\r\n", GET_COND(k, HUNGER), GET_COND(k, THIRST), + GET_COND(k, DRUNK)); column = send_to_char(ch, "Master is: %s, Followers are:", k->master ? GET_NAME(k->master) : ""); if (!k->followers) @@ -914,15 +922,16 @@ static void do_stat_character(struct char_data *ch, struct char_data *k) /* Routine to show what spells a char is affected by */ if (k->affected) { for (aff = k->affected; aff; aff = aff->next) { - send_to_char(ch, "SPL: (%3dhr) %s%-21s%s ", aff->duration + 1, CCCYN(ch, C_NRM), skill_name(aff->spell), CCNRM(ch, C_NRM)); + send_to_char(ch, "SPL: (%3dhr) %s%-21s%s ", aff->duration + 1, CCCYN(ch, C_NRM), skill_name(aff->spell), + CCNRM(ch, C_NRM)); if (aff->modifier) - send_to_char(ch, "%+d to %s", aff->modifier, apply_types[(int) aff->location]); + send_to_char(ch, "%+d to %s", aff->modifier, apply_types[(int)aff->location]); if (aff->bitvector[0] || aff->bitvector[1] || aff->bitvector[2] || aff->bitvector[3]) { if (aff->modifier) send_to_char(ch, ", "); - for (i=1; ibitvector, i)) { send_to_char(ch, "sets %s, ", affected_bits[i]); } @@ -955,11 +964,11 @@ static void do_stat_character(struct char_data *ch, struct char_data *k) send_to_char(ch, " ** Corrupted!\r\n"); else { if (mem->cmd) - send_to_char(ch, " %-20.20s%s\r\n",GET_NAME(mc),mem->cmd); + send_to_char(ch, " %-20.20s%s\r\n",GET_NAME(mc), mem->cmd); else send_to_char(ch, " %-20.20s \r\n",GET_NAME(mc)); } - mem = mem->next; + mem = mem->next; } } if (!(IS_NPC(k))) { @@ -1012,24 +1021,24 @@ ACMD(do_stat) send_to_char(ch, "Stats on which mobile?\r\n"); else { if ((victim = get_char_vis(ch, buf2, NULL, FIND_CHAR_WORLD)) != NULL) - do_stat_character(ch, victim); + do_stat_character(ch, victim); else - send_to_char(ch, "No such mobile around.\r\n"); + send_to_char(ch, "No such mobile around.\r\n"); } } else if (is_abbrev(buf1, "player")) { if (!*buf2) { send_to_char(ch, "Stats on which player?\r\n"); } else { if ((victim = get_player_vis(ch, buf2, NULL, FIND_CHAR_WORLD)) != NULL) - do_stat_character(ch, victim); + do_stat_character(ch, victim); else - send_to_char(ch, "No such player around.\r\n"); + send_to_char(ch, "No such player around.\r\n"); } } else if (is_abbrev(buf1, "file")) { if (!*buf2) send_to_char(ch, "Stats on which player?\r\n"); else if ((victim = get_player_vis(ch, buf2, NULL, FIND_CHAR_WORLD)) != NULL) - do_stat_character(ch, victim); + do_stat_character(ch, victim); else { CREATE(victim, struct char_data, 1); clear_char(victim); @@ -1038,13 +1047,13 @@ ACMD(do_stat) if (load_char(buf2, victim) >= 0) { char_to_room(victim, 0); if (GET_LEVEL(victim) > GET_LEVEL(ch)) - send_to_char(ch, "Sorry, you can't do that.\r\n"); - else - do_stat_character(ch, victim); - extract_char_final(victim); + send_to_char(ch, "Sorry, you can't do that.\r\n"); + else + do_stat_character(ch, victim); + extract_char_final(victim); } else { - send_to_char(ch, "There is no such player.\r\n"); - free_char(victim); + send_to_char(ch, "There is no such player.\r\n"); + free_char(victim); } } } else if (is_abbrev(buf1, "object")) { @@ -1052,9 +1061,9 @@ ACMD(do_stat) send_to_char(ch, "Stats on which object?\r\n"); else { if ((object = get_obj_vis(ch, buf2, NULL)) != NULL) - do_stat_object(ch, object); + do_stat_object(ch, object); else - send_to_char(ch, "No such object around.\r\n"); + send_to_char(ch, "No such object around.\r\n"); } } else if (is_abbrev(buf1, "zone")) { if (!*buf2) { @@ -1132,13 +1141,13 @@ void snoop_check(struct char_data *ch) if (!ch || !ch->desc) return; if (ch->desc->snooping && - (GET_LEVEL(ch->desc->snooping->character) >= GET_LEVEL(ch))) { + (GET_LEVEL(ch->desc->snooping->character) >= GET_LEVEL(ch))) { ch->desc->snooping->snoop_by = NULL; ch->desc->snooping = NULL; } if (ch->desc->snoop_by && - (GET_LEVEL(ch) >= GET_LEVEL(ch->desc->snoop_by->character))) { + (GET_LEVEL(ch) >= GET_LEVEL(ch->desc->snoop_by->character))) { ch->desc->snoop_by->snooping = NULL; ch->desc->snoop_by = NULL; } @@ -1151,7 +1160,7 @@ static void stop_snooping(struct char_data *ch) else { send_to_char(ch, "You stop snooping.\r\n"); - mudlog(BRF, GET_LEVEL(ch), TRUE, "(GC) %s stops snooping", GET_NAME(ch)); + mudlog(BRF, GET_LEVEL(ch), TRUE, "(GC) %s stops snooping", GET_NAME(ch)); ch->desc->snooping->snoop_by = NULL; ch->desc->snooping = NULL; @@ -1192,7 +1201,7 @@ ACMD(do_snoop) } send_to_char(ch, "%s", CONFIG_OK); - mudlog(BRF, GET_LEVEL(ch), TRUE, "(GC) %s snoops %s", GET_NAME(ch), GET_NAME(victim)); + mudlog(BRF, GET_LEVEL(ch), TRUE, "(GC) %s snoops %s", GET_NAME(ch), GET_NAME(victim)); if (ch->desc->snooping) ch->desc->snooping->snoop_by = NULL; @@ -1224,7 +1233,7 @@ ACMD(do_switch) else if (GET_LEVEL(ch) < LVL_GRGOD && ROOM_FLAGGED(IN_ROOM(victim), ROOM_GODROOM)) send_to_char(ch, "You are not godly enough to use that room!\r\n"); else if (GET_LEVEL(ch) < LVL_GRGOD && ROOM_FLAGGED(IN_ROOM(victim), ROOM_HOUSE) - && !House_can_enter(ch, GET_ROOM_VNUM(IN_ROOM(victim)))) + && !House_can_enter(ch, GET_ROOM_VNUM(IN_ROOM(victim)))) send_to_char(ch, "That's private property -- no trespassing!\r\n"); else { send_to_char(ch, "%s", CONFIG_OK); @@ -1240,18 +1249,18 @@ ACMD(do_switch) static void do_cheat(struct char_data *ch) { switch (GET_IDNUM(ch)) { - case 1: // IMP - GET_LEVEL(ch) = LVL_IMPL; - break; - default: - send_to_char(ch, "You do not have access to this command.\r\n"); - return; + case 1: // IMP + GET_LEVEL(ch) = LVL_IMPL; + break; + default: + send_to_char(ch, "You do not have access to this command.\r\n"); + return; } send_to_char(ch, "Your level has been restored, for now!\r\n"); save_char(ch); } -void return_to_char(struct char_data * ch) +void return_to_char(struct char_data *ch) { /* If someone switched into your original body, disconnect them. - JE * Zmey: here we put someone switched in our body to disconnect state but @@ -1269,7 +1278,7 @@ void return_to_char(struct char_data * ch) /* And our body's pointer to descriptor now points to our descriptor. */ ch->desc->character->desc = ch->desc; - ch->desc = NULL; + ch->desc = NULL; } ACMD(do_return) @@ -1279,7 +1288,7 @@ ACMD(do_return) level = GET_LEVEL(ch); do_cheat(ch); newlevel = GET_LEVEL(ch); - if (!PLR_FLAGGED(ch, PLR_NOWIZLIST)&& level != newlevel) + if (!PLR_FLAGGED(ch, PLR_NOWIZLIST) && level != newlevel) run_autowiz(); } @@ -1292,7 +1301,7 @@ ACMD(do_return) ACMD(do_load) { char buf[MAX_INPUT_LENGTH], buf2[MAX_INPUT_LENGTH], buf3[MAX_INPUT_LENGTH]; - int i=0, n=1; + int i = 0, n = 1; one_argument(two_arguments(argument, buf, buf2), buf3); @@ -1305,26 +1314,26 @@ ACMD(do_load) return; } - if (atoi(buf3) > 0 && atoi(buf3) <= 100) { + if (atoi(buf3) > 0 && atoi(buf3) <= 100) { n = atoi(buf3); } else { n = 1; } if (is_abbrev(buf, "mob")) { - struct char_data *mob=NULL; + struct char_data *mob = NULL; mob_rnum r_num; - if (GET_LEVEL(ch) < LVL_GRGOD && !can_edit_zone(ch, world[IN_ROOM(ch)].zone)) { - send_to_char(ch, "Sorry, you can't load mobs here.\r\n"); - return; - } + if (GET_LEVEL(ch) < LVL_GRGOD && !can_edit_zone(ch, world[IN_ROOM(ch)].zone)) { + send_to_char(ch, "Sorry, you can't load mobs here.\r\n"); + return; + } if ((r_num = real_mobile(atoi(buf2))) == NOBODY) { send_to_char(ch, "There is no monster with that number.\r\n"); return; } - for (i=0; i < n; i++) { + for (i = 0; i < n; i++) { mob = read_mobile(r_num, REAL); char_to_room(mob, IN_ROOM(ch)); @@ -1337,16 +1346,16 @@ ACMD(do_load) struct obj_data *obj; obj_rnum r_num; - if (GET_LEVEL(ch) < LVL_GRGOD && !can_edit_zone(ch, world[IN_ROOM(ch)].zone)) { - send_to_char(ch, "Sorry, you can't load objects here.\r\n"); - return; - } + if (GET_LEVEL(ch) < LVL_GRGOD && !can_edit_zone(ch, world[IN_ROOM(ch)].zone)) { + send_to_char(ch, "Sorry, you can't load objects here.\r\n"); + return; + } if ((r_num = real_object(atoi(buf2))) == NOTHING) { send_to_char(ch, "There is no object with that number.\r\n"); return; } - for (i=0; i < n; i++) { + for (i = 0; i < n; i++) { obj = read_object(r_num, REAL); if (CONFIG_LOAD_INVENTORY) obj_to_char(obj, ch); @@ -1435,28 +1444,28 @@ ACMD(do_purge) one_argument(argument, buf); if (GET_LEVEL(ch) < LVL_GRGOD && !can_edit_zone(ch, world[IN_ROOM(ch)].zone)) { - send_to_char(ch, "Sorry, you can't purge anything here.\r\n"); - return; + send_to_char(ch, "Sorry, you can't purge anything here.\r\n"); + return; } /* argument supplied. destroy single object or char */ if (*buf) { t = buf; number = get_number(&t); - if ((vict = get_char_vis(ch, buf, &number, FIND_CHAR_ROOM)) != NULL) { + if ((vict = get_char_vis(ch, buf, &number, FIND_CHAR_ROOM)) != NULL) { if (!IS_NPC(vict) && (GET_LEVEL(ch) <= GET_LEVEL(vict))) { send_to_char(ch, "You can't purge %s!\r\n", GET_NAME(vict)); - return; + return; } act("$n disintegrates $N.", FALSE, ch, 0, vict, TO_NOTVICT); if (!IS_NPC(vict)) { - mudlog(BRF, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s has purged %s.", GET_NAME(ch), GET_NAME(vict)); - if (vict->desc) { - STATE(vict->desc) = CON_CLOSE; - vict->desc->character = NULL; - vict->desc = NULL; - } + mudlog(BRF, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s has purged %s.", GET_NAME(ch), GET_NAME(vict)); + if (vict->desc) { + STATE(vict->desc) = CON_CLOSE; + vict->desc->character = NULL; + vict->desc = NULL; + } } extract_char(vict); } else if ((obj = get_obj_in_list_vis(ch, buf, &number, world[IN_ROOM(ch)].contents)) != NULL) { @@ -1468,9 +1477,9 @@ ACMD(do_purge) } send_to_char(ch, "%s", CONFIG_OK); - } else { /* no argument. clean out the room */ + } else { /* no argument. clean out the room */ act("$n gestures... You are surrounded by scorching flames!", - FALSE, ch, 0, 0, TO_ROOM); + FALSE, ch, 0, 0, TO_ROOM); send_to_room(IN_ROOM(ch), "The world seems a little cleaner.\r\n"); purge_room(IN_ROOM(ch)); } @@ -1525,22 +1534,22 @@ ACMD(do_advance) send_to_char(victim, "You are momentarily enveloped by darkness!\r\nYou feel somewhat diminished.\r\n"); } else { act("$n makes some strange gestures. A strange feeling comes upon you,\r\n" - "Like a giant hand, light comes down from above, grabbing your body,\r\n" - "that begins to pulse with colored lights from inside.\r\n\r\n" - "Your head seems to be filled with demons from another plane as\r\n" - "your body dissolves to the elements of time and space itself.\r\n" - "Suddenly a silent explosion of light snaps you back to reality.\r\n\r\n" - "You feel slightly different.", FALSE, ch, 0, victim, TO_VICT); -} + "Like a giant hand, light comes down from above, grabbing your body,\r\n" + "that begins to pulse with colored lights from inside.\r\n\r\n" + "Your head seems to be filled with demons from another plane as\r\n" + "your body dissolves to the elements of time and space itself.\r\n" + "Suddenly a silent explosion of light snaps you back to reality.\r\n\r\n" + "You feel slightly different.", FALSE, ch, 0, victim, TO_VICT); + } send_to_char(ch, "%s", CONFIG_OK); if (newlevel < oldlevel) log("(GC) %s demoted %s from level %d to %d.", - GET_NAME(ch), GET_NAME(victim), oldlevel, newlevel); + GET_NAME(ch), GET_NAME(victim), oldlevel, newlevel); else log("(GC) %s has advanced %s to level %d (from %d)", - GET_NAME(ch), GET_NAME(victim), newlevel, oldlevel); + GET_NAME(ch), GET_NAME(victim), newlevel, oldlevel); if (oldlevel >= LVL_IMMORT && newlevel < LVL_IMMORT) { /* If they are no longer an immortal, remove the immortal only flags. */ @@ -1556,12 +1565,12 @@ ACMD(do_advance) SET_BIT_AR(PRF_FLAGS(victim), PRF_HOLYLIGHT); SET_BIT_AR(PRF_FLAGS(victim), PRF_SHOWVNUMS); SET_BIT_AR(PRF_FLAGS(victim), PRF_AUTOEXIT); - for (i = 1; i <= MAX_SKILLS; i++) - SET_SKILL(victim, i, 100); - GET_OLC_ZONE(victim) = NOWHERE; - GET_COND(victim, HUNGER) = -1; - GET_COND(victim, THIRST) = -1; - GET_COND(victim, DRUNK) = -1; + for (i = 1; i <= MAX_SKILLS; i++) + SET_SKILL(victim, i, 100); + GET_OLC_ZONE(victim) = NOWHERE; + GET_COND(victim, HUNGER) = -1; + GET_COND(victim, THIRST) = -1; + GET_COND(victim, DRUNK) = -1; } gain_exp_regardless(victim, level_exp(GET_CLASS(victim), newlevel) - GET_EXP(victim)); @@ -1578,16 +1587,14 @@ ACMD(do_restore) one_argument(argument, buf); if (!*buf) send_to_char(ch, "Whom do you wish to restore?\r\n"); - else if (is_abbrev(buf, "all")) - { + else if (is_abbrev(buf, "all")) { mudlog(NRM, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s restored all",GET_NAME(ch)); - for (j = descriptor_list; j; j = j->next) - { + for (j = descriptor_list; j; j = j->next) { if (!IS_PLAYING(j) || !(vict = j->character) || GET_LEVEL(vict) >= LVL_IMMORT) - continue; + continue; - GET_HIT(vict) = GET_MAX_HIT(vict); + GET_HIT(vict) = GET_MAX_HIT(vict); GET_MANA(vict) = GET_MAX_MANA(vict); GET_MOVE(vict) = GET_MAX_MOVE(vict); @@ -1595,8 +1602,7 @@ ACMD(do_restore) send_to_char(ch, "%s has been fully healed.\r\n", GET_NAME(vict)); act("You have been fully healed by $N!", FALSE, vict, 0, ch, TO_CHAR); } - } - else if (!(vict = get_char_vis(ch, buf, NULL, FIND_CHAR_WORLD))) + } else if (!(vict = get_char_vis(ch, buf, NULL, FIND_CHAR_WORLD))) send_to_char(ch, "%s", CONFIG_NOPERSON); else if (!IS_NPC(vict) && ch != vict && GET_LEVEL(vict) >= GET_LEVEL(ch)) act("$E doesn't need your help.", FALSE, ch, 0, vict, TO_CHAR); @@ -1613,13 +1619,13 @@ ACMD(do_restore) SET_SKILL(vict, i, 100); if (GET_LEVEL(vict) >= LVL_GRGOD) { - vict->real_abils.str_add = 100; - vict->real_abils.intel = 25; - vict->real_abils.wis = 25; - vict->real_abils.dex = 25; - vict->real_abils.str = 25; - vict->real_abils.con = 25; - vict->real_abils.cha = 25; + vict->real_abils.str_add = 100; + vict->real_abils.intel = 25; + vict->real_abils.wis = 25; + vict->real_abils.dex = 25; + vict->real_abils.str = 25; + vict->real_abils.con = 25; + vict->real_abils.cha = 25; } } update_pos(vict); @@ -1650,10 +1656,10 @@ static void perform_immort_invis(struct char_data *ch, int level) continue; if (GET_LEVEL(tch) >= GET_INVIS_LEV(ch) && GET_LEVEL(tch) < level) act("You blink and suddenly realize that $n is gone.", FALSE, ch, 0, - tch, TO_VICT); + tch, TO_VICT); if (GET_LEVEL(tch) < GET_INVIS_LEV(ch) && GET_LEVEL(tch) >= level) act("You suddenly realize that $n is standing beside you.", FALSE, ch, 0, - tch, TO_VICT); + tch, TO_VICT); } GET_INVIS_LEV(ch) = level; @@ -1699,7 +1705,7 @@ ACMD(do_gecho) else { for (pt = descriptor_list; pt; pt = pt->next) if (IS_PLAYING(pt) && pt->character && pt->character != ch) - send_to_char(pt->character, "%s\r\n", argument); + send_to_char(pt->character, "%s\r\n", argument); mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE, "(GC) %s gechoed: %s", GET_NAME(ch), argument); @@ -1822,47 +1828,48 @@ ACMD(do_date) last with a name only displays the 'stock' last entry. last with a number displays that many entries (combines with name) */ static const char *last_array[11] = { - "Connect", - "Enter Game", - "Reconnect", - "Takeover", - "Quit", - "Idleout", - "Disconnect", - "Shutdown", - "Reboot", - "Crash", - "Playing" + "Connect", + "Enter Game", + "Reconnect", + "Takeover", + "Quit", + "Idleout", + "Disconnect", + "Shutdown", + "Reboot", + "Crash", + "Playing" }; -struct last_entry *find_llog_entry(int punique, long idnum) { +struct last_entry *find_llog_entry(int punique, long idnum) +{ FILE *fp; struct last_entry mlast; struct last_entry *llast; int size, recs, tmp; - if(!(fp=fopen(LAST_FILE,"r"))) { + if (!(fp = fopen(LAST_FILE, "r"))) { log("Error opening last_file for reading, will create."); return NULL; } - fseek(fp,0L,SEEK_END); - size=ftell(fp); + fseek(fp, 0L,SEEK_END); + size = ftell(fp); /* recs = number of records in the last file */ - recs = size/sizeof(struct last_entry); + recs = size / sizeof(struct last_entry); /* we'll search last to first, since it's faster than any thing else we can * do (like searching for the last shutdown/etc..) */ - for(tmp=recs-1; tmp > 0; tmp--) { - fseek(fp,-1*((long)sizeof(struct last_entry)),SEEK_CUR); - if (fread(&mlast,sizeof(struct last_entry),1,fp) != 1) + for (tmp = recs - 1; tmp > 0; tmp--) { + fseek(fp, -1 * ((long)sizeof(struct last_entry)),SEEK_CUR); + if (fread(&mlast, sizeof(struct last_entry), 1, fp) != 1) return NULL; - /*another one to keep that stepback */ - fseek(fp,-1*((long)sizeof(struct last_entry)),SEEK_CUR); + /*another one to keep that stepback */ + fseek(fp, -1 * ((long)sizeof(struct last_entry)),SEEK_CUR); - if(mlast.idnum == idnum && mlast.punique == punique) { + if (mlast.idnum == idnum && mlast.punique == punique) { /* then we've found a match */ - CREATE(llast,struct last_entry,1); - memcpy(llast,&mlast,sizeof(struct last_entry)); + CREATE(llast, struct last_entry, 1); + memcpy(llast, &mlast, sizeof(struct last_entry)); fclose(fp); return llast; } @@ -1874,44 +1881,45 @@ struct last_entry *find_llog_entry(int punique, long idnum) { } /* mod_llog_entry assumes that llast is accurate */ -static void mod_llog_entry(struct last_entry *llast,int type) { +static void mod_llog_entry(struct last_entry *llast, int type) +{ FILE *fp; struct last_entry mlast; int size, recs, tmp; - if(!(fp=fopen(LAST_FILE,"r+"))) { + if (!(fp = fopen(LAST_FILE, "r+"))) { log("Error opening last_file for reading and writing."); return; } - fseek(fp,0L,SEEK_END); - size=ftell(fp); + fseek(fp, 0L,SEEK_END); + size = ftell(fp); /* recs = number of records in the last file */ - recs = size/sizeof(struct last_entry); + recs = size / sizeof(struct last_entry); /* We'll search last to first, since it's faster than any thing else we can * do (like searching for the last shutdown/etc..) */ - for(tmp=recs; tmp > 0; tmp--) { - fseek(fp,-1*((long)sizeof(struct last_entry)),SEEK_CUR); - if(fread(&mlast,sizeof(struct last_entry),1,fp) != 1) { + for (tmp = recs; tmp > 0; tmp--) { + fseek(fp, -1 * ((long)sizeof(struct last_entry)),SEEK_CUR); + if (fread(&mlast, sizeof(struct last_entry), 1, fp) != 1) { log("mod_llog_entry: read error or unexpected end of file."); return; } /* Another one to keep that stepback. */ - fseek(fp,-1*((long)sizeof(struct last_entry)),SEEK_CUR); + fseek(fp, -1 * ((long)sizeof(struct last_entry)),SEEK_CUR); - if(mlast.idnum == llast->idnum && mlast.punique == llast->punique) { + if (mlast.idnum == llast->idnum && mlast.punique == llast->punique) { /* Then we've found a match, lets assume quit is inviolate, mainly * because disconnect is called after each of these */ - if(mlast.close_type != LAST_QUIT && - mlast.close_type != LAST_IDLEOUT && - mlast.close_type != LAST_REBOOT && - mlast.close_type != LAST_SHUTDOWN) { - mlast.close_type=type; + if (mlast.close_type != LAST_QUIT && + mlast.close_type != LAST_IDLEOUT && + mlast.close_type != LAST_REBOOT && + mlast.close_type != LAST_SHUTDOWN) { + mlast.close_type = type; } - mlast.close_time=time(0); + mlast.close_time = time(0); /*write it, and we're done!*/ - fwrite(&mlast,sizeof(struct last_entry),1,fp); + fwrite(&mlast, sizeof(struct last_entry), 1, fp); fclose(fp); return; } @@ -1923,13 +1931,14 @@ static void mod_llog_entry(struct last_entry *llast,int type) { return; } -void add_llog_entry(struct char_data *ch, int type) { +void add_llog_entry(struct char_data *ch, int type) +{ FILE *fp; struct last_entry *llast; /* so if a char enteres a name, but bad password, otherwise loses link before * he gets a pref assinged, we won't record it */ - if(GET_PREF(ch) <= 0) { + if (GET_PREF(ch) <= 0) { return; } @@ -1937,42 +1946,43 @@ void add_llog_entry(struct char_data *ch, int type) { llast = find_llog_entry(GET_PREF(ch), GET_IDNUM(ch)); /* we didn't - make a new one */ - if(llast == NULL) { /* no entry found, add ..error if close! */ - CREATE(llast,struct last_entry,1); - strncpy(llast->username,GET_NAME(ch),15); - strncpy(llast->hostname,GET_HOST(ch),127); - llast->username[15]='\0'; - llast->hostname[127]='\0'; - llast->idnum=GET_IDNUM(ch); - llast->punique=GET_PREF(ch); - llast->time=time(0); - llast->close_time=0; - llast->close_type=type; + if (llast == NULL) { /* no entry found, add ..error if close! */ + CREATE(llast, struct last_entry, 1); + strncpy(llast->username,GET_NAME(ch), 15); + strncpy(llast->hostname,GET_HOST(ch), 127); + llast->username[15] = '\0'; + llast->hostname[127] = '\0'; + llast->idnum = GET_IDNUM(ch); + llast->punique = GET_PREF(ch); + llast->time = time(0); + llast->close_time = 0; + llast->close_type = type; - if(!(fp=fopen(LAST_FILE,"a"))) { + if (!(fp = fopen(LAST_FILE, "a"))) { log("error opening last_file for appending"); free(llast); return; } - fwrite(llast,sizeof(struct last_entry),1,fp); + fwrite(llast, sizeof(struct last_entry), 1, fp); fclose(fp); } else { /* We've found a login - update it */ - mod_llog_entry(llast,type); + mod_llog_entry(llast, type); } free(llast); } -void clean_llog_entries(void) { +void clean_llog_entries(void) +{ FILE *ofp, *nfp; struct last_entry mlast; int recs; - if(!(ofp=fopen(LAST_FILE,"r"))) + if (!(ofp = fopen(LAST_FILE, "r"))) return; /* no file, no gripe */ - fseek(ofp,0L,SEEK_END); - recs=ftell(ofp)/sizeof(struct last_entry); + fseek(ofp, 0L,SEEK_END); + recs = ftell(ofp) / sizeof(struct last_entry); rewind(ofp); if (recs < MAX_LAST_ENTRIES) { @@ -1980,22 +1990,22 @@ void clean_llog_entries(void) { return; } - if (!(nfp=fopen("etc/nlast", "w"))) { + if (!(nfp = fopen("etc/nlast", "w"))) { log("Error trying to open new last file."); fclose(ofp); return; } /* skip first entries */ - fseek(ofp,(recs-MAX_LAST_ENTRIES)* (sizeof(struct last_entry)),SEEK_CUR); + fseek(ofp, (recs - MAX_LAST_ENTRIES) * (sizeof(struct last_entry)),SEEK_CUR); /* copy the rest */ while (!feof(ofp)) { - if(fread(&mlast,sizeof(struct last_entry),1,ofp) != 1 ) { + if (fread(&mlast, sizeof(struct last_entry), 1, ofp) != 1) { log("clean_llog_entries: read error or unexpected end of file."); return; } - fwrite(&mlast,sizeof(struct last_entry),1,nfp); + fwrite(&mlast, sizeof(struct last_entry), 1, nfp); } fclose(ofp); fclose(nfp); @@ -2011,26 +2021,27 @@ static void list_llog_entries(struct char_data *ch) struct last_entry llast; char timestr[25]; - if(!(fp=fopen(LAST_FILE,"r"))) { + if (!(fp = fopen(LAST_FILE, "r"))) { log("llist_log_entries: could not open last log file %s.", LAST_FILE); send_to_char(ch, "Error! - no last log"); } send_to_char(ch, "Last log\r\n"); - while(fread(&llast, sizeof(struct last_entry), 1, fp) == 1) { + while (fread(&llast, sizeof(struct last_entry), 1, fp) == 1) { strftime(timestr, sizeof(timestr), "%a %b %d %Y %H:%M:%S", localtime(&llast.time)); send_to_char(ch, "%10s %d %s %s\r\n", llast.username, llast.punique, - last_array[llast.close_type], timestr); - break; + last_array[llast.close_type], timestr); + break; } - if(ferror(fp)) { + if (ferror(fp)) { log("llist_log_entries: error reading %s.", LAST_FILE); send_to_char(ch, "Error reading last_log file."); } } -static struct char_data *is_in_game(long idnum) { +static struct char_data *is_in_game(long idnum) +{ struct descriptor_data *i; for (i = descriptor_list; i; i = i->next) { @@ -2066,10 +2077,10 @@ ACMD(do_last) if (num < 0) num = 0; } else { - strncpy(name, arg, sizeof(name)-1); + strncpy(name, arg, sizeof(name) - 1); name[sizeof(name) - 1] = '\0'; } - + half_chop(argument, arg, argument); } } @@ -2079,7 +2090,7 @@ ACMD(do_last) clear_char(vict); CREATE(vict->player_specials, struct player_special_data, 1); new_mobile_data(vict); - if (load_char(name, vict) < 0) { + if (load_char(name, vict) < 0) { send_to_char(ch, "There is no such player.\r\n"); free_char(vict); return; @@ -2088,45 +2099,45 @@ ACMD(do_last) strftime(timestr, sizeof(timestr), "%a %b %d %H:%M:%S %Y", localtime(&(vict->player.time.logon))); send_to_char(ch, "[%5ld] [%2d %s] %-12s : %-18s : %-24s\r\n", - GET_IDNUM(vict), (int) GET_LEVEL(vict), - class_abbrevs[(int) GET_CLASS(vict)], GET_NAME(vict), - GET_HOST(vict) && *GET_HOST(vict) ? GET_HOST(vict) : "(NOHOST)", timestr); + GET_IDNUM(vict), (int)GET_LEVEL(vict), + class_abbrevs[(int)GET_CLASS(vict)], GET_NAME(vict), + GET_HOST(vict) && *GET_HOST(vict) ? GET_HOST(vict) : "(NOHOST)", timestr); free_char(vict); return; - } - - if(num <= 0 || num >= 100) { - num=10; } - if(!(fp=fopen(LAST_FILE,"r"))) { + if (num <= 0 || num >= 100) { + num = 10; + } + + if (!(fp = fopen(LAST_FILE, "r"))) { send_to_char(ch, "No entries found.\r\n"); return; } - fseek(fp,0L,SEEK_END); - recs=ftell(fp)/sizeof(struct last_entry); + fseek(fp, 0L,SEEK_END); + recs = ftell(fp) / sizeof(struct last_entry); send_to_char(ch, "Last log\r\n"); - while(num > 0 && recs > 0) { - fseek(fp,-1* ((long)sizeof(struct last_entry)),SEEK_CUR); - if(fread(&mlast,sizeof(struct last_entry),1,fp) != 1) { + while (num > 0 && recs > 0) { + fseek(fp, -1 * ((long)sizeof(struct last_entry)),SEEK_CUR); + if (fread(&mlast, sizeof(struct last_entry), 1, fp) != 1) { send_to_char(ch, "Error reading log file."); return; } - fseek(fp,-1*((long)sizeof(struct last_entry)),SEEK_CUR); - if(!*name ||(*name && !str_cmp(name, mlast.username))) { + fseek(fp, -1 * ((long)sizeof(struct last_entry)),SEEK_CUR); + if (!*name || (*name && !str_cmp(name, mlast.username))) { strftime(timestr, sizeof(timestr), "%a %b %d %Y %H:%M", localtime(&mlast.time)); send_to_char(ch, "%10.10s %20.20s %20.21s - ", - mlast.username, mlast.hostname, timestr); - if((temp=is_in_game(mlast.idnum)) && mlast.punique == GET_PREF(temp)) { + mlast.username, mlast.hostname, timestr); + if ((temp = is_in_game(mlast.idnum)) && mlast.punique == GET_PREF(temp)) { send_to_char(ch, "Still Playing "); } else { delta = mlast.close_time - mlast.time; - strftime(to, sizeof(to), "%H:%M", localtime(&mlast.close_time)); - strftime(deltastr, sizeof(deltastr), "%H:%M", gmtime(&delta)); + strftime(to, sizeof(to), "%H:%M", localtime(&mlast.close_time)); + strftime(deltastr, sizeof(deltastr), "%H:%M", gmtime(&delta)); send_to_char(ch, "%5.5s (%5.5s) %s", to, deltastr, - last_array[mlast.close_type]); + last_array[mlast.close_type]); } send_to_char(ch, "\r\n"); @@ -2159,18 +2170,19 @@ ACMD(do_force) else { send_to_char(ch, "%s", CONFIG_OK); act(buf1, TRUE, ch, NULL, vict, TO_VICT); - mudlog(CMP, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s forced %s to %s", GET_NAME(ch), GET_NAME(vict), to_force); + mudlog(CMP, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s forced %s to %s", GET_NAME(ch), GET_NAME(vict), + to_force); command_interpreter(vict, to_force); } } else if (!str_cmp("room", arg)) { send_to_char(ch, "%s", CONFIG_OK); mudlog(NRM, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s forced room %d to %s", - GET_NAME(ch), GET_ROOM_VNUM(IN_ROOM(ch)), to_force); + GET_NAME(ch), GET_ROOM_VNUM(IN_ROOM(ch)), to_force); for (vict = world[IN_ROOM(ch)].people; vict; vict = next_force) { next_force = vict->next_in_room; if (!IS_NPC(vict) && GET_LEVEL(vict) >= GET_LEVEL(ch)) - continue; + continue; act(buf1, TRUE, ch, NULL, vict, TO_VICT); command_interpreter(vict, to_force); } @@ -2182,7 +2194,7 @@ ACMD(do_force) next_desc = i->next; if (STATE(i) != CON_PLAYING || !(vict = i->character) || (!IS_NPC(vict) && GET_LEVEL(vict) >= GET_LEVEL(ch))) - continue; + continue; act(buf1, TRUE, ch, NULL, vict, TO_VICT); command_interpreter(vict, to_force); } @@ -2209,11 +2221,11 @@ ACMD(do_wiznet) case '#': one_argument(argument + 1, buf1); if (is_number(buf1)) { - half_chop(argument+1, buf1, argument); + half_chop(argument + 1, buf1, argument); level = MAX(atoi(buf1), LVL_IMMORT); if (level > GET_LEVEL(ch)) { - send_to_char(ch, "You can't wizline above your own level.\r\n"); - return; + send_to_char(ch, "You can't wizline above your own level.\r\n"); + return; } } else if (emote) argument++; @@ -2228,9 +2240,9 @@ ACMD(do_wiznet) continue; send_to_char(ch, " %-*s%s%s%s\r\n", MAX_NAME_LENGTH, GET_NAME(d->character), - PLR_FLAGGED(d->character, PLR_WRITING) ? " (Writing)" : "", - PLR_FLAGGED(d->character, PLR_MAILING) ? " (Writing mail)" : "", - PRF_FLAGGED(d->character, PRF_NOWIZ) ? " (Offline)" : ""); + PLR_FLAGGED(d->character, PLR_WRITING) ? " (Writing)" : "", + PLR_FLAGGED(d->character, PLR_MAILING) ? " (Writing mail)" : "", + PRF_FLAGGED(d->character, PRF_NOWIZ) ? " (Offline)" : ""); } return; @@ -2253,15 +2265,15 @@ ACMD(do_wiznet) if (level > LVL_IMMORT) { snprintf(buf1, sizeof(buf1), "\tc%s: <%d> %s%s\tn\r\n", GET_NAME(ch), level, emote ? "<--- " : "", argument); snprintf(buf2, sizeof(buf1), "\tcSomeone: <%d> %s%s\tn\r\n", level, emote ? "<--- " : "", argument); -} else { + } else { snprintf(buf1, sizeof(buf1), "\tc%s: %s%s\tn\r\n", GET_NAME(ch), emote ? "<--- " : "", argument); snprintf(buf2, sizeof(buf1), "\tcSomeone: %s%s\tn\r\n", emote ? "<--- " : "", argument); } for (d = descriptor_list; d; d = d->next) { if (IS_PLAYING(d) && (GET_LEVEL(d->character) >= level) && - (!PRF_FLAGGED(d->character, PRF_NOWIZ)) - && (d != ch->desc || !(PRF_FLAGGED(d->character, PRF_NOREPEAT)))) { + (!PRF_FLAGGED(d->character, PRF_NOWIZ)) + && (d != ch->desc || !(PRF_FLAGGED(d->character, PRF_NOREPEAT)))) { if (CAN_SEE(d->character, ch)) { parse_at(buf1); send_to_char(d->character, "%s%s%s", CCCYN(d->character, C_NRM), buf1, CCNRM(d->character, C_NRM)); @@ -2287,27 +2299,29 @@ ACMD(do_zreset) one_argument(argument, arg); if (*arg == '*') { - if (GET_LEVEL(ch) < LVL_GOD){ + if (GET_LEVEL(ch) < LVL_GOD) { send_to_char(ch, "You do not have permission to reset the entire world.\r\n"); return; - } else { + } else { for (i = 0; i <= top_of_zone_table; i++) - reset_zone(i); - send_to_char(ch, "Reset world.\r\n"); - mudlog(NRM, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s reset entire world.", GET_NAME(ch)); - return; } + reset_zone(i); + send_to_char(ch, "Reset world.\r\n"); + mudlog(NRM, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s reset entire world.", GET_NAME(ch)); + return; + } } else if (*arg == '.' || !*arg) i = world[IN_ROOM(ch)].zone; else { j = atoi(arg); for (i = 0; i <= top_of_zone_table; i++) if (zone_table[i].number == j) - break; + break; } if (i <= top_of_zone_table && (can_edit_zone(ch, i) || GET_LEVEL(ch) > LVL_IMMORT)) { reset_zone(i); send_to_char(ch, "Reset zone #%d: %s.\r\n", zone_table[i].number, zone_table[i].name); - mudlog(NRM, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s reset zone %d (%s)", GET_NAME(ch), zone_table[i].number, zone_table[i].name); + mudlog(NRM, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s reset zone %d (%s)", GET_NAME(ch), zone_table[i].number, + zone_table[i].name); } else send_to_char(ch, "You do not have permission to reset this zone. Try %d.\r\n", GET_OLC_ZONE(ch)); } @@ -2337,13 +2351,13 @@ ACMD(do_wizutil) roll_real_abils(vict); log("(GC) %s has rerolled %s.", GET_NAME(ch), GET_NAME(vict)); send_to_char(ch, "New stats: Str %d/%d, Int %d, Wis %d, Dex %d, Con %d, Cha %d\r\n", - GET_STR(vict), GET_ADD(vict), GET_INT(vict), GET_WIS(vict), - GET_DEX(vict), GET_CON(vict), GET_CHA(vict)); + GET_STR(vict), GET_ADD(vict), GET_INT(vict), GET_WIS(vict), + GET_DEX(vict), GET_CON(vict), GET_CHA(vict)); break; case SCMD_PARDON: if (!PLR_FLAGGED(vict, PLR_THIEF) && !PLR_FLAGGED(vict, PLR_KILLER)) { - send_to_char(ch, "Your victim is not flagged.\r\n"); - return; + send_to_char(ch, "Your victim is not flagged.\r\n"); + return; } REMOVE_BIT_AR(PLR_FLAGS(vict), PLR_THIEF); REMOVE_BIT_AR(PLR_FLAGS(vict), PLR_KILLER); @@ -2354,40 +2368,41 @@ ACMD(do_wizutil) case SCMD_NOTITLE: result = PLR_TOG_CHK(vict, PLR_NOTITLE); mudlog(NRM, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) Notitle %s for %s by %s.", - ONOFF(result), GET_NAME(vict), GET_NAME(ch)); + ONOFF(result), GET_NAME(vict), GET_NAME(ch)); send_to_char(ch, "(GC) Notitle %s for %s by %s.\r\n", ONOFF(result), GET_NAME(vict), GET_NAME(ch)); break; case SCMD_MUTE: result = PLR_TOG_CHK(vict, PLR_NOSHOUT); mudlog(BRF, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) Mute %s for %s by %s.", - ONOFF(result), GET_NAME(vict), GET_NAME(ch)); + ONOFF(result), GET_NAME(vict), GET_NAME(ch)); send_to_char(ch, "(GC) Mute %s for %s by %s.\r\n", ONOFF(result), GET_NAME(vict), GET_NAME(ch)); break; case SCMD_FREEZE: if (ch == vict) { - send_to_char(ch, "Oh, yeah, THAT'S real smart...\r\n"); - return; + send_to_char(ch, "Oh, yeah, THAT'S real smart...\r\n"); + return; } if (PLR_FLAGGED(vict, PLR_FROZEN)) { - send_to_char(ch, "Your victim is already pretty cold.\r\n"); - return; + send_to_char(ch, "Your victim is already pretty cold.\r\n"); + return; } SET_BIT_AR(PLR_FLAGS(vict), PLR_FROZEN); GET_FREEZE_LEV(vict) = GET_LEVEL(ch); - send_to_char(vict, "A bitter wind suddenly rises and drains every erg of heat from your body!\r\nYou feel frozen!\r\n"); + send_to_char( + vict, "A bitter wind suddenly rises and drains every erg of heat from your body!\r\nYou feel frozen!\r\n"); send_to_char(ch, "Frozen.\r\n"); act("A sudden cold wind conjured from nowhere freezes $n!", FALSE, vict, 0, 0, TO_ROOM); mudlog(BRF, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s frozen by %s.", GET_NAME(vict), GET_NAME(ch)); break; case SCMD_THAW: if (!PLR_FLAGGED(vict, PLR_FROZEN)) { - send_to_char(ch, "Sorry, your victim is not morbidly encased in ice at the moment.\r\n"); - return; + send_to_char(ch, "Sorry, your victim is not morbidly encased in ice at the moment.\r\n"); + return; } if (GET_FREEZE_LEV(vict) > GET_LEVEL(ch)) { - send_to_char(ch, "Sorry, a level %d God froze %s... you can't unfreeze %s.\r\n", - GET_FREEZE_LEV(vict), GET_NAME(vict), HMHR(vict)); - return; + send_to_char(ch, "Sorry, a level %d God froze %s... you can't unfreeze %s.\r\n", + GET_FREEZE_LEV(vict), GET_NAME(vict), HMHR(vict)); + return; } mudlog(BRF, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s un-frozen by %s.", GET_NAME(vict), GET_NAME(ch)); REMOVE_BIT_AR(PLR_FLAGS(vict), PLR_FROZEN); @@ -2397,21 +2412,21 @@ ACMD(do_wizutil) break; case SCMD_UNAFFECT: if (vict->affected || AFF_FLAGS(vict)) { - while (vict->affected) - affect_remove(vict, vict->affected); - for(taeller=0; taeller < AF_ARRAY_MAX; taeller++) - AFF_FLAGS(vict)[taeller] = 0; - send_to_char(vict, "There is a brief flash of light!\r\nYou feel slightly different.\r\n"); - send_to_char(ch, "All spells removed.\r\n"); + while (vict->affected) + affect_remove(vict, vict->affected); + for (taeller = 0; taeller < AF_ARRAY_MAX; taeller++) + AFF_FLAGS(vict)[taeller] = 0; + send_to_char(vict, "There is a brief flash of light!\r\nYou feel slightly different.\r\n"); + send_to_char(ch, "All spells removed.\r\n"); } else { - send_to_char(ch, "Your victim does not have any affections!\r\n"); - return; + send_to_char(ch, "Your victim does not have any affections!\r\n"); + return; } break; default: log("SYSERR: Unknown subcmd %d passed to do_wizutil (%s)", subcmd, __FILE__); - /* SYSERR_DESC: This is the same as the unhandled case in do_gen_ps(), - * but this function handles 'reroll', 'pardon', 'freeze', etc. */ + /* SYSERR_DESC: This is the same as the unhandled case in do_gen_ps(), + * but this function handles 'reroll', 'pardon', 'freeze', etc. */ break; } save_char(vict); @@ -2431,62 +2446,64 @@ static size_t print_zone_to_buf(char *bufptr, size_t left, zone_rnum zone, int l sprintbitarray(zone_table[zone].zone_flags, zone_bits, ZN_ARRAY_MAX, buf); tmp = snprintf(bufptr, left, - "%3d %-30.30s%s By: %-10.10s%s Age: %3d; Reset: %3d (%s); Range: %5d-%5d\r\n", - zone_table[zone].number, zone_table[zone].name, KNRM, zone_table[zone].builders, KNRM, - zone_table[zone].age, zone_table[zone].lifespan, - zone_table[zone].reset_mode ? ((zone_table[zone].reset_mode == 1) ? "Reset when no players are in zone" : "Normal reset") : "Never reset", - zone_table[zone].bot, zone_table[zone].top); - j = k = l = m = n = o = 0; + "%3d %-30.30s%s By: %-10.10s%s Age: %3d; Reset: %3d (%s); Range: %5d-%5d\r\n", + zone_table[zone].number, zone_table[zone].name, KNRM, zone_table[zone].builders, KNRM, + zone_table[zone].age, zone_table[zone].lifespan, + zone_table[zone].reset_mode + ? ((zone_table[zone].reset_mode == 1) ? "Reset when no players are in zone" : "Normal reset") + : "Never reset", + zone_table[zone].bot, zone_table[zone].top); + j = k = l = m = n = o = 0; - for (i = 0; i < top_of_world; i++) - if (world[i].number >= zone_table[zone].bot && world[i].number <= zone_table[zone].top) - j++; + for (i = 0; i < top_of_world; i++) + if (world[i].number >= zone_table[zone].bot && world[i].number <= zone_table[zone].top) + j++; - for (i = 0; i < top_of_objt; i++) - if (obj_index[i].vnum >= zone_table[zone].bot && obj_index[i].vnum <= zone_table[zone].top) - k++; + for (i = 0; i < top_of_objt; i++) + if (obj_index[i].vnum >= zone_table[zone].bot && obj_index[i].vnum <= zone_table[zone].top) + k++; - for (i = 0; i < top_of_mobt; i++) - if (mob_index[i].vnum >= zone_table[zone].bot && mob_index[i].vnum <= zone_table[zone].top) - l++; + for (i = 0; i < top_of_mobt; i++) + if (mob_index[i].vnum >= zone_table[zone].bot && mob_index[i].vnum <= zone_table[zone].top) + l++; - for (i = 0; i<= top_shop; i++) - if (SHOP_NUM(i) >= zone_table[zone].bot && SHOP_NUM(i) <= zone_table[zone].top) - m++; + for (i = 0; i <= top_shop; i++) + if (SHOP_NUM(i) >= zone_table[zone].bot && SHOP_NUM(i) <= zone_table[zone].top) + m++; - for (i = 0; i < top_of_trigt; i++) - if (trig_index[i]->vnum >= zone_table[zone].bot && trig_index[i]->vnum <= zone_table[zone].top) - n++; + for (i = 0; i < top_of_trigt; i++) + if (trig_index[i]->vnum >= zone_table[zone].bot && trig_index[i]->vnum <= zone_table[zone].top) + n++; - o = count_quests(zone_table[zone].bot, zone_table[zone].top); + o = count_quests(zone_table[zone].bot, zone_table[zone].top); - tmp += snprintf(bufptr + tmp, left - tmp, - " Zone stats:\r\n" - " ---------------\r\n" - " Flags: %s\r\n" - " Min Lev: %2d\r\n" - " Max Lev: %2d\r\n" - " Rooms: %2d\r\n" - " Objects: %2d\r\n" - " Mobiles: %2d\r\n" - " Shops: %2d\r\n" - " Triggers: %2d\r\n" - " Quests: %2d\r\n", - buf, zone_table[zone].min_level, zone_table[zone].max_level, - j, k, l, m, n, o); + tmp += snprintf(bufptr + tmp, left - tmp, + " Zone stats:\r\n" + " ---------------\r\n" + " Flags: %s\r\n" + " Min Lev: %2d\r\n" + " Max Lev: %2d\r\n" + " Rooms: %2d\r\n" + " Objects: %2d\r\n" + " Mobiles: %2d\r\n" + " Shops: %2d\r\n" + " Triggers: %2d\r\n" + " Quests: %2d\r\n", + buf, zone_table[zone].min_level, zone_table[zone].max_level, + j, k, l, m, n, o); return tmp; } - return snprintf(bufptr, left, - "%3d %-*s%s By: %-10.10s%s Range: %5d-%5d\r\n", zone_table[zone].number, - count_color_chars(zone_table[zone].name)+30, zone_table[zone].name, KNRM, - zone_table[zone].builders, KNRM, zone_table[zone].bot, zone_table[zone].top); + return snprintf(bufptr, left, + "%3d %-*s%s By: %-10.10s%s Range: %5d-%5d\r\n", zone_table[zone].number, + count_color_chars(zone_table[zone].name) + 30, zone_table[zone].name, KNRM, + zone_table[zone].builders, KNRM, zone_table[zone].bot, zone_table[zone].top); } ACMD(do_show) { - int i, j, k, l, con, builder =0; /* i, j, k to specifics? */ + int i, j, k, l, con, builder = 0; /* i, j, k to specifics? */ size_t len, nlen; zone_rnum zrn; zone_vnum zvn; @@ -2495,30 +2512,31 @@ ACMD(do_show) struct obj_data *obj; struct descriptor_data *d; char field[MAX_INPUT_LENGTH], value[MAX_INPUT_LENGTH], - arg[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH]; + arg[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH]; int r, g, b; char colour[16]; - struct show_struct { + struct show_struct + { const char *cmd; const char level; } fields[] = { - { "nothing", 0 }, /* 0 */ - { "zones", LVL_IMMORT }, /* 1 */ - { "player", LVL_IMMORT }, - { "rent", LVL_IMMORT }, - { "stats", LVL_IMMORT }, - { "errors", LVL_IMMORT }, /* 5 */ - { "death", LVL_IMMORT }, - { "godrooms", LVL_IMMORT }, - { "shops", LVL_IMMORT }, - { "houses", LVL_IMMORT }, - { "snoop", LVL_IMMORT }, /* 10 */ - { "thaco", LVL_IMMORT }, - { "exp", LVL_IMMORT }, - { "colour", LVL_IMMORT }, - { "\n", 0 } - }; + {"nothing", 0}, /* 0 */ + {"zones", LVL_IMMORT}, /* 1 */ + {"player", LVL_IMMORT}, + {"rent", LVL_IMMORT}, + {"stats", LVL_IMMORT}, + {"errors", LVL_IMMORT}, /* 5 */ + {"death", LVL_IMMORT}, + {"godrooms", LVL_IMMORT}, + {"shops", LVL_IMMORT}, + {"houses", LVL_IMMORT}, + {"snoop", LVL_IMMORT}, /* 10 */ + {"thaco", LVL_IMMORT}, + {"exp", LVL_IMMORT}, + {"colour", LVL_IMMORT}, + {"\n", 0} + }; skip_spaces(&argument); @@ -2526,12 +2544,12 @@ ACMD(do_show) send_to_char(ch, "Show options:\r\n"); for (j = 0, i = 1; fields[i].level; i++) if (fields[i].level <= GET_LEVEL(ch)) - send_to_char(ch, "%-15s%s", fields[i].cmd, (!(++j % 5) ? "\r\n" : "")); + send_to_char(ch, "%-15s%s", fields[i].cmd, (!(++j % 5) ? "\r\n" : "")); send_to_char(ch, "\r\n"); return; } - strcpy(arg, two_arguments(argument, field, value)); /* strcpy: OK (argument <= MAX_INPUT_LENGTH == arg) */ + strcpy(arg, two_arguments(argument, field, value)); /* strcpy: OK (argument <= MAX_INPUT_LENGTH == arg) */ for (l = 0; *(fields[l].cmd) != '\n'; l++) if (!strncmp(field, fields[l].cmd, strlen(field))) @@ -2554,10 +2572,10 @@ ACMD(do_show) else if (*value && is_number(value)) { for (zvn = atoi(value), zrn = 0; zone_table[zrn].number != zvn && zrn <= top_of_zone_table; zrn++); if (zrn <= top_of_zone_table) - print_zone_to_buf(buf, sizeof(buf), zrn, 1); + print_zone_to_buf(buf, sizeof(buf), zrn, 1); else { - send_to_char(ch, "That is not a valid zone.\r\n"); - return; + send_to_char(ch, "That is not a valid zone.\r\n"); + return; } } else { char *buf2; @@ -2571,13 +2589,13 @@ ACMD(do_show) if (builder == 1) builder++; break; - } + } buf2 = strtok(NULL, " "); } if (!buf2) - continue; - } - nlen = print_zone_to_buf(buf + len, sizeof(buf) - len, zrn, 0); + continue; + } + nlen = print_zone_to_buf(buf + len, sizeof(buf) - len, zrn, 0); if (len + nlen >= sizeof(buf)) break; len += nlen; @@ -2591,7 +2609,8 @@ ACMD(do_show) break; /* show player */ - case 2: { + case 2: + { char buf1[64], buf2[64]; if (!*value) { @@ -2613,15 +2632,15 @@ ACMD(do_show) strftime(buf2, sizeof(buf2), "%a %b %d %H:%H:%S %Y", localtime(&(vict->player.time.logon))); send_to_char(ch, "Player: %-12s (%s) [%2d %s]\r\n", GET_NAME(vict), - genders[(int) GET_SEX(vict)], GET_LEVEL(vict), class_abbrevs[(int) - GET_CLASS(vict)]); + genders[(int)GET_SEX(vict)], GET_LEVEL(vict), class_abbrevs[(int) + GET_CLASS(vict)]); send_to_char(ch, "Gold: %-8d Bal: %-8d Exp: %-8d Align: %-5d Lessons: %-3d\r\n", - GET_GOLD(vict), GET_BANK_GOLD(vict), GET_EXP(vict), - GET_ALIGNMENT(vict), GET_PRACTICES(vict)); + GET_GOLD(vict), GET_BANK_GOLD(vict), GET_EXP(vict), + GET_ALIGNMENT(vict), GET_PRACTICES(vict)); send_to_char(ch, "Started: %-25.25s Last: %-25.25s\r\n", buf1, buf2); send_to_char(ch, "Played: %dh %dm\r\n", - (int) (vict->player.time.played / 3600), - (int) (vict->player.time.played / 60 % 60)); + (int)(vict->player.time.played / 3600), + (int)(vict->player.time.played / 60 % 60)); free_char(vict); break; @@ -2643,35 +2662,35 @@ ACMD(do_show) con = 0; for (vict = character_list; vict; vict = vict->next) { if (IS_NPC(vict)) - j++; + j++; else if (CAN_SEE(ch, vict)) { - i++; - if (vict->desc) - con++; + i++; + if (vict->desc) + con++; } } for (obj = object_list; obj; obj = obj->next) k++; send_to_char(ch, - "Current stats:\r\n" - " %5d players in game %5d connected\r\n" - " %5d registered\r\n" - " %5d mobiles %5d prototypes\r\n" - " %5d objects %5d prototypes\r\n" - " %5d rooms %5d zones\r\n" - " %5d triggers %5d shops\r\n" - " %5d large bufs %5d autoquests\r\n" - " %5d buf switches %5d overflows\r\n" - " %5d lists\r\n", - i, con, - top_of_p_table + 1, - j, top_of_mobt + 1, - k, top_of_objt + 1, - top_of_world + 1, top_of_zone_table + 1, - top_of_trigt + 1, top_shop + 1, - buf_largecount, total_quests, - buf_switches, buf_overflows, global_lists->iSize - ); + "Current stats:\r\n" + " %5d players in game %5d connected\r\n" + " %5d registered\r\n" + " %5d mobiles %5d prototypes\r\n" + " %5d objects %5d prototypes\r\n" + " %5d rooms %5d zones\r\n" + " %5d triggers %5d shops\r\n" + " %5d large bufs %5d autoquests\r\n" + " %5d buf switches %5d overflows\r\n" + " %5d lists\r\n", + i, con, + top_of_p_table + 1, + j, top_of_mobt + 1, + k, top_of_objt + 1, + top_of_world + 1, top_of_zone_table + 1, + top_of_trigt + 1, top_shop + 1, + buf_largecount, total_quests, + buf_switches, buf_overflows, global_lists->iSize + ); break; /* show errors */ @@ -2679,19 +2698,21 @@ ACMD(do_show) len = strlcpy(buf, "Errant Rooms\r\n------------\r\n", sizeof(buf)); for (i = 0, k = 0; i <= top_of_world; i++) for (j = 0; j < DIR_COUNT; j++) { - if (!W_EXIT(i,j)) - continue; - if (W_EXIT(i,j)->to_room == 0) { - nlen = snprintf(buf + len, sizeof(buf) - len, "%2d: (void ) [%5d] %-*s%s (%s)\r\n", ++k, GET_ROOM_VNUM(i), count_color_chars(world[i].name)+40, world[i].name, QNRM, dirs[j]); - if (len + nlen >= sizeof(buf)) - break; - len += nlen; + if (!W_EXIT(i, j)) + continue; + if (W_EXIT(i, j)->to_room == 0) { + nlen = snprintf(buf + len, sizeof(buf) - len, "%2d: (void ) [%5d] %-*s%s (%s)\r\n", ++k, GET_ROOM_VNUM(i), + count_color_chars(world[i].name) + 40, world[i].name, QNRM, dirs[j]); + if (len + nlen >= sizeof(buf)) + break; + len += nlen; } - if (W_EXIT(i,j)->to_room == NOWHERE && !W_EXIT(i,j)->general_description) { - nlen = snprintf(buf + len, sizeof(buf) - len, "%2d: (Nowhere) [%5d] %-*s%s (%s)\r\n", ++k, GET_ROOM_VNUM(i), count_color_chars(world[i].name)+ 40, world[i].name, QNRM, dirs[j]); - if (len + nlen >= sizeof(buf)) - break; - len += nlen; + if (W_EXIT(i, j)->to_room == NOWHERE && !W_EXIT(i, j)->general_description) { + nlen = snprintf(buf + len, sizeof(buf) - len, "%2d: (Nowhere) [%5d] %-*s%s (%s)\r\n", ++k, GET_ROOM_VNUM(i), + count_color_chars(world[i].name) + 40, world[i].name, QNRM, dirs[j]); + if (len + nlen >= sizeof(buf)) + break; + len += nlen; } } page_string(ch->desc, buf, TRUE); @@ -2702,7 +2723,8 @@ ACMD(do_show) len = strlcpy(buf, "Death Traps\r\n-----------\r\n", sizeof(buf)); for (i = 0, j = 0; i <= top_of_world; i++) if (ROOM_FLAGGED(i, ROOM_DEATH)) { - nlen = snprintf(buf + len, sizeof(buf) - len, "%2d: [%5d] %s%s\r\n", ++j, GET_ROOM_VNUM(i), world[i].name, QNRM); + nlen = snprintf(buf + len, sizeof(buf) - len, "%2d: [%5d] %s%s\r\n", ++j, GET_ROOM_VNUM(i), world[i].name, + QNRM); if (len + nlen >= sizeof(buf)) break; len += nlen; @@ -2715,7 +2737,8 @@ ACMD(do_show) len = strlcpy(buf, "Godrooms\r\n--------------------------\r\n", sizeof(buf)); for (i = 0, j = 0; i <= top_of_world; i++) if (ROOM_FLAGGED(i, ROOM_GODROOM)) { - nlen = snprintf(buf + len, sizeof(buf) - len, "%2d: [%5d] %s%s\r\n", ++j, GET_ROOM_VNUM(i), world[i].name, QNRM); + nlen = snprintf(buf + len, sizeof(buf) - len, "%2d: [%5d] %s%s\r\n", ++j, GET_ROOM_VNUM(i), world[i].name, + QNRM); if (len + nlen >= sizeof(buf)) break; len += nlen; @@ -2739,13 +2762,14 @@ ACMD(do_show) send_to_char(ch, "People currently snooping:\r\n--------------------------\r\n"); for (d = descriptor_list; d; d = d->next) { if (d->snooping == NULL || d->character == NULL) - continue; + continue; if (STATE(d) != CON_PLAYING || GET_LEVEL(ch) < GET_LEVEL(d->character)) - continue; + continue; if (!CAN_SEE(ch, d->character) || IN_ROOM(d->character) == NOWHERE) - continue; + continue; i++; - send_to_char(ch, "%-10s%s - snooped by %s%s.\r\n", GET_NAME(d->snooping->character), QNRM, GET_NAME(d->character), QNRM); + send_to_char(ch, "%-10s%s - snooped by %s%s.\r\n", GET_NAME(d->snooping->character), QNRM, GET_NAME(d->character), + QNRM); } if (i == 0) send_to_char(ch, "No one is currently snooping.\r\n"); @@ -2756,11 +2780,11 @@ ACMD(do_show) len = strlcpy(buf, "LvL - Mu Cl Th Wa\r\n----------------\r\n", sizeof(buf)); for (j = 1; j < LVL_IMMORT; j++) { - nlen = snprintf(buf + len, sizeof(buf) - len, "%-3d - %-2d %-2d %-2d %-2d\r\n", j, - thaco(CLASS_MAGIC_USER, j), - thaco(CLASS_CLERIC, j), - thaco(CLASS_THIEF, j), - thaco(CLASS_WARRIOR, j)); + nlen = snprintf(buf + len, sizeof(buf) - len, "%-3d - %-2d %-2d %-2d %-2d\r\n", j, + thaco(CLASS_MAGIC_USER, j), + thaco(CLASS_CLERIC, j), + thaco(CLASS_THIEF, j), + thaco(CLASS_WARRIOR, j)); if (len + nlen >= sizeof(buf)) break; len += nlen; @@ -2773,12 +2797,12 @@ ACMD(do_show) case 12: len = strlcpy(buf, "LvL - Mu Cl Th Wa\r\n--------------------------\r\n", sizeof(buf)); - for (i = 1; i < LVL_IMMORT; i++) { - nlen = snprintf(buf + len, sizeof(buf) - len, "%-3d - %-6d %-6d %-6d %-6d\r\n", i, - level_exp(CLASS_MAGIC_USER, i) - level_exp(CLASS_MAGIC_USER, i - 1), - level_exp(CLASS_CLERIC, i) - level_exp(CLASS_CLERIC, i - 1), - level_exp(CLASS_THIEF, i) - level_exp(CLASS_THIEF, i - 1), - level_exp(CLASS_WARRIOR, i) - level_exp(CLASS_WARRIOR, i - 1)); + for (i = 1; i < LVL_IMMORT; i++) { + nlen = snprintf(buf + len, sizeof(buf) - len, "%-3d - %-6d %-6d %-6d %-6d\r\n", i, + level_exp(CLASS_MAGIC_USER, i) - level_exp(CLASS_MAGIC_USER, i - 1), + level_exp(CLASS_CLERIC, i) - level_exp(CLASS_CLERIC, i - 1), + level_exp(CLASS_THIEF, i) - level_exp(CLASS_THIEF, i - 1), + level_exp(CLASS_WARRIOR, i) - level_exp(CLASS_WARRIOR, i - 1)); if (len + nlen >= sizeof(buf)) break; len += nlen; @@ -2794,7 +2818,8 @@ ACMD(do_show) for (g = 0; g < 6; g++) for (b = 0; b < 6; b++) { sprintf(colour, "F%d%d%d", r, g, b); - nlen = snprintf(buf + len, sizeof(buf) - len, "%s%s%s", ColourRGB(ch->desc, colour), colour, ++k % 6 == 0 ? "\tn\r\n" : " "); + nlen = snprintf(buf + len, sizeof(buf) - len, "%s%s%s", ColourRGB(ch->desc, colour), colour, + ++k % 6 == 0 ? "\tn\r\n" : " "); if (len + nlen >= sizeof(buf)) break; len += nlen; @@ -2826,72 +2851,73 @@ ACMD(do_show) #define RANGE(low, high) (value = MAX((low), MIN((high), (value)))) /* The set options available */ -static struct set_struct { - const char *cmd; - const char level; - const char pcnpc; - const char type; - } set_fields[] = { - { "ac", LVL_BUILDER, BOTH, NUMBER }, /* 0 */ - { "afk", LVL_BUILDER, PC, BINARY }, /* 1 */ - { "age", LVL_GOD, BOTH, NUMBER }, - { "align", LVL_BUILDER, BOTH, NUMBER }, - { "bank", LVL_BUILDER, PC, NUMBER }, - { "brief", LVL_GOD, PC, BINARY }, /* 5 */ - { "cha", LVL_BUILDER, BOTH, NUMBER }, - { "class", LVL_BUILDER, BOTH, MISC }, - { "color", LVL_GOD, PC, BINARY }, - { "con", LVL_BUILDER, BOTH, NUMBER }, - { "damroll", LVL_BUILDER, BOTH, NUMBER }, /* 10 */ - { "deleted", LVL_IMPL, PC, BINARY }, - { "dex", LVL_BUILDER, BOTH, NUMBER }, - { "drunk", LVL_BUILDER, BOTH, MISC }, - { "exp", LVL_GOD, BOTH, NUMBER }, - { "frozen", LVL_GRGOD, PC, BINARY }, /* 15 */ - { "gold", LVL_BUILDER, BOTH, NUMBER }, - { "height", LVL_BUILDER, BOTH, NUMBER }, - { "hitpoints", LVL_BUILDER, BOTH, NUMBER }, - { "hitroll", LVL_BUILDER, BOTH, NUMBER }, - { "hunger", LVL_BUILDER, BOTH, MISC }, /* 20 */ - { "int", LVL_BUILDER, BOTH, NUMBER }, - { "invis", LVL_GOD, PC, NUMBER }, - { "invstart", LVL_BUILDER, PC, BINARY }, - { "killer", LVL_GOD, PC, BINARY }, - { "level", LVL_GRGOD, BOTH, NUMBER }, /* 25 */ - { "loadroom", LVL_BUILDER, PC, MISC }, - { "mana", LVL_BUILDER, BOTH, NUMBER }, - { "maxhit", LVL_BUILDER, BOTH, NUMBER }, - { "maxmana", LVL_BUILDER, BOTH, NUMBER }, - { "maxmove", LVL_BUILDER, BOTH, NUMBER }, /* 30 */ - { "move", LVL_BUILDER, BOTH, NUMBER }, - { "name", LVL_IMMORT, PC, MISC }, - { "nodelete", LVL_GOD, PC, BINARY }, - { "nohassle", LVL_GOD, PC, BINARY }, - { "nosummon", LVL_BUILDER, PC, BINARY }, /* 35 */ - { "nowizlist", LVL_GRGOD, PC, BINARY }, - { "olc", LVL_GRGOD, PC, MISC }, - { "password", LVL_GRGOD, PC, MISC }, - { "poofin", LVL_IMMORT, PC, MISC }, - { "poofout", LVL_IMMORT, PC, MISC }, /* 40 */ - { "practices", LVL_GOD, PC, NUMBER }, - { "quest", LVL_GOD, PC, BINARY }, - { "room", LVL_BUILDER, BOTH, NUMBER }, - { "screenwidth", LVL_GOD, PC, NUMBER }, - { "sex", LVL_GOD, BOTH, MISC }, /* 45 */ - { "showvnums", LVL_BUILDER, PC, BINARY }, - { "siteok", LVL_GOD, PC, BINARY }, - { "str", LVL_BUILDER, BOTH, NUMBER }, - { "stradd", LVL_BUILDER, BOTH, NUMBER }, - { "thief", LVL_GOD, PC, BINARY }, /* 50 */ - { "thirst", LVL_BUILDER, BOTH, MISC }, - { "title", LVL_GOD, PC, MISC }, - { "variable", LVL_GRGOD, PC, MISC }, - { "weight", LVL_BUILDER, BOTH, NUMBER }, - { "wis", LVL_BUILDER, BOTH, NUMBER }, /* 55 */ - { "questpoints", LVL_GOD, PC, NUMBER }, - { "questhistory", LVL_GOD, PC, NUMBER }, - { "\n", 0, BOTH, MISC } - }; +static struct set_struct +{ + const char *cmd; + const char level; + const char pcnpc; + const char type; +} set_fields[] = { + {"ac", LVL_BUILDER, BOTH, NUMBER}, /* 0 */ + {"afk", LVL_BUILDER, PC, BINARY}, /* 1 */ + {"age", LVL_GOD, BOTH, NUMBER}, + {"align", LVL_BUILDER, BOTH, NUMBER}, + {"bank", LVL_BUILDER, PC, NUMBER}, + {"brief", LVL_GOD, PC, BINARY}, /* 5 */ + {"cha", LVL_BUILDER, BOTH, NUMBER}, + {"class", LVL_BUILDER, BOTH, MISC}, + {"color", LVL_GOD, PC, BINARY}, + {"con", LVL_BUILDER, BOTH, NUMBER}, + {"damroll", LVL_BUILDER, BOTH, NUMBER}, /* 10 */ + {"deleted", LVL_IMPL, PC, BINARY}, + {"dex", LVL_BUILDER, BOTH, NUMBER}, + {"drunk", LVL_BUILDER, BOTH, MISC}, + {"exp", LVL_GOD, BOTH, NUMBER}, + {"frozen", LVL_GRGOD, PC, BINARY}, /* 15 */ + {"gold", LVL_BUILDER, BOTH, NUMBER}, + {"height", LVL_BUILDER, BOTH, NUMBER}, + {"hitpoints", LVL_BUILDER, BOTH, NUMBER}, + {"hitroll", LVL_BUILDER, BOTH, NUMBER}, + {"hunger", LVL_BUILDER, BOTH, MISC}, /* 20 */ + {"int", LVL_BUILDER, BOTH, NUMBER}, + {"invis", LVL_GOD, PC, NUMBER}, + {"invstart", LVL_BUILDER, PC, BINARY}, + {"killer", LVL_GOD, PC, BINARY}, + {"level", LVL_GRGOD, BOTH, NUMBER}, /* 25 */ + {"loadroom", LVL_BUILDER, PC, MISC}, + {"mana", LVL_BUILDER, BOTH, NUMBER}, + {"maxhit", LVL_BUILDER, BOTH, NUMBER}, + {"maxmana", LVL_BUILDER, BOTH, NUMBER}, + {"maxmove", LVL_BUILDER, BOTH, NUMBER}, /* 30 */ + {"move", LVL_BUILDER, BOTH, NUMBER}, + {"name", LVL_IMMORT, PC, MISC}, + {"nodelete", LVL_GOD, PC, BINARY}, + {"nohassle", LVL_GOD, PC, BINARY}, + {"nosummon", LVL_BUILDER, PC, BINARY}, /* 35 */ + {"nowizlist", LVL_GRGOD, PC, BINARY}, + {"olc", LVL_GRGOD, PC, MISC}, + {"password", LVL_GRGOD, PC, MISC}, + {"poofin", LVL_IMMORT, PC, MISC}, + {"poofout", LVL_IMMORT, PC, MISC}, /* 40 */ + {"practices", LVL_GOD, PC, NUMBER}, + {"quest", LVL_GOD, PC, BINARY}, + {"room", LVL_BUILDER, BOTH, NUMBER}, + {"screenwidth", LVL_GOD, PC, NUMBER}, + {"sex", LVL_GOD, BOTH, MISC}, /* 45 */ + {"showvnums", LVL_BUILDER, PC, BINARY}, + {"siteok", LVL_GOD, PC, BINARY}, + {"str", LVL_BUILDER, BOTH, NUMBER}, + {"stradd", LVL_BUILDER, BOTH, NUMBER}, + {"thief", LVL_GOD, PC, BINARY}, /* 50 */ + {"thirst", LVL_BUILDER, BOTH, MISC}, + {"title", LVL_GOD, PC, MISC}, + {"variable", LVL_GRGOD, PC, MISC}, + {"weight", LVL_BUILDER, BOTH, NUMBER}, + {"wis", LVL_BUILDER, BOTH, NUMBER}, /* 55 */ + {"questpoints", LVL_GOD, PC, NUMBER}, + {"questhistory", LVL_GOD, PC, NUMBER}, + {"\n", 0, BOTH, MISC} +}; static int perform_set(struct char_data *ch, struct char_data *vict, int mode, char *val_arg) { @@ -2934,379 +2960,379 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c value = atoi(val_arg); } switch (mode) { - case 0: /* ac */ - vict->points.armor = RANGE(-100, 100); - affect_total(vict); - break; - case 1: /* afk */ - SET_OR_REMOVE(PRF_FLAGS(vict), PRF_AFK); - break; - case 2: /* age */ - if (value < 2 || value > 200) { /* Arbitrary limits. */ - send_to_char(ch, "Ages 2 to 200 accepted.\r\n"); - return (0); - } - /* NOTE: May not display the exact age specified due to the integer - * division used elsewhere in the code. Seems to only happen for - * some values below the starting age (17) anyway. -gg 5/27/98 */ - vict->player.time.birth = time(0) - ((value - 17) * SECS_PER_MUD_YEAR); - break; - case 3: /* align */ - GET_ALIGNMENT(vict) = RANGE(-1000, 1000); - affect_total(vict); - break; - case 4: /* bank */ - GET_BANK_GOLD(vict) = RANGE(0, 100000000); - break; - case 5: /* brief */ - SET_OR_REMOVE(PRF_FLAGS(vict), PRF_BRIEF); - break; - case 6: /* cha */ - if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_GRGOD) - RANGE(3, 25); - else - RANGE(3, 18); - vict->real_abils.cha = value; - affect_total(vict); - break; - case 7: /* class */ - if ((i = parse_class(*val_arg)) == CLASS_UNDEFINED) { - send_to_char(ch, "That is not a class.\r\n"); - return (0); - } - GET_CLASS(vict) = i; - break; - case 8: /* color */ - SET_OR_REMOVE(PRF_FLAGS(vict), (PRF_COLOR_1)); - SET_OR_REMOVE(PRF_FLAGS(vict), (PRF_COLOR_2)); - break; - case 9: /* con */ - if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_GRGOD) - RANGE(3, 25); - else - RANGE(3, 18); - vict->real_abils.con = value; - affect_total(vict); - break; - case 10: /* damroll */ - vict->points.damroll = RANGE(-20, 20); - affect_total(vict); - break; - case 11: /* delete */ - SET_OR_REMOVE(PLR_FLAGS(vict), PLR_DELETED); - break; - case 12: /* dex */ - if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_GRGOD) - RANGE(3, 25); - else - RANGE(3, 18); - vict->real_abils.dex = value; - affect_total(vict); - break; - case 13: /* drunk */ - if (!str_cmp(val_arg, "off")) { - GET_COND(vict, DRUNK) = -1; - send_to_char(ch, "%s's drunkenness is now off.\r\n", GET_NAME(vict)); - } else if (is_number(val_arg)) { - value = atoi(val_arg); - RANGE(0, 24); - GET_COND(vict, DRUNK) = value; - send_to_char(ch, "%s's drunkenness set to %d.\r\n", GET_NAME(vict), value); - } else { - send_to_char(ch, "Must be 'off' or a value from 0 to 24.\r\n"); - return (0); - } - break; - case 14: /* exp */ - vict->points.exp = RANGE(0, 50000000); - break; - case 15: /* frozen */ - if (ch == vict && on) { - send_to_char(ch, "Better not -- could be a long winter!\r\n"); - return (0); - } - SET_OR_REMOVE(PLR_FLAGS(vict), PLR_FROZEN); - break; - case 16: /* gold */ - GET_GOLD(vict) = RANGE(0, 100000000); - break; - case 17: /* height */ - GET_HEIGHT(vict) = value; - affect_total(vict); - break; - case 18: /* hit */ - vict->points.hit = RANGE(-9, vict->points.max_hit); - affect_total(vict); - break; - case 19: /* hitroll */ - vict->points.hitroll = RANGE(-20, 20); - affect_total(vict); - break; - case 20: /* hunger */ - if (!str_cmp(val_arg, "off")) { - GET_COND(vict, HUNGER) = -1; - send_to_char(ch, "%s's hunger is now off.\r\n", GET_NAME(vict)); - } else if (is_number(val_arg)) { - value = atoi(val_arg); - RANGE(0, 24); - GET_COND(vict, HUNGER) = value; - send_to_char(ch, "%s's hunger set to %d.\r\n", GET_NAME(vict), value); - } else { - send_to_char(ch, "Must be 'off' or a value from 0 to 24.\r\n"); - return (0); - } - break; - case 21: /* int */ - if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_GRGOD) - RANGE(3, 25); - else - RANGE(3, 18); - vict->real_abils.intel = value; - affect_total(vict); - break; - case 22: /* invis */ - if (GET_LEVEL(ch) < LVL_IMPL && ch != vict) { - send_to_char(ch, "You aren't godly enough for that!\r\n"); - return (0); - } - GET_INVIS_LEV(vict) = RANGE(0, GET_LEVEL(vict)); - break; - case 23: /* invistart */ - SET_OR_REMOVE(PLR_FLAGS(vict), PLR_INVSTART); - break; - case 24: /* killer */ - SET_OR_REMOVE(PLR_FLAGS(vict), PLR_KILLER); - break; - case 25: /* level */ - if ((!IS_NPC(vict) && value > GET_LEVEL(ch)) || value > LVL_IMPL) { - send_to_char(ch, "You can't do that.\r\n"); - return (0); - } - RANGE(1, LVL_IMPL); - vict->player.level = value; - break; - case 26: /* loadroom */ - if (!str_cmp(val_arg, "off")) { - REMOVE_BIT_AR(PLR_FLAGS(vict), PLR_LOADROOM); - } else if (is_number(val_arg)) { - rvnum = atoi(val_arg); - if (real_room(rvnum) != NOWHERE) { - SET_BIT_AR(PLR_FLAGS(vict), PLR_LOADROOM); - GET_LOADROOM(vict) = rvnum; - send_to_char(ch, "%s will enter at room #%d.\r\n", GET_NAME(vict), GET_LOADROOM(vict)); - } else { - send_to_char(ch, "That room does not exist!\r\n"); - return (0); - } - } else { - send_to_char(ch, "Must be 'off' or a room's virtual number.\r\n"); - return (0); - } - break; - case 27: /* mana */ - vict->points.mana = RANGE(0, vict->points.max_mana); - affect_total(vict); - break; - case 28: /* maxhit */ - vict->points.max_hit = RANGE(1, 5000); - affect_total(vict); - break; - case 29: /* maxmana */ - vict->points.max_mana = RANGE(1, 5000); - affect_total(vict); - break; - case 30: /* maxmove */ - vict->points.max_move = RANGE(1, 5000); - affect_total(vict); - break; - case 31: /* move */ - vict->points.move = RANGE(0, vict->points.max_move); - affect_total(vict); - break; - case 32: /* name */ - if (ch != vict && GET_LEVEL(ch) < LVL_IMPL) { - send_to_char(ch, "Only Imps can change the name of other players.\r\n"); - return (0); - } - if (!change_player_name(ch, vict, val_arg)) { - send_to_char(ch, "Name has not been changed!\r\n"); - return (0); - } - break; - case 33: /* nodelete */ - SET_OR_REMOVE(PLR_FLAGS(vict), PLR_NODELETE); - break; - case 34: /* nohassle */ - if (GET_LEVEL(ch) < LVL_GOD && ch != vict) { - send_to_char(ch, "You aren't godly enough for that!\r\n"); - return (0); - } - SET_OR_REMOVE(PRF_FLAGS(vict), PRF_NOHASSLE); - break; - case 35: /* nosummon */ - SET_OR_REMOVE(PRF_FLAGS(vict), PRF_SUMMONABLE); - send_to_char(ch, "Nosummon %s for %s.\r\n", ONOFF(!on), GET_NAME(vict)); - break; - case 36: /* nowiz */ - SET_OR_REMOVE(PLR_FLAGS(vict), PLR_NOWIZLIST); - break; - case 37: /* olc */ - if (is_abbrev(val_arg, "socials") || is_abbrev(val_arg, "actions") || is_abbrev(val_arg, "aedit")) - GET_OLC_ZONE(vict) = AEDIT_PERMISSION; - else if (is_abbrev(val_arg, "hedit") || is_abbrev(val_arg, "help")) - GET_OLC_ZONE(vict) = HEDIT_PERMISSION; - else if (*val_arg == '*' || is_abbrev(val_arg, "all")) - GET_OLC_ZONE(vict) = ALL_PERMISSION; - else if (is_abbrev(val_arg, "off")) - GET_OLC_ZONE(vict) = NOWHERE; - else if (!is_number(val_arg)) { - send_to_char(ch, "Value must be a zone number, 'aedit', 'hedit', 'off' or 'all'.\r\n"); - return (0); - } else - GET_OLC_ZONE(vict) = atoi(val_arg); - break; - case 38: /* password */ - if (GET_LEVEL(vict) >= LVL_GRGOD) { - send_to_char(ch, "You cannot change that.\r\n"); - return (0); - } - strncpy(GET_PASSWD(vict), CRYPT(val_arg, GET_NAME(vict)), MAX_PWD_LENGTH); /* strncpy: OK (G_P:MAX_PWD_LENGTH) */ - *(GET_PASSWD(vict) + MAX_PWD_LENGTH) = '\0'; - send_to_char(ch, "Password changed to '%s'.\r\n", val_arg); - break; - case 39: /* poofin */ - if ((vict == ch) || (GET_LEVEL(ch) == LVL_IMPL)) { - skip_spaces(&val_arg); - parse_at(val_arg); - - if (POOFIN(vict)) - free(POOFIN(vict)); - - if (!*val_arg) - POOFIN(vict) = NULL; - else - POOFIN(vict) = strdup(val_arg); - } - break; - case 40: /* poofout */ - if ((vict == ch) || (GET_LEVEL(ch) == LVL_IMPL)) { - skip_spaces(&val_arg); - parse_at(val_arg); - - if (POOFOUT(vict)) - free(POOFOUT(vict)); - - if (!*val_arg) - POOFOUT(vict) = NULL; - else - POOFOUT(vict) = strdup(val_arg); - } - break; - case 41: /* practices */ - GET_PRACTICES(vict) = RANGE(0, 100); - break; - case 42: /* quest */ - SET_OR_REMOVE(PRF_FLAGS(vict), PRF_QUEST); - break; - case 43: /* room */ - if ((rnum = real_room(value)) == NOWHERE) { - send_to_char(ch, "No room exists with that number.\r\n"); - return (0); - } - if (IN_ROOM(vict) != NOWHERE) - char_from_room(vict); - char_to_room(vict, rnum); - break; - case 44: /* screenwidth */ - GET_SCREEN_WIDTH(vict) = RANGE(40, 200); - break; - case 45: /* sex */ - if ((i = search_block(val_arg, genders, FALSE)) < 0) { - send_to_char(ch, "Must be 'male', 'female', or 'neutral'.\r\n"); - return (0); - } - GET_SEX(vict) = i; - break; - case 46: /* showvnums */ - SET_OR_REMOVE(PRF_FLAGS(vict), PRF_SHOWVNUMS); - break; - case 47: /* siteok */ - SET_OR_REMOVE(PLR_FLAGS(vict), PLR_SITEOK); - break; - case 48: /* str */ - if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_GRGOD) - RANGE(3, 25); - else - RANGE(3, 18); - vict->real_abils.str = value; - vict->real_abils.str_add = 0; - affect_total(vict); - break; - case 49: /* stradd */ - vict->real_abils.str_add = RANGE(0, 100); - if (value > 0) - vict->real_abils.str = 18; - affect_total(vict); - break; - case 50: /* thief */ - SET_OR_REMOVE(PLR_FLAGS(vict), PLR_THIEF); - break; - case 51: /* thirst */ - if (!str_cmp(val_arg, "off")) { - GET_COND(vict, THIRST) = -1; - send_to_char(ch, "%s's thirst is now off.\r\n", GET_NAME(vict)); - } else if (is_number(val_arg)) { - value = atoi(val_arg); - RANGE(0, 24); - GET_COND(vict, THIRST) = value; - send_to_char(ch, "%s's thirst set to %d.\r\n", GET_NAME(vict), value); - } else { - send_to_char(ch, "Must be 'off' or a value from 0 to 24.\r\n"); - return (0); - } - break; - case 52: /* title */ - set_title(vict, val_arg); - send_to_char(ch, "%s's title is now: %s\r\n", GET_NAME(vict), GET_TITLE(vict)); - break; - case 53: /* variable */ - return perform_set_dg_var(ch, vict, val_arg); - case 54: /* weight */ - GET_WEIGHT(vict) = value; - affect_total(vict); - break; - case 55: /* wis */ - if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_GRGOD) - RANGE(3, 25); - else - RANGE(3, 18); - vict->real_abils.wis = value; - affect_total(vict); - break; - case 56: /* questpoints */ - GET_QUESTPOINTS(vict) = RANGE(0, 100000000); - break; - case 57: /* questhistory */ - qvnum = atoi(val_arg); - if (real_quest(qvnum) == NOTHING) { - send_to_char(ch, "That quest doesn't exist.\r\n"); - return FALSE; - } else { - if (is_complete(vict, qvnum)) { - remove_completed_quest(vict, qvnum); - send_to_char(ch, "Quest %d removed from history for player %s.\r\n", - qvnum, GET_NAME(vict)); - } else { - add_completed_quest(vict, qvnum); - send_to_char(ch, "Quest %d added to history for player %s.\r\n", - qvnum, GET_NAME(vict)); - } - break; - } - default: - send_to_char(ch, "Can't set that!\r\n"); + case 0: /* ac */ + vict->points.armor = RANGE(-100, 100); + affect_total(vict); + break; + case 1: /* afk */ + SET_OR_REMOVE(PRF_FLAGS(vict), PRF_AFK); + break; + case 2: /* age */ + if (value < 2 || value > 200) { /* Arbitrary limits. */ + send_to_char(ch, "Ages 2 to 200 accepted.\r\n"); return (0); } + /* NOTE: May not display the exact age specified due to the integer + * division used elsewhere in the code. Seems to only happen for + * some values below the starting age (17) anyway. -gg 5/27/98 */ + vict->player.time.birth = time(0) - ((value - 17) * SECS_PER_MUD_YEAR); + break; + case 3: /* align */ + GET_ALIGNMENT(vict) = RANGE(-1000, 1000); + affect_total(vict); + break; + case 4: /* bank */ + GET_BANK_GOLD(vict) = RANGE(0, 100000000); + break; + case 5: /* brief */ + SET_OR_REMOVE(PRF_FLAGS(vict), PRF_BRIEF); + break; + case 6: /* cha */ + if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_GRGOD) + RANGE(3, 25); + else + RANGE(3, 18); + vict->real_abils.cha = value; + affect_total(vict); + break; + case 7: /* class */ + if ((i = parse_class(*val_arg)) == CLASS_UNDEFINED) { + send_to_char(ch, "That is not a class.\r\n"); + return (0); + } + GET_CLASS(vict) = i; + break; + case 8: /* color */ + SET_OR_REMOVE(PRF_FLAGS(vict), (PRF_COLOR_1)); + SET_OR_REMOVE(PRF_FLAGS(vict), (PRF_COLOR_2)); + break; + case 9: /* con */ + if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_GRGOD) + RANGE(3, 25); + else + RANGE(3, 18); + vict->real_abils.con = value; + affect_total(vict); + break; + case 10: /* damroll */ + vict->points.damroll = RANGE(-20, 20); + affect_total(vict); + break; + case 11: /* delete */ + SET_OR_REMOVE(PLR_FLAGS(vict), PLR_DELETED); + break; + case 12: /* dex */ + if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_GRGOD) + RANGE(3, 25); + else + RANGE(3, 18); + vict->real_abils.dex = value; + affect_total(vict); + break; + case 13: /* drunk */ + if (!str_cmp(val_arg, "off")) { + GET_COND(vict, DRUNK) = -1; + send_to_char(ch, "%s's drunkenness is now off.\r\n", GET_NAME(vict)); + } else if (is_number(val_arg)) { + value = atoi(val_arg); + RANGE(0, 24); + GET_COND(vict, DRUNK) = value; + send_to_char(ch, "%s's drunkenness set to %d.\r\n", GET_NAME(vict), value); + } else { + send_to_char(ch, "Must be 'off' or a value from 0 to 24.\r\n"); + return (0); + } + break; + case 14: /* exp */ + vict->points.exp = RANGE(0, 50000000); + break; + case 15: /* frozen */ + if (ch == vict && on) { + send_to_char(ch, "Better not -- could be a long winter!\r\n"); + return (0); + } + SET_OR_REMOVE(PLR_FLAGS(vict), PLR_FROZEN); + break; + case 16: /* gold */ + GET_GOLD(vict) = RANGE(0, 100000000); + break; + case 17: /* height */ + GET_HEIGHT(vict) = value; + affect_total(vict); + break; + case 18: /* hit */ + vict->points.hit = RANGE(-9, vict->points.max_hit); + affect_total(vict); + break; + case 19: /* hitroll */ + vict->points.hitroll = RANGE(-20, 20); + affect_total(vict); + break; + case 20: /* hunger */ + if (!str_cmp(val_arg, "off")) { + GET_COND(vict, HUNGER) = -1; + send_to_char(ch, "%s's hunger is now off.\r\n", GET_NAME(vict)); + } else if (is_number(val_arg)) { + value = atoi(val_arg); + RANGE(0, 24); + GET_COND(vict, HUNGER) = value; + send_to_char(ch, "%s's hunger set to %d.\r\n", GET_NAME(vict), value); + } else { + send_to_char(ch, "Must be 'off' or a value from 0 to 24.\r\n"); + return (0); + } + break; + case 21: /* int */ + if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_GRGOD) + RANGE(3, 25); + else + RANGE(3, 18); + vict->real_abils.intel = value; + affect_total(vict); + break; + case 22: /* invis */ + if (GET_LEVEL(ch) < LVL_IMPL && ch != vict) { + send_to_char(ch, "You aren't godly enough for that!\r\n"); + return (0); + } + GET_INVIS_LEV(vict) = RANGE(0, GET_LEVEL(vict)); + break; + case 23: /* invistart */ + SET_OR_REMOVE(PLR_FLAGS(vict), PLR_INVSTART); + break; + case 24: /* killer */ + SET_OR_REMOVE(PLR_FLAGS(vict), PLR_KILLER); + break; + case 25: /* level */ + if ((!IS_NPC(vict) && value > GET_LEVEL(ch)) || value > LVL_IMPL) { + send_to_char(ch, "You can't do that.\r\n"); + return (0); + } + RANGE(1, LVL_IMPL); + vict->player.level = value; + break; + case 26: /* loadroom */ + if (!str_cmp(val_arg, "off")) { + REMOVE_BIT_AR(PLR_FLAGS(vict), PLR_LOADROOM); + } else if (is_number(val_arg)) { + rvnum = atoi(val_arg); + if (real_room(rvnum) != NOWHERE) { + SET_BIT_AR(PLR_FLAGS(vict), PLR_LOADROOM); + GET_LOADROOM(vict) = rvnum; + send_to_char(ch, "%s will enter at room #%d.\r\n", GET_NAME(vict), GET_LOADROOM(vict)); + } else { + send_to_char(ch, "That room does not exist!\r\n"); + return (0); + } + } else { + send_to_char(ch, "Must be 'off' or a room's virtual number.\r\n"); + return (0); + } + break; + case 27: /* mana */ + vict->points.mana = RANGE(0, vict->points.max_mana); + affect_total(vict); + break; + case 28: /* maxhit */ + vict->points.max_hit = RANGE(1, 5000); + affect_total(vict); + break; + case 29: /* maxmana */ + vict->points.max_mana = RANGE(1, 5000); + affect_total(vict); + break; + case 30: /* maxmove */ + vict->points.max_move = RANGE(1, 5000); + affect_total(vict); + break; + case 31: /* move */ + vict->points.move = RANGE(0, vict->points.max_move); + affect_total(vict); + break; + case 32: /* name */ + if (ch != vict && GET_LEVEL(ch) < LVL_IMPL) { + send_to_char(ch, "Only Imps can change the name of other players.\r\n"); + return (0); + } + if (!change_player_name(ch, vict, val_arg)) { + send_to_char(ch, "Name has not been changed!\r\n"); + return (0); + } + break; + case 33: /* nodelete */ + SET_OR_REMOVE(PLR_FLAGS(vict), PLR_NODELETE); + break; + case 34: /* nohassle */ + if (GET_LEVEL(ch) < LVL_GOD && ch != vict) { + send_to_char(ch, "You aren't godly enough for that!\r\n"); + return (0); + } + SET_OR_REMOVE(PRF_FLAGS(vict), PRF_NOHASSLE); + break; + case 35: /* nosummon */ + SET_OR_REMOVE(PRF_FLAGS(vict), PRF_SUMMONABLE); + send_to_char(ch, "Nosummon %s for %s.\r\n", ONOFF(!on), GET_NAME(vict)); + break; + case 36: /* nowiz */ + SET_OR_REMOVE(PLR_FLAGS(vict), PLR_NOWIZLIST); + break; + case 37: /* olc */ + if (is_abbrev(val_arg, "socials") || is_abbrev(val_arg, "actions") || is_abbrev(val_arg, "aedit")) + GET_OLC_ZONE(vict) = AEDIT_PERMISSION; + else if (is_abbrev(val_arg, "hedit") || is_abbrev(val_arg, "help")) + GET_OLC_ZONE(vict) = HEDIT_PERMISSION; + else if (*val_arg == '*' || is_abbrev(val_arg, "all")) + GET_OLC_ZONE(vict) = ALL_PERMISSION; + else if (is_abbrev(val_arg, "off")) + GET_OLC_ZONE(vict) = NOWHERE; + else if (!is_number(val_arg)) { + send_to_char(ch, "Value must be a zone number, 'aedit', 'hedit', 'off' or 'all'.\r\n"); + return (0); + } else + GET_OLC_ZONE(vict) = atoi(val_arg); + break; + case 38: /* password */ + if (GET_LEVEL(vict) >= LVL_GRGOD) { + send_to_char(ch, "You cannot change that.\r\n"); + return (0); + } + strncpy(GET_PASSWD(vict), CRYPT(val_arg, GET_NAME(vict)), MAX_PWD_LENGTH); /* strncpy: OK (G_P:MAX_PWD_LENGTH) */ + *(GET_PASSWD(vict) + MAX_PWD_LENGTH) = '\0'; + send_to_char(ch, "Password changed to '%s'.\r\n", val_arg); + break; + case 39: /* poofin */ + if ((vict == ch) || (GET_LEVEL(ch) == LVL_IMPL)) { + skip_spaces(&val_arg); + parse_at(val_arg); + + if (POOFIN(vict)) + free(POOFIN(vict)); + + if (!*val_arg) + POOFIN(vict) = NULL; + else + POOFIN(vict) = strdup(val_arg); + } + break; + case 40: /* poofout */ + if ((vict == ch) || (GET_LEVEL(ch) == LVL_IMPL)) { + skip_spaces(&val_arg); + parse_at(val_arg); + + if (POOFOUT(vict)) + free(POOFOUT(vict)); + + if (!*val_arg) + POOFOUT(vict) = NULL; + else + POOFOUT(vict) = strdup(val_arg); + } + break; + case 41: /* practices */ + GET_PRACTICES(vict) = RANGE(0, 100); + break; + case 42: /* quest */ + SET_OR_REMOVE(PRF_FLAGS(vict), PRF_QUEST); + break; + case 43: /* room */ + if ((rnum = real_room(value)) == NOWHERE) { + send_to_char(ch, "No room exists with that number.\r\n"); + return (0); + } + if (IN_ROOM(vict) != NOWHERE) + char_from_room(vict); + char_to_room(vict, rnum); + break; + case 44: /* screenwidth */ + GET_SCREEN_WIDTH(vict) = RANGE(40, 200); + break; + case 45: /* sex */ + if ((i = search_block(val_arg, genders, FALSE)) < 0) { + send_to_char(ch, "Must be 'male', 'female', or 'neutral'.\r\n"); + return (0); + } + GET_SEX(vict) = i; + break; + case 46: /* showvnums */ + SET_OR_REMOVE(PRF_FLAGS(vict), PRF_SHOWVNUMS); + break; + case 47: /* siteok */ + SET_OR_REMOVE(PLR_FLAGS(vict), PLR_SITEOK); + break; + case 48: /* str */ + if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_GRGOD) + RANGE(3, 25); + else + RANGE(3, 18); + vict->real_abils.str = value; + vict->real_abils.str_add = 0; + affect_total(vict); + break; + case 49: /* stradd */ + vict->real_abils.str_add = RANGE(0, 100); + if (value > 0) + vict->real_abils.str = 18; + affect_total(vict); + break; + case 50: /* thief */ + SET_OR_REMOVE(PLR_FLAGS(vict), PLR_THIEF); + break; + case 51: /* thirst */ + if (!str_cmp(val_arg, "off")) { + GET_COND(vict, THIRST) = -1; + send_to_char(ch, "%s's thirst is now off.\r\n", GET_NAME(vict)); + } else if (is_number(val_arg)) { + value = atoi(val_arg); + RANGE(0, 24); + GET_COND(vict, THIRST) = value; + send_to_char(ch, "%s's thirst set to %d.\r\n", GET_NAME(vict), value); + } else { + send_to_char(ch, "Must be 'off' or a value from 0 to 24.\r\n"); + return (0); + } + break; + case 52: /* title */ + set_title(vict, val_arg); + send_to_char(ch, "%s's title is now: %s\r\n", GET_NAME(vict), GET_TITLE(vict)); + break; + case 53: /* variable */ + return perform_set_dg_var(ch, vict, val_arg); + case 54: /* weight */ + GET_WEIGHT(vict) = value; + affect_total(vict); + break; + case 55: /* wis */ + if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_GRGOD) + RANGE(3, 25); + else + RANGE(3, 18); + vict->real_abils.wis = value; + affect_total(vict); + break; + case 56: /* questpoints */ + GET_QUESTPOINTS(vict) = RANGE(0, 100000000); + break; + case 57: /* questhistory */ + qvnum = atoi(val_arg); + if (real_quest(qvnum) == NOTHING) { + send_to_char(ch, "That quest doesn't exist.\r\n"); + return FALSE; + } else { + if (is_complete(vict, qvnum)) { + remove_completed_quest(vict, qvnum); + send_to_char(ch, "Quest %d removed from history for player %s.\r\n", + qvnum, GET_NAME(vict)); + } else { + add_completed_quest(vict, qvnum); + send_to_char(ch, "Quest %d added to history for player %s.\r\n", + qvnum, GET_NAME(vict)); + } + break; + } + default: + 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)); @@ -3324,15 +3350,15 @@ static void show_set_help(struct char_data *ch) 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; + 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)]); + 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; } } @@ -3372,13 +3398,13 @@ ACMD(do_set) if (!is_file) { if (is_player) { if (!(vict = get_player_vis(ch, name, NULL, FIND_CHAR_WORLD))) { - send_to_char(ch, "There is no such player.\r\n"); - return; + send_to_char(ch, "There is no such player.\r\n"); + return; } } else { /* is_mob */ if (!(vict = get_char_vis(ch, name, NULL, FIND_CHAR_WORLD))) { - send_to_char(ch, "There is no such creature.\r\n"); - return; + send_to_char(ch, "There is no such creature.\r\n"); + return; } } } else if (is_file) { @@ -3389,9 +3415,9 @@ ACMD(do_set) new_mobile_data(cbuf); if ((player_i = load_char(name, cbuf)) > -1) { if (GET_LEVEL(cbuf) > GET_LEVEL(ch)) { - free_char(cbuf); - send_to_char(ch, "Sorry, you can't do that.\r\n"); - return; + free_char(cbuf); + send_to_char(ch, "Sorry, you can't do that.\r\n"); + return; } vict = cbuf; } else { @@ -3412,7 +3438,7 @@ ACMD(do_set) send_to_char(ch, "Can't set that!\r\n"); } else /* perform the set */ - retval = perform_set(ch, vict, mode, buf); + retval = perform_set(ch, vict, mode, buf); /* save the character if a change was made */ if (retval) { @@ -3432,13 +3458,13 @@ ACMD(do_set) ACMD(do_saveall) { - if (GET_LEVEL(ch) < LVL_BUILDER) - send_to_char (ch, "You are not holy enough to use this privelege.\n\r"); - else { + if (GET_LEVEL(ch) < LVL_BUILDER) + send_to_char(ch, "You are not holy enough to use this privelege.\n\r"); + else { save_all(); House_save_all(); send_to_char(ch, "World and house files saved.\n\r"); - } + } } ACMD(do_links) @@ -3466,7 +3492,7 @@ ACMD(do_links) return; } - last = zone_table[zrnum].top; + last = zone_table[zrnum].top; first = zone_table[zrnum].bot; send_to_char(ch, "Zone %d is linked to the following zones:\r\n", zvnum); @@ -3476,10 +3502,10 @@ ACMD(do_links) if (world[nr].dir_option[j]) { to_room = world[nr].dir_option[j]->to_room; if (to_room != NOWHERE && (zrnum != world[to_room].zone)) - send_to_char(ch, "%3d %-30s at %5d (%-5s) ---> %5d\r\n", - zone_table[world[to_room].zone].number, - zone_table[world[to_room].zone].name, - GET_ROOM_VNUM(nr), dirs[j], world[to_room].number); + send_to_char(ch, "%3d %-30s at %5d (%-5s) ---> %5d\r\n", + zone_table[world[to_room].zone].number, + zone_table[world[to_room].zone].name, + GET_ROOM_VNUM(nr), dirs[j], world[to_room].number); } } } @@ -3506,59 +3532,62 @@ ACMD(do_links) /* Armor class limits*/ #define TOTAL_WEAR_CHECKS (NUM_ITEM_WEARS-2) /*minus Wield and Take*/ -static struct zcheck_armor { - bitvector_t bitvector; /* from Structs.h */ - int ac_allowed; /* Max. AC allowed for this body part */ - char *message; /* phrase for error message */ + +static struct zcheck_armor +{ + bitvector_t bitvector; /* from Structs.h */ + int ac_allowed; /* Max. AC allowed for this body part */ + char *message; /* phrase for error message */ } zarmor[] = { - {ITEM_WEAR_FINGER, 10, "Ring"}, - {ITEM_WEAR_NECK, 10, "Necklace"}, - {ITEM_WEAR_BODY, 10, "Body armor"}, - {ITEM_WEAR_HEAD, 10, "Head gear"}, - {ITEM_WEAR_LEGS, 10, "Legwear"}, - {ITEM_WEAR_FEET, 10, "Footwear"}, - {ITEM_WEAR_HANDS, 10, "Glove"}, - {ITEM_WEAR_ARMS, 10, "Armwear"}, - {ITEM_WEAR_SHIELD, 10, "Shield"}, - {ITEM_WEAR_ABOUT, 10, "Cloak"}, - {ITEM_WEAR_WAIST, 10, "Belt"}, - {ITEM_WEAR_WRIST, 10, "Wristwear"}, - {ITEM_WEAR_HOLD, 10, "Held item"} + {ITEM_WEAR_FINGER, 10, "Ring"}, + {ITEM_WEAR_NECK, 10, "Necklace"}, + {ITEM_WEAR_BODY, 10, "Body armor"}, + {ITEM_WEAR_HEAD, 10, "Head gear"}, + {ITEM_WEAR_LEGS, 10, "Legwear"}, + {ITEM_WEAR_FEET, 10, "Footwear"}, + {ITEM_WEAR_HANDS, 10, "Glove"}, + {ITEM_WEAR_ARMS, 10, "Armwear"}, + {ITEM_WEAR_SHIELD, 10, "Shield"}, + {ITEM_WEAR_ABOUT, 10, "Cloak"}, + {ITEM_WEAR_WAIST, 10, "Belt"}, + {ITEM_WEAR_WRIST, 10, "Wristwear"}, + {ITEM_WEAR_HOLD, 10, "Held item"} }; /* Applies limits !! Very Important: Keep these in the same order as in Structs.h. * To ignore an apply, set max_aff to -99. These will be ignored if MAX_APPLIES_LIMIT = 0 */ -static struct zcheck_affs { - int aff_type; /*from Structs.h*/ - int min_aff; /*min. allowed value*/ - int max_aff; /*max. allowed value*/ - char *message; /*phrase for error message*/ +static struct zcheck_affs +{ + int aff_type; /*from Structs.h*/ + int min_aff; /*min. allowed value*/ + int max_aff; /*max. allowed value*/ + char *message; /*phrase for error message*/ } zaffs[] = { - {APPLY_NONE, 0, -99, "unused0"}, - {APPLY_STR, -5, 3, "strength"}, - {APPLY_DEX, -5, 3, "dexterity"}, - {APPLY_INT, -5, 3, "intelligence"}, - {APPLY_WIS, -5, 3, "wisdom"}, - {APPLY_CON, -5, 3, "constitution"}, - {APPLY_CHA, -5, 3, "charisma"}, - {APPLY_CLASS, 0, 0, "class"}, - {APPLY_LEVEL, 0, 0, "level"}, - {APPLY_AGE, -10, 10, "age"}, - {APPLY_CHAR_WEIGHT,-50, 50, "character weight"}, - {APPLY_CHAR_HEIGHT,-50, 50, "character height"}, - {APPLY_MANA, -50, 50, "mana"}, - {APPLY_HIT, -50, 50, "hit points"}, - {APPLY_MOVE, -50, 50, "movement"}, - {APPLY_GOLD, 0, 0, "gold"}, - {APPLY_EXP, 0, 0, "experience"}, - {APPLY_AC, -10, 10, "magical AC"}, - {APPLY_HITROLL, 0, -99, "hitroll"}, /* Handled seperately below */ - {APPLY_DAMROLL, 0, -99, "damroll"}, /* Handled seperately below */ - {APPLY_SAVING_PARA, -2, 2, "saving throw (paralysis)"}, - {APPLY_SAVING_ROD, -2, 2, "saving throw (rod)"}, - {APPLY_SAVING_PETRI,-2, 2, "saving throw (death)"}, - {APPLY_SAVING_BREATH,-2, 2, "saving throw (breath)"}, - {APPLY_SAVING_SPELL,-2, 2, "saving throw (spell)"} + {APPLY_NONE, 0, -99, "unused0"}, + {APPLY_STR, -5, 3, "strength"}, + {APPLY_DEX, -5, 3, "dexterity"}, + {APPLY_INT, -5, 3, "intelligence"}, + {APPLY_WIS, -5, 3, "wisdom"}, + {APPLY_CON, -5, 3, "constitution"}, + {APPLY_CHA, -5, 3, "charisma"}, + {APPLY_CLASS, 0, 0, "class"}, + {APPLY_LEVEL, 0, 0, "level"}, + {APPLY_AGE, -10, 10, "age"}, + {APPLY_CHAR_WEIGHT, -50, 50, "character weight"}, + {APPLY_CHAR_HEIGHT, -50, 50, "character height"}, + {APPLY_MANA, -50, 50, "mana"}, + {APPLY_HIT, -50, 50, "hit points"}, + {APPLY_MOVE, -50, 50, "movement"}, + {APPLY_GOLD, 0, 0, "gold"}, + {APPLY_EXP, 0, 0, "experience"}, + {APPLY_AC, -10, 10, "magical AC"}, + {APPLY_HITROLL, 0, -99, "hitroll"}, /* Handled seperately below */ + {APPLY_DAMROLL, 0, -99, "damroll"}, /* Handled seperately below */ + {APPLY_SAVING_PARA, -2, 2, "saving throw (paralysis)"}, + {APPLY_SAVING_ROD, -2, 2, "saving throw (rod)"}, + {APPLY_SAVING_PETRI, -2, 2, "saving throw (death)"}, + {APPLY_SAVING_BREATH, -2, 2, "saving throw (breath)"}, + {APPLY_SAVING_SPELL, -2, 2, "saving throw (spell)"} }; /* These are ABS() values. */ @@ -3567,18 +3596,18 @@ static struct zcheck_affs { /*room limits*/ /* Off limit zones are any zones a player should NOT be able to walk to (ex. Limbo) */ -static const int offlimit_zones[] = {0,12,13,14,-1}; /*what zones can no room connect to (virtual num) */ +static const int offlimit_zones[] = {0, 12, 13, 14, -1}; /*what zones can no room connect to (virtual num) */ #define MIN_ROOM_DESC_LENGTH 80 /* at least one line - set to 0 to not care. */ #define MAX_COLOUMN_WIDTH 80 /* at most 80 chars per line */ -ACMD (do_zcheck) +ACMD(do_zcheck) { zone_rnum zrnum; struct obj_data *obj; struct char_data *mob = NULL; - room_vnum exroom=0; - int ac=0; - int affs=0, tohit, todam, value; + room_vnum exroom = 0; + int ac = 0; + int affs = 0, tohit, todam, value; int i = 0, j = 0, k = 0, l = 0, m = 0, found = 0; /* found is used as a 'send now' flag*/ char buf[MAX_STRING_LENGTH]; float avg_dam; @@ -3597,309 +3626,313 @@ ACMD (do_zcheck) } else send_to_char(ch, "Checking zone %d!\r\n", zone_table[zrnum].number); - /* Check mobs */ + /* Check mobs */ send_to_char(ch, "Checking Mobs for limits...\r\n"); /*check mobs first*/ - for (i=0; iplayer.name, "mob unfinished") && (found=1)) + for (i = 0; i < top_of_mobt; i++) { + if (real_zone_by_thing(mob_index[i].vnum) == zrnum) { /*is mob in this zone?*/ + mob = &mob_proto[i]; + if (!strcmp(mob->player.name, "mob unfinished") && (found = 1)) + len += snprintf(buf + len, sizeof(buf) - len, + "- Alias hasn't been set.\r\n"); + + if (!strcmp(mob->player.short_descr, "the unfinished mob") && (found = 1)) + len += snprintf(buf + len, sizeof(buf) - len, + "- Short description hasn't been set.\r\n"); + + if (!strncmp(mob->player.long_descr, "An unfinished mob stands here.", 30) && (found = 1)) + len += snprintf(buf + len, sizeof(buf) - len, + "- Long description hasn't been set.\r\n"); + + if (mob->player.description && *mob->player.description) { + if (!strncmp(mob->player.description, "It looks unfinished.", 20) && (found = 1)) len += snprintf(buf + len, sizeof(buf) - len, - "- Alias hasn't been set.\r\n"); - - if (!strcmp(mob->player.short_descr, "the unfinished mob") && (found=1)) + "- Description hasn't been set.\r\n"); + else if (strncmp(mob->player.description, " ", 3) && (found = 1)) len += snprintf(buf + len, sizeof(buf) - len, - "- Short description hasn't been set.\r\n"); + "- Description hasn't been formatted. (/fi)\r\n"); + } - if (!strncmp(mob->player.long_descr, "An unfinished mob stands here.", 30) && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, - "- Long description hasn't been set.\r\n"); + if (GET_LEVEL(mob) > MAX_LEVEL_ALLOWED && (found = 1)) + len += snprintf(buf + len, sizeof(buf) - len, + "- Is level %d (limit: 1-%d)\r\n", + GET_LEVEL(mob), MAX_LEVEL_ALLOWED); - if (mob->player.description && *mob->player.description) { - if (!strncmp(mob->player.description, "It looks unfinished.", 20) && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, - "- Description hasn't been set.\r\n"); - else if (strncmp(mob->player.description, " ", 3) && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, - "- Description hasn't been formatted. (/fi)\r\n"); - } + if (GET_DAMROLL(mob) > MAX_DAMROLL_ALLOWED && (found = 1)) + len += snprintf(buf + len, sizeof(buf) - len, + "- Damroll of %d is too high (limit: %d)\r\n", + GET_DAMROLL(mob), MAX_DAMROLL_ALLOWED); - if (GET_LEVEL(mob)>MAX_LEVEL_ALLOWED && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, - "- Is level %d (limit: 1-%d)\r\n", - GET_LEVEL(mob), MAX_LEVEL_ALLOWED); + if (GET_HITROLL(mob) > MAX_HITROLL_ALLOWED && (found = 1)) + len += snprintf(buf + len, sizeof(buf) - len, + "- Hitroll of %d is too high (limit: %d)\r\n", + GET_HITROLL(mob), MAX_HITROLL_ALLOWED); - if (GET_DAMROLL(mob)>MAX_DAMROLL_ALLOWED && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, - "- Damroll of %d is too high (limit: %d)\r\n", - GET_DAMROLL(mob), MAX_DAMROLL_ALLOWED); + /* avg. dam including damroll per round of combat */ + avg_dam = (((mob->mob_specials.damsizedice / 2.0) * mob->mob_specials.damnodice) + GET_DAMROLL(mob)); + if (avg_dam > MAX_MOB_DAM_ALLOWED && (found = 1)) + len += snprintf(buf + len, sizeof(buf) - len, + "- average damage of %4.1f is too high (limit: %d)\r\n", + avg_dam, MAX_MOB_DAM_ALLOWED); - if (GET_HITROLL(mob)>MAX_HITROLL_ALLOWED && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, - "- Hitroll of %d is too high (limit: %d)\r\n", - GET_HITROLL(mob), MAX_HITROLL_ALLOWED); + if (mob->mob_specials.damsizedice == 1 && + mob->mob_specials.damnodice == 1 && + GET_LEVEL(mob) == 0 && + (found = 1)) + len += snprintf(buf + len, sizeof(buf) - len, + "- Needs to be fixed - %sAutogenerate!%s\r\n", CCYEL(ch, C_NRM), CCNRM(ch, C_NRM)); - /* avg. dam including damroll per round of combat */ - avg_dam = (((mob->mob_specials.damsizedice / 2.0) * mob->mob_specials.damnodice)+GET_DAMROLL(mob)); - if (avg_dam>MAX_MOB_DAM_ALLOWED && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, - "- average damage of %4.1f is too high (limit: %d)\r\n", - avg_dam, MAX_MOB_DAM_ALLOWED); + if (MOB_FLAGGED(mob, MOB_AGGRESSIVE) && (MOB_FLAGGED(mob, MOB_AGGR_GOOD) || MOB_FLAGGED(mob, MOB_AGGR_EVIL) || + MOB_FLAGGED(mob, MOB_AGGR_NEUTRAL)) && (found = 1)) + len += snprintf(buf + len, sizeof(buf) - len, + "- Both aggresive and agressive to align.\r\n"); - if (mob->mob_specials.damsizedice == 1 && - mob->mob_specials.damnodice == 1 && - GET_LEVEL(mob) == 0 && - (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, - "- Needs to be fixed - %sAutogenerate!%s\r\n", CCYEL(ch, C_NRM), CCNRM(ch, C_NRM)); + if ((GET_GOLD(mob) > MAX_MOB_GOLD_ALLOWED) && (found = 1)) + len += snprintf(buf + len, sizeof(buf) - len, + "- Set to %d Gold (limit : %d).\r\n", + GET_GOLD(mob), + MAX_MOB_GOLD_ALLOWED); - if (MOB_FLAGGED(mob, MOB_AGGRESSIVE) && (MOB_FLAGGED(mob, MOB_AGGR_GOOD) || MOB_FLAGGED(mob, MOB_AGGR_EVIL) || MOB_FLAGGED(mob, MOB_AGGR_NEUTRAL)) && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, - "- Both aggresive and agressive to align.\r\n"); - - if ((GET_GOLD(mob) > MAX_MOB_GOLD_ALLOWED) && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, - "- Set to %d Gold (limit : %d).\r\n", - GET_GOLD(mob), - MAX_MOB_GOLD_ALLOWED); - - if (GET_EXP(mob)>MAX_EXP_ALLOWED && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, - "- Has %d experience (limit: %d)\r\n", - GET_EXP(mob), MAX_EXP_ALLOWED); - if ((AFF_FLAGGED(mob, AFF_CHARM) || AFF_FLAGGED(mob, AFF_POISON)) && (found = 1)) - len += snprintf(buf + len, sizeof(buf) - len, - "- Has illegal affection bits set (%s %s)\r\n", - AFF_FLAGGED(mob, AFF_CHARM) ? "CHARM" : "", - AFF_FLAGGED(mob, AFF_POISON) ? "POISON" : ""); + if (GET_EXP(mob) > MAX_EXP_ALLOWED && (found = 1)) + len += snprintf(buf + len, sizeof(buf) - len, + "- Has %d experience (limit: %d)\r\n", + GET_EXP(mob), MAX_EXP_ALLOWED); + if ((AFF_FLAGGED(mob, AFF_CHARM) || AFF_FLAGGED(mob, AFF_POISON)) && (found = 1)) + len += snprintf(buf + len, sizeof(buf) - len, + "- Has illegal affection bits set (%s %s)\r\n", + AFF_FLAGGED(mob, AFF_CHARM) ? "CHARM" : "", + AFF_FLAGGED(mob, AFF_POISON) ? "POISON" : ""); - if (!MOB_FLAGGED(mob, MOB_SENTINEL) && !MOB_FLAGGED(mob, MOB_STAY_ZONE) && (found = 1)) - len += snprintf(buf + len, sizeof(buf) - len, - "- Neither SENTINEL nor STAY_ZONE bits set.\r\n"); + if (!MOB_FLAGGED(mob, MOB_SENTINEL) && !MOB_FLAGGED(mob, MOB_STAY_ZONE) && (found = 1)) + len += snprintf(buf + len, sizeof(buf) - len, + "- Neither SENTINEL nor STAY_ZONE bits set.\r\n"); - if (MOB_FLAGGED(mob, MOB_SPEC) && (found = 1)) - snprintf(buf + len, sizeof(buf) - len, - "- SPEC flag needs to be removed.\r\n"); + if (MOB_FLAGGED(mob, MOB_SPEC) && (found = 1)) + snprintf(buf + len, sizeof(buf) - len, + "- SPEC flag needs to be removed.\r\n"); - /* Additional mob checks.*/ - if (found) { - send_to_char(ch, - "%s[%5d]%s %-30s: %s\r\n", - CCCYN(ch, C_NRM), GET_MOB_VNUM(mob), - CCYEL(ch, C_NRM), GET_NAME(mob), - CCNRM(ch, C_NRM)); - send_to_char(ch, "%s", buf); - } - /* reset buffers and found flag */ - strcpy(buf, ""); - found = 0; - len = 0; - } /* mob is in zone */ - } /* check mobs */ + /* Additional mob checks.*/ + if (found) { + send_to_char(ch, + "%s[%5d]%s %-30s: %s\r\n", + CCCYN(ch, C_NRM), GET_MOB_VNUM(mob), + CCYEL(ch, C_NRM), GET_NAME(mob), + CCNRM(ch, C_NRM)); + send_to_char(ch, "%s", buf); + } + /* reset buffers and found flag */ + strcpy(buf, ""); + found = 0; + len = 0; + } /* mob is in zone */ + } /* check mobs */ - /* Check objects */ + /* Check objects */ send_to_char(ch, "\r\nChecking Objects for limits...\r\n"); - for (i=0; iMAX_OBJ_GOLD_ALLOWED && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, - "- Is worth %d (money limit %d coins).\r\n", - value, MAX_OBJ_GOLD_ALLOWED); - break; - case ITEM_WEAPON: - if (GET_OBJ_VAL(obj, 3) >= NUM_ATTACK_TYPES && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, - "- has out of range attack type %d.\r\n", - GET_OBJ_VAL(obj, 3)); + case ITEM_MONEY: + if ((value = GET_OBJ_VAL(obj, 0)) > MAX_OBJ_GOLD_ALLOWED && (found = 1)) + len += snprintf(buf + len, sizeof(buf) - len, + "- Is worth %d (money limit %d coins).\r\n", + value, MAX_OBJ_GOLD_ALLOWED); + break; + case ITEM_WEAPON: + if (GET_OBJ_VAL(obj, 3) >= NUM_ATTACK_TYPES && (found = 1)) + len += snprintf(buf + len, sizeof(buf) - len, + "- has out of range attack type %d.\r\n", + GET_OBJ_VAL(obj, 3)); - if (GET_OBJ_AVG_DAM(obj)>MAX_DAM_ALLOWED && (found=1)) + if (GET_OBJ_AVG_DAM(obj) > MAX_DAM_ALLOWED && (found = 1)) + len += snprintf(buf + len, sizeof(buf) - len, + "- Damroll is %2.1f (limit %d)\r\n", + GET_OBJ_AVG_DAM(obj), MAX_DAM_ALLOWED); + break; + case ITEM_ARMOR: + ac = GET_OBJ_VAL(obj, 0); + for (j = 0; j < TOTAL_WEAR_CHECKS; j++) { + if (CAN_WEAR(obj, zarmor[j].bitvector) && (ac > zarmor[j].ac_allowed) && (found = 1)) len += snprintf(buf + len, sizeof(buf) - len, - "- Damroll is %2.1f (limit %d)\r\n", - GET_OBJ_AVG_DAM(obj), MAX_DAM_ALLOWED); - break; - case ITEM_ARMOR: - ac=GET_OBJ_VAL(obj,0); - for (j=0; jzarmor[j].ac_allowed) && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, - "- Has AC %d (%s limit is %d)\r\n", - ac, zarmor[j].message, zarmor[j].ac_allowed); - } - break; + "- Has AC %d (%s limit is %d)\r\n", + ac, zarmor[j].message, zarmor[j].ac_allowed); + } + break; - } /*switch on Item_Type*/ + } /*switch on Item_Type*/ if (!CAN_WEAR(obj, ITEM_WEAR_TAKE)) { if ((GET_OBJ_COST(obj) || (GET_OBJ_WEIGHT(obj) && GET_OBJ_TYPE(obj) != ITEM_FOUNTAIN) || - GET_OBJ_RENT(obj)) && (found = 1)) + GET_OBJ_RENT(obj)) && (found = 1)) len += snprintf(buf + len, sizeof(buf) - len, "- is NO_TAKE, but has cost (%d) weight (%d) or rent (%d) set.\r\n", GET_OBJ_COST(obj), GET_OBJ_WEIGHT(obj), GET_OBJ_RENT(obj)); } else { - if (GET_OBJ_COST(obj) == 0 && (found=1) && GET_OBJ_TYPE(obj) != ITEM_TRASH) + if (GET_OBJ_COST(obj) == 0 && (found = 1) && GET_OBJ_TYPE(obj) != ITEM_TRASH) len += snprintf(buf + len, sizeof(buf) - len, "- has 0 cost (min. 1).\r\n"); - if (GET_OBJ_WEIGHT(obj) == 0 && (found=1)) + if (GET_OBJ_WEIGHT(obj) == 0 && (found = 1)) len += snprintf(buf + len, sizeof(buf) - len, "- has 0 weight (min. 1).\r\n"); - if (GET_OBJ_WEIGHT(obj) > MAX_OBJ_WEIGHT && (found=1)) + if (GET_OBJ_WEIGHT(obj) > MAX_OBJ_WEIGHT && (found = 1)) len += snprintf(buf + len, sizeof(buf) - len, " Weight is too high: %d (limit %d).\r\n", GET_OBJ_WEIGHT(obj), MAX_OBJ_WEIGHT); - if (GET_OBJ_COST(obj) > MAX_OBJ_COST && (found=1)) + if (GET_OBJ_COST(obj) > MAX_OBJ_COST && (found = 1)) len += snprintf(buf + len, sizeof(buf) - len, "- has %d cost (max %d).\r\n", GET_OBJ_COST(obj), MAX_OBJ_COST); } - if (GET_OBJ_LEVEL(obj) > LVL_IMMORT-1 && (found=1)) + if (GET_OBJ_LEVEL(obj) > LVL_IMMORT - 1 && (found = 1)) len += snprintf(buf + len, sizeof(buf) - len, - "- has min level set to %d (max %d).\r\n", - GET_OBJ_LEVEL(obj), LVL_IMMORT-1); + "- has min level set to %d (max %d).\r\n", + GET_OBJ_LEVEL(obj), LVL_IMMORT - 1); if (obj->action_description && *obj->action_description && GET_OBJ_TYPE(obj) != ITEM_STAFF && GET_OBJ_TYPE(obj) != ITEM_WAND && GET_OBJ_TYPE(obj) != ITEM_SCROLL && - GET_OBJ_TYPE(obj) != ITEM_NOTE && (found=1)) + GET_OBJ_TYPE(obj) != ITEM_NOTE && (found = 1)) len += snprintf(buf + len, sizeof(buf) - len, - "- has action_description set, but is inappropriate type.\r\n"); + "- has action_description set, but is inappropriate type.\r\n"); /*first check for over-all affections*/ - for (affs=0, j = 0; j < MAX_OBJ_AFFECT; j++) - if (obj->affected[j].modifier) affs++; + for (affs = 0, j = 0; j < MAX_OBJ_AFFECT; j++) + if (obj->affected[j].modifier) + affs++; - if (affs>MAX_AFFECTS_ALLOWED && (found=1)) + if (affs > MAX_AFFECTS_ALLOWED && (found = 1)) len += snprintf(buf + len, sizeof(buf) - len, - "- has %d affects (limit %d).\r\n", - affs, MAX_AFFECTS_ALLOWED); + "- has %d affects (limit %d).\r\n", + affs, MAX_AFFECTS_ALLOWED); /*check for out of range affections. */ - for (j=0;jaffected[j].location].max_aff != -99 && /* only care if a range is set */ (obj->affected[j].modifier > zaffs[(int)obj->affected[j].location].max_aff || obj->affected[j].modifier < zaffs[(int)obj->affected[j].location].min_aff || - zaffs[(int)obj->affected[j].location].min_aff == zaffs[(int)obj->affected[j].location].max_aff) && (found=1)) + zaffs[(int)obj->affected[j].location].min_aff == zaffs[(int)obj->affected[j].location].max_aff) && ( + found = 1)) len += snprintf(buf + len, sizeof(buf) - len, "- apply to %s is %d (limit %d - %d).\r\n", - zaffs[(int)obj->affected[j].location].message, - obj->affected[j].modifier, - zaffs[(int)obj->affected[j].location].min_aff, - zaffs[(int)obj->affected[j].location].max_aff); + zaffs[(int)obj->affected[j].location].message, + obj->affected[j].modifier, + zaffs[(int)obj->affected[j].location].min_aff, + zaffs[(int)obj->affected[j].location].max_aff); - /* special handling of +hit and +dam because of +hit_n_dam */ - for (todam=0, tohit=0, j=0;jaffected[j].location == APPLY_HITROLL) - tohit += obj->affected[j].modifier; - if (obj->affected[j].location == APPLY_DAMROLL) - todam += obj->affected[j].modifier; - } - if (abs(todam) > MAX_APPLY_DAMROLL_TOTAL && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, - "- total damroll %d out of range (limit +/-%d.\r\n", - todam, MAX_APPLY_DAMROLL_TOTAL); - if (abs(tohit) > MAX_APPLY_HITROLL_TOTAL && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, - "- total hitroll %d out of range (limit +/-%d).\r\n", - tohit, MAX_APPLY_HITROLL_TOTAL); + /* special handling of +hit and +dam because of +hit_n_dam */ + for (todam = 0, tohit = 0, j = 0; j < MAX_OBJ_AFFECT; j++) { + if (obj->affected[j].location == APPLY_HITROLL) + tohit += obj->affected[j].modifier; + if (obj->affected[j].location == APPLY_DAMROLL) + todam += obj->affected[j].modifier; + } + if (abs(todam) > MAX_APPLY_DAMROLL_TOTAL && (found = 1)) + len += snprintf(buf + len, sizeof(buf) - len, + "- total damroll %d out of range (limit +/-%d.\r\n", + todam, MAX_APPLY_DAMROLL_TOTAL); + if (abs(tohit) > MAX_APPLY_HITROLL_TOTAL && (found = 1)) + len += snprintf(buf + len, sizeof(buf) - len, + "- total hitroll %d out of range (limit +/-%d).\r\n", + tohit, MAX_APPLY_HITROLL_TOTAL); - for (ext2 = NULL, ext = obj->ex_description; ext; ext = ext->next) - if (strncmp(ext->description, " ", 3)) - ext2 = ext; + for (ext2 = NULL, ext = obj->ex_description; ext; ext = ext->next) + if (strncmp(ext->description, " ", 3)) + ext2 = ext; - if (ext2 && (found = 1)) - snprintf(buf + len, sizeof(buf) - len, - "- has unformatted extra description\r\n"); - /* Additional object checks. */ - if (found) { + if (ext2 && (found = 1)) + snprintf(buf + len, sizeof(buf) - len, + "- has unformatted extra description\r\n"); + /* Additional object checks. */ + if (found) { send_to_char(ch, "[%5d] %-30s: \r\n", GET_OBJ_VNUM(obj), obj->short_description); send_to_char(ch, "%s", buf); } strcpy(buf, ""); len = 0; found = 0; - } /*object is in zone*/ - } /*check objects*/ + } /*object is in zone*/ + } /*check objects*/ /* Check rooms */ send_to_char(ch, "\r\nChecking Rooms for limits...\r\n"); - for (i=0; ito_room; - if (exroom==NOWHERE) + exroom = world[i].dir_option[j]->to_room; + if (exroom == NOWHERE) continue; if (world[exroom].zone == zrnum) continue; if (world[exroom].zone == world[i].zone) continue; - for (k=0;offlimit_zones[k] != -1;k++) { + for (k = 0; offlimit_zones[k] != -1; k++) { if (world[exroom].zone == real_zone(offlimit_zones[k]) && (found = 1)) len += snprintf(buf + len, sizeof(buf) - len, "- Exit %s cannot connect to %d (zone off limits).\r\n", dirs[j], world[exroom].number); } /* for (k.. */ - } /* cycle directions */ + } /* cycle directions */ - if (ROOM_FLAGGED(i, ROOM_ATRIUM) || ROOM_FLAGGED(i, ROOM_HOUSE) || ROOM_FLAGGED(i, ROOM_HOUSE_CRASH) || ROOM_FLAGGED(i, ROOM_OLC) || ROOM_FLAGGED(i, ROOM_BFS_MARK)) - len += snprintf(buf + len, sizeof(buf) - len, - "- Has illegal affection bits set (%s %s %s %s %s)\r\n", - ROOM_FLAGGED(i, ROOM_ATRIUM) ? "ATRIUM" : "", - ROOM_FLAGGED(i, ROOM_HOUSE) ? "HOUSE" : "", - ROOM_FLAGGED(i, ROOM_HOUSE_CRASH) ? "HCRSH" : "", - ROOM_FLAGGED(i, ROOM_OLC) ? "OLC" : "", - ROOM_FLAGGED(i, ROOM_BFS_MARK) ? "*" : ""); - - if ((MIN_ROOM_DESC_LENGTH) && strlen(world[i].description)MAX_COLOUMN_WIDTH) && (found=1)) + if ((strcspn(world[i].description, "\r\n") > MAX_COLOUMN_WIDTH) && (found = 1)) len += snprintf(buf + len, sizeof(buf) - len, "- Room description not wrapped at %d chars (/fi in the editor).\r\n", - MAX_COLOUMN_WIDTH); + MAX_COLOUMN_WIDTH); - for (ext2 = NULL, ext = world[i].ex_description; ext; ext = ext->next) - if (strncmp(ext->description, " ", 3)) - ext2 = ext; + for (ext2 = NULL, ext = world[i].ex_description; ext; ext = ext->next) + if (strncmp(ext->description, " ", 3)) + ext2 = ext; - if (ext2 && (found = 1)) - len += snprintf(buf + len, sizeof(buf) - len, - "- has unformatted extra description\r\n"); + if (ext2 && (found = 1)) + len += snprintf(buf + len, sizeof(buf) - len, + "- has unformatted extra description\r\n"); if (found) { send_to_char(ch, "[%5d] %-30s: \r\n", - world[i].number, world[i].name ? world[i].name : "An unnamed room"); + world[i].number, world[i].name ? world[i].name : "An unnamed room"); send_to_char(ch, "%s", buf); strcpy(buf, ""); len = 0; found = 0; } } /*is room in this zone?*/ - } /*checking rooms*/ + } /*checking rooms*/ - for (i=0; iproto->attach_type == MOB_TRIGGER ? "mobile" : - (trig_index[trnum]->proto->attach_type == OBJ_TRIGGER ? "object" : "room"), - trig_index[trnum]->proto->name); + trig_index[trnum]->proto->attach_type == MOB_TRIGGER + ? "mobile" + : (trig_index[trnum]->proto->attach_type == OBJ_TRIGGER ? "object" : "room"), + trig_index[trnum]->proto->name); - for (zone=0; zone <= top_of_zone_table; zone++) { + for (zone = 0; zone <= top_of_zone_table; zone++) { for (cmd_no = 0; ZCMD2.command != 'S'; cmd_no++) { switch (ZCMD2.command) { - case 'M': - lastroom_v = world[ZCMD2.arg3].number; - lastroom_r = ZCMD2.arg3; - lastmob_r = ZCMD2.arg1; + case 'M': + lastroom_v = world[ZCMD2.arg3].number; + lastroom_r = ZCMD2.arg3; + lastmob_r = ZCMD2.arg1; + break; + case 'O': /* read an object */ + lastroom_v = world[ZCMD2.arg3].number; + lastroom_r = ZCMD2.arg3; + lastobj_r = ZCMD2.arg1; + break; + case 'P': /* object to object */ + lastobj_r = ZCMD2.arg1; + break; + case 'G': /* obj_to_char */ + lastobj_r = ZCMD2.arg1; + break; + case 'E': /* object to equipment list */ + lastobj_r = ZCMD2.arg1; + break; + case 'R': /* rem obj from room */ + lastroom_v = 0; + lastroom_r = 0; + lastobj_r = 0; + lastmob_r = 0; + case 'T': /* trigger to something */ + if (ZCMD2.arg2 != trnum) break; - case 'O': /* read an object */ - lastroom_v = world[ZCMD2.arg3].number; - lastroom_r = ZCMD2.arg3; - lastobj_r = ZCMD2.arg1; - break; - case 'P': /* object to object */ - lastobj_r = ZCMD2.arg1; - break; - case 'G': /* obj_to_char */ - lastobj_r = ZCMD2.arg1; - break; - case 'E': /* object to equipment list */ - lastobj_r = ZCMD2.arg1; - break; - case 'R': /* rem obj from room */ - lastroom_v = 0; - lastroom_r = 0; - lastobj_r = 0; - lastmob_r = 0; - case 'T': /* trigger to something */ - if (ZCMD2.arg2 != trnum) - break; - if (ZCMD2.arg1 == MOB_TRIGGER) { - send_to_char(ch, "mob [%5d] %-60s (zedit room %5d)\r\n", - mob_index[lastmob_r].vnum, - mob_proto[lastmob_r].player.short_descr, - lastroom_v); - found = 1; - } else if (ZCMD2.arg1 == OBJ_TRIGGER) { - send_to_char(ch, "obj [%5d] %-60s (zedit room %d)\r\n", - obj_index[lastobj_r].vnum, - obj_proto[lastobj_r].short_description, - lastroom_v); - found = 1; - } else if (ZCMD2.arg1==WLD_TRIGGER) { - send_to_char(ch, "room [%5d] %-60s (zedit)\r\n", - lastroom_v, - world[lastroom_r].name); - found = 1; - } + if (ZCMD2.arg1 == MOB_TRIGGER) { + send_to_char(ch, "mob [%5d] %-60s (zedit room %5d)\r\n", + mob_index[lastmob_r].vnum, + mob_proto[lastmob_r].player.short_descr, + lastroom_v); + found = 1; + } else if (ZCMD2.arg1 == OBJ_TRIGGER) { + send_to_char(ch, "obj [%5d] %-60s (zedit room %d)\r\n", + obj_index[lastobj_r].vnum, + obj_proto[lastobj_r].short_description, + lastroom_v); + found = 1; + } else if (ZCMD2.arg1 == WLD_TRIGGER) { + send_to_char(ch, "room [%5d] %-60s (zedit)\r\n", + lastroom_v, + world[lastroom_r].name); + found = 1; + } break; } /* switch */ - } /*for cmd_no......*/ - } /*for zone...*/ + } /*for cmd_no......*/ + } /*for zone...*/ for (i = 0; i < top_of_mobt; i++) { if (!mob_proto[i].proto_script) continue; - for (tpl = mob_proto[i].proto_script;tpl;tpl = tpl->next) + for (tpl = mob_proto[i].proto_script; tpl; tpl = tpl->next) if (tpl->vnum == tvnum) { send_to_char(ch, "mob [%5d] %s\r\n", - mob_index[i].vnum, - mob_proto[i].player.short_descr); + mob_index[i].vnum, + mob_proto[i].player.short_descr); found = 1; } } @@ -4107,24 +4141,24 @@ static void trg_checkload(struct char_data *ch, trig_vnum tvnum) if (!obj_proto[j].proto_script) continue; - for (tpl = obj_proto[j].proto_script;tpl;tpl = tpl->next) + for (tpl = obj_proto[j].proto_script; tpl; tpl = tpl->next) if (tpl->vnum == tvnum) { send_to_char(ch, "obj [%5d] %s\r\n", - obj_index[j].vnum, - obj_proto[j].short_description); + obj_index[j].vnum, + obj_proto[j].short_description); found = 1; } } - for (k = 0;k < top_of_world; k++) { + for (k = 0; k < top_of_world; k++) { if (!world[k].proto_script) continue; - for (tpl = world[k].proto_script;tpl;tpl = tpl->next) + for (tpl = world[k].proto_script; tpl; tpl = tpl->next) if (tpl->vnum == tvnum) { send_to_char(ch, "room[%5d] %s\r\n", - world[k].number, - world[k].name); + world[k].number, + world[k].name); found = 1; } } @@ -4159,6 +4193,7 @@ ACMD(do_checkloadstatus) return; } } + /* Zone Checker code above. */ /* (c) 1996-97 Erwin S. Andreasen. */ @@ -4166,76 +4201,76 @@ ACMD(do_copyover) { FILE *fp; struct descriptor_data *d, *d_next; - char buf [100], buf2[100]; + char buf[100], buf2[100]; - fp = fopen (COPYOVER_FILE, "w"); - if (!fp) { - send_to_char (ch, "Copyover file not writeable, aborted.\n\r"); - return; - } + fp = fopen(COPYOVER_FILE, "w"); + if (!fp) { + send_to_char(ch, "Copyover file not writeable, aborted.\n\r"); + return; + } - sprintf (buf, "\n\r *** COPYOVER by %s - please remain seated!\n\r", GET_NAME(ch)); + sprintf(buf, "\n\r *** COPYOVER by %s - please remain seated!\n\r", GET_NAME(ch)); - /* write boot_time as first line in file */ - fprintf(fp, "%ld\n", (long)boot_time); + /* write boot_time as first line in file */ + fprintf(fp, "%ld\n", (long)boot_time); - /* For each playing descriptor, save its state */ - for (d = descriptor_list; d ; d = d_next) { - struct char_data * och = d->character; - - /* If d is currently in someone else's body, return them. */ - if (och && d->original) - return_to_char(och); - - /* We delete from the list , so need to save this */ - d_next = d->next; + /* For each playing descriptor, save its state */ + for (d = descriptor_list; d; d = d_next) { + struct char_data *och = d->character; - /* drop those logging on */ - if (!d->character || d->connected > CON_PLAYING) { - write_to_descriptor (d->descriptor, "\n\rSorry, we are rebooting. Come back in a few minutes.\n\r"); - close_socket (d); /* throw'em out */ - } else { - fprintf (fp, "%d %ld %s %s %s\n", d->descriptor, GET_PREF(och), GET_NAME(och), d->host, CopyoverGet(d)); + /* If d is currently in someone else's body, return them. */ + if (och && d->original) + return_to_char(och); + + /* We delete from the list , so need to save this */ + d_next = d->next; + + /* drop those logging on */ + if (!d->character || d->connected > CON_PLAYING) { + write_to_descriptor(d->descriptor, "\n\rSorry, we are rebooting. Come back in a few minutes.\n\r"); + close_socket(d); /* throw'em out */ + } else { + fprintf(fp, "%d %ld %s %s %s\n", d->descriptor, GET_PREF(och), GET_NAME(och), d->host, CopyoverGet(d)); /* save och */ GET_LOADROOM(och) = GET_ROOM_VNUM(IN_ROOM(och)); - Crash_rentsave(och,0); + Crash_rentsave(och, 0); save_char(och); - write_to_descriptor (d->descriptor, buf); + write_to_descriptor(d->descriptor, buf); } } - fprintf (fp, "-1\n"); - fclose (fp); + fprintf(fp, "-1\n"); + fclose(fp); /* exec - descriptors are inherited */ - sprintf (buf, "%d", port); - sprintf (buf2, "-C%d", mother_desc); + sprintf(buf, "%d", port); + sprintf(buf2, "-C%d", mother_desc); /* Ugh, seems it is expected we are 1 step above lib - this may be dangerous! */ - if(chdir ("..") != 0) { + if (chdir("..") != 0) { log("Error changing working directory: %s", strerror(errno)); send_to_char(ch, "Error changing working directory: %s.", strerror(errno)); exit(1); } /* Close reserve and other always-open files and release other resources */ - execl (EXE_FILE, "circle", buf2, buf, (char *) NULL); + execl(EXE_FILE, "circle", buf2, buf, (char *)NULL); /* Failed - successful exec will not return */ - perror ("do_copyover: execl"); - send_to_char (ch, "Copyover FAILED!\n\r"); + perror("do_copyover: execl"); + send_to_char(ch, "Copyover FAILED!\n\r"); - exit (1); /* too much trouble to try to recover! */ + exit(1); /* too much trouble to try to recover! */ } ACMD(do_peace) { struct char_data *vict, *next_v; - act ("As $n makes a strange arcane gesture, a golden light descends\r\n" - "from the heavens stopping all the fighting.\r\n",FALSE, ch, 0, 0, TO_ROOM); + act("As $n makes a strange arcane gesture, a golden light descends\r\n" + "from the heavens stopping all the fighting.\r\n",FALSE, ch, 0, 0, TO_ROOM); send_to_room(IN_ROOM(ch), "Everything is quite peaceful now.\r\n"); - for(vict=world[IN_ROOM(ch)].people; vict; vict=next_v) { + for (vict = world[IN_ROOM(ch)].people; vict; vict = next_v) { next_v = vict->next_in_room; if (FIGHTING(vict)) stop_fighting(vict); @@ -4252,18 +4287,15 @@ ACMD(do_zpurge) one_argument(argument, arg); if (*arg == '.' || !*arg) { zone = world[IN_ROOM(ch)].zone; - } - else if (is_number(arg)) { + } else if (is_number(arg)) { zone = real_zone(atoi(arg)); if (zone == NOWHERE || zone > top_of_zone_table) { send_to_char(ch, "That zone doesn't exist!\r\n"); return; } - } - else if (*arg == '*') { + } else if (*arg == '*') { purge_all = TRUE; - } - else { + } else { send_to_char(ch, "That isn't a valid zone number!\r\n"); return; } @@ -4276,9 +4308,9 @@ ACMD(do_zpurge) purge_room(real_room(vroom)); } send_to_char(ch, "Purged zone #%d: %s.\r\n", zone_table[zone].number, zone_table[zone].name); - mudlog(NRM, MAX(LVL_GRGOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s purged zone %d (%s)", GET_NAME(ch), zone_table[zone].number, zone_table[zone].name); - } - else { + mudlog(NRM, MAX(LVL_GRGOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s purged zone %d (%s)", GET_NAME(ch), + zone_table[zone].number, zone_table[zone].name); + } else { for (room = 0; room <= top_of_world; room++) { purge_room(room); } @@ -4299,168 +4331,157 @@ ACMD(do_zpurge) ACMD(do_file) { /* Local variables */ - int def_lines_to_read = 15; /* Set the default num lines to be read. */ - int max_lines_to_read = 300; /* Maximum number of lines to read. */ - FILE *req_file; /* Pointer to file to be read. */ - size_t req_file_size = 0; /* Size of file to be read. */ - int req_file_lines = 0; /* Number of total lines in file to be read. */ - int lines_read = 0; /* Counts total number of lines read from the file. */ - int req_lines = 0; /* Number of lines requested to be displayed. */ - int i; /* Generic loop counter. */ - int l; /* Marks choice of file in fields array. */ - char field[MAX_INPUT_LENGTH]; /* Holds users choice of file to be read. */ - char value[MAX_INPUT_LENGTH]; /* Holds # lines to be read, if requested. */ - char buf[MAX_STRING_LENGTH]; /* Display buffer for req_file. */ + int def_lines_to_read = 15; /* Set the default num lines to be read. */ + int max_lines_to_read = 300; /* Maximum number of lines to read. */ + FILE *req_file; /* Pointer to file to be read. */ + size_t req_file_size = 0; /* Size of file to be read. */ + int req_file_lines = 0; /* Number of total lines in file to be read. */ + int lines_read = 0; /* Counts total number of lines read from the file. */ + int req_lines = 0; /* Number of lines requested to be displayed. */ + int i; /* Generic loop counter. */ + int l; /* Marks choice of file in fields array. */ + char field[MAX_INPUT_LENGTH]; /* Holds users choice of file to be read. */ + char value[MAX_INPUT_LENGTH]; /* Holds # lines to be read, if requested. */ + char buf[MAX_STRING_LENGTH]; /* Display buffer for req_file. */ /* Defines which files are available to read. */ - struct file_struct { + struct file_struct + { char *cmd; /* The 'name' of the file to view */ char level; /* Minimum level needed to view. */ char *file; /* The file location, relative to the working dir. */ int read_backwards; /* Should the file be read backwards by default? */ } fields[] = { - { "xnames", LVL_GOD, XNAME_FILE, TRUE}, - { "levels", LVL_GOD, LEVELS_LOGFILE, TRUE}, - { "rip", LVL_GOD, RIP_LOGFILE, TRUE}, - { "players", LVL_GOD, NEWPLAYERS_LOGFILE, TRUE}, - { "rentgone", LVL_GOD, RENTGONE_LOGFILE, TRUE}, - { "errors", LVL_GOD, ERRORS_LOGFILE, TRUE}, - { "godcmds", LVL_GOD, GODCMDS_LOGFILE, TRUE}, - { "syslog", LVL_GOD, SYSLOG_LOGFILE, TRUE}, - { "crash", LVL_GOD, CRASH_LOGFILE, TRUE}, - { "help", LVL_GOD, HELP_LOGFILE, TRUE}, - { "changelog", LVL_GOD, CHANGE_LOG_FILE, FALSE}, - { "deletes", LVL_GOD, DELETES_LOGFILE, TRUE}, - { "restarts", LVL_GOD, RESTARTS_LOGFILE, TRUE}, - { "usage", LVL_GOD, USAGE_LOGFILE, TRUE}, - { "badpws", LVL_GOD, BADPWS_LOGFILE, TRUE}, - { "olc", LVL_GOD, OLC_LOGFILE, TRUE}, - { "trigger", LVL_GOD, TRIGGER_LOGFILE, TRUE}, - { "\n", 0, "\n", FALSE } /* This must be the last entry */ - }; + {"xnames", LVL_GOD, XNAME_FILE, TRUE}, + {"levels", LVL_GOD, LEVELS_LOGFILE, TRUE}, + {"rip", LVL_GOD, RIP_LOGFILE, TRUE}, + {"players", LVL_GOD, NEWPLAYERS_LOGFILE, TRUE}, + {"rentgone", LVL_GOD, RENTGONE_LOGFILE, TRUE}, + {"errors", LVL_GOD, ERRORS_LOGFILE, TRUE}, + {"godcmds", LVL_GOD, GODCMDS_LOGFILE, TRUE}, + {"syslog", LVL_GOD, SYSLOG_LOGFILE, TRUE}, + {"crash", LVL_GOD, CRASH_LOGFILE, TRUE}, + {"help", LVL_GOD, HELP_LOGFILE, TRUE}, + {"changelog", LVL_GOD, CHANGE_LOG_FILE, FALSE}, + {"deletes", LVL_GOD, DELETES_LOGFILE, TRUE}, + {"restarts", LVL_GOD, RESTARTS_LOGFILE, TRUE}, + {"usage", LVL_GOD, USAGE_LOGFILE, TRUE}, + {"badpws", LVL_GOD, BADPWS_LOGFILE, TRUE}, + {"olc", LVL_GOD, OLC_LOGFILE, TRUE}, + {"trigger", LVL_GOD, TRIGGER_LOGFILE, TRUE}, + {"\n", 0, "\n", FALSE} /* This must be the last entry */ + }; - /* Initialize buffer */ - buf[0] = '\0'; + /* Initialize buffer */ + buf[0] = '\0'; - /**/ - /* End function variable set-up and initialization. */ + /**/ + /* End function variable set-up and initialization. */ - skip_spaces(&argument); + skip_spaces(&argument); - /* Display usage if no argument. */ - if (!*argument) { - send_to_char(ch, "USAGE: file \r\n\r\nFile options:\r\n"); - for (i = 0; fields[i].level; i++) - if (fields[i].level <= GET_LEVEL(ch)) - send_to_char(ch, "%-15s%s\r\n", fields[i].cmd, fields[i].file); - return; - } + /* Display usage if no argument. */ + if (!*argument) { + send_to_char(ch, "USAGE: file \r\n\r\nFile options:\r\n"); + for (i = 0; fields[i].level; i++) + if (fields[i].level <= GET_LEVEL(ch)) + send_to_char(ch, "%-15s%s\r\n", fields[i].cmd, fields[i].file); + return; + } - /* Begin validity checks. Is the file choice valid and accessible? */ - /**/ - /* There are some arguments, deal with them. */ - two_arguments(argument, field, value); + /* Begin validity checks. Is the file choice valid and accessible? */ + /**/ + /* There are some arguments, deal with them. */ + two_arguments(argument, field, value); - for (l = 0; *(fields[l].cmd) != '\n'; l++) - { - if (!strncmp(field, fields[l].cmd, strlen(field))) - break; - } + for (l = 0; *(fields[l].cmd) != '\n'; l++) { + if (!strncmp(field, fields[l].cmd, strlen(field))) + break; + } - if(*(fields[l].cmd) == '\n') { - send_to_char(ch, "'%s' is not a valid file.\r\n", field); - return; - } + if (*(fields[l].cmd) == '\n') { + send_to_char(ch, "'%s' is not a valid file.\r\n", field); + return; + } - if (GET_LEVEL(ch) < fields[l].level) { - send_to_char(ch, "You have not achieved a high enough level to view '%s'.\r\n", - fields[l].cmd); - return; - } + if (GET_LEVEL(ch) < fields[l].level) { + send_to_char(ch, "You have not achieved a high enough level to view '%s'.\r\n", + fields[l].cmd); + return; + } - /* Number of lines to view. Default is 15. */ - if(!*value) - req_lines = def_lines_to_read; - else if (!isdigit(*value)) - { - /* This check forces the requisite positive digit and prevents negative - * numbers of lines from being read. */ - send_to_char(ch, "'%s' is not a valid number of lines to view.\r\n", value); - return; - } - else - { - req_lines = atoi(value); - /* Limit the maximum number of lines */ - req_lines = MIN( req_lines, max_lines_to_read ); - } + /* Number of lines to view. Default is 15. */ + if (!*value) + req_lines = def_lines_to_read; + else if (!isdigit(*value)) { + /* This check forces the requisite positive digit and prevents negative + * numbers of lines from being read. */ + send_to_char(ch, "'%s' is not a valid number of lines to view.\r\n", value); + return; + } else { + req_lines = atoi(value); + /* Limit the maximum number of lines */ + req_lines = MIN(req_lines, max_lines_to_read); + } - /* Must be able to access the file on disk. */ - if (!(req_file=fopen(fields[l].file,"r"))) { - send_to_char(ch, "The file %s can not be opened.\r\n", fields[l].file); - mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: Error opening file %s using 'file' command.", fields[l].file); - return; - } - /**/ - /* End validity checks. From here on, the file should be viewable. */ + /* Must be able to access the file on disk. */ + if (!(req_file = fopen(fields[l].file, "r"))) { + send_to_char(ch, "The file %s can not be opened.\r\n", fields[l].file); + mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: Error opening file %s using 'file' command.", fields[l].file); + return; + } + /**/ + /* End validity checks. From here on, the file should be viewable. */ - /* Diagnostic information about the file */ - req_file_size = file_sizeof(req_file); - req_file_lines = file_numlines(req_file); + /* Diagnostic information about the file */ + req_file_size = file_sizeof(req_file); + req_file_lines = file_numlines(req_file); - snprintf( buf, sizeof(buf), - "\tgFile:\tn %s\tg; Min. Level to read:\tn %d\tg; File Location:\tn %s\tg\r\n" - "File size (bytes):\tn %ld\tg; Total num lines:\tn %d\r\n", - fields[l].cmd, fields[l].level, fields[l].file, (long) req_file_size, - req_file_lines); + snprintf(buf, sizeof(buf), + "\tgFile:\tn %s\tg; Min. Level to read:\tn %d\tg; File Location:\tn %s\tg\r\n" + "File size (bytes):\tn %ld\tg; Total num lines:\tn %d\r\n", + fields[l].cmd, fields[l].level, fields[l].file, (long)req_file_size, + req_file_lines); - /* Should the file be 'headed' or 'tailed'? */ - if ( (fields[l].read_backwards == TRUE) && (req_lines < req_file_lines) ) - { - snprintf( buf + strlen(buf), sizeof(buf) - strlen(buf), - "\tgReading from the tail of the file.\tn\r\n\r\n" ); - lines_read = file_tail( req_file, buf, sizeof(buf), req_lines ); - } - else - { - snprintf( buf + strlen(buf), sizeof(buf) - strlen(buf), - "\tgReading from the head of the file.\tn\r\n\r\n" ); - lines_read = file_head( req_file, buf, sizeof(buf), req_lines ); - } + /* Should the file be 'headed' or 'tailed'? */ + if ((fields[l].read_backwards == TRUE) && (req_lines < req_file_lines)) { + snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), + "\tgReading from the tail of the file.\tn\r\n\r\n"); + lines_read = file_tail(req_file, buf, sizeof(buf), req_lines); + } else { + snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), + "\tgReading from the head of the file.\tn\r\n\r\n"); + lines_read = file_head(req_file, buf, sizeof(buf), req_lines); + } - /* Since file_head and file_tail will add the overflow message, we - * don't check for status here. */ - if ( lines_read == req_file_lines ) - { - /* We're reading the entire file */ - snprintf( buf + strlen(buf), sizeof(buf) - strlen(buf), - "\r\n\tgEntire file returned (\tn%d \tglines).\tn\r\n", - lines_read ); - } - else if ( lines_read == max_lines_to_read ) - { - snprintf( buf + strlen(buf), sizeof(buf) - strlen(buf), - "\r\n\tgMaximum number of \tn%d \tglines returned.\tn\r\n", - lines_read ); - } - else - { - snprintf( buf + strlen(buf), sizeof(buf) - strlen(buf), - "\r\n%d \tglines returned.\tn\r\n", - lines_read ); - } + /* Since file_head and file_tail will add the overflow message, we + * don't check for status here. */ + if (lines_read == req_file_lines) { + /* We're reading the entire file */ + snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), + "\r\n\tgEntire file returned (\tn%d \tglines).\tn\r\n", + lines_read); + } else if (lines_read == max_lines_to_read) { + snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), + "\r\n\tgMaximum number of \tn%d \tglines returned.\tn\r\n", + lines_read); + } else { + snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), + "\r\n%d \tglines returned.\tn\r\n", + lines_read); + } - /* Clean up before return */ - fclose(req_file); + /* Clean up before return */ + fclose(req_file); - page_string(ch->desc, buf, 1); + page_string(ch->desc, buf, 1); } ACMD(do_changelog) { time_t rawtime; char timestr[12], line[READ_SIZE], last_buf[READ_SIZE], - buf[READ_SIZE]; + buf[READ_SIZE]; FILE *fl, *new; skip_spaces(&argument); @@ -4528,7 +4549,7 @@ ACMD(do_plist) int low = 0, high = LVL_IMPL, low_day = 0, high_day = 10000, low_hr = 0, high_hr = 24; skip_spaces(&argument); - strcpy(buf, argument); /* strcpy: OK (sizeof: argument == buf) */ + strcpy(buf, argument); /* strcpy: OK (sizeof: argument == buf) */ name_search[0] = '\0'; while (*buf) { @@ -4538,9 +4559,9 @@ ACMD(do_plist) if (isdigit(*arg)) { if (sscanf(arg, "%d-%d", &low, &high) == 1) high = low; - strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ + strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ } else if (*arg == '-') { - mode = *(arg + 1); /* just in case; we destroy arg in the switch */ + mode = *(arg + 1); /* just in case; we destroy arg in the switch */ switch (mode) { case 'l': half_chop(buf1, arg, buf); @@ -4617,18 +4638,16 @@ ACMD(do_wizupdate) /* NOTE: This is called from perform_set */ bool change_player_name(struct char_data *ch, struct char_data *vict, char *new_name) { - struct char_data *temp_ch=NULL; + struct char_data *temp_ch = NULL; int plr_i = 0, i, k; char old_name[MAX_NAME_LENGTH], old_pfile[50], new_pfile[50], buf[MAX_STRING_LENGTH]; - if (!ch) - { + if (!ch) { log("SYSERR: No char passed to change_player_name."); return FALSE; } - if (!vict) - { + if (!vict) { log("SYSERR: No victim passed to change_player_name."); send_to_char(ch, "Invalid victim.\r\n"); return FALSE; @@ -4636,7 +4655,7 @@ bool change_player_name(struct char_data *ch, struct char_data *vict, char *new_ if (!new_name || !(*new_name) || strlen(new_name) < 2 || strlen(new_name) > MAX_NAME_LENGTH || !valid_name(new_name) || - fill_word(new_name) || reserved_word(new_name) ) { + fill_word(new_name) || reserved_word(new_name)) { send_to_char(ch, "Invalid new name.\r\n"); return FALSE; } @@ -4645,7 +4664,7 @@ bool change_player_name(struct char_data *ch, struct char_data *vict, char *new_ if ((temp_ch = get_player_vis(ch, new_name, NULL, FIND_CHAR_WORLD)) != NULL) { send_to_char(ch, "Sorry, the new name already exists.\r\n"); return FALSE; - } else { + } else { /* try to load the player off disk */ CREATE(temp_ch, struct char_data, 1); clear_char(temp_ch); @@ -4663,8 +4682,7 @@ bool change_player_name(struct char_data *ch, struct char_data *vict, char *new_ if (player_table[i].id == GET_IDNUM(vict)) break; - if (player_table[i].id != GET_IDNUM(vict)) - { + if (player_table[i].id != GET_IDNUM(vict)) { send_to_char(ch, "Your target was not found in the player index.\r\n"); log("SYSERR: Player %s, with ID %ld, could not be found in the player index.", GET_NAME(vict), GET_IDNUM(vict)); return FALSE; @@ -4672,13 +4690,11 @@ bool change_player_name(struct char_data *ch, struct char_data *vict, char *new_ /* Set up a few variables that will be needed */ sprintf(old_name, "%s", GET_NAME(vict)); - if (!get_filename(old_pfile, sizeof(old_pfile), PLR_FILE, old_name)) - { + if (!get_filename(old_pfile, sizeof(old_pfile), PLR_FILE, old_name)) { send_to_char(ch, "Unable to ascertain player's old pfile name.\r\n"); return FALSE; } - if (!get_filename(new_pfile, sizeof(new_pfile), PLR_FILE, new_name)) - { + if (!get_filename(new_pfile, sizeof(new_pfile), PLR_FILE, new_name)) { send_to_char(ch, "Unable to ascertain player's new pfile name.\r\n"); return FALSE; } @@ -4686,10 +4702,10 @@ bool change_player_name(struct char_data *ch, struct char_data *vict, char *new_ /* Now start changing the name over - all checks and setup have passed */ free(player_table[i].name); // Free the old name in the index player_table[i].name = strdup(new_name); // Insert the new name into the index - for (k=0; (*(player_table[i].name+k) = LOWER(*(player_table[i].name+k))); k++); + for (k = 0; (*(player_table[i].name + k) = LOWER(*(player_table[i].name+k))); k++); free(GET_PC_NAME(vict)); - GET_PC_NAME(vict) = strdup(CAP(new_name)); // Change the name in the victims char struct + GET_PC_NAME(vict) = strdup(CAP(new_name)); // Change the name in the victims char struct /* Rename the player's pfile */ sprintf(buf, "mv %s %s", old_pfile, new_pfile); @@ -4699,9 +4715,10 @@ bool change_player_name(struct char_data *ch, struct char_data *vict, char *new_ mudlog(BRF, LVL_IMMORT, TRUE, "(GC) %s changed the name of %s to %s", GET_NAME(ch), old_name, new_name); - if (vict->desc) /* Descriptor is set if the victim is logged in */ - send_to_char(vict, "Your login name has changed from %s%s%s to %s%s%s.\r\n", CCYEL(vict, C_NRM), old_name, CCNRM(vict, C_NRM), - CCYEL(vict, C_NRM), new_name, CCNRM(vict, C_NRM)); + if (vict->desc) /* Descriptor is set if the victim is logged in */ + send_to_char(vict, "Your login name has changed from %s%s%s to %s%s%s.\r\n", CCYEL(vict, C_NRM), old_name, + CCNRM(vict, C_NRM), + CCYEL(vict, C_NRM), new_name, CCNRM(vict, C_NRM)); return TRUE; } @@ -4710,9 +4727,9 @@ ACMD(do_zlock) { zone_vnum znvnum; zone_rnum zn; - char arg[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH]; - int counter = 0; - bool fail = FALSE; + char arg[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH]; + int counter = 0; + bool fail = FALSE; two_arguments(argument, arg, arg2); @@ -4771,11 +4788,13 @@ ACMD(do_zlock) /* Show all locked zones */ for (zn = 0; zn <= top_of_zone_table; zn++) { if (ZONE_FLAGGED(zn, ZONE_NOBUILD)) { - if (!counter) send_to_char(ch, "Locked Zones\r\n"); + if (!counter) + send_to_char(ch, "Locked Zones\r\n"); send_to_char(ch, "[%s%3d%s] %s%-*s %s%-1s%s\r\n", - QGRN, zone_table[zn].number, QNRM, QCYN, count_color_chars(zone_table[zn].name)+30, zone_table[zn].name, - QYEL, zone_table[zn].builders ? zone_table[zn].builders : "None.", QNRM); + QGRN, zone_table[zn].number, QNRM, QCYN, count_color_chars(zone_table[zn].name) + 30, + zone_table[zn].name, + QYEL, zone_table[zn].builders ? zone_table[zn].builders : "None.", QNRM); counter++; } } @@ -4783,8 +4802,7 @@ ACMD(do_zlock) send_to_char(ch, "There are currently no locked zones!\r\n"); } return; - } - else if ((znvnum = atoi(arg)) == 0) { + } else if ((znvnum = atoi(arg)) == 0) { send_to_char(ch, "Usage: %szlock %s\r\n", QYEL, QNRM); return; } @@ -4808,9 +4826,7 @@ ACMD(do_zlock) SET_BIT_AR(ZONE_FLAGS(zn), ZONE_NOBUILD); if (save_zone(zn)) { mudlog(NRM, MAX(LVL_GRGOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s has locked zone %d", GET_NAME(ch), znvnum); - } - else - { + } else { send_to_char(ch, "Unable to save zone changes. Check syslog!\r\n"); } } @@ -4819,9 +4835,9 @@ ACMD(do_zunlock) { zone_vnum znvnum; zone_rnum zn; - char arg[MAX_INPUT_LENGTH]; - int counter = 0; - bool fail = FALSE; + char arg[MAX_INPUT_LENGTH]; + int counter = 0; + bool fail = FALSE; one_argument(argument, arg); @@ -4865,11 +4881,13 @@ ACMD(do_zunlock) /* Show all unlocked zones */ for (zn = 0; zn <= top_of_zone_table; zn++) { if (!ZONE_FLAGGED(zn, ZONE_NOBUILD)) { - if (!counter) send_to_char(ch, "Unlocked Zones\r\n"); + if (!counter) + send_to_char(ch, "Unlocked Zones\r\n"); send_to_char(ch, "[%s%3d%s] %s%-*s %s%-1s%s\r\n", - QGRN, zone_table[zn].number, QNRM, QCYN, count_color_chars(zone_table[zn].name)+30, zone_table[zn].name, - QYEL, zone_table[zn].builders ? zone_table[zn].builders : "None.", QNRM); + QGRN, zone_table[zn].number, QNRM, QCYN, count_color_chars(zone_table[zn].name) + 30, + zone_table[zn].name, + QYEL, zone_table[zn].builders ? zone_table[zn].builders : "None.", QNRM); counter++; } } @@ -4877,8 +4895,7 @@ ACMD(do_zunlock) send_to_char(ch, "There are currently no unlocked zones!\r\n"); } return; - } - else if ((znvnum = atoi(arg)) == 0) { + } else if ((znvnum = atoi(arg)) == 0) { send_to_char(ch, "Usage: %szunlock %s\r\n", QYEL, QNRM); return; } @@ -4902,9 +4919,7 @@ ACMD(do_zunlock) REMOVE_BIT_AR(ZONE_FLAGS(zn), ZONE_NOBUILD); if (save_zone(zn)) { mudlog(NRM, MAX(LVL_GRGOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s has unlocked zone %d", GET_NAME(ch), znvnum); - } - else - { + } else { send_to_char(ch, "Unable to save zone changes. Check syslog!\r\n"); } } @@ -4913,14 +4928,14 @@ ACMD(do_zunlock) static int get_max_recent(void) { struct recent_player *this; - int iRet=0; + int iRet = 0; this = recent_list; - while (this) - { - if (this->vnum > iRet) iRet = this->vnum; - this = this->next; + while (this) { + if (this->vnum > iRet) + iRet = this->vnum; + this = this->next; } return iRet; @@ -4959,13 +4974,14 @@ bool AddRecentPlayer(char *chname, char *chhost, bool newplr, bool cpyplr) int max_vnum; if (!chname || !*chname) // dropped connection with no name given - return FALSE; + return FALSE; - ct = time(0); /* Grab the current time */ + ct = time(0); /* Grab the current time */ this = create_recent(); - if (!this) return FALSE; + if (!this) + return FALSE; this->time = ct; this->new_player = newplr; @@ -4973,23 +4989,22 @@ bool AddRecentPlayer(char *chname, char *chhost, bool newplr, bool cpyplr) strcpy(this->host, chhost); strcpy(this->name, chname); max_vnum = get_max_recent(); - this->vnum = max_vnum; /* Possibly should be +1 ? */ + this->vnum = max_vnum; /* Possibly should be +1 ? */ return TRUE; } -void free_recent_players(void) +void free_recent_players(void) { struct recent_player *this; struct recent_player *temp; - + this = recent_list; - - while((temp = this) != NULL) - { - this = this->next; - free(temp); - } + + while ((temp = this) != NULL) { + this = this->next; + free(temp); + } } ACMD(do_recent) @@ -5007,38 +5022,38 @@ ACMD(do_recent) limit = atoi(arg); } - if (GET_LEVEL(ch) >= LVL_GRGOD) { /* If High-Level Imm, then show Host IP */ + if (GET_LEVEL(ch) >= LVL_GRGOD) { /* If High-Level Imm, then show Host IP */ send_to_char(ch, " ID | DATE/TIME | HOST IP | Player Name\r\n"); } else { send_to_char(ch, " ID | DATE/TIME | Player Name\r\n"); } this = recent_list; - while(this) - { + while (this) { loc = FALSE; hits++; ct = this->time; strftime(timestr, sizeof(timestr), "%a %b %d %H:%M:%S %Y", localtime(&ct)); if (*(this->host)) { - if (!strcmp(this->host, "localhost")) loc = TRUE; + if (!strcmp(this->host, "localhost")) + loc = TRUE; } - if ((limit == 0) || (count < limit)) - { - if (GET_LEVEL(ch) >= LVL_GRGOD) /* If High-Level Imm, then show Host IP */ + if ((limit == 0) || (count < limit)) { + if (GET_LEVEL(ch) >= LVL_GRGOD) /* If High-Level Imm, then show Host IP */ { if (this->new_player == TRUE) { - send_to_char(ch, "%3d | %-24.24s | %s%-32s%s | %s %s(New Player)%s\r\n", this->vnum, timestr, loc ? QRED : "", this->host, QNRM, this->name, QYEL, QNRM); + send_to_char(ch, "%3d | %-24.24s | %s%-32s%s | %s %s(New Player)%s\r\n", this->vnum, timestr, loc ? QRED : "", + this->host, QNRM, this->name, QYEL, QNRM); } else if (this->copyover_player == TRUE) { - send_to_char(ch, "%3d | %-24.24s | %s%-32s%s | %s %s(Copyover)%s\r\n", this->vnum, timestr, loc ? QRED : "", this->host, QNRM, this->name, QCYN, QNRM); + send_to_char(ch, "%3d | %-24.24s | %s%-32s%s | %s %s(Copyover)%s\r\n", this->vnum, timestr, loc ? QRED : "", + this->host, QNRM, this->name, QCYN, QNRM); } else { - send_to_char(ch, "%3d | %-24.24s | %s%-32s%s | %s\r\n", this->vnum, timestr, loc ? QRED : "", this->host, QNRM, this->name); + send_to_char(ch, "%3d | %-24.24s | %s%-32s%s | %s\r\n", this->vnum, timestr, loc ? QRED : "", this->host, + QNRM, this->name); } - } - else - { + } else { if (this->new_player == TRUE) { send_to_char(ch, "%3d | %-24.24s | %s %s(New Player)%s\r\n", this->vnum, timestr, this->name, QYEL, QNRM); } else if (this->copyover_player == TRUE) { @@ -5050,14 +5065,12 @@ ACMD(do_recent) count++; this = this->next; - } - else - { + } else { this = NULL; } } - ct = time(0); /* Grab the current time */ + ct = time(0); /* Grab the current time */ strftime(timestr, sizeof(timestr), "%c", localtime(&ct)); send_to_char(ch, "Current Server Time: %s\r\nShowing %d players since last copyover/reboot\r\n", timestr, hits); } @@ -5068,8 +5081,8 @@ ACMD(do_oset) char arg[MAX_INPUT_LENGTH]; char arg2[MAX_INPUT_LENGTH]; const char usage[] = "Usage: \r\n" - "Options: alias, apply, longdesc, shortdesc\r\n" - "> oset