diff --git a/changelog b/changelog index c85e4d8..21eb733 100644 --- a/changelog +++ b/changelog @@ -35,93 +35,13 @@ export (QQ's a zone into a tarball) Xlist (mlist, olist, rlist, zlist, slist, tlist, qlist) (lots of major bugfixes too) @ -[Jan 30 2012] - Rumble - Fixed redit/zedit menu bug. -[Aug 25 2011] - Rumble - Comment fixes, clarification, and warning cleanup. (thanks Kyle) -[Sep 11 2011] - Fizban - Added MXP, MSP, MSSP, MSDP, ATCP, CHARSET, NAWS, TTYPE, 256-color protocols. (Thanks KaVir) -[Aug 18 2011] - Fizban - Added hitroll and damroll fields to DG Scripts. Also made them editable via scripts. - Made do_stat_character show scripts attached to players. -[Mar 31 2011] - Rumble - Fixed several typos and formatting issues. (Thanks Kyle) - Added check to prevent immortals from getting poisoned. - Fixed crash bug on advance. - Added output to helpcheck command instead of an empty return. - Fixed do_levels max/min level confusion. - Fixed do_score which was showing gold as exp. (Thanks Rhade) - Added free_olc_ibt. - Added CONFIG_IBT_AUTOSAVE. - Fixed bug when casting invis on objects. - Added mudmail.pdf instructions to /doc. -[Dec 16 2010] - Jamdog - Bug-Fix: Fixed illegal mob flag bug where medit set wrong flag -[Dec 10 2010] - Jamdog - Minor bug fixes, added MAIL flag names and fixed compile warnings - Bug Fix: Alignment in medit now saves when it's the only thing edited (thanks cosine_omerta) - Added ZONE_WORLDMAP flag to set a whole zone to worldmap style maps -[Dec 08 2010] - Jamdog - Added olist - page_string now uses player's screen width and correctly parses ANSI color codes -[Dec 07 2010] - Jamdog - Fixed erroneous SYSERR report and incorrect contant in new house system (thanks Vatiken) - Buildwalk now allows builder to specify default sector type (thanks Mirad) - Added happyhour script variables (thanks Kam) - Added affects list and type list to olist command -[Dec 06 2010] - Jamdog - Added new mail system, with inbox OLC, index rebuilder and first mail (to ID 1) - Bug-Fix: levels command wasn't showing max level, or validating high/low levels - score now shows stats for the mobile (same as 'stat ') -[Dec 05 2010] - Jamdog - Bug-Fix: 'Did you mean' now only shows commands you have access to (thanks Welcor) - Bug-Fix: Fixed crash bug introduced by new house system when saving house contents - Scan command now tells you when nothing is nearby (thanks Mirad) - zlist command can now list by builder, like show zones - zlist command now uses page_string (thanks Mirad) - areas command now uses page_string (thanks Mirad) -[Dec 02 2010] - Jamdog - Bug-Fix: identify command in shops was listing incorrect buy price (thanks Kam) - Added %actor.admlevel% and %actor.admlevel()% to dg-scripts - Earthquake spell now misses flying people -[Dec 01 2010] - Jamdog - Fixed do_cheat so that only ID 1 can get a full restoration - Added zone checks for load/purge commands below admin level 3 (GrGod) -[Nov 30 2010] - Jamdog - Bug-Fix: Fixed incorrect rnum showing on stat room (Thanks Kam) - Added hsedit House Editor OLC -[Nov 28 2010] - Jamdog - Converted houses (lib/etc/hcontrol file) to ASCII file format - Added hcontrol file converter (hstoascii.c) to src/utils folder - Converted houses to work as linked lists, not wasteful fixed-size arrays - Added GOD houses and player-owned shops as house types - Added 'receptionist' and 'player-shopkeeper' type spec-procs for houses -[Nov 26 2010] - Jamdog - Bug-Fix: set level now allows GRGOD or higher to set to any mortal level - Advance command changed to work for both mortal and admin levels - Added increase_gold and increase_bank functions to prevent cash overflows - Added dupe check for new characters in char creation (thanks Mirad) - Bug-Fix: Since admin update, real mortals didn't show on who list (thanks Rhade) -[Nov 25 2010] - Jamdog - Added diagonal directions with cedit toggle (default to 'off') - Bug-Fix: admin default now targets the victim player - Bug-Fix: Crash bug developed due to no 'vict' in is_tell_ok, added checks - Added HIDDEN flag for doors, hiding from exits, autoexits, scan and map - Admins now show admin level instead of class on who list -[Nov 24 2010] - Jamdog - Split mortal and admin levels (thanks fnord for original patch/idea) - Mortal level converted to ubyte for 255 max - Max mortal level now configurable in cedit - Level on help files now indicates admin level - Added 'set admlevel ' - Added admin command for imms - Added mortal command, and modified return command to work for everyone - Added admin level to player index (for autowiz) - Added mortal flag to player index (for autowiz) - Autowiz converted to work with new admin levels - Socials are now admin-level dependant - Added imm ability to 'score ' - Minor Bug Fix: Cured problem where Imps didn't regain default flags when using 'return' +[Feb 04 2012] - Vatiken + Feature: Added 'Experience' and 'Thaco' to the do_show() command. + Bug Fix: Nipped a bug where shopkeepers weren't sending tells. + Visuals: Fixed a small glitch in redit where things weren't lining up right with extra dirs activated. + Made olist, mlist, and rlist, page_string() compatible. + Bug Fix: Editing extra directions is now doable from redit. + MAJOR: Reverted back to 3.62 Revision 241, followed up by backporting bug fixes and some of the positive changes implemented by Jamdog. Not coming along for the ride currently are the new mail system, housing system and the admin level system. [Nov 06 2010] - Jamdog Added HappyHour feature Added game_info function for sending global messages to all players diff --git a/src/act.comm.c b/src/act.comm.c index 4303193..e4c8d9a 100644 --- a/src/act.comm.c +++ b/src/act.comm.c @@ -81,7 +81,7 @@ ACMD(do_gsay) for (f = k->followers; f; f = f->next) if (AFF_FLAGGED(f->follower, AFF_GROUP) && (f->follower != ch)) act(buf, FALSE, ch, 0, f->follower, TO_VICT | TO_SLEEP); - + if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT)) send_to_char(ch, "%s", CONFIG_OK); else @@ -101,7 +101,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); } @@ -119,13 +119,13 @@ static int is_tell_ok(struct char_data *ch, struct char_data *vict) send_to_char(ch, "You try to tell yourself something.\r\n"); else if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOTELL)) 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) && !(IS_ADMIN(ch, ADMLVL_GOD))) + 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 */ 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) && !(IS_ADMIN(ch, ADMLVL_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); @@ -138,7 +138,6 @@ static int is_tell_ok(struct char_data *ch, struct char_data *vict) ACMD(do_tell) { struct char_data *vict = NULL; - struct descriptor_data *d = NULL; char buf[MAX_INPUT_LENGTH], buf2[MAX_INPUT_LENGTH]; half_chop(argument, buf, buf2); @@ -179,22 +178,11 @@ ACMD(do_tell) last_webster_teller = GET_IDNUM(ch); send_to_char(ch, "You look up '%s' in Merriam-Webster.\r\n", word); #endif /* platform specific part */ - } - else if (is_abbrev(buf, "all") && ADM_FLAGGED(ch, ADM_TELLALL)) { - for (d = descriptor_list; d; d = d->next) { - if (!(vict = d->character)) - continue; - if (vict == ch || STATE(d) != CON_PLAYING) - continue; - perform_tell(ch, vict, buf2); - } - } - else if (IS_ADMIN(ch, ADMLVL_IMMORT) && !(vict = get_player_vis(ch, buf, NULL, FIND_CHAR_WORLD))) { - if (!(vict = get_char_vis(ch, buf, NULL, FIND_CHAR_WORLD))) - send_to_char(ch, "%s", CONFIG_NOPERSON); - else if (is_tell_ok(ch, vict)) - perform_tell(ch, vict, buf2); - } else if (is_tell_ok(ch, vict)) + } else if (GET_LEVEL(ch) < LVL_IMMORT && !(vict = get_player_vis(ch, buf, NULL, FIND_CHAR_WORLD))) + send_to_char(ch, "%s", CONFIG_NOPERSON); + else if (GET_LEVEL(ch) >= LVL_IMMORT && !(vict = get_char_vis(ch, buf, NULL, FIND_CHAR_WORLD))) + send_to_char(ch, "%s", CONFIG_NOPERSON); + else if (is_tell_ok(ch, vict)) perform_tell(ch, vict, buf2); } @@ -215,8 +203,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; @@ -268,7 +256,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); @@ -372,20 +360,20 @@ ACMD(do_page) snprintf(buf, sizeof(buf), "\007\007*$n* %s", buf2); if (!str_cmp(arg, "all")) { - if (ADM_FLAGGED(ch, ADM_TELLALL)) { - for (d = descriptor_list; d; d = d->next) - if (STATE(d) == CON_PLAYING && d->character) - act(buf, FALSE, ch, 0, d->character, TO_VICT); + 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); } 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"); } @@ -458,7 +446,7 @@ ACMD(do_gen_comm) send_to_char(ch, "%s", com_msgs[subcmd][0]); return; } - if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_SOUNDPROOF) && !(IS_ADMIN(ch, ADMLVL_GOD))) { + 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"); return; } @@ -507,7 +495,7 @@ ACMD(do_gen_comm) else { 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)); - + msg = act(buf1, FALSE, ch, 0, 0, TO_CHAR | TO_SLEEP); add_history(ch, msg, hist_type[subcmd]); } @@ -521,14 +509,14 @@ ACMD(do_gen_comm) if (!IS_NPC(ch) && (PRF_FLAGGED(i->character, channels[subcmd]) || PLR_FLAGGED(i->character, PLR_WRITING))) continue; - if (ROOM_FLAGGED(IN_ROOM(i->character), ROOM_SOUNDPROOF) && !(IS_ADMIN(ch, ADMLVL_GOD))) + if (ROOM_FLAGGED(IN_ROOM(i->character), ROOM_SOUNDPROOF) && (GET_LEVEL(ch) < LVL_GOD)) continue; if (subcmd == SCMD_SHOUT && ((world[IN_ROOM(ch)].zone != world[IN_ROOM(i->character)].zone) || !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]); } @@ -560,7 +548,7 @@ ACMD(do_qcomm) snprintf(buf, sizeof(buf), "$n quest-says, '%s'", argument); else { strlcpy(buf, argument, sizeof(buf)); - mudlog(CMP, MAX(ADMLVL_BUILDER, GET_INVIS_LEV(ch)), TRUE, "(GC) %s qechoed: %s", GET_NAME(ch), argument); + mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE, "(GC) %s qechoed: %s", GET_NAME(ch), argument); } for (i = descriptor_list; i; i = i->next) if (STATE(i) == CON_PLAYING && i != ch->desc && PRF_FLAGGED(i->character, PRF_QUEST)) diff --git a/src/act.h b/src/act.h index c856b4f..c60a2dc 100644 --- a/src/act.h +++ b/src/act.h @@ -51,21 +51,12 @@ ACMD(do_write); * Begin Functions and defines for act.informative.c ****************************************************************************/ /* Utility Functions */ -/* do_look, do_inventory utility functions */ -void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mode); -void list_obj_to_char(struct obj_data *list, struct char_data *ch, int mode, int show); /** @todo Move to a utility library */ char *find_exdesc(char *word, struct extra_descr_data *list); /** @todo Move to a mud centric string utility library */ void space_to_minus(char *str); /** @todo Move to a help module? */ int search_help(const char *argument, int level); - -/* Used by show_obj_to_char */ -#define SHOW_OBJ_LONG 0 -#define SHOW_OBJ_SHORT 1 -#define SHOW_OBJ_ACTION 2 - /* functions with subcommands */ /* do_commands */ ACMD(do_commands); @@ -290,9 +281,6 @@ void perform_immort_vis(struct char_data *ch); void snoop_check(struct char_data *ch); bool change_player_name(struct char_data *ch, struct char_data *vict, char *new_name); bool AddRecentPlayer(char *chname, char *chhost, bool newplr, bool cpyplr); -void set_default_admin_privs(struct char_data *ch, bool keep_old); -int get_admin_level_by_string(char *lv); -void do_stat_character(struct char_data *ch, struct char_data *k); /* Functions with subcommands */ /* do_date */ ACMD(do_date); @@ -319,7 +307,6 @@ ACMD(do_wizutil); #define SCMD_THAW 5 #define SCMD_UNAFFECT 6 /* Functions without subcommands */ -ACMD(do_admin); ACMD(do_advance); ACMD(do_at); ACMD(do_checkloadstatus); @@ -333,7 +320,6 @@ ACMD(do_goto); ACMD(do_invis); ACMD(do_links); ACMD(do_load); -ACMD(do_mortal); ACMD(do_peace); ACMD(do_plist); ACMD(do_purge); diff --git a/src/act.informative.c b/src/act.informative.c index 420969d..b59c566 100644 --- a/src/act.informative.c +++ b/src/act.informative.c @@ -38,14 +38,23 @@ static void look_at_char(struct char_data *i, struct char_data *ch); static void look_at_target(struct char_data *ch, char *arg); static void look_in_direction(struct char_data *ch, int dir); static void look_in_obj(struct char_data *ch, char *arg); +/* do_look, do_inventory utility functions */ +static void list_obj_to_char(struct obj_data *list, struct char_data *ch, int mode, int show); /* do_look, do_equipment, do_examine, do_inventory */ +static void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mode); static void show_obj_modifiers(struct obj_data *obj, struct char_data *ch); /* do_where utility functions */ static void perform_immort_where(struct char_data *ch, char *arg); 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); -void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mode) +/* Subcommands */ +/* For show_obj_to_char 'mode'. /-- arbitrary */ +#define SHOW_OBJ_LONG 0 +#define SHOW_OBJ_SHORT 1 +#define SHOW_OBJ_ACTION 2 + +static void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mode) { int found = 0; struct char_data *temp; @@ -115,7 +124,7 @@ void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mode) 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: @@ -161,7 +170,7 @@ static void show_obj_modifiers(struct obj_data *obj, struct char_data *ch) send_to_char(ch, " ..It emits a faint humming sound!"); } -void list_obj_to_char(struct obj_data *list, struct char_data *ch, int mode, int show) +static void list_obj_to_char(struct obj_data *list, struct char_data *ch, int mode, int show) { struct obj_data *i, *j, *display; bool found; @@ -193,9 +202,9 @@ void list_obj_to_char(struct obj_data *list, struct char_data *ch, int mode, int display = j; } - /* When looking in room, hide objects starting with '.', except for holylight and seesecret */ + /* 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)) || (ADM_FLAGGED(ch, ADM_SEESECRET)))) { + (!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) @@ -263,11 +272,11 @@ static void look_at_char(struct char_data *i, struct char_data *ch) 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))) { - send_to_char(ch, "%s", wear_where[j]); - show_obj_to_char(GET_EQ(i, j), ch, SHOW_OBJ_SHORT); + send_to_char(ch, "%s", wear_where[j]); + show_obj_to_char(GET_EQ(i, j), ch, SHOW_OBJ_SHORT); } } - if (ch != i && (IS_THIEF(ch) || (ADM_FLAGGED(ch, ADM_SEEINV)))) { + if (ch != i && (IS_THIEF(ch) || GET_LEVEL(ch) >= LVL_IMMORT)) { act("\r\nYou attempt to peek at $s inventory:", FALSE, i, 0, ch, TO_VICT); list_obj_to_char(i->carrying, ch, SHOW_OBJ_SHORT, TRUE); } @@ -313,7 +322,7 @@ static void list_one_char(struct char_data *i, struct char_data *ch) if (AFF_FLAGGED(i, AFF_SANCTUARY)) act("...$e glows with a bright light!", FALSE, i, 0, ch, TO_VICT); - if (AFF_FLAGGED(i, AFF_BLIND) && !IS_ADMIN(i, ADMLVL_IMMORT)) + if (AFF_FLAGGED(i, AFF_BLIND) && GET_LEVEL(i) < LVL_IMMORT) act("...$e is groping around blindly!", FALSE, i, 0, ch, TO_VICT); return; @@ -340,22 +349,22 @@ 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)]); - else { - furniture = SITTING(i); - send_to_char(ch, " is %s upon %s.", (GET_POS(i) == POS_SLEEPING ? + 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)); - } + } } else { if (FIGHTING(i)) { send_to_char(ch, " is here, fighting "); if (FIGHTING(i) == ch) - send_to_char(ch, "YOU!"); + send_to_char(ch, "YOU!"); else { - 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!"); + 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!"); } } else /* NIL fighting pointer */ send_to_char(ch, " is here struggling with thin air."); @@ -380,7 +389,7 @@ static void list_char_to_char(struct char_data *list, struct char_data *ch) for (i = list; i; i = i->next_in_room) if (ch != i) { /* hide npcs whose description starts with a '.' from non-holylighted people - Idea from Elaseth of TBA */ - if (!IS_NPC(ch) && !ADM_FLAGGED(ch, ADM_SEESECRET) && + if (!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_HOLYLIGHT) && IS_NPC(i) && i->player.long_descr && *i->player.long_descr == '.') continue; send_to_char(ch, "%s", CCYEL(ch, C_NRM)); @@ -404,13 +413,12 @@ static void do_auto_exits(struct char_data *ch) continue; if (EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) && !CONFIG_DISP_CLOSED_DOORS) continue; - if (EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) && !ADM_FLAGGED(ch, ADM_SEESECRET)) - continue; - + 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)); - 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)); + 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 send_to_char(ch, "%s ", autoexits[door]); slen++; @@ -423,7 +431,7 @@ ACMD(do_exits) { int door, len = 0; - if (AFF_FLAGGED(ch, AFF_BLIND) && !IS_ADMIN(ch, ADMLVL_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; } @@ -435,8 +443,8 @@ ACMD(do_exits) continue; if (EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) && !CONFIG_DISP_CLOSED_DOORS) continue; - if (EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) && !ADM_FLAGGED(ch, ADM_SEESECRET)) - continue; + if (EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) && !PRF_FLAGGED(ch, PRF_HOLYLIGHT)) + continue; len++; @@ -446,8 +454,8 @@ ACMD(do_exits) 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." : "."); + (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) && @@ -472,7 +480,7 @@ void look_at_room(struct char_data *ch, int ignore_brief) 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) && !IS_ADMIN(ch, ADMLVL_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; } @@ -498,12 +506,14 @@ void look_at_room(struct char_data *ch, int ignore_brief) if ((!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_BRIEF)) || ignore_brief || 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); - } + 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); + } } /* autoexits */ @@ -544,44 +554,46 @@ static void look_in_obj(struct char_data *ch, char *arg) 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_CONTAINER)) send_to_char(ch, "There's nothing inside that!\r\n"); - } else { + else { if (GET_OBJ_TYPE(obj) == ITEM_CONTAINER) { - if (OBJVAL_FLAGGED(obj, CONT_CLOSED) && (!IS_ADMIN(ch, ADMLVL_IMMORT) || !PRF_FLAGGED(ch, PRF_NOHASSLE))) { - send_to_char(ch, "It is closed.\r\n"); - } else { - send_to_char(ch, "%s", fname(obj->name)); - switch (bits) { - case FIND_OBJ_INV: - send_to_char(ch, " (carried): \r\n"); - break; - case FIND_OBJ_ROOM: - send_to_char(ch, " (here): \r\n"); - break; - case FIND_OBJ_EQUIP: - send_to_char(ch, " (used): \r\n"); - break; - } - list_obj_to_char(obj->contains, ch, SHOW_OBJ_SHORT, TRUE); + if (OBJVAL_FLAGGED(obj, CONT_CLOSED) && (GET_LEVEL(ch) < LVL_IMMORT || !PRF_FLAGGED(ch, PRF_NOHASSLE))) + send_to_char(ch, "It is closed.\r\n"); + else { + send_to_char(ch, "%s", fname(obj->name)); + switch (bits) { + case FIND_OBJ_INV: + send_to_char(ch, " (carried): \r\n"); + break; + case FIND_OBJ_ROOM: + send_to_char(ch, " (here): \r\n"); + break; + case FIND_OBJ_EQUIP: + send_to_char(ch, " (used): \r\n"); + break; + } + + list_obj_to_char(obj->contains, ch, SHOW_OBJ_SHORT, TRUE); } } 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"); + send_to_char(ch, "It is empty.\r\n"); else { 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)) { - send_to_char(ch, "Its contents seem somewhat murky.\r\n"); /* BUG */ - } 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)); - send_to_char(ch, "It's %sfull of a %s liquid.\r\n", fullness[amt], buf2); } + 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 { + 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)); + send_to_char(ch, "It's %sfull of a %s liquid.\r\n", fullness[amt], buf2); + } } } } @@ -625,7 +637,7 @@ static void look_at_target(struct char_data *ch, char *arg) 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; @@ -644,46 +656,40 @@ static void look_at_target(struct char_data *ch, char *arg) } /* Does the argument match an extra desc in the char's equipment? */ - for (j = 0; j < NUM_WEARS && !found; j++) { - if (GET_EQ(ch, j) && CAN_SEE_OBJ(ch, GET_EQ(ch, j))) { + 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 (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; } - } } /* Does the argument match an extra desc of an object in the room? */ - for (obj = world[IN_ROOM(ch)].contents; obj && !found; obj = obj->next_content) { - if (CAN_SEE_OBJ(ch, obj)) { + 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 */ if (bits) { - if (!found) { + if (!found) show_obj_to_char(found_obj, ch, SHOW_OBJ_ACTION); - } else { + else { show_obj_modifiers(found_obj, ch); send_to_char(ch, "\r\n"); } - } else if (!found) { + } else if (!found) send_to_char(ch, "You do not see that here.\r\n"); - } } ACMD(do_look) @@ -696,7 +702,7 @@ ACMD(do_look) if (GET_POS(ch) < POS_SLEEPING) send_to_char(ch, "You can't see anything but stars!\r\n"); - else if (AFF_FLAGGED(ch, AFF_BLIND) && !IS_ADMIN(ch, ADMLVL_IMMORT)) + else 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"); else if (IS_DARK(IN_ROOM(ch)) && !CAN_SEE_IN_DARK(ch)) { send_to_char(ch, "It is pitch black...\r\n"); @@ -780,79 +786,52 @@ ACMD(do_gold) ACMD(do_score) { - int i,j,admin; - char arg[MAX_INPUT_LENGTH]; - struct char_data *vict; struct time_info_data playing_time; - char gold_str[50], exp_str[50]; if (IS_NPC(ch)) return; - vict = ch; /* Default is 'self' */ + send_to_char(ch, "You are %d years old.", GET_AGE(ch)); - /* Admins can type score to see someone elses score */ - if(IS_ADMIN(ch, ADMLVL_GOD)) { - one_argument(argument, arg); - if ((arg != NULL) && *arg) { - if (!(vict = get_char_vis(ch, arg, NULL, FIND_CHAR_WORLD))) { - send_to_char(ch, "%s", CONFIG_NOPERSON); - return; - } - } - } - - if (IS_NPC(vict)) { - send_to_char(ch, "Stats for: %s\r\n", GET_NAME(vict)); - do_stat_character(ch, vict); - return; - } - if (ch != vict) - send_to_char(ch, "Score for: %s %s (level %d)\r\n", GET_NAME(vict), GET_TITLE(vict), GET_LEVEL(vict)); - - send_to_char(ch, "You are %d years old.", GET_AGE(vict)); - - if (age(vict)->month == 0 && age(vict)->day == 0) + if (age(ch)->month == 0 && age(ch)->day == 0) send_to_char(ch, " It's your birthday today.\r\n"); else 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(vict), GET_MAX_HIT(vict), GET_MANA(vict), GET_MAX_MANA(vict), - GET_MOVE(vict), GET_MAX_MOVE(vict)); + 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(vict), GET_ALIGNMENT(vict)); + compute_armor_class(ch), GET_ALIGNMENT(ch)); - strcpy(gold_str, add_commas(GET_GOLD(vict))); - strcpy(exp_str, add_commas(GET_EXP(vict))); - send_to_char(ch, "You have %s exp, %s gold coin%s, and %d questpoints.\r\n", - exp_str, gold_str, (GET_GOLD(vict) == 1 ? "" : "s"), GET_QUESTPOINTS(vict)); + 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)); - if (GET_LEVEL(vict) < CONFIG_MAX_LEVEL) + if (GET_LEVEL(ch) < 30) send_to_char(ch, "You need %d exp to reach your next level.\r\n", - level_exp(GET_CLASS(vict), GET_LEVEL(vict) + 1) - GET_EXP(vict)); + 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(vict)); + 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(vict), - GET_NUM_QUESTS(vict) == 1 ? "" : "s"); - if (GET_QUEST(vict) == NOTHING) + 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 send_to_char(ch, "and your current quest is %d.\r\n", - GET_QUEST(vict) == NOTHING ? -1 : GET_QUEST(vict)); + GET_QUEST(ch) == NOTHING ? -1 : GET_QUEST(ch)); - playing_time = *real_time_passed((time(0) - vict->player.time.logon) + - vict->player.time.played, 0); + playing_time = *real_time_passed((time(0) - ch->player.time.logon) + + 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"); send_to_char(ch, "This ranks you as %s %s (level %d).\r\n", - GET_NAME(vict), GET_TITLE(vict), GET_LEVEL(vict)); + GET_NAME(ch), GET_TITLE(ch), GET_LEVEL(ch)); - switch (GET_POS(vict)) { + switch (GET_POS(ch)) { case POS_DEAD: send_to_char(ch, "You are DEAD!\r\n"); break; @@ -872,15 +851,15 @@ ACMD(do_score) send_to_char(ch, "You are resting.\r\n"); break; case POS_SITTING: - if (!SITTING(vict)) + if (!SITTING(ch)) send_to_char(ch, "You are sitting.\r\n"); else { - struct obj_data *furniture = SITTING(vict); + struct obj_data *furniture = SITTING(ch); send_to_char(ch, "You are sitting upon %s.\r\n", furniture->short_description); } break; case POS_FIGHTING: - send_to_char(ch, "You are fighting %s.\r\n", FIGHTING(vict) ? PERS(FIGHTING(vict), vict) : "thin air"); + send_to_char(ch, "You are fighting %s.\r\n", FIGHTING(ch) ? PERS(FIGHTING(ch), ch) : "thin air"); break; case POS_STANDING: send_to_char(ch, "You are standing.\r\n"); @@ -890,72 +869,56 @@ ACMD(do_score) break; } - if (GET_COND(vict, DRUNK) > 10) + if (GET_COND(ch, DRUNK) > 10) send_to_char(ch, "You are intoxicated.\r\n"); - if (GET_COND(vict, HUNGER) == 0) + if (GET_COND(ch, HUNGER) == 0) send_to_char(ch, "You are hungry.\r\n"); - if (GET_COND(vict, THIRST) == 0) + if (GET_COND(ch, THIRST) == 0) send_to_char(ch, "You are thirsty.\r\n"); - if (AFF_FLAGGED(vict, AFF_BLIND) && !IS_ADMIN(vict, ADMLVL_IMMORT)) + if (AFF_FLAGGED(ch, AFF_BLIND) && GET_LEVEL(ch) < LVL_IMMORT) send_to_char(ch, "You have been blinded!\r\n"); - if (AFF_FLAGGED(vict, AFF_INVISIBLE)) + if (AFF_FLAGGED(ch, AFF_INVISIBLE)) send_to_char(ch, "You are invisible.\r\n"); - if (AFF_FLAGGED(vict, AFF_DETECT_INVIS)) + if (AFF_FLAGGED(ch, AFF_DETECT_INVIS)) send_to_char(ch, "You are sensitive to the presence of invisible things.\r\n"); - if (AFF_FLAGGED(vict, AFF_SANCTUARY)) + if (AFF_FLAGGED(ch, AFF_SANCTUARY)) send_to_char(ch, "You are protected by Sanctuary.\r\n"); - if (AFF_FLAGGED(vict, AFF_POISON)) + if (AFF_FLAGGED(ch, AFF_POISON)) send_to_char(ch, "You are poisoned!\r\n"); - if (AFF_FLAGGED(vict, AFF_CHARM)) + if (AFF_FLAGGED(ch, AFF_CHARM)) send_to_char(ch, "You have been charmed!\r\n"); - if (affected_by_spell(vict, SPELL_ARMOR)) + if (affected_by_spell(ch, SPELL_ARMOR)) send_to_char(ch, "You feel protected.\r\n"); - if (AFF_FLAGGED(vict, AFF_INFRAVISION)) + if (AFF_FLAGGED(ch, AFF_INFRAVISION)) send_to_char(ch, "Your eyes are glowing red.\r\n"); - if (PRF_FLAGGED(vict, PRF_SUMMONABLE)) + if (PRF_FLAGGED(ch, PRF_SUMMONABLE)) send_to_char(ch, "You are summonable by other players.\r\n"); - if (ADM_FLAGGED(vict, ADM_POOF)) { + if (GET_LEVEL(ch) >= LVL_IMMORT) { if (POOFIN(ch)) - send_to_char(ch, "%sPOOFIN: %s%s %s%s\r\n", QYEL, QCYN, GET_NAME(vict), POOFIN(vict), QNRM); + send_to_char(ch, "%sPOOFIN: %s%s %s%s\r\n", QYEL, QCYN, GET_NAME(ch), POOFIN(ch), QNRM); else - send_to_char(ch, "%sPOOFIN: %s%s appears with an ear-splitting bang.%s\r\n", QYEL, QCYN, GET_NAME(vict), QNRM); + send_to_char(ch, "%sPOOFIN: %s%s appears with an ear-splitting bang.%s\r\n", QYEL, QCYN, GET_NAME(ch), QNRM); if (POOFOUT(ch)) - send_to_char(ch, "%sPOOFOUT: %s%s %s%s\r\n", QYEL, QCYN, GET_NAME(vict), POOFOUT(vict), QNRM); + send_to_char(ch, "%sPOOFOUT: %s%s %s%s\r\n", QYEL, QCYN, GET_NAME(ch), POOFOUT(ch), QNRM); else - send_to_char(ch, "%sPOOFOUT: %s%s disappears in a puff of smoke.%s\r\n", QYEL, QCYN, GET_NAME(vict), QNRM); - } - if (ADM_FLAGGED(vict, ADM_BUILD)) { - send_to_char(ch, "Your current zone: %s%d%s\r\n", QCYN, GET_OLC_ZONE(vict), QNRM); - } + send_to_char(ch, "%sPOOFOUT: %s%s disappears in a puff of smoke.%s\r\n", QYEL, QCYN, GET_NAME(ch), QNRM); - admin = 0; - for (i=0; i < NUM_ADMFLAGS; i++) - if (ADM_FLAGGED(vict, i)) - admin++; - - if (admin > 0) { - send_to_char(ch, "Admin Level: %d (%s)\r\n", GET_ADMLEVEL(vict), admin_level_names[(GET_ADMLEVEL(vict))]); - send_to_char(ch, "You possess the following administrative abilities:\r\n"); - for (i=0,j=0; i < NUM_ADMFLAGS; i++) { - if (ADM_FLAGGED(vict, i)) - send_to_char(ch, "%s%-40.40s%s%s", QYEL, admin_flags[i], (!(++j % 2)) ? "\r\n" : "", QNRM); - } - send_to_char(ch, "\r\n"); + send_to_char(ch, "Your current zone: %s%d%s\r\n", CCCYN(ch, C_NRM), GET_OLC_ZONE(ch), + CCNRM(ch, C_NRM)); } - } ACMD(do_inventory) @@ -1038,7 +1001,7 @@ ACMD(do_weather) 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"); - if (ADM_FLAGGED(ch, ADM_KNOWWEATHER)) + 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, @@ -1074,7 +1037,7 @@ int search_help(const char *argument, int level) while (level < help_table[mid].min_level && mid < (bot + top) / 2) mid++; -// if (strn_cmp(argument, help_table[mid].keywords, minlen) || level < help_table[mid].min_level) +// if (strn_cmp(argument, help_table[mid].keywords, minlen) || level < help_table[mid].min_level) if (strn_cmp(argument, help_table[mid].keywords, minlen)) break; @@ -1104,7 +1067,7 @@ ACMD(do_help) } if (!*argument) { - if (!IS_ADMIN(ch, ADMLVL_IMMORT)) + if (GET_LEVEL(ch) < LVL_IMMORT) page_string(ch->desc, help, 0); else page_string(ch->desc, ihelp, 0); @@ -1113,12 +1076,12 @@ ACMD(do_help) space_to_minus(argument); - if ((mid = search_help(argument, GET_ADMLEVEL(ch))) == NOWHERE) { + if ((mid = search_help(argument, GET_LEVEL(ch))) == NOWHERE) { send_to_char(ch, "There is no help on that word.\r\n"); - mudlog(NRM, MAX(ADMLVL_IMPL, GET_INVIS_LEV(ch)), TRUE, + mudlog(NRM, MAX(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++) { - if (help_table[i].min_level > GET_ADMLEVEL(ch)) + 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. */ if (*argument != *help_table[i].keywords) @@ -1145,9 +1108,9 @@ ACMD(do_who) struct descriptor_data *d; struct char_data *tch; int i, num_can_see = 0; - char name_search[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH], admlev[15]; + char name_search[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH]; char mode; - int low = 0, high = CONFIG_MAX_LEVEL, localwho = 0, questwho = 0; + int low = 0, high = LVL_IMPL, localwho = 0, questwho = 0; int showclass = 0, short_list = 0, outlaws = 0; int who_room = 0, showgroup = 0, showleader = 0; @@ -1157,8 +1120,8 @@ ACMD(do_who) int max_level; int count; /* must always start as 0 */ } rank[] = { - { "Immortals\r\n---------\r\n", ADMLVL_IMMORT, ADMLVL_IMPL, 0}, - { "Mortals\r\n-------\r\n", 0, ADMLVL_MORTAL, 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 } }; @@ -1248,13 +1211,8 @@ ACMD(do_who) if (showleader && (!tch->followers || !AFF_FLAGGED(tch, AFF_GROUP))) continue; for (i = 0; *rank[i].disp != '\n'; i++) - if (GET_ADMLEVEL(tch) >= rank[i].min_level && GET_ADMLEVEL(tch) <= rank[i].max_level) { - if (rank[i].min_level >= ADMLVL_IMMORT && !PRF_FLAGGED(tch, PRF_MORTAL)) - rank[i].count++; /* Add 'real' admins */ - else if (rank[i].max_level < ADMLVL_IMMORT) - rank[i].count++; /* Add 'real' mortals */ - } else if (rank[i].max_level < ADMLVL_IMMORT && PRF_FLAGGED(tch, PRF_MORTAL)) - rank[i].count++; /* Add 'fake' mortals */ + if (GET_LEVEL(tch) >= rank[i].min_level && GET_LEVEL(tch) <= rank[i].max_level) + rank[i].count++; } } @@ -1273,13 +1231,8 @@ ACMD(do_who) else if (!(tch = d->character)) continue; - if (PRF_FLAGGED(tch, PRF_MORTAL)) { - if (rank[i].min_level >= ADMLVL_IMMORT) - continue; - } else { - if ((GET_ADMLEVEL(tch) < rank[i].min_level || GET_ADMLEVEL(tch) > rank[i].max_level) && !short_list) - continue; - } + if ((GET_LEVEL(tch) < rank[i].min_level || GET_LEVEL(tch) > rank[i].max_level) && !short_list) + continue; if (!IS_PLAYING(d)) continue; if (*name_search && str_cmp(GET_NAME(tch), name_search) && @@ -1302,20 +1255,16 @@ ACMD(do_who) if (showleader && (!tch->followers || !AFF_FLAGGED(tch, AFF_GROUP))) continue; - sprintf(admlev, "%-11s", admin_level_names[(GET_ADMLEVEL(tch))]); if (short_list) { send_to_char(ch, "%s[%2d %s] %-12.12s%s%s", - (IS_ADMIN(tch, ADMLVL_IMMORT) ? CCYEL(ch, C_SPR) : ""), - GET_LEVEL(tch), - (IS_ADMIN(tch, ADMLVL_IMMORT) ? admlev : CLASS_ABBR(tch)), - GET_NAME(tch), + (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", - (IS_ADMIN(tch, ADMLVL_IMMORT) ? CCYEL(ch, C_SPR) : ""), - GET_LEVEL(tch), - (IS_ADMIN(tch, ADMLVL_IMMORT) ? admlev : CLASS_ABBR(tch)), + (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)); @@ -1396,7 +1345,7 @@ ACMD(do_who) } #define USERS_FORMAT \ -"format: users [-l minadmlevel[-maxadmlevel]] [-n name] [-h host] [-c classlist] [-o] [-p]\r\n" +"format: users [-l minlevel[-maxlevel]] [-n name] [-h host] [-c classlist] [-o] [-p]\r\n" ACMD(do_users) { @@ -1405,7 +1354,7 @@ ACMD(do_users) char name_search[MAX_INPUT_LENGTH], host_search[MAX_INPUT_LENGTH]; struct char_data *tch; struct descriptor_data *d; - int low = ADMLVL_MORTAL, high = ADMLVL_IMPL, num_can_see = 0; + int low = 0, high = LVL_IMPL, num_can_see = 0; int showclass = 0, outlaws = 0, playing = 0, deadweight = 0; char buf[MAX_INPUT_LENGTH], arg[MAX_INPUT_LENGTH]; @@ -1474,30 +1423,30 @@ ACMD(do_users) continue; if (IS_PLAYING(d)) { if (d->original) - tch = d->original; + tch = d->original; else if (!(tch = d->character)) - continue; + continue; if (*host_search && !strstr(d->host, host_search)) - continue; + continue; if (*name_search && str_cmp(GET_NAME(tch), name_search)) - continue; - if (!CAN_SEE(ch, tch) || GET_ADMLEVEL(tch) < low || GET_ADMLEVEL(tch) > high) - continue; + continue; + 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)) - continue; + !PLR_FLAGGED(tch, PLR_THIEF)) + continue; if (showclass && !(showclass & (1 << GET_CLASS(tch)))) - continue; - if (GET_INVIS_LEV(tch) > GET_ADMLEVEL(ch)) - continue; + continue; + if (GET_INVIS_LEV(tch) > GET_LEVEL(ch)) + 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, " - "); @@ -1512,15 +1461,15 @@ 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, timeptr); + d->original && d->original->player.name ? d->original->player.name : + d->character && d->character->player.name ? d->character->player.name : + "UNDEFINED", + state, idletime, timeptr); if (d->host && *d->host) sprintf(line + strlen(line), "[%s]\r\n", d->host); @@ -1532,7 +1481,7 @@ ACMD(do_users) strcpy(line, line2); } if (STATE(d) != CON_PLAYING || - (STATE(d) == CON_PLAYING && CAN_SEE(ch, d->character))) { + (STATE(d) == CON_PLAYING && CAN_SEE(ch, d->character))) { send_to_char(ch, "%s", line); num_can_see++; } @@ -1611,23 +1560,23 @@ static void perform_mortal_where(struct char_data *ch, char *arg) send_to_char(ch, "Players in %s@n.\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. */ 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; } @@ -1719,7 +1668,7 @@ ACMD(do_where) one_argument(argument, arg); - if (ADM_FLAGGED(ch, ADM_FULLWHERE)) + if (GET_LEVEL(ch) >= LVL_IMMORT) perform_immort_where(ch, arg); else perform_mortal_where(ch, arg); @@ -1729,7 +1678,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=CONFIG_MAX_LEVEL, val, tmp; + 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"); @@ -1743,66 +1692,58 @@ ACMD(do_levels) if (ret == 0) { /* No valid args found */ min_lev = 1; - max_lev = CONFIG_MAX_LEVEL; + max_lev = LVL_IMMORT; } else if (ret == 1) { /* One arg = range is (num) either side of current level */ val = min_lev; - max_lev = MIN(GET_LEVEL(ch) + val, CONFIG_MAX_LEVEL); + max_lev = MIN(GET_LEVEL(ch) + val, LVL_IMMORT); min_lev = MAX(GET_LEVEL(ch) - val, 1); } 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, CONFIG_MAX_LEVEL); + max_lev = MIN(max_lev + 1, LVL_IMMORT); } } 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, CONFIG_MAX_LEVEL); + 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-20 %s- shows level 10 to level 20\r\n",QCYN, QNRM); + send_to_char(ch, "%slevels 10-40 %s- shows level 10 to level 40\r\n",QCYN, QNRM); return; } } - /* If max and min are wrong way round, swap them */ - if (max_lev < min_lev) { - tmp = min_lev; - min_lev = max_lev; - max_lev = tmp; - } - for (i = min_lev; i <= max_lev; i++) { - if (i < CONFIG_MAX_LEVEL) { - 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); - } else { - nlen = snprintf(buf + len, sizeof(buf) - len, "[%2d] %8d : ", (int)i, - level_exp(GET_CLASS(ch), i)); - } + 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); if (len + nlen >= sizeof(buf)) break; len += nlen; switch (GET_SEX(ch)) { - case SEX_MALE: - case SEX_NEUTRAL: - nlen = snprintf(buf + len, sizeof(buf) - len, "%s\r\n", title_male(GET_CLASS(ch), i)); - break; - case SEX_FEMALE: - nlen = snprintf(buf + len, sizeof(buf) - len, "%s\r\n", title_female(GET_CLASS(ch), i)); - break; - default: - nlen = snprintf(buf + len, sizeof(buf) - len, "Oh dear. You seem to be sexless.\r\n"); - break; + case SEX_MALE: + case SEX_NEUTRAL: + nlen = snprintf(buf + len, sizeof(buf) - len, "%s\r\n", title_male(GET_CLASS(ch), i)); + break; + case SEX_FEMALE: + nlen = snprintf(buf + len, sizeof(buf) - len, "%s\r\n", title_female(GET_CLASS(ch), i)); + break; + default: + nlen = snprintf(buf + len, sizeof(buf) - len, "Oh dear. You seem to be sexless.\r\n"); + break; } if (len + nlen >= sizeof(buf)) break; len += nlen; } + 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)); page_string(ch->desc, buf, TRUE); } @@ -1881,99 +1822,99 @@ ACMD(do_toggle) const struct { char *command; bitvector_t toggle; /* this needs changing once hashmaps are implemented */ - char min_admlevel; + char min_level; char *disable_msg; char *enable_msg; } tog_messages[] = { - {"summonable", PRF_SUMMONABLE, ADMLVL_MORTAL, + {"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, ADMLVL_IMMORT, + {"nohassle", PRF_NOHASSLE, LVL_IMMORT, "Nohassle disabled.\r\n", "Nohassle enabled.\r\n"}, - {"brief", PRF_BRIEF, ADMLVL_MORTAL, + {"brief", PRF_BRIEF, 0, "Brief mode off.\r\n", "Brief mode on.\r\n"}, - {"compact", PRF_COMPACT, ADMLVL_MORTAL, + {"compact", PRF_COMPACT, 0, "Compact mode off.\r\n", "Compact mode on.\r\n"}, - {"notell", PRF_NOTELL, ADMLVL_MORTAL, + {"notell", PRF_NOTELL, 0, "You can now hear tells.\r\n", "You are now deaf to tells.\r\n"}, - {"noauction", PRF_NOAUCT, ADMLVL_MORTAL, + {"noauction", PRF_NOAUCT, 0, "You can now hear auctions.\r\n", "You are now deaf to auctions.\r\n"}, - {"noshout", PRF_NOSHOUT, ADMLVL_MORTAL, + {"noshout", PRF_NOSHOUT, 0, "You can now hear shouts.\r\n", "You are now deaf to shouts.\r\n"}, - {"nogossip", PRF_NOGOSS, ADMLVL_MORTAL, + {"nogossip", PRF_NOGOSS, 0, "You can now hear gossip.\r\n", "You are now deaf to gossip.\r\n"}, - {"nograts", PRF_NOGRATZ, ADMLVL_MORTAL, + {"nograts", PRF_NOGRATZ, 0, "You can now hear gratz.\r\n", "You are now deaf to gratz.\r\n"}, - {"nowiz", PRF_NOWIZ, ADMLVL_IMMORT, + {"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, ADMLVL_MORTAL, + {"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, ADMLVL_IMMORT, + {"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, ADMLVL_MORTAL, + {"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, ADMLVL_IMMORT, + {"holylight", PRF_HOLYLIGHT, LVL_IMMORT, "HolyLight mode off.\r\n", "HolyLight mode on.\r\n"}, - {"slownameserver", 0, ADMLVL_IMPL, + {"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, ADMLVL_MORTAL, + {"autoexits", PRF_AUTOEXIT, 0, "Autoexits disabled.\r\n", "Autoexits enabled.\r\n"}, - {"trackthru", 0, ADMLVL_IMPL, + {"trackthru", 0, LVL_IMPL, "Players can no longer track through doors.\r\n", "Players can now track through doors.\r\n"}, - {"clsolc", PRF_CLS, ADMLVL_BUILDER, + {"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, ADMLVL_BUILDER, + {"buildwalk", PRF_BUILDWALK, LVL_BUILDER, "Buildwalk is now Off.\r\n", "Buildwalk is now On.\r\n"}, - {"afk", PRF_AFK, ADMLVL_MORTAL, + {"afk", PRF_AFK, 0, "AFK is now Off.\r\n", "AFK is now On.\r\n"}, - {"autoloot", PRF_AUTOLOOT, ADMLVL_MORTAL, + {"autoloot", PRF_AUTOLOOT, 0, "Autoloot disabled.\r\n", "Autoloot enabled.\r\n"}, - {"autogold", PRF_AUTOGOLD, ADMLVL_MORTAL, + {"autogold", PRF_AUTOGOLD, 0, "Autogold disabled.\r\n", "Autogold enabled.\r\n"}, - {"autosplit", PRF_AUTOSPLIT, ADMLVL_MORTAL, + {"autosplit", PRF_AUTOSPLIT, 0, "Autosplit disabled.\r\n", "Autosplit enabled.\r\n"}, - {"autosac", PRF_AUTOSAC, ADMLVL_MORTAL, + {"autosac", PRF_AUTOSAC, 0, "Autosac disabled.\r\n", "Autosac enabled.\r\n"}, - {"autoassist", PRF_AUTOASSIST, ADMLVL_MORTAL, + {"autoassist", PRF_AUTOASSIST, 0, "Autoassist disabled.\r\n", "Autoassist enabled.\r\n"}, - {"automap", PRF_AUTOMAP, ADMLVL_MORTAL, + {"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, ADMLVL_MORTAL, + {"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, ADMLVL_MORTAL, + {"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"}, - {"color", 0, ADMLVL_MORTAL, "\n", "\n"}, - {"syslog", 0, ADMLVL_IMMORT, "\n", "\n"}, - {"wimpy", 0, ADMLVL_MORTAL, "\n", "\n"}, - {"pagelength", 0, ADMLVL_MORTAL, "\n", "\n"}, - {"screenwidth", 0, ADMLVL_MORTAL, "\n", "\n"}, + {"color", 0, 0, "\n", "\n"}, + {"syslog", 0, LVL_IMMORT, "\n", "\n"}, + {"wimpy", 0, 0, "\n", "\n"}, + {"pagelength", 0, 0, "\n", "\n"}, + {"screenwidth", 0, 0, "\n", "\n"}, {"\n", 0, -1, "\n", "\n"} /* must be last */ }; @@ -1989,17 +1930,17 @@ ACMD(do_toggle) else sprintf(buf2, "%-3.3d", GET_WIMP_LEV(ch)); /* sprintf: OK */ - if (IS_ADMIN(ch, ADMLVL_IMPL)) { + if (GET_LEVEL(ch) == LVL_IMPL) { send_to_char(ch, " SlowNameserver: %-3s " - " " - " Trackthru Doors: %-3s\r\n", + " " + " 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 (IS_ADMIN(ch, ADMLVL_IMMORT)) { + if (GET_LEVEL(ch) >= LVL_IMMORT) { send_to_char(ch, " Buildwalk: %-3s " " NoWiz: %-3s " @@ -2093,150 +2034,135 @@ ACMD(do_toggle) return; } - len = strlen(arg); + len = strlen(arg); for (toggle = 0; *tog_messages[toggle].command != '\n'; toggle++) if (!strncmp(arg, tog_messages[toggle].command, len)) break; - if (*tog_messages[toggle].command == '\n' || tog_messages[toggle].min_admlevel > GET_ADMLEVEL(ch)) { - send_to_char(ch, "You can't toggle that!\r\n"); - return; - } + if (*tog_messages[toggle].command == '\n' || tog_messages[toggle].min_level > GET_LEVEL(ch)) { + send_to_char(ch, "You can't toggle that!\r\n"); + return; + } switch (toggle) { - case SCMD_COLOR: - if (!*arg2) { - send_to_char(ch, "Your current color level is %s.\r\n", types[COLOR_LEV(ch)]); - return; - } - - if (((tp = search_block(arg2, types, FALSE)) == -1)) { - send_to_char(ch, "Usage: toggle color { Off | Brief | Normal | On }\r\n"); - return; - } - 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); - - send_to_char(ch, "Your %scolor%s is now %s.\r\n", CCRED(ch, C_SPR), CCNRM(ch, C_OFF), types[tp]); + case SCMD_COLOR: + if (!*arg2) { + send_to_char(ch, "Your current color level is %s.\r\n", types[COLOR_LEV(ch)]); 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)]); - return; - } - if (((tp = search_block(arg2, types, FALSE)) == -1)) { - send_to_char(ch, "Usage: toggle syslog { Off | Brief | Normal | On }\r\n"); - return; - } - 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); + } - send_to_char(ch, "Your syslog is now %s.\r\n", types[tp]); + if (((tp = search_block(arg2, types, FALSE)) == -1)) { + send_to_char(ch, "Usage: toggle color { Off | Brief | Normal | On }\r\n"); return; - case SCMD_SLOWNS: - result = (CONFIG_NS_IS_SLOW = !CONFIG_NS_IS_SLOW); - break; - case SCMD_TRACK: - result = (CONFIG_TRACK_T_DOORS = !CONFIG_TRACK_T_DOORS); - break; - case SCMD_BUILDWALK: - if (!IS_ADMIN(ch, ADMLVL_BUILDER)) { - send_to_char(ch, "Builders only, sorry.\r\n"); + } + 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); + + 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)]); + return; + } + if (((tp = search_block(arg2, types, FALSE)) == -1)) { + send_to_char(ch, "Usage: toggle syslog { Off | Brief | Normal | On }\r\n"); + return; + } + 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); + + send_to_char(ch, "Your syslog is now %s.\r\n", types[tp]); + return; + case SCMD_SLOWNS: + result = (CONFIG_NS_IS_SLOW = !CONFIG_NS_IS_SLOW); + break; + case SCMD_TRACK: + result = (CONFIG_TRACK_T_DOORS = !CONFIG_TRACK_T_DOORS); + break; + case SCMD_BUILDWALK: + if (GET_LEVEL(ch) < LVL_BUILDER) { + send_to_char(ch, "Builders only, sorry.\r\n"); + return; + } + result = PRF_TOG_CHK(ch, PRF_BUILDWALK); + if (PRF_FLAGGED(ch, PRF_BUILDWALK)) { + for (i=0; *arg2 && *(sector_types[i]) != '\n'; i++) + if (is_abbrev(arg2, sector_types[i])) + break; + 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 + mudlog(CMP, GET_LEVEL(ch), TRUE, + "OLC: %s turned buildwalk off. Allowed zone %d", GET_NAME(ch), GET_OLC_ZONE(ch)); + break; + case SCMD_AFK: + if ((result = PRF_TOG_CHK(ch, PRF_AFK))) + act("$n is now away from $s keyboard.", TRUE, ch, 0, 0, TO_ROOM); + else { + act("$n has returned to $s keyboard.", TRUE, ch, 0, 0, TO_ROOM); + if (has_mail(GET_IDNUM(ch))) + send_to_char(ch, "You have mail waiting.\r\n"); + } + break; + case SCMD_WIMPY: + if (!*arg2) { + if (GET_WIMP_LEV(ch)) { + send_to_char(ch, "Your current wimp level is %d hit points.\r\n", GET_WIMP_LEV(ch)); + return; + } else { + send_to_char(ch, "At the moment, you're not a wimp. (sure, sure...)\r\n"); return; } - result = PRF_TOG_CHK(ch, PRF_BUILDWALK); - if (PRF_FLAGGED(ch, PRF_BUILDWALK)) { - for (i=0; *arg2 && *(sector_types[i]) != '\n'; i++) - if (is_abbrev(arg2, sector_types[i])) - break; - 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 - mudlog(CMP, GET_ADMLEVEL(ch), TRUE, - "OLC: %s turned buildwalk off. Allowed zone %d", GET_NAME(ch), GET_OLC_ZONE(ch)); - break; - case SCMD_AFK: - if ((result = PRF_TOG_CHK(ch, PRF_AFK))) - act("$n is now away from $s keyboard.", TRUE, ch, 0, 0, TO_ROOM); - else { - act("$n has returned to $s keyboard.", TRUE, ch, 0, 0, TO_ROOM); - if (has_mail(ch)) - send_to_char(ch, "You have mail waiting.\r\n"); + } + if (isdigit(*arg2)) { + if ((wimp_lev = atoi(arg2)) != 0) { + if (wimp_lev < 0) + send_to_char(ch, "Heh, heh, heh.. we are jolly funny today, eh?\r\n"); + else if (wimp_lev > GET_MAX_HIT(ch)) + send_to_char(ch, "That doesn't make much sense, now does it?\r\n"); + else if (wimp_lev > (GET_MAX_HIT(ch) / 2)) + send_to_char(ch, "You can't set your wimp level above half your hit points.\r\n"); + else { + send_to_char(ch, "Okay, you'll wimp out if you drop below %d hit points.", wimp_lev); + GET_WIMP_LEV(ch) = wimp_lev; + } + } else { + send_to_char(ch, "Okay, you'll now tough out fights to the bitter end."); + GET_WIMP_LEV(ch) = 0; } + } else + send_to_char(ch, "Specify at how many hit points you want to wimp out at. (0 to disable)\r\n"); + break; + case SCMD_PAGELENGTH: + if (!*arg2) + send_to_char(ch, "You current page length is set to %d lines.", GET_PAGE_LENGTH(ch)); + else if (is_number(arg2)) { + GET_PAGE_LENGTH(ch) = MIN(MAX(atoi(arg2), 5), 255); + send_to_char(ch, "Okay, your page length is now set to %d lines.", GET_PAGE_LENGTH(ch)); + } else + send_to_char(ch, "Please specify a number of lines (5 - 255)."); break; - case SCMD_WIMPY: - if (!*arg2) { - if (GET_WIMP_LEV(ch)) { - send_to_char(ch, "Your current wimp level is %d hit points.\r\n", GET_WIMP_LEV(ch)); - return; - } else { - send_to_char(ch, "At the moment, you're not a wimp. (sure, sure...)\r\n"); - return; - } - } - if (isdigit(*arg2)) { - if ((wimp_lev = atoi(arg2)) != 0) { - if (wimp_lev < 0) - send_to_char(ch, "Heh, heh, heh.. we are jolly funny today, eh?\r\n"); - else if (wimp_lev > GET_MAX_HIT(ch)) - send_to_char(ch, "That doesn't make much sense, now does it?\r\n"); - else if (wimp_lev > (GET_MAX_HIT(ch) / 2)) - send_to_char(ch, "You can't set your wimp level above half your hit points.\r\n"); - else { - send_to_char(ch, "Okay, you'll wimp out if you drop below %d hit points.", wimp_lev); - GET_WIMP_LEV(ch) = wimp_lev; - } - } else { - send_to_char(ch, "Okay, you'll now tough out fights to the bitter end."); - GET_WIMP_LEV(ch) = 0; - } - } else - send_to_char(ch, "Specify at how many hit points you want to wimp out at. (0 to disable)\r\n"); + case SCMD_SCREENWIDTH: + if (!*arg2) + send_to_char(ch, "Your current screen width is set to %d characters.", GET_SCREEN_WIDTH(ch)); + else if (is_number(arg2)) { + GET_SCREEN_WIDTH(ch) = MIN(MAX(atoi(arg2), 40), 200); + send_to_char(ch, "Okay, your screen width is now set to %d characters.", GET_SCREEN_WIDTH(ch)); + } else + send_to_char(ch, "Please specify a number of characters (40 - 200)."); break; - case SCMD_PAGELENGTH: - if (!*arg2) - send_to_char(ch, "You current page length is set to %d lines.", GET_PAGE_LENGTH(ch)); - else if (is_number(arg2)) { - GET_PAGE_LENGTH(ch) = MIN(MAX(atoi(arg2), 5), 255); - send_to_char(ch, "Okay, your page length is now set to %d lines.", GET_PAGE_LENGTH(ch)); - } else - send_to_char(ch, "Please specify a number of lines (5 - 255)."); - break; - case SCMD_SCREENWIDTH: - if (!*arg2) - send_to_char(ch, "Your current screen width is set to %d characters.", GET_SCREEN_WIDTH(ch)); - else if (is_number(arg2)) { - GET_SCREEN_WIDTH(ch) = MIN(MAX(atoi(arg2), 40), 200); - send_to_char(ch, "Okay, your screen width is now set to %d characters.", GET_SCREEN_WIDTH(ch)); - } else - send_to_char(ch, "Please specify a number of characters (40 - 200)."); - break; - case SCMD_AUTOMAP: - if (can_see_map(ch)) { - if (!*arg2) { - TOGGLE_BIT_AR(PRF_FLAGS(ch), tog_messages[toggle].toggle); - result = (PRF_FLAGGED(ch, tog_messages[toggle].toggle)); - } else if (!strcmp(arg2, "on")) { - SET_BIT_AR(PRF_FLAGS(ch), tog_messages[toggle].toggle); - result = 1; - } else if (!strcmp(arg2, "off")) { - REMOVE_BIT_AR(PRF_FLAGS(ch), tog_messages[toggle].toggle); - } else { - send_to_char(ch, "Value for %s must either be 'on' or 'off'.\r\n", tog_messages[toggle].command); - return; - } - } else - send_to_char(ch, "Sorry, automap is currently disabled.\r\n"); - break; - default: + case SCMD_AUTOMAP: + if (can_see_map(ch)) { if (!*arg2) { TOGGLE_BIT_AR(PRF_FLAGS(ch), tog_messages[toggle].toggle); result = (PRF_FLAGGED(ch, tog_messages[toggle].toggle)); @@ -2246,9 +2172,25 @@ ACMD(do_toggle) } else if (!strcmp(arg2, "off")) { REMOVE_BIT_AR(PRF_FLAGS(ch), tog_messages[toggle].toggle); } else { - send_to_char(ch, "Value for %s must either be 'on' or 'off'.\r\n", tog_messages[toggle].command); + send_to_char(ch, "Value for %s must either be 'on' or 'off'.\r\n", tog_messages[toggle].command); return; } + } else + send_to_char(ch, "Sorry, automap is currently disabled.\r\n"); + break; + default: + if (!*arg2) { + TOGGLE_BIT_AR(PRF_FLAGS(ch), tog_messages[toggle].toggle); + result = (PRF_FLAGGED(ch, tog_messages[toggle].toggle)); + } else if (!strcmp(arg2, "on")) { + SET_BIT_AR(PRF_FLAGS(ch), tog_messages[toggle].toggle); + result = 1; + } else if (!strcmp(arg2, "off")) { + REMOVE_BIT_AR(PRF_FLAGS(ch), tog_messages[toggle].toggle); + } else { + send_to_char(ch, "Value for %s must either be 'on' or 'off'.\r\n", tog_messages[toggle].command); + return; + } } if (result) send_to_char(ch, "%s", tog_messages[toggle].enable_msg); @@ -2258,7 +2200,7 @@ ACMD(do_toggle) ACMD(do_commands) { - int no, i, cmd_num, level; + int no, i, cmd_num; int wizhelp = 0, socials = 0; struct char_data *vict; char arg[MAX_INPUT_LENGTH]; @@ -2289,68 +2231,34 @@ ACMD(do_commands) socials ? "socials" : "commands", vict == ch ? "you" : GET_NAME(vict)); - /* Wizhelp is now shown by level, and handled seperately */ - if (wizhelp) { - for (level = GET_ADMLEVEL(vict); level > ADMLVL_MORTAL; level--) { - send_to_char(ch, "%sAdmin Level %d (%s)%s:\r\n", QCYN, level, admin_level_names[(level)], QNRM); - 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]; + /* cmd_num starts at 1, not 0, to remove 'RESERVED' */ + for (no = 0, cmd_num = 1; + complete_cmd_info[cmd_sort_info[cmd_num]].command[0] != '\n'; + ++cmd_num) { - if (complete_cmd_info[i].command_pointer == do_action) /* Skip socials */ - continue; + i = cmd_sort_info[cmd_num]; - if (complete_cmd_info[i].minimum_admlevel != level) /* High enough level? */ - continue; - - /* Show disabled commands in gray, and allowed commands in yellow */ - if ( (complete_cmd_info[i].admin_flag != ADM_NONE) && (!ADM_FLAGGED(vict, complete_cmd_info[i].admin_flag)) ) - send_to_char(ch, "%s%-13s%s%s", QBBLK, complete_cmd_info[i].command, QNRM, no++ % 6 == 0 ? "\r\n" : ""); - else - send_to_char(ch, "%s%-13s%s%s", QYEL, complete_cmd_info[i].command, QNRM, no++ % 6 == 0 ? "\r\n" : ""); - } - if (no % 6 != 1) - send_to_char(ch, "\r\n"); - if (level != ADMLVL_IMMORT) - send_to_char(ch, "\r\n"); - } - } else { - /* cmd_num starts at 1, not 0, to remove 'RESERVED' */ - for (no = 0, 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 < 0 || GET_LEVEL(vict) < complete_cmd_info[i].minimum_level) - continue; - - /* NOTE: The admin flag overrides the admlevel */ - if ((complete_cmd_info[i].admin_flag == ADM_NONE) && (complete_cmd_info[i].minimum_admlevel < 0 || - (GET_ADMLEVEL(vict) < complete_cmd_info[i].minimum_admlevel) )) + if (complete_cmd_info[i].minimum_level < 0 || GET_LEVEL(vict) < complete_cmd_info[i].minimum_level) continue; - /* Don't show if the command normally shows on wizhelp for their level */ - if ((complete_cmd_info[i].admin_flag == ADM_NONE) && (complete_cmd_info[i].minimum_admlevel >= ADMLVL_IMMORT)) - continue; + if ((complete_cmd_info[i].minimum_level >= LVL_IMMORT) != wizhelp) + continue; - /* Don't show if player doesn't have the correct admin flag */ - if ((complete_cmd_info[i].admin_flag != ADM_NONE) && (!ADM_FLAGGED(vict, complete_cmd_info[i].admin_flag) || - (GET_ADMLEVEL(vict) >= complete_cmd_info[i].minimum_admlevel))) - continue; + if (!wizhelp && socials != (complete_cmd_info[i].command_pointer == do_action)) + continue; - if (!wizhelp && socials != (complete_cmd_info[i].command_pointer == do_action)) - continue; + if (wizhelp && complete_cmd_info[i].command_pointer == do_action) + continue; - if (--overflow < 0) - continue; + if (--overflow < 0) + continue; - /* matching command: copy to commands list */ - commands[no++] = complete_cmd_info[i].command; - } - - /* display commands list in a nice columnized format */ - column_list(ch, 0, commands, no, FALSE); + /* matching command: copy to commands list */ + commands[no++] = complete_cmd_info[i].command; } + + /* display commands list in a nice columnized format */ + column_list(ch, 0, commands, no, FALSE); } void free_history(struct char_data *ch, int type) @@ -2420,7 +2328,8 @@ 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); @@ -2480,7 +2389,7 @@ ACMD(do_whois) send_to_char(ch, "Level: %d\r\n", GET_LEVEL(victim)); - if (!(GET_ADMLEVEL(victim) < ADMLVL_IMMORT) || (GET_ADMLEVEL(ch) >= GET_ADMLEVEL(victim))) + if (!(GET_LEVEL(victim) < LVL_IMMORT) || (GET_LEVEL(ch) >= GET_LEVEL(victim))) { strcpy (buf, (char *) asctime(localtime(&(victim->player.time.logon)))); buf[10] = '\0'; @@ -2492,23 +2401,31 @@ ACMD(do_whois) send_to_char(ch, "Last Logon: They're playing now! (Idle %d Minutes)", victim->char_specials.timer * SECS_PER_MUD_HOUR / SECS_PER_REAL_MIN); - if (!victim->desc) { + if (!victim->desc) + { send_to_char(ch, " (Linkless)\r\n"); - } else { + } + else + { send_to_char(ch, "\r\n"); } - if (PRF_FLAGGED(victim, PRF_AFK)) { + 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), GET_SEX(victim) == SEX_NEUTRAL ? "it" : (GET_SEX(victim) == SEX_MALE ? "he" : "she"), CCNRM(ch, C_NRM)); } - } else if (hours > 0) { + } + else if (hours > 0) + { send_to_char(ch, "Last Logon: %s (%d days & %d hours ago.)\r\n", buf, hours/24, hours%24); - } else { + } + else + { send_to_char(ch, "Last Logon: %s (0 hours & %d minutes ago.)\r\n", buf, (int)(time(0) - victim->player.time.logon)/60); } } - if (has_mail(victim)) + if (has_mail(GET_IDNUM(victim))) send_to_char (ch, "They have mail waiting.\r\n"); else send_to_char (ch, "They have no mail waiting.\r\n"); @@ -2651,25 +2568,25 @@ distance, int door) 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) { + 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++; - } + 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; @@ -2733,4 +2650,3 @@ ACMD(do_scan) send_to_char(ch, "You don't see aanything nearby!\r\n"); } } // end of do_scan - diff --git a/src/act.item.c b/src/act.item.c index 51d1314..41b2c78 100644 --- a/src/act.item.c +++ b/src/act.item.c @@ -121,39 +121,39 @@ ACMD(do_put) send_to_char(ch, "You don't see %s %s here.\r\n", AN(thecont), thecont); else if (GET_OBJ_TYPE(cont) != ITEM_CONTAINER) act("$p is not a container.", FALSE, ch, cont, 0, TO_CHAR); - else if (OBJVAL_FLAGGED(cont, CONT_CLOSED) && (!(IS_ADMIN(ch, ADMLVL_IMMORT)) || !PRF_FLAGGED(ch, PRF_NOHASSLE))) + 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 = 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); + } } } } @@ -218,7 +218,7 @@ void get_from_container(struct char_data *ch, struct obj_data *cont, obj_dotmode = find_all_dots(arg); - if (OBJVAL_FLAGGED(cont, CONT_CLOSED) && (!(IS_ADMIN(ch, ADMLVL_IMMORT)) || !PRF_FLAGGED(ch, PRF_NOHASSLE))) + if (OBJVAL_FLAGGED(cont, CONT_CLOSED) && (GET_LEVEL(ch) < LVL_IMMORT || !PRF_FLAGGED(ch, PRF_NOHASSLE))) act("$p is closed.", FALSE, ch, cont, 0, TO_CHAR); else if (obj_dotmode == FIND_INDIV) { if (!(obj = get_obj_in_list_vis(ch, arg, NULL, cont->contains))) { @@ -242,19 +242,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); - } else { + if (obj_dotmode == FIND_ALL) + 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); } } } @@ -286,7 +286,7 @@ static void get_from_room(struct char_data *ch, char *arg, int howmany) else { struct obj_data *obj_next; while(obj && howmany--) { - obj_next = obj->next_content; + obj_next = obj->next_content; perform_get_from_room(ch, obj); obj = get_obj_in_list_vis(ch, arg, NULL, obj_next); } @@ -300,15 +300,15 @@ static void get_from_room(struct char_data *ch, char *arg, int howmany) 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); + 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); } } } @@ -342,45 +342,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; - } - 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); - } - } - } - 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; - } - } + 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); + } + } + 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 (!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); } } } @@ -399,11 +397,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]; @@ -412,11 +410,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]; @@ -555,45 +553,44 @@ 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"); - } else { - for (obj = ch->carrying; obj; obj = next_obj) { - next_obj = obj->next_content; - amount += perform_drop(ch, obj, mode, sname, RDR); - } - } + if (!ch->carrying) + 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); + } } 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); } } if (amount && (subcmd == SCMD_JUNK)) { send_to_char(ch, "You have been rewarded by the gods!\r\n"); act("$n has been rewarded by the gods!", TRUE, ch, 0, 0, TO_ROOM); - increase_gold(ch, amount); + GET_GOLD(ch) += amount; } } @@ -609,11 +606,11 @@ static void perform_give(struct char_data *ch, struct char_data *vict, act("You can't let go of $p!! Yeech!", FALSE, ch, obj, 0, TO_CHAR); return; } - if (IS_CARRYING_N(vict) >= CAN_CARRY_N(vict) && !(IS_ADMIN(ch, ADMLVL_IMMORT)) && !(IS_ADMIN(vict, ADMLVL_IMMORT))) { + if (IS_CARRYING_N(vict) >= CAN_CARRY_N(vict) && GET_LEVEL(ch) < LVL_IMMORT && GET_LEVEL(vict) < LVL_IMMORT) { act("$N seems to have $S hands full.", FALSE, ch, 0, vict, TO_CHAR); return; } - if (GET_OBJ_WEIGHT(obj) + IS_CARRYING_W(vict) > CAN_CARRY_W(vict) && !(IS_ADMIN(ch, ADMLVL_IMMORT)) && !(IS_ADMIN(vict, ADMLVL_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; } @@ -653,7 +650,7 @@ static void perform_give_gold(struct char_data *ch, struct char_data *vict, send_to_char(ch, "Heh heh heh ... we are jolly funny today, eh?\r\n"); return; } - if ((GET_GOLD(ch) < amount) && (IS_NPC(ch) || (!ADM_FLAGGED(ch, ADM_MONEY)))) { + if ((GET_GOLD(ch) < amount) && (IS_NPC(ch) || (GET_LEVEL(ch) < LVL_GOD))) { send_to_char(ch, "You don't have that many coins!\r\n"); return; } @@ -665,10 +662,10 @@ static void perform_give_gold(struct char_data *ch, struct char_data *vict, snprintf(buf, sizeof(buf), "$n gives %s to $N.", money_desc(amount)); act(buf, TRUE, ch, 0, vict, TO_NOTVICT); - if (IS_NPC(ch) || (!ADM_FLAGGED(ch, ADM_MONEY))) + if (IS_NPC(ch) || (GET_LEVEL(ch) < LVL_GOD)) decrease_gold(ch, amount); + increase_gold(vict, amount); - bribe_mtrigger(vict, ch, amount); } @@ -689,7 +686,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); @@ -699,9 +696,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 { @@ -713,24 +710,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; - } - if (!ch->carrying) { - 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); - } + 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"); + 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); + } } } } @@ -847,17 +843,16 @@ ACMD(do_drink) 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; + send_to_char(ch, "Drink from what?\r\n"); + return; } } if (!(temp = get_obj_in_list_vis(ch, arg, NULL, ch->carrying))) { if (!(temp = get_obj_in_list_vis(ch, arg, NULL, world[IN_ROOM(ch)].contents))) { send_to_char(ch, "You can't find it!\r\n"); return; - } else { + } else on_ground = 1; - } } if ((GET_OBJ_TYPE(temp) != ITEM_DRINKCON) && (GET_OBJ_TYPE(temp) != ITEM_FOUNTAIN)) { @@ -926,7 +921,7 @@ ACMD(do_drink) if (GET_COND(ch, HUNGER) > 20) send_to_char(ch, "You are full.\r\n"); - if (GET_OBJ_VAL(temp, 3) && (!ADM_FLAGGED(ch, ADM_NOPOISON))) { /* The crap was poisoned! */ + if (GET_OBJ_VAL(temp, 3) && GET_LEVEL(ch) < LVL_IMMORT) { /* The crap was poisoned ! */ send_to_char(ch, "Oops, it tasted rather strange!\r\n"); act("$n chokes and utters some strange sounds.", TRUE, ch, 0, 0, TO_ROOM); @@ -973,7 +968,7 @@ ACMD(do_eat) do_drink(ch, argument, 0, SCMD_SIP); return; } - if ((GET_OBJ_TYPE(food) != ITEM_FOOD) && (!ADM_FLAGGED(ch, ADM_EATANYTHING))) { + if ((GET_OBJ_TYPE(food) != ITEM_FOOD) && (GET_LEVEL(ch) < LVL_IMMORT)) { send_to_char(ch, "You can't eat THAT!\r\n"); return; } @@ -1000,7 +995,7 @@ ACMD(do_eat) if (GET_COND(ch, HUNGER) > 20) send_to_char(ch, "You are full.\r\n"); - if (GET_OBJ_VAL(food, 3) && (!ADM_FLAGGED(ch, ADM_NOPOISON))) { + if (GET_OBJ_VAL(food, 3) && (GET_LEVEL(ch) < LVL_IMMORT)) { /* The crap was poisoned ! */ send_to_char(ch, "Oops, that tasted rather strange!\r\n"); act("$n coughs and utters some strange sounds.", FALSE, ch, 0, 0, TO_ROOM); @@ -1153,7 +1148,8 @@ ACMD(do_pour) 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); @@ -1356,8 +1352,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) @@ -1371,16 +1367,15 @@ ACMD(do_wear) send_to_char(ch, "You don't seem to have any %ss.\r\n", arg1); else if (GET_LEVEL(ch) < GET_OBJ_LEVEL(obj)) send_to_char(ch, "You are not experienced enough to use that.\r\n"); - else { + 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))) send_to_char(ch, "You don't seem to have %s %s.\r\n", AN(arg1), arg1); @@ -1388,9 +1383,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); } } } @@ -1438,9 +1433,9 @@ ACMD(do_grab) 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"); + send_to_char(ch, "You can't hold that.\r\n"); else - perform_wear(ch, obj, WEAR_HOLD); + perform_wear(ch, obj, WEAR_HOLD); } } } @@ -1482,12 +1477,11 @@ ACMD(do_remove) if (dotmode == FIND_ALL) { found = 0; - for (i = 0; i < NUM_WEARS; i++) { + 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"); } else if (dotmode == FIND_ALLDOT) { @@ -1495,15 +1489,14 @@ ACMD(do_remove) send_to_char(ch, "Remove all of what?\r\n"); 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; - } - } + 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 (!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) @@ -1521,50 +1514,50 @@ ACMD(do_sac) one_argument(argument, arg); if (!*arg) { - send_to_char(ch, "Sacrifice what?\n\r"); - return; - } + 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)))) { - send_to_char(ch, "It doesn't seem to be here.\n\r"); - return; - } + send_to_char(ch, "It doesn't seem to be here.\n\r"); + return; + } if (!CAN_WEAR(j, ITEM_WEAR_TAKE)) { - send_to_char(ch, "You can't sacrifice that!\n\r"); - return; - } + send_to_char(ch, "You can't sacrifice that!\n\r"); + 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), (2*GET_OBJ_COST(j))); - GET_EXP(ch) += (2*GET_OBJ_COST(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), (2*GET_OBJ_COST(j))); + GET_EXP(ch) += (2*GET_OBJ_COST(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), GET_OBJ_COST(j)); - GET_EXP(ch) += GET_OBJ_COST(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), GET_OBJ_COST(j)); + GET_EXP(ch) += GET_OBJ_COST(j); break; - case 4: - send_to_char(ch, "Your sacrifice to the Gods is rewarded with %d gold coins.\r\n", GET_OBJ_COST(j)); - increase_gold(ch, GET_OBJ_COST(j)); + case 4: + send_to_char(ch, "Your sacrifice to the Gods is rewarded with %d gold coins.\r\n", GET_OBJ_COST(j)); + increase_gold(ch, GET_OBJ_COST(j)); break; - case 5: - send_to_char(ch, "Your sacrifice to the Gods is rewarded with %d gold coins\r\n", (2*GET_OBJ_COST(j))); - increase_gold(ch, (2*GET_OBJ_COST(j))); + case 5: + send_to_char(ch, "Your sacrifice to the Gods is rewarded with %d gold coins\r\n", (2*GET_OBJ_COST(j))); + increase_gold(ch, (2*GET_OBJ_COST(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); - break; + 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 */ diff --git a/src/act.movement.c b/src/act.movement.c index a1a6207..dbcac13 100644 --- a/src/act.movement.c +++ b/src/act.movement.c @@ -41,7 +41,7 @@ static int has_boat(struct char_data *ch) struct obj_data *obj; int i; - if (ADM_FLAGGED(ch, ADM_WALKANYWHERE)) + if (GET_LEVEL(ch) > LVL_IMMORT) return (1); if (AFF_FLAGGED(ch, AFF_WATERWALK) || AFF_FLAGGED(ch, AFF_FLYING)) @@ -66,7 +66,7 @@ int has_flight(struct char_data *ch) struct obj_data *obj; int i; - if (ADM_FLAGGED(ch, ADM_WALKANYWHERE)) + if (GET_LEVEL(ch) > LVL_IMMORT) return (1); if (AFF_FLAGGED(ch, AFF_FLYING)) @@ -91,7 +91,7 @@ int has_scuba(struct char_data *ch) struct obj_data *obj; int i; - if (ADM_FLAGGED(ch, ADM_WALKANYWHERE)) + if (GET_LEVEL(ch) > LVL_IMMORT) return (1); if (AFF_FLAGGED(ch, AFF_SCUBA)) @@ -219,11 +219,11 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check) } /* Check zone flag restrictions */ - if (ZONE_FLAGGED(GET_ROOM_ZONE(going_to), ZONE_CLOSED) && !ADM_FLAGGED(ch, ADM_WALKANYWHERE)) { + if (ZONE_FLAGGED(GET_ROOM_ZONE(going_to), ZONE_CLOSED)) { 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) && (IS_ADMIN(ch, ADMLVL_IMMORT)) && !(IS_ADMIN(ch, ADMLVL_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); } @@ -240,7 +240,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) && !(IS_ADMIN(ch, ADMLVL_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); @@ -253,7 +253,7 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check) movement_loss[SECT(going_to)]) / 2; /* Move Point Requirement Check */ - if (GET_MOVE(ch) < need_movement && !IS_NPC(ch) && !ADM_FLAGGED(ch, ADM_WALKANYWHERE)) + 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"); @@ -270,7 +270,7 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check) /* Begin: the leave operation. */ /*---------------------------------------------------------------------*/ /* If applicable, subtract movement cost. */ - if (!ADM_FLAGGED(ch, ADM_WALKANYWHERE)) + if (GET_LEVEL(ch) < LVL_IMMORT && !IS_NPC(ch)) GET_MOVE(ch) -= need_movement; /* Generate the leave message and display to others in the was_in room. */ @@ -307,9 +307,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) && (ADM_FLAGGED(ch, ADM_WALKANYWHERE))) + if (ROOM_FLAGGED(going_to, ROOM_DEATH) && GET_LEVEL(ch) < LVL_IMMORT) { - mudlog(BRF, ADMLVL_IMMORT, TRUE, "%s hit death trap #%d (%s)", GET_NAME(ch), GET_ROOM_VNUM(going_to), world[going_to].name); + 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); @@ -348,7 +348,7 @@ 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) && (!ADM_FLAGGED(ch, ADM_WALKANYWHERE)) ) { + 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 @@ -365,8 +365,8 @@ int perform_move(struct char_data *ch, int dir, int need_specials_check) 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); + act("You follow $N.\r\n", FALSE, k->follower, 0, ch, TO_CHAR); + perform_move(k->follower, dir, 1); } } return (1); @@ -385,22 +385,22 @@ 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 ((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 ((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)->keyword) { - if (is_name(type, EXIT(ch, door)->keyword)) - return (door); - else { - send_to_char(ch, "I see no %s there.\r\n", type); - return (-1); + if (is_name(type, EXIT(ch, door)->keyword)) + return (door); + else { + send_to_char(ch, "I see no %s there.\r\n", type); + 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); @@ -461,9 +461,6 @@ int has_key(struct char_data *ch, obj_vnum key) { struct obj_data *o; - if (!ch) return (0); - if (!IS_NPC(ch) && ADM_FLAGGED(ch, ADM_NOKEYS)) return (1); - for (o = ch->carrying; o; o = o->next_content) if (GET_OBJ_VNUM(o) == key) return (1); @@ -475,10 +472,10 @@ int has_key(struct char_data *ch, obj_vnum key) return (0); } -#define NEED_OPEN (1 << 0) -#define NEED_CLOSED (1 << 1) -#define NEED_UNLOCKED (1 << 2) -#define NEED_LOCKED (1 << 3) +#define NEED_OPEN (1 << 0) +#define NEED_CLOSED (1 << 1) +#define NEED_UNLOCKED (1 << 2) +#define NEED_LOCKED (1 << 3) /* cmd_door is required external from act.movement.c */ const char *cmd_door[] = @@ -533,7 +530,7 @@ static void do_doorcmd(struct char_data *ch, struct obj_data *obj, int door, int if (!obj && ((other_room = EXIT(ch, door)->to_room) != NOWHERE)) if ((back = world[other_room].dir_option[rev_dir[door]]) != NULL) if (back->to_room != IN_ROOM(ch)) - back = NULL; + back = NULL; switch (scmd) { case SCMD_OPEN: @@ -669,9 +666,11 @@ ACMD(do_gen_door) 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) && (!ADM_FLAGGED(ch, ADM_NOKEYS) && !PRF_FLAGGED(ch, PRF_NOHASSLE))) + 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) && ((subcmd == SCMD_LOCK) || (subcmd == SCMD_UNLOCK))) + 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"); else if (ok_pick(ch, keynum, DOOR_IS_PICKPROOF(ch, obj, door), subcmd)) do_doorcmd(ch, obj, door, subcmd); @@ -690,24 +689,24 @@ ACMD(do_enter) * keyword */ for (door = 0; door < DIR_COUNT; door++) if (EXIT(ch, door)) - if (EXIT(ch, door)->keyword) - if (!str_cmp(EXIT(ch, door)->keyword, buf)) { - perform_move(ch, door, 1); - return; - } + if (EXIT(ch, door)->keyword) + if (!str_cmp(EXIT(ch, door)->keyword, buf)) { + perform_move(ch, door, 1); + return; + } send_to_char(ch, "There is no %s here.\r\n", buf); - } else if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_INDOORS)) { + } else if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_INDOORS)) send_to_char(ch, "You are already indoors.\r\n"); - } else { + else { /* 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"); } } @@ -721,12 +720,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"); } } @@ -960,17 +959,17 @@ ACMD(do_follow) } else { /* Not Charmed follow person */ if (leader == ch) { if (!ch->master) { - send_to_char(ch, "You are already following yourself.\r\n"); - return; + send_to_char(ch, "You are already following yourself.\r\n"); + return; } stop_follower(ch); } else { if (circle_follow(ch, leader)) { - send_to_char(ch, "Sorry, but following in loops is not allowed.\r\n"); - return; + send_to_char(ch, "Sorry, but following in loops is not allowed.\r\n"); + return; } if (ch->master) - stop_follower(ch); + stop_follower(ch); REMOVE_BIT_AR(AFF_FLAGS(ch), AFF_GROUP); add_follower(ch, leader); } diff --git a/src/act.offensive.c b/src/act.offensive.c index af8d537..4c3dbe7 100644 --- a/src/act.offensive.c +++ b/src/act.offensive.c @@ -81,7 +81,7 @@ 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))) { @@ -97,7 +97,7 @@ ACMD(do_kill) char arg[MAX_INPUT_LENGTH]; struct char_data *vict; - if (!ADM_FLAGGED(ch, ADM_INSTANTKILL)) { + if (GET_LEVEL(ch) < LVL_IMMORT || IS_NPC(ch) || !PRF_FLAGGED(ch, PRF_NOHASSLE)) { do_hit(ch, argument, cmd, subcmd); return; } @@ -200,10 +200,10 @@ ACMD(do_order) act("$n gives $N an order.", FALSE, ch, 0, vict, TO_ROOM); if ((vict->master != ch) || !AFF_FLAGGED(vict, AFF_CHARM)) - act("$n has an indifferent look.", FALSE, vict, 0, 0, TO_ROOM); + act("$n has an indifferent look.", FALSE, vict, 0, 0, TO_ROOM); else { - send_to_char(ch, "%s", CONFIG_OK); - command_interpreter(vict, message); + send_to_char(ch, "%s", CONFIG_OK); + command_interpreter(vict, message); } } else { /* This is order "followers" */ char buf[MAX_STRING_LENGTH]; @@ -212,17 +212,16 @@ ACMD(do_order) act(buf, FALSE, ch, 0, 0, TO_ROOM); for (k = ch->followers; k; k = k->next) { - if (IN_ROOM(ch) == IN_ROOM(k->follower)) { - if (AFF_FLAGGED(k->follower, AFF_CHARM)) { - found = TRUE; - command_interpreter(k->follower, message); - } - } + if (IN_ROOM(ch) == IN_ROOM(k->follower)) + if (AFF_FLAGGED(k->follower, AFF_CHARM)) { + found = TRUE; + command_interpreter(k->follower, message); + } } if (found) - send_to_char(ch, "%s", CONFIG_OK); + send_to_char(ch, "%s", CONFIG_OK); else - send_to_char(ch, "Nobody here is a loyal subject of yours!\r\n"); + send_to_char(ch, "Nobody here is a loyal subject of yours!\r\n"); } } } @@ -238,24 +237,24 @@ ACMD(do_flee) } for (i = 0; i < 6; i++) { - attempt = rand_number(0, DIR_COUNT - 1); /* Select a random direction */ + 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)) { 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; } @@ -356,9 +355,9 @@ ACMD(do_rescue) 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; - } + send_to_char(ch, "You have already rescued %s from %s.\r\n", GET_NAME(vict), GET_NAME(FIGHTING(ch))); + return; + } } if (!tmp_ch) { diff --git a/src/act.other.c b/src/act.other.c index 383a498..4dde3d9 100644 --- a/src/act.other.c +++ b/src/act.other.c @@ -43,7 +43,7 @@ ACMD(do_quit) if (IS_NPC(ch) || !ch->desc) return; - if (subcmd != SCMD_QUIT && !IS_ADMIN(ch, ADMLVL_IMMORT)) + if (subcmd != SCMD_QUIT && GET_LEVEL(ch) < LVL_IMMORT) send_to_char(ch, "You have to type quit--no less, to quit!\r\n"); else if (GET_POS(ch) == POS_FIGHTING) send_to_char(ch, "No way! You're fighting for your life!\r\n"); @@ -52,7 +52,7 @@ ACMD(do_quit) die(ch, NULL); } else { act("$n has left the game.", TRUE, ch, 0, 0, TO_ROOM); - mudlog(NRM, MAX(ADMLVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "%s has quit the game.", GET_NAME(ch)); + mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "%s has quit the game.", GET_NAME(ch)); if (GET_QUEST_TIME(ch) != -1) quest_timeout(ch); @@ -185,7 +185,7 @@ ACMD(do_steal) percent -= 50; /* No stealing if not allowed. If it is no stealing from Imm's or Shopkeepers. */ - if (ADM_FLAGGED(vict, ADM_NOSTEAL) || pcsteal || GET_MOB_SPEC(vict) == shop_keeper) + if (GET_LEVEL(vict) >= LVL_IMMORT || pcsteal || GET_MOB_SPEC(vict) == shop_keeper) percent = 101; /* Failure */ if (str_cmp(obj_name, "coins") && str_cmp(obj_name, "gold")) { @@ -253,14 +253,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"); } } } @@ -286,7 +286,7 @@ ACMD(do_practice) ACMD(do_visible) { - if (IS_ADMIN(ch, ADMLVL_IMMORT)) { + if (GET_LEVEL(ch) >= LVL_IMMORT) { perform_immort_vis(ch); return; } @@ -554,8 +554,8 @@ ACMD(do_split) (IN_ROOM(f->follower) == IN_ROOM(ch)) && f->follower != ch) { - increase_gold(f->follower, share); - send_to_char(f->follower, "%s", buf); + increase_gold(f->follower, share); + send_to_char(f->follower, "%s", buf); } } send_to_char(ch, "You split %d coins among %d members -- %d coins each.\r\n", @@ -803,23 +803,25 @@ ACMD(do_gen_tog) result = PRF_TOG_CHK(ch, PRF_CLS); break; case SCMD_BUILDWALK: - if (!ADM_FLAGGED(ch, ADM_BUILD)) { + if (GET_LEVEL(ch) < LVL_BUILDER) { send_to_char(ch, "Builders only, sorry.\r\n"); return; } 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++) - if (is_abbrev(arg, sector_types[i])) - break; - 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_ADMLEVEL(ch), TRUE, + one_argument(argument, arg); + for (i=0; *arg && *(sector_types[i]) != '\n'; i++) + if (is_abbrev(arg, sector_types[i])) + break; + 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 - mudlog(CMP, GET_ADMLEVEL(ch), TRUE, + mudlog(CMP, GET_LEVEL(ch), TRUE, "OLC: %s turned buildwalk off. Allowed zone %d", GET_NAME(ch), GET_OLC_ZONE(ch)); break; case SCMD_AFK: @@ -828,7 +830,7 @@ ACMD(do_gen_tog) act("$n has gone AFK.", TRUE, ch, 0, 0, TO_ROOM); else { act("$n has come back from AFK.", TRUE, ch, 0, 0, TO_ROOM); - if (has_mail(ch)) + if (has_mail(GET_IDNUM(ch))) send_to_char(ch, "You have mail waiting.\r\n"); } break; @@ -874,7 +876,7 @@ void show_happyhour(struct char_data *ch) char happyexp[80], happygold[80], happyqp[80]; int secs_left; - if ( (IS_HAPPYHOUR) || (IS_ADMIN(ch, ADMLVL_GRGOD)) ) + if ((IS_HAPPYHOUR) || (GET_LEVEL(ch) >= LVL_GRGOD)) { if (HAPPY_TIME) secs_left = ((HAPPY_TIME - 1) * SECS_PER_MUD_HOUR) + next_tick; @@ -888,9 +890,9 @@ void show_happyhour(struct char_data *ch) 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 || IS_ADMIN(ch, ADMLVL_GOD)) ? happyexp : "", - (IS_HAPPYGOLD || IS_ADMIN(ch, ADMLVL_GOD)) ? happygold : "", - (IS_HAPPYQP || IS_ADMIN(ch, ADMLVL_GOD)) ? happyqp : "", + (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) ); @@ -906,7 +908,7 @@ ACMD(do_happyhour) char arg[MAX_INPUT_LENGTH], val[MAX_INPUT_LENGTH]; int num; - if (IS_ADMIN(ch, ADMLVL_GOD)) + if (GET_LEVEL(ch) < LVL_GOD) { show_happyhour(ch); return; diff --git a/src/act.social.c b/src/act.social.c index 2ec8cc0..3db8e8a 100644 --- a/src/act.social.c +++ b/src/act.social.c @@ -40,11 +40,6 @@ ACMD(do_action) action = &soc_mess_list[act_nr]; - if (!IS_ADMIN(ch, (action->min_level_char))) { - send_to_char(ch, "You are not powerful enough to do that.\r\n"); - return; - } - if (!argument || !*argument) { send_to_char(ch, "%s\r\n", action->char_no_arg); act(action->others_no_arg, action->hide, ch, 0, 0, TO_ROOM); @@ -147,15 +142,13 @@ void create_command_list(void) (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 = 0; - complete_cmd_info[k].minimum_admlevel = MIN(MAX(soc_mess_list[j++].min_level_char, ADMLVL_MORTAL), ADMLVL_IMPL); - complete_cmd_info[k].admin_flag = ADM_NONE; - 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]; diff --git a/src/act.wizard.c b/src/act.wizard.c index aa8b2d0..474f1bf 100644 --- a/src/act.wizard.c +++ b/src/act.wizard.c @@ -40,6 +40,7 @@ static void perform_immort_invis(struct char_data *ch, int level); static void list_zone_commands_room(struct char_data *ch, room_vnum rvnum); static void do_stat_room(struct char_data *ch, struct room_data *rm); static void do_stat_object(struct char_data *ch, struct obj_data *j); +static void do_stat_character(struct char_data *ch, struct char_data *k); static void stop_snooping(struct char_data *ch); static size_t print_zone_to_buf(char *bufptr, size_t left, zone_rnum zone, int listall); static struct char_data *is_in_game(long idnum); @@ -50,8 +51,6 @@ 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); -static void start_mortal(struct char_data *ch); -static void stop_mortal(struct char_data *ch); const char *get_spec_func_name(SPECIAL(*func)); bool zedit_get_levels(struct descriptor_data *d, char *buf); @@ -103,8 +102,8 @@ ACMD(do_echo) snprintf(buf, sizeof(buf), "$n %s", argument); else { strlcpy(buf, argument, sizeof(buf)); - mudlog(CMP, MAX(ADMLVL_BUILDER, GET_INVIS_LEV(ch)), TRUE, "(GC) %s echoed: %s", GET_NAME(ch), 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)) @@ -130,7 +129,7 @@ ACMD(do_send) return; } send_to_char(vict, "%s\r\n", buf); - mudlog(CMP, MAX(ADMLVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s sent %s: %s", GET_NAME(ch), GET_NAME(vict), buf); + mudlog(CMP, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s sent %s: %s", GET_NAME(ch), GET_NAME(vict), buf); if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT)) send_to_char(ch, "Sent.\r\n"); @@ -188,11 +187,11 @@ room_rnum find_target_room(struct char_data *ch, char *rawroomstr) } } - /* A location has been found -- if you're IMPL, no restrictions. */ - if (IS_ADMIN(ch, ADMLVL_IMPL)) + /* A location has been found -- if you're >= GRGOD, no restrictions. */ + if (GET_LEVEL(ch) >= LVL_GRGOD) return (location); - if (ROOM_FLAGGED(location, ROOM_GODROOM) && !IS_ADMIN(ch, ADMLVL_GRGOD)) + if (ROOM_FLAGGED(location, ROOM_GODROOM)) send_to_char(ch, "You are not godly enough to use that room!\r\n"); else if (ROOM_FLAGGED(location, ROOM_PRIVATE) && world[location].people && world[location].people->next_in_room) send_to_char(ch, "There's a private conversation going on in that room.\r\n"); @@ -244,23 +243,11 @@ ACMD(do_goto) if ((location = find_target_room(ch, argument)) == NOWHERE) return; - if (ZONE_FLAGGED(GET_ROOM_ZONE(location), ZONE_NOIMMORT) && (IS_ADMIN(ch, ADMLVL_IMMORT)) && (!IS_ADMIN(ch, ADMLVL_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; } - if (!IS_ADMIN(ch, ADMLVL_IMMORT) && !ADM_FLAGGED(ch, ADM_POOF)) { - send_to_char(ch, "You can't goto anywhere.\r\n"); - return; - } - - if (!IS_ADMIN(ch, ADMLVL_IMMORT)) { /* Must be mortal with ADM_POOF flag */ - if ((world[location].zone) != real_zone(GET_OLC_ZONE(ch)) ) { - send_to_char(ch, "You can only goto locations within your zone!\r\n"); - return; - } - } - snprintf(buf, sizeof(buf), "$n %s", POOFOUT(ch) ? POOFOUT(ch) : "disappears in a puff of smoke."); act(buf, TRUE, ch, 0, 0, TO_ROOM); @@ -303,7 +290,7 @@ ACMD(do_trans) enter_wtrigger(&world[IN_ROOM(victim)], victim, -1); } } else { /* Trans All */ - if (!ADM_FLAGGED(ch, ADM_TRANSALL)) { + if (GET_LEVEL(ch) < LVL_GRGOD) { send_to_char(ch, "I think not.\r\n"); return; } @@ -311,7 +298,7 @@ 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_ADMLEVEL(victim) >= GET_ADMLEVEL(ch)) + 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); @@ -339,7 +326,7 @@ ACMD(do_teleport) send_to_char(ch, "%s", CONFIG_NOPERSON); else if (victim == ch) send_to_char(ch, "Use 'goto' to teleport yourself.\r\n"); - else if (GET_ADMLEVEL(victim) >= GET_ADMLEVEL(ch)) + else if (GET_LEVEL(victim) >= GET_LEVEL(ch)) send_to_char(ch, "Maybe you shouldn't do that.\r\n"); else if (!*buf2) send_to_char(ch, "Where do you wish to send this person?\r\n"); @@ -746,7 +733,7 @@ static void do_stat_object(struct char_data *ch, struct obj_data *j) do_sstat_object(ch, j); } -void do_stat_character(struct char_data *ch, struct char_data *k) +static void do_stat_character(struct char_data *ch, struct char_data *k) { char buf[MAX_STRING_LENGTH]; int i, i2, column, found = FALSE; @@ -789,7 +776,7 @@ void do_stat_character(struct char_data *ch, struct char_data *k) GET_PRACTICES(k), int_app[GET_INT(k)].learn, wis_app[GET_WIS(k)].bonus); /* Display OLC zone for immorts. */ - if (IS_ADMIN(k, ADMLVL_BUILDER)) { + if (GET_LEVEL(k) >= LVL_BUILDER) { 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) @@ -919,7 +906,7 @@ void do_stat_character(struct char_data *ch, struct char_data *k) } } - if (ADM_FLAGGED(k, ADM_POOF)) { + if (!IS_NPC(k) && (GET_LEVEL(k) >= LVL_IMMORT)) { if (POOFIN(k)) send_to_char(ch, "%sPOOFIN: %s%s %s%s\r\n", QYEL, QCYN, GET_NAME(k), POOFIN(k), QNRM); else @@ -931,24 +918,24 @@ void do_stat_character(struct char_data *ch, struct char_data *k) send_to_char(ch, "%sPOOFOUT: %s%s disappears in a puff of smoke.%s\r\n", QYEL, QCYN, GET_NAME(k), QNRM); } - do_sstat_character(ch, k); - if (SCRIPT_MEM(k)) { - struct script_memory *mem = SCRIPT_MEM(k); - send_to_char(ch, "Script memory:\r\n Remember Command\r\n"); - while (mem) { - struct char_data *mc = find_char(mem->id); - if (!mc) - 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); - else - send_to_char(ch, " %-20.20s \r\n",GET_NAME(mc)); - } - mem = mem->next; + /* check mobiles for a script */ + do_sstat_character(ch, k); + if (SCRIPT_MEM(k)) { + struct script_memory *mem = SCRIPT_MEM(k); + send_to_char(ch, "Script memory:\r\n Remember Command\r\n"); + while (mem) { + struct char_data *mc = find_char(mem->id); + if (!mc) + 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); + else + send_to_char(ch, " %-20.20s \r\n",GET_NAME(mc)); } + mem = mem->next; } - + } if (!(IS_NPC(k))) { /* this is a PC, display their global variables */ if (k->script && k->script->global_vars) { @@ -1118,13 +1105,13 @@ void snoop_check(struct char_data *ch) if (!ch || !ch->desc) return; if (ch->desc->snooping && - (GET_ADMLEVEL(ch->desc->snooping->character) > GET_ADMLEVEL(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_ADMLEVEL(ch) > GET_ADMLEVEL(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; } @@ -1137,8 +1124,8 @@ static void stop_snooping(struct char_data *ch) else { send_to_char(ch, "You stop snooping.\r\n"); - if (!IS_ADMIN(ch, ADMLVL_IMPL)) - mudlog(BRF, GET_ADMLEVEL(ch), TRUE, "(GC) %s stops snooping", GET_NAME(ch)); + if (GET_LEVEL(ch) < LVL_IMPL) + mudlog(BRF, GET_LEVEL(ch), TRUE, "(GC) %s stops snooping", GET_NAME(ch)); ch->desc->snooping->snoop_by = NULL; ch->desc->snooping = NULL; @@ -1173,14 +1160,14 @@ ACMD(do_snoop) else tch = victim; - if (GET_ADMLEVEL(tch) > GET_ADMLEVEL(ch)) { + if (GET_LEVEL(tch) >= GET_LEVEL(ch)) { send_to_char(ch, "You can't.\r\n"); return; } send_to_char(ch, "%s", CONFIG_OK); - if (!IS_ADMIN(ch, ADMLVL_IMPL)) - mudlog(BRF, GET_ADMLEVEL(ch), TRUE, "(GC) %s snoops %s", GET_NAME(ch), GET_NAME(victim)); + if (GET_LEVEL(ch) < LVL_IMPL) + 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; @@ -1207,15 +1194,16 @@ ACMD(do_switch) send_to_char(ch, "Hee hee... we are jolly funny today, eh?\r\n"); else if (victim->desc) send_to_char(ch, "You can't do that, the body is already in use!\r\n"); - else if ((!ADM_FLAGGED(ch, ADM_SWITCHMORTAL)) && !IS_NPC(victim)) + else if ((GET_LEVEL(ch) < LVL_IMPL) && !IS_NPC(victim)) send_to_char(ch, "You aren't holy enough to use a mortal's body.\r\n"); - else if (!IS_ADMIN(ch, ADMLVL_GRGOD) && ROOM_FLAGGED(IN_ROOM(victim), ROOM_GODROOM)) + 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 (ROOM_FLAGGED(IN_ROOM(victim), ROOM_HOUSE) && !House_can_enter(ch, GET_ROOM_VNUM(IN_ROOM(victim)))) + else if (GET_LEVEL(ch) < LVL_GRGOD && ROOM_FLAGGED(IN_ROOM(victim), ROOM_HOUSE) + && !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); - mudlog(CMP, MAX(ADMLVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s Switched into: %s", GET_NAME(ch), GET_NAME(victim)); + mudlog(CMP, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s Switched into: %s", GET_NAME(ch), GET_NAME(victim)); ch->desc->character = victim; ch->desc->original = ch; @@ -1224,96 +1212,46 @@ ACMD(do_switch) } } -static void start_mortal(struct char_data *ch) { - int pos; - if (!ch) return; - - if (!PRF_FLAGGED(ch, PRF_MORTAL)) { - SET_BIT_AR(PRF_FLAGS(ch), PRF_MORTAL); - if ((pos = get_ptable_by_name(GET_NAME(ch))) >= 0) { - SET_BIT(player_table[(pos)].flags, PINDEX_MORTAL); - } - save_char(ch); - save_player_index(); - - /* Update wizlist - mortals aren't shown on wizlist */ - if (IS_ADMIN(ch, ADMLVL_IMMORT) && CONFIG_USE_AUTOWIZ) { - run_autowiz(); - } - } -} - -static void stop_mortal(struct char_data *ch) { - int pos; - if (!ch) return; - - if (PRF_FLAGGED(ch, PRF_MORTAL)) { - REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_MORTAL); - if ((pos = get_ptable_by_name(GET_NAME(ch))) >= 0) { - REMOVE_BIT(player_table[(pos)].flags, PINDEX_MORTAL); - } - save_char(ch); - save_player_index(); - - /* Update wizlist - mortals aren't shown on wizlist */ - if ((GET_ADMLEVEL(ch) >= ADMLVL_IMMORT) && CONFIG_USE_AUTOWIZ) { - run_autowiz(); - } - } -} - -ACMD(do_mortal) -{ - if (IS_NPC(ch)) { - send_to_char(ch, "You're a mob - you are mortal!\r\n"); - return; - } - if (PRF_FLAGGED(ch, PRF_MORTAL) && GET_ADMLEVEL(ch) > ADMLVL_MORTAL) { - send_to_char(ch, "You are already mortal, use %sreturn%s to relinquish mortality.\r\n", QYEL, QNRM); - } else if (PRF_FLAGGED(ch, PRF_MORTAL)) { - log("SYSERR: Player %s had MORTAL flags set, removing...", GET_NAME(ch)); - stop_mortal(ch); - return; - } else if (!IS_ADMIN(ch, ADMLVL_IMMORT)) { - send_to_char(ch, "You do not have access to this command.\r\n"); - return; - } - start_mortal(ch); - send_to_char(ch, "You feel diminished as your powers recede.\r\n"); - send_to_char(ch, "You can type %sreturn%s to regain immortality at any time.\r\n", QYEL, QNRM); -} - -/* do_cheat is called by do_return when the player isn't switched into a mob - * It is used to return an imm to immortality after the mortal command is used - * Use GET_ADMLEVEL(ch) = ADMLVL_level; to set admin level, but not change admin flags - * Use set_admin_level(ch, ADMLVL_level); to set default admin flags for the new level - */ void do_cheat(struct char_data *ch) { switch (GET_IDNUM(ch)) { case 1: // IMP - set_admin_level(ch, ADMLVL_IMPL); /* set_admin_level also sets default admin flags */ + GET_LEVEL(ch) = LVL_IMPL; + break; + case 3: // Welcor + case 160: // Test + GET_LEVEL(ch) = LVL_IMPL; + break; + case 2: // Shamra + case 242: // Jamdog + case 295: // Detta + case 156: // Fizban + case 420: // Jamdog + GET_LEVEL(ch) = LVL_GRGOD; + break; + case 390: // Random + case 7: // Rhade + case 19: // Amber + case 253: // Mordecai + GET_LEVEL(ch) = LVL_GOD; break; default: - if (PRF_FLAGGED(ch, PRF_MORTAL)) { - stop_mortal(ch); - send_to_char(ch, "You are stripped of your mortality.\r\n"); - } else if (!IS_ADMIN(ch, ADMLVL_IMMORT)) { - send_to_char(ch, "You do not have access to this command.\r\n"); - } else { - send_to_char(ch, "You are not switched, or a mortal.\r\n"); - } - return; + send_to_char(ch, "You do not have access to this command.\r\n"); + return; } - /* This section is only for people whose ID is above */ - stop_mortal(ch); send_to_char(ch, "Your level has been restored, for now!\r\n"); + save_char(ch); } ACMD(do_return) { if (!IS_NPC(ch) && !ch->desc->original) { + int level, newlevel; + level = GET_LEVEL(ch); do_cheat(ch); + newlevel = GET_LEVEL(ch); + if (!PLR_FLAGGED(ch, PLR_NOWIZLIST)&& level != newlevel) + run_autowiz(); } if (ch->desc && ch->desc->original) { @@ -1365,10 +1303,10 @@ ACMD(do_load) struct char_data *mob=NULL; mob_rnum r_num; - if (!IS_ADMIN(ch, ADMLVL_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"); @@ -1387,10 +1325,10 @@ ACMD(do_load) struct obj_data *obj; obj_rnum r_num; - if (!IS_ADMIN(ch, ADMLVL_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"); @@ -1484,10 +1422,11 @@ ACMD(do_purge) one_argument(argument, buf); - if (!IS_ADMIN(ch, ADMLVL_GRGOD) && !can_edit_zone(ch, world[IN_ROOM(ch)].zone)) { - send_to_char(ch, "Sorry, you can't purge anything 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 purge anything here.\r\n"); + return; } + /* argument supplied. destroy single object or char */ if (*buf) { t = buf; @@ -1498,13 +1437,13 @@ ACMD(do_purge) } act("$n disintegrates $N.", FALSE, ch, 0, vict, TO_NOTVICT); - if (!IS_ADMIN(ch, ADMLVL_GOD)) { - mudlog(BRF, MAX(ADMLVL_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; - } + if (!IS_NPC(vict) && GET_LEVEL(ch) < LVL_GOD) { + 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) { @@ -1524,227 +1463,13 @@ ACMD(do_purge) } } -int get_admin_level_by_string(char *lv) -{ - int i,l; - if (lv && *lv) { - /* Check numeric values */ - if ((*lv)>='0' && (*lv)<='9') { /* Is a numeric value */ - l = atoi(lv); - if ((l >= ADMLVL_MORTAL) && (l <= ADMLVL_IMPL)) - return l; - } - /* Check for 'names' */ - for (i=0; i @n - toggle privs@n\r\n"); - send_to_char(ch, " @yadmin @n - show player's privs\r\n"); - send_to_char(ch, " @yadmin help@n - show priv names and full usage\r\n"); - return; - } - else if (is_abbrev(arg, "help")) { - send_to_char(ch, "ADMIN\r\n\r\n"); - send_to_char(ch, "Usage: @yadmin @n - toggle privs@n\r\n"); - send_to_char(ch, " @yadmin all@n - turn on ALL privs\r\n"); - send_to_char(ch, " @yadmin none@n - turn off ALL privs\r\n"); - send_to_char(ch, " @yadmin default@n - Set default privs for admin level\r\n"); - send_to_char(ch, " @yadmin @n - show player's privs\r\n"); - send_to_char(ch, " @yadmin help@n - show priv names\r\n\r\n"); - send_to_char(ch, "NOTE: Works for offline players too!\r\n"); - send_to_char(ch, "Valid privs are:\r\n"); - for (i=0; *admin_flag_names[i] != '\n'; i++) { - send_to_char(ch, "@c%12.12s@n - @y%s@n\r\n", admin_flag_names[i], admin_flags[i]); - } - send_to_char(ch, "Build, AdvBuild and Poof privs for mortals require the OLC zone to be set!\r\n"); - } - else { - if (!(vict = get_char_vis(ch, arg, NULL, FIND_CHAR_WORLD))) - { - // Not logged in? - just log them in for this - CREATE(vict, struct char_data, 1); - clear_char(vict); - CREATE(vict->player_specials, struct player_special_data, 1); - - if ((player_i = load_char(arg, vict)) >= 0) { - char_to_room(vict, 0); - file = TRUE; - } else { - send_to_char(ch, "There is no such player.\r\n"); - free_char(vict); - return; - } - } - changed = FALSE; - - if (IS_NPC(vict)) { - send_to_char(ch, "%s is a mob, and mobs can't have admin privs!\r\n", GET_NAME(vict)); - } else if (GET_ADMLEVEL(vict) > GET_ADMLEVEL(ch)) { - send_to_char(ch, "%s is a higher admin level, you can't change their admin privs!\r\n", GET_NAME(vict)); - } else if (!*arg2) { - // Display player's current admin settings - send_to_char(ch, "%sAdmin information for %s%s\r\n", QBWHT, GET_NAME(vict), QNRM); - for (i=0; i < NUM_ADMFLAGS; i++) { - send_to_char(ch, "%s[%s%s%s] %s%-12.12s%s - %-40.40s%s\r\n", - QCYN, QBWHT, ((ADM_FLAGGED(vict, i)) ? "X" : " "), - QCYN, QYEL, admin_flag_names[i], - QNRM, admin_flags[i], QNRM); - } - } else if (is_abbrev(arg2, "all")) { - /* Enable ALL admin flags */ - for (i=0; i < NUM_ADMFLAGS; i++) { - if (!ADM_FLAGGED(vict, i)) { - SET_BIT_AR(ADM_FLAGS(vict), i); - send_to_char(ch, "Priv \"%s\" turned on for %s\r\n", admin_flags[i], GET_NAME(vict)); - changed = TRUE; - } - } - } else if (is_abbrev(arg2, "none")) { - /* Remove ALL admin flags */ - for (i=0; i < NUM_ADMFLAGS; i++) { - if (ADM_FLAGGED(vict, i)) { - REMOVE_BIT_AR(ADM_FLAGS(vict), i); - send_to_char(ch, "Priv \"%s\" turned off for %s\r\n", admin_flags[i], GET_NAME(vict)); - changed = TRUE; - } - } - } else if (is_abbrev(arg2, "default")) { - /* Copy current flags */ - for (i=0; i %s\r\n", QYEL, QNRM); - send_to_char(ch, "Usage: %sadvance admin %s\r\n", QYEL, QNRM); - send_to_char(ch, "%s%s may be a level name (e.g. immortal) or number.\r\n", QYEL, QNRM); + send_to_char(ch, "Advance who?\r\n"); return; } - if (GET_ADMLEVEL(ch) <= GET_ADMLEVEL(victim)) { + if (GET_LEVEL(ch) <= GET_LEVEL(victim)) { send_to_char(ch, "Maybe that's not such a great idea.\r\n"); return; } @@ -1766,120 +1489,66 @@ ACMD(do_advance) send_to_char(ch, "NO! Not on NPC's.\r\n"); return; } - if (!*level) { - send_to_char(ch, "You must specify a level!\r\n"); + if (!*level || (newlevel = atoi(level)) <= 0) { + send_to_char(ch, "That's not a level!\r\n"); return; } - /* Set MORTAL Level */ - if (!is_abbrev(level, "admin")) { - if ((newlevel = atoi(level)) <= 0) { - send_to_char(ch, "That's not a valid mortal level!\r\n"); - return; - } - if (newlevel > CONFIG_MAX_LEVEL) { - send_to_char(ch, "%d is the highest possible mortal level.\r\n", CONFIG_MAX_LEVEL); - return; - } - if (!IS_ADMIN(ch, ADMLVL_GRGOD) && newlevel > GET_LEVEL(ch)) { - send_to_char(ch, "You can't set above your own mortal level.\r\n"); - return; - } - if (newlevel == GET_LEVEL(victim)) { - send_to_char(ch, "They are already at that mortal level.\r\n"); - return; - } - oldlevel = GET_LEVEL(victim); - if (newlevel < GET_LEVEL(victim)) { - do_start(victim); /* Send 'em back to level 1, then advance */ - GET_LEVEL(victim) = newlevel; - 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); - } - - send_to_char(ch, "%s", CONFIG_OK); - - if (newlevel < oldlevel) - log("(GC) %s demoted %s from mortal level %d to %d.", - GET_NAME(ch), GET_NAME(victim), oldlevel, newlevel); - else - log("(GC) %s has advanced %s to mortal level %d (from %d)", - GET_NAME(ch), GET_NAME(victim), newlevel, oldlevel); - - gain_exp_regardless(victim, level_exp(GET_CLASS(victim), newlevel) - GET_EXP(victim)); - - } else { /* Set ADMIN Level */ - one_argument(buf, level); - - if (!*level) { - send_to_char(ch, "You must specify a level!\r\n"); - return; - } - if ((newlevel = get_admin_level_by_string(level)) < 0) { - send_to_char(ch, "That's not a level!\r\n"); - return; - } - if (newlevel > ADMLVL_IMPL) { - send_to_char(ch, "%s (level %d) is the highest possible admin level.\r\n", admin_level_names[ADMLVL_IMPL], ADMLVL_IMPL); - return; - } - if (newlevel > GET_ADMLEVEL(ch)) { - send_to_char(ch, "Yeah, right.\r\n"); - return; - } - if (newlevel == GET_ADMLEVEL(victim)) { - send_to_char(ch, "They are already at that level.\r\n"); - return; - } - oldlevel = GET_ADMLEVEL(victim); - if (newlevel < GET_ADMLEVEL(victim)) { - do_start(victim); - 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); - } - - set_admin_level(victim, newlevel); - send_to_char(ch, "%s", CONFIG_OK); - - if (newlevel < oldlevel) - log("(GC) %s demoted %s from admin level %d to %d.", - GET_NAME(ch), GET_NAME(victim), oldlevel, newlevel); - else - log("(GC) %s has advanced %s to admin level %d (from %d)", - GET_NAME(ch), GET_NAME(victim), newlevel, oldlevel); - - if (oldlevel >= ADMLVL_IMMORT && newlevel < ADMLVL_IMMORT) { - /* If they are no longer an immortal, remove the immortal only flags. */ - REMOVE_BIT_AR(PRF_FLAGS(victim), PRF_LOG1); - REMOVE_BIT_AR(PRF_FLAGS(victim), PRF_LOG2); - REMOVE_BIT_AR(PRF_FLAGS(victim), PRF_NOHASSLE); - REMOVE_BIT_AR(PRF_FLAGS(victim), PRF_HOLYLIGHT); - REMOVE_BIT_AR(PRF_FLAGS(victim), PRF_SHOWVNUMS); - if (!PLR_FLAGGED(victim, PLR_NOWIZLIST)) - run_autowiz(); - } else if (oldlevel < ADMLVL_IMMORT && newlevel >= ADMLVL_IMMORT) { - SET_BIT_AR(PRF_FLAGS(victim), PRF_LOG2); - 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; - } + if (newlevel > LVL_IMPL) { + send_to_char(ch, "%d is the highest possible level.\r\n", LVL_IMPL); + return; } + if (newlevel > GET_LEVEL(ch)) { + send_to_char(ch, "Yeah, right.\r\n"); + return; + } + if (newlevel == GET_LEVEL(victim)) { + send_to_char(ch, "They are already at that level.\r\n"); + return; + } + oldlevel = GET_LEVEL(victim); + if (newlevel < GET_LEVEL(victim)) { + do_start(victim); + GET_LEVEL(victim) = newlevel; + 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); +} + + 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); + else + log("(GC) %s has advanced %s to level %d (from %d)", + 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. */ + REMOVE_BIT_AR(PRF_FLAGS(victim), PRF_LOG1); + REMOVE_BIT_AR(PRF_FLAGS(victim), PRF_LOG2); + REMOVE_BIT_AR(PRF_FLAGS(victim), PRF_NOHASSLE); + REMOVE_BIT_AR(PRF_FLAGS(victim), PRF_HOLYLIGHT); + REMOVE_BIT_AR(PRF_FLAGS(victim), PRF_SHOWVNUMS); + if (!PLR_FLAGGED(victim, PLR_NOWIZLIST)) + run_autowiz(); + } else if (oldlevel < LVL_IMMORT && newlevel >= LVL_IMMORT) { + SET_BIT_AR(PRF_FLAGS(victim), PRF_LOG2); + 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; + } + + gain_exp_regardless(victim, level_exp(GET_CLASS(victim), newlevel) - GET_EXP(victim)); save_char(victim); } @@ -1893,14 +1562,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")) - { - mudlog(NRM, MAX(ADMLVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s restored all",GET_NAME(ch)); + 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) || IS_ADMIN(vict, ADMLVL_IMMORT)) - continue; + if (!IS_PLAYING(j) || !(vict = j->character) || GET_LEVEL(vict) >= LVL_IMMORT) + continue; GET_HIT(vict) = GET_MAX_HIT(vict); GET_MANA(vict) = GET_MAX_MANA(vict); @@ -1913,26 +1582,26 @@ ACMD(do_restore) } 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_ADMLEVEL(vict) >= GET_ADMLEVEL(ch)) + else if (!IS_NPC(vict) && ch != vict && GET_LEVEL(vict) >= GET_LEVEL(ch)) send_to_char(ch, "They don't need your help.\r\n"); else { GET_HIT(vict) = GET_MAX_HIT(vict); GET_MANA(vict) = GET_MAX_MANA(vict); GET_MOVE(vict) = GET_MAX_MOVE(vict); - if (!IS_NPC(vict) && IS_ADMIN(ch, ADMLVL_GRGOD)) { - if (IS_ADMIN(vict, ADMLVL_IMMORT)) { + if (!IS_NPC(vict) && GET_LEVEL(ch) >= LVL_GRGOD) { + if (GET_LEVEL(vict) >= LVL_IMMORT) for (i = 1; i <= MAX_SKILLS; i++) SET_SKILL(vict, i, 100); - } - if (IS_ADMIN(vict, ADMLVL_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 = 18; - vict->real_abils.con = 25; - vict->real_abils.cha = 25; + + 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 = 18; + vict->real_abils.con = 25; + vict->real_abils.cha = 25; } } update_pos(vict); @@ -1961,10 +1630,10 @@ static void perform_immort_invis(struct char_data *ch, int level) for (tch = world[IN_ROOM(ch)].people; tch; tch = tch->next_in_room) { if (tch == ch || IS_NPC(tch)) continue; - if (GET_ADMLEVEL(tch) >= GET_INVIS_LEV(ch) && GET_ADMLEVEL(tch) < level) + 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); - if (GET_ADMLEVEL(tch) < GET_INVIS_LEV(ch) && GET_ADMLEVEL(tch) >= level) + 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); } @@ -1988,11 +1657,11 @@ ACMD(do_invis) if (GET_INVIS_LEV(ch) > 0) perform_immort_vis(ch); else - perform_immort_invis(ch, GET_ADMLEVEL(ch)); + perform_immort_invis(ch, GET_LEVEL(ch)); } else { level = atoi(arg); - if (level > GET_ADMLEVEL(ch)) - send_to_char(ch, "You can't go invisible above your own admin level.\r\n"); + if (level > GET_LEVEL(ch)) + send_to_char(ch, "You can't go invisible above your own level.\r\n"); else if (level < 1) perform_immort_vis(ch); else @@ -2014,7 +1683,7 @@ ACMD(do_gecho) if (IS_PLAYING(pt) && pt->character && pt->character != ch) send_to_char(pt->character, "%s\r\n", argument); - mudlog(CMP, MAX(ADMLVL_BUILDER, GET_INVIS_LEV(ch)), TRUE, "(GC) %s gechoed: %s", GET_NAME(ch), argument); + mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE, "(GC) %s gechoed: %s", GET_NAME(ch), argument); if (PRF_FLAGGED(ch, PRF_NOREPEAT)) send_to_char(ch, "%s", CONFIG_OK); @@ -2040,7 +1709,7 @@ ACMD(do_dc) send_to_char(ch, "No such connection.\r\n"); return; } - if (d->character && GET_ADMLEVEL(d->character) >= GET_ADMLEVEL(ch)) { + if (d->character && GET_LEVEL(d->character) >= GET_LEVEL(ch)) { if (!CAN_SEE(ch, d->character)) send_to_char(ch, "No such connection.\r\n"); else @@ -2325,7 +1994,7 @@ void list_llog_entries(struct char_data *ch) i = fread(&llast, sizeof(struct last_entry), 1, fp); while(!feof(fp)) { - send_to_char(ch, "%10s %d %s %s", llast.username, llast.punique, + send_to_char(ch, "%10s\t%d\t%s\t%s", llast.username, llast.punique, last_array[llast.close_type], ctime(&llast.time)); i = fread(&llast, sizeof(struct last_entry), 1, fp); } @@ -2357,7 +2026,7 @@ ACMD(do_last) if (*argument) { /* parse it */ half_chop(argument, arg, argument); while (*arg) { - if ((*arg == '*') && (IS_ADMIN(ch, ADMLVL_IMPL))) { + if ((*arg == '*') && (GET_LEVEL(ch) == LVL_IMPL)) { list_llog_entries(ch); return; } @@ -2381,13 +2050,13 @@ ACMD(do_last) return; } - if ((GET_ADMLEVEL(vict) > GET_ADMLEVEL(ch)) && (!IS_ADMIN(ch, ADMLVL_IMPL))) { + if ((GET_LEVEL(vict) > GET_LEVEL(ch)) && (GET_LEVEL(ch) < LVL_IMPL)) { send_to_char(ch, "You are not sufficiently godly for that!\r\n"); return; } - send_to_char(ch, "[%5ld] [%2d %11s %s] %-12s : %-18s : %-20s\r\n", - GET_IDNUM(vict), (int) GET_LEVEL(vict), admin_level_names[((int) GET_ADMLEVEL(vict))], + send_to_char(ch, "[%5ld] [%2d %s] %-12s : %-18s : %-20s\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)", ctime(&vict->player.time.logon)); @@ -2443,40 +2112,40 @@ ACMD(do_force) if (!*arg || !*to_force) send_to_char(ch, "Whom do you wish to force do what?\r\n"); - else if ((!ADM_FLAGGED(ch, ADM_FORCEMASS)) || (str_cmp("all", arg) && str_cmp("room", arg))) { + else if ((GET_LEVEL(ch) < LVL_GRGOD) || (str_cmp("all", arg) && str_cmp("room", arg))) { if (!(vict = get_char_vis(ch, arg, NULL, FIND_CHAR_WORLD))) send_to_char(ch, "%s", CONFIG_NOPERSON); - else if (!IS_NPC(vict) && !IS_ADMIN(ch, ADMLVL_GOD)) + else if (!IS_NPC(vict) && GET_LEVEL(ch) < LVL_GOD) send_to_char(ch, "You cannot force players.\r\n"); - else if (!IS_NPC(vict) && GET_ADMLEVEL(ch) <= GET_ADMLEVEL(vict)) + else if (!IS_NPC(vict) && GET_LEVEL(ch) <= GET_LEVEL(vict)) send_to_char(ch, "No, no, no!\r\n"); else { send_to_char(ch, "%s", CONFIG_OK); act(buf1, TRUE, ch, NULL, vict, TO_VICT); - mudlog(CMP, MAX(ADMLVL_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(ADMLVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s forced room %d to %s", + 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); for (vict = world[IN_ROOM(ch)].people; vict; vict = next_force) { next_force = vict->next_in_room; - if (!IS_NPC(vict) && GET_ADMLEVEL(vict) >= GET_ADMLEVEL(ch)) - continue; + if (!IS_NPC(vict) && GET_LEVEL(vict) >= GET_LEVEL(ch)) + continue; act(buf1, TRUE, ch, NULL, vict, TO_VICT); command_interpreter(vict, to_force); } } else { /* force all */ send_to_char(ch, "%s", CONFIG_OK); - mudlog(NRM, MAX(ADMLVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s forced all to %s", GET_NAME(ch), to_force); + mudlog(NRM, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s forced all to %s", GET_NAME(ch), to_force); for (i = descriptor_list; i; i = next_desc) { next_desc = i->next; - if (STATE(i) != CON_PLAYING || !(vict = i->character) || (!IS_NPC(vict) && GET_ADMLEVEL(vict) >= GET_ADMLEVEL(ch))) - continue; + if (STATE(i) != CON_PLAYING || !(vict = i->character) || (!IS_NPC(vict) && GET_LEVEL(vict) >= GET_LEVEL(ch))) + continue; act(buf1, TRUE, ch, NULL, vict, TO_VICT); command_interpreter(vict, to_force); } @@ -2490,7 +2159,7 @@ ACMD(do_wiznet) struct descriptor_data *d; char emote = FALSE; char any = FALSE; - int level = ADMLVL_IMMORT; + int level = LVL_IMMORT; skip_spaces(&argument); delete_doubledollar(argument); @@ -2506,8 +2175,8 @@ ACMD(do_wiznet) one_argument(argument + 1, buf1); if (is_number(buf1)) { half_chop(argument+1, buf1, argument); - level = MAX(atoi(buf1), ADMLVL_IMMORT); - if (level > GET_ADMLEVEL(ch)) { + 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; } @@ -2518,7 +2187,7 @@ ACMD(do_wiznet) case '@': send_to_char(ch, "God channel status:\r\n"); for (any = 0, d = descriptor_list; d; d = d->next) { - if (STATE(d) != CON_PLAYING || !IS_ADMIN(d->character, ADMLVL_IMMORT)) + if (STATE(d) != CON_PLAYING || GET_LEVEL(d->character) < LVL_IMMORT) continue; if (!CAN_SEE(ch, d->character)) continue; @@ -2546,7 +2215,7 @@ ACMD(do_wiznet) send_to_char(ch, "Don't bother the gods like that!\r\n"); return; } - if (level > ADMLVL_IMMORT) { + if (level > LVL_IMMORT) { snprintf(buf1, sizeof(buf1), "@c%s: <%d> %s%s@n\r\n", GET_NAME(ch), level, emote ? "<--- " : "", argument); snprintf(buf2, sizeof(buf1), "@cSomeone: <%d> %s%s@n\r\n", level, emote ? "<--- " : "", argument); } else { @@ -2555,7 +2224,7 @@ ACMD(do_wiznet) } for (d = descriptor_list; d; d = d->next) { - if (IS_PLAYING(d) && (GET_ADMLEVEL(d->character) >= level) && + if (IS_PLAYING(d) && (GET_LEVEL(d->character) >= level) && (!PRF_FLAGGED(d->character, PRF_NOWIZ)) && (d != ch->desc || !(PRF_FLAGGED(d->character, PRF_NOREPEAT)))) { if (CAN_SEE(d->character, ch)) { @@ -2582,14 +2251,14 @@ ACMD(do_zreset) one_argument(argument, arg); if (*arg == '*') { - if (!IS_ADMIN(ch, ADMLVL_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 { for (i = 0; i <= top_of_zone_table; i++) reset_zone(i); send_to_char(ch, "Reset world.\r\n"); - mudlog(NRM, MAX(ADMLVL_GRGOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s reset entire world.", GET_NAME(ch)); + mudlog(NRM, MAX(LVL_GRGOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s reset entire world.", GET_NAME(ch)); return; } } else if (*arg == '.' || !*arg) i = world[IN_ROOM(ch)].zone; @@ -2599,10 +2268,10 @@ ACMD(do_zreset) if (zone_table[i].number == j) break; } - if (i <= top_of_zone_table && (can_edit_zone(ch, i) || IS_ADMIN(ch, ADMLVL_GOD))) { + 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(ADMLVL_GRGOD, 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_GRGOD, 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)); } @@ -2623,7 +2292,7 @@ ACMD(do_wizutil) send_to_char(ch, "There is no such player.\r\n"); else if (IS_NPC(vict)) send_to_char(ch, "You can't do that to a mob!\r\n"); - else if (GET_ADMLEVEL(vict) >= GET_ADMLEVEL(ch) && vict != ch) + else if (GET_LEVEL(vict) >= GET_LEVEL(ch) && vict != ch) send_to_char(ch, "Hmmm...you'd better not.\r\n"); else { switch (subcmd) { @@ -2644,17 +2313,17 @@ ACMD(do_wizutil) REMOVE_BIT_AR(PLR_FLAGS(vict), PLR_KILLER); send_to_char(ch, "Pardoned.\r\n"); send_to_char(vict, "You have been pardoned by the Gods!\r\n"); - mudlog(BRF, MAX(ADMLVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s pardoned by %s", GET_NAME(vict), GET_NAME(ch)); + mudlog(BRF, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s pardoned by %s", GET_NAME(vict), GET_NAME(ch)); break; case SCMD_NOTITLE: result = PLR_TOG_CHK(vict, PLR_NOTITLE); - mudlog(NRM, MAX(ADMLVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) Notitle %s for %s by %s.", + 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)); 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(ADMLVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) Mute %s for %s by %s.", + 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)); send_to_char(ch, "(GC) Mute %s for %s by %s.\r\n", ONOFF(result), GET_NAME(vict), GET_NAME(ch)); break; @@ -2668,23 +2337,23 @@ ACMD(do_wizutil) return; } SET_BIT_AR(PLR_FLAGS(vict), PLR_FROZEN); - GET_FREEZE_LEV(vict) = GET_ADMLEVEL(ch); + 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(ch, "Frozen.\r\n"); act("A sudden cold wind conjured from nowhere freezes $n!", FALSE, vict, 0, 0, TO_ROOM); - mudlog(BRF, MAX(ADMLVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s frozen by %s.", GET_NAME(vict), GET_NAME(ch)); + 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_ADMLEVEL(ch)) { - send_to_char(ch, "Sorry, a level %d God froze %s... you can't unfreeze %s.\r\n", + 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; + return; } - mudlog(BRF, MAX(ADMLVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s un-frozen by %s.", GET_NAME(vict), GET_NAME(ch)); + 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); send_to_char(vict, "A fireball suddenly explodes in front of you, melting the ice!\r\nYou feel thawed.\r\n"); send_to_char(ch, "Thawed.\r\n"); @@ -2692,15 +2361,15 @@ 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: @@ -2796,17 +2465,19 @@ ACMD(do_show) const char *cmd; const char level; } fields[] = { - { "nothing", ADMLVL_MORTAL }, /* 0 */ - { "zones", ADMLVL_IMMORT }, /* 1 */ - { "player", ADMLVL_IMMORT }, - { "rent", ADMLVL_IMMORT }, - { "stats", ADMLVL_IMMORT }, - { "errors", ADMLVL_IMMORT }, /* 5 */ - { "death", ADMLVL_IMMORT }, - { "godrooms", ADMLVL_IMMORT }, - { "shops", ADMLVL_IMMORT }, - { "houses", ADMLVL_IMMORT }, - { "snoop", ADMLVL_IMMORT }, /* 10 */ + { "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 }, + { "experience", LVL_IMMORT }, { "\n", 0 } }; @@ -2815,7 +2486,7 @@ ACMD(do_show) if (!*argument) { send_to_char(ch, "Show options:\r\n"); for (j = 0, i = 1; fields[i].level; i++) - if (fields[i].level <= GET_ADMLEVEL(ch)) + if (fields[i].level <= GET_LEVEL(ch)) send_to_char(ch, "%-15s%s", fields[i].cmd, (!(++j % 5) ? "\r\n" : "")); send_to_char(ch, "\r\n"); return; @@ -2827,7 +2498,7 @@ ACMD(do_show) if (!strncmp(field, fields[l].cmd, strlen(field))) break; - if (GET_ADMLEVEL(ch) < fields[l].level) { + if (GET_LEVEL(ch) < fields[l].level) { send_to_char(ch, "You are not godly enough for that!\r\n"); return; } @@ -2895,8 +2566,8 @@ ACMD(do_show) free_char(vict); return; } - send_to_char(ch, "Player: %-12s (%s) [%2d %11s %s]\r\n", GET_NAME(vict), - genders[(int) GET_SEX(vict)], GET_LEVEL(vict), admin_level_names[(GET_ADMLEVEL(vict))], class_abbrevs[(int) + 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)]); send_to_char(ch, "Au: %-8d Bal: %-8d Exp: %-8d Align: %-5d Lessons: %-3d\r\n", GET_GOLD(vict), GET_BANK_GOLD(vict), GET_EXP(vict), @@ -3024,7 +2695,7 @@ ACMD(do_show) for (d = descriptor_list; d; d = d->next) { if (d->snooping == NULL || d->character == NULL) continue; - if (STATE(d) != CON_PLAYING || GET_ADMLEVEL(ch) < GET_ADMLEVEL(d->character)) + if (STATE(d) != CON_PLAYING || GET_LEVEL(ch) < GET_LEVEL(d->character)) continue; if (!CAN_SEE(ch, d->character) || IN_ROOM(d->character) == NOWHERE) continue; @@ -3035,6 +2706,42 @@ ACMD(do_show) send_to_char(ch, "No one is currently snooping.\r\n"); break; + /* show thaco */ + case 11: + 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)); + if (len + nlen >= sizeof(buf)) + break; + len += nlen; + } + + page_string(ch->desc, buf, TRUE); + break; + + /* show experience tables */ + 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)); + if (len + nlen >= sizeof(buf)) + break; + len += nlen; + } + + page_string(ch->desc, buf, TRUE); + break; + /* show what? */ default: send_to_char(ch, "Sorry, I don't understand that.\r\n"); @@ -3065,65 +2772,64 @@ ACMD(do_show) const char pcnpc; const char type; } set_fields[] = { - { "ac", ADMLVL_BUILDER, BOTH, NUMBER }, /* 0 */ - { "admlevel", ADMLVL_GRGOD, PC, NUMBER }, /* 1 */ - { "afk", ADMLVL_BUILDER, PC, BINARY }, /* 2 */ - { "age", ADMLVL_GOD, BOTH, NUMBER }, - { "align", ADMLVL_BUILDER, BOTH, NUMBER }, - { "bank", ADMLVL_BUILDER, PC, NUMBER }, /* 5 */ - { "brief", ADMLVL_GOD, PC, BINARY }, - { "cha", ADMLVL_BUILDER, BOTH, NUMBER }, - { "class", ADMLVL_BUILDER, BOTH, MISC }, - { "color", ADMLVL_GOD, PC, BINARY }, - { "con", ADMLVL_BUILDER, BOTH, NUMBER }, /* 10 */ - { "damroll", ADMLVL_BUILDER, BOTH, NUMBER }, - { "deleted", ADMLVL_IMPL, PC, BINARY }, - { "dex", ADMLVL_BUILDER, BOTH, NUMBER }, - { "drunk", ADMLVL_BUILDER, BOTH, MISC }, - { "exp", ADMLVL_GOD, BOTH, NUMBER }, /* 15 */ - { "frozen", ADMLVL_GRGOD, PC, BINARY }, - { "gold", ADMLVL_BUILDER, BOTH, NUMBER }, - { "height", ADMLVL_BUILDER, BOTH, NUMBER }, - { "hitpoints", ADMLVL_BUILDER, BOTH, NUMBER }, - { "hitroll", ADMLVL_BUILDER, BOTH, NUMBER }, /* 20 */ - { "hunger", ADMLVL_BUILDER, BOTH, MISC }, - { "int", ADMLVL_BUILDER, BOTH, NUMBER }, - { "invis", ADMLVL_GOD, PC, NUMBER }, - { "invstart", ADMLVL_BUILDER, PC, BINARY }, - { "killer", ADMLVL_GOD, PC, BINARY }, /* 25 */ - { "level", ADMLVL_GRGOD, BOTH, NUMBER }, - { "loadroom", ADMLVL_BUILDER, PC, MISC }, - { "mana", ADMLVL_BUILDER, BOTH, NUMBER }, - { "maxhit", ADMLVL_BUILDER, BOTH, NUMBER }, - { "maxmana", ADMLVL_BUILDER, BOTH, NUMBER }, /* 30 */ - { "maxmove", ADMLVL_BUILDER, BOTH, NUMBER }, - { "move", ADMLVL_BUILDER, BOTH, NUMBER }, - { "name", ADMLVL_IMMORT, PC, MISC }, - { "nodelete", ADMLVL_GOD, PC, BINARY }, - { "nohassle", ADMLVL_GOD, PC, BINARY }, /* 35 */ - { "nosummon", ADMLVL_BUILDER, PC, BINARY }, - { "nowizlist", ADMLVL_GRGOD, PC, BINARY }, - { "olc", ADMLVL_GRGOD, PC, MISC }, - { "password", ADMLVL_GRGOD, PC, MISC }, - { "poofin", ADMLVL_IMMORT, PC, MISC }, /* 40 */ - { "poofout", ADMLVL_IMMORT, PC, MISC }, - { "practices", ADMLVL_GOD, PC, NUMBER }, - { "quest", ADMLVL_GOD, PC, BINARY }, - { "questhistory",ADMLVL_GOD, PC, NUMBER }, - { "questpoints", ADMLVL_GOD, PC, NUMBER }, /* 45 */ - { "room", ADMLVL_BUILDER, BOTH, NUMBER }, - { "screenwidth", ADMLVL_GOD, PC, NUMBER }, - { "sex", ADMLVL_GOD, BOTH, MISC }, - { "showvnums", ADMLVL_BUILDER, PC, BINARY }, - { "siteok", ADMLVL_GOD, PC, BINARY }, /* 50 */ - { "str", ADMLVL_BUILDER, BOTH, NUMBER }, - { "stradd", ADMLVL_BUILDER, BOTH, NUMBER }, - { "thief", ADMLVL_GOD, PC, BINARY }, - { "thirst", ADMLVL_BUILDER, BOTH, MISC }, - { "title", ADMLVL_GOD, PC, MISC }, /* 55 */ - { "variable", ADMLVL_GRGOD, PC, MISC }, - { "weight", ADMLVL_BUILDER, BOTH, NUMBER }, - { "wis", ADMLVL_BUILDER, BOTH, NUMBER }, + { "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 } }; @@ -3134,13 +2840,13 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c room_vnum rvnum; /* Check to make sure all the levels are correct */ - if (!IS_ADMIN(ch, ADMLVL_IMPL)) { - if (!IS_NPC(vict) && GET_ADMLEVEL(ch) <= GET_ADMLEVEL(vict) && vict != ch) { + if (GET_LEVEL(ch) != LVL_IMPL) { + if (!IS_NPC(vict) && GET_LEVEL(ch) <= GET_LEVEL(vict) && vict != ch) { send_to_char(ch, "Maybe that's not such a great idea...\r\n"); return (0); } } - if (GET_ADMLEVEL(ch) < set_fields[mode].level) { + if (GET_LEVEL(ch) < set_fields[mode].level) { send_to_char(ch, "You are not godly enough for that!\r\n"); return (0); } @@ -3175,15 +2881,7 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c case 1: /* afk */ SET_OR_REMOVE(PRF_FLAGS(vict), PRF_AFK); break; - case 2: /* admlevel */ - if ((IS_NPC(vict) || value > GET_ADMLEVEL(ch)) || value > ADMLVL_IMPL) { - send_to_char(ch, "You can't set above your own admin level.\r\n"); - return (0); - } - RANGE(1, ADMLVL_IMPL); - vict->player_specials->saved.adm_level = value; - break; - case 3: /* age */ + case 2: /* age */ if (value < 2 || value > 200) { /* Arbitrary limits. */ send_to_char(ch, "Ages 2 to 200 accepted.\r\n"); return (0); @@ -3193,59 +2891,59 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c * 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 4: /* align */ + case 3: /* align */ GET_ALIGNMENT(vict) = RANGE(-1000, 1000); affect_total(vict); break; - case 5: /* bank */ + case 4: /* bank */ GET_BANK_GOLD(vict) = RANGE(0, 100000000); break; - case 6: /* brief */ + case 5: /* brief */ SET_OR_REMOVE(PRF_FLAGS(vict), PRF_BRIEF); break; - case 7: /* cha */ - if (IS_NPC(vict) || IS_ADMIN(vict, ADMLVL_GRGOD)) + 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 8: /* class */ + 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 9: /* color */ + case 8: /* color */ SET_OR_REMOVE(PRF_FLAGS(vict), (PRF_COLOR_1)); SET_OR_REMOVE(PRF_FLAGS(vict), (PRF_COLOR_2)); break; - case 10: /* con */ - if (IS_NPC(vict) || IS_ADMIN(vict, ADMLVL_GRGOD)) + 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 11: /* damroll */ + case 10: /* damroll */ vict->points.damroll = RANGE(-20, 20); affect_total(vict); break; - case 12: /* delete */ + case 11: /* delete */ SET_OR_REMOVE(PLR_FLAGS(vict), PLR_DELETED); break; - case 13: /* dex */ - if (IS_NPC(vict) || IS_ADMIN(vict, ADMLVL_GRGOD)) + 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 14: /* drunk */ + 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)); @@ -3259,32 +2957,32 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c return (0); } break; - case 15: /* exp */ + case 14: /* exp */ vict->points.exp = RANGE(0, 50000000); break; - case 16: /* frozen */ + 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 17: /* gold */ + case 16: /* gold */ GET_GOLD(vict) = RANGE(0, 100000000); break; - case 18: /* height */ + case 17: /* height */ GET_HEIGHT(vict) = value; affect_total(vict); break; - case 19: /* hit */ + case 18: /* hit */ vict->points.hit = RANGE(-9, vict->points.max_hit); affect_total(vict); break; - case 20: /* hitroll */ + case 19: /* hitroll */ vict->points.hitroll = RANGE(-20, 20); affect_total(vict); break; - case 21: /* hunger */ + 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)); @@ -3298,40 +2996,36 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c return (0); } break; - case 22: /* int */ - if (IS_NPC(vict) || IS_ADMIN(vict, ADMLVL_GRGOD)) + 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 23: /* invis */ - if (!IS_ADMIN(vict, ADMLVL_IMPL) && ch != vict) { + 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_ADMLEVEL(vict)); + GET_INVIS_LEV(vict) = RANGE(0, GET_LEVEL(vict)); break; - case 24: /* invistart */ + case 23: /* invistart */ SET_OR_REMOVE(PLR_FLAGS(vict), PLR_INVSTART); break; - case 25: /* killer */ + case 24: /* killer */ SET_OR_REMOVE(PLR_FLAGS(vict), PLR_KILLER); break; - case 26: /* level */ - if (!IS_NPC(vict) && !IS_ADMIN(ch, ADMLVL_GRGOD)) { - if (value > GET_LEVEL(ch)) { - send_to_char(ch, "You can't set higher than your own level.\r\n"); - } else if (value > CONFIG_MAX_LEVEL) { - send_to_char(ch, "Maximum level is %d.\r\n", CONFIG_MAX_LEVEL); - } + 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, CONFIG_MAX_LEVEL); + RANGE(1, LVL_IMPL); vict->player.level = value; break; - case 27: /* loadroom */ + case 26: /* loadroom */ if (!str_cmp(val_arg, "off")) { REMOVE_BIT_AR(PLR_FLAGS(vict), PLR_LOADROOM); } else if (is_number(val_arg)) { @@ -3349,28 +3043,28 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c return (0); } break; - case 28: /* mana */ + case 27: /* mana */ vict->points.mana = RANGE(0, vict->points.max_mana); affect_total(vict); break; - case 29: /* maxhit */ + case 28: /* maxhit */ vict->points.max_hit = RANGE(1, 5000); affect_total(vict); break; - case 30: /* maxmana */ + case 29: /* maxmana */ vict->points.max_mana = RANGE(1, 5000); affect_total(vict); break; - case 31: /* maxmove */ + case 30: /* maxmove */ vict->points.max_move = RANGE(1, 5000); affect_total(vict); break; - case 32: /* move */ + case 31: /* move */ vict->points.move = RANGE(0, vict->points.max_move); affect_total(vict); break; - case 33: /* name */ - if (ch != vict && (!IS_ADMIN(ch, ADMLVL_IMPL))) { + 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); } @@ -3379,24 +3073,24 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c return (0); } break; - case 34: /* nodelete */ + case 33: /* nodelete */ SET_OR_REMOVE(PLR_FLAGS(vict), PLR_NODELETE); break; - case 35: /* nohassle */ - if ((!IS_ADMIN(ch, ADMLVL_GOD)) && ch != vict) { + 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 36: /* nosummon */ + 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 37: /* nowiz */ + case 36: /* nowiz */ SET_OR_REMOVE(PLR_FLAGS(vict), PLR_NOWIZLIST); break; - case 38: /* olc */ + 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")) @@ -3411,8 +3105,8 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c } else GET_OLC_ZONE(vict) = atoi(val_arg); break; - case 39: /* password */ - if (IS_ADMIN(vict, ADMLVL_GRGOD)) { + case 38: /* password */ + if (GET_LEVEL(vict) >= LVL_GRGOD) { send_to_char(ch, "You cannot change that.\r\n"); return (0); } @@ -3420,59 +3114,39 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c *(GET_PASSWD(vict) + MAX_PWD_LENGTH) = '\0'; send_to_char(ch, "Password changed to '%s'.\r\n", val_arg); break; - case 40: /* poofin */ - if ((vict == ch) || (IS_ADMIN(ch, ADMLVL_IMPL))) { + case 39: /* poofin */ + if ((vict == ch) || (GET_LEVEL(ch) == LVL_IMPL)) { skip_spaces(&val_arg); if (POOFIN(vict)) free(POOFIN(vict)); - if (!*val_arg) + if (!*val_arg) POOFIN(vict) = NULL; else POOFIN(vict) = strdup(val_arg); } break; - case 41: /* poofout */ - if ((vict == ch) || (IS_ADMIN(ch, ADMLVL_IMPL))) { + case 40: /* poofout */ + if ((vict == ch) || (GET_LEVEL(ch) == LVL_IMPL)) { skip_spaces(&val_arg); if (POOFOUT(vict)) free(POOFOUT(vict)); - if (!*val_arg) + if (!*val_arg) POOFOUT(vict) = NULL; else POOFOUT(vict) = strdup(val_arg); } break; - case 42: /* practices */ + case 41: /* practices */ GET_PRACTICES(vict) = RANGE(0, 100); break; - case 43: /* quest */ + case 42: /* quest */ SET_OR_REMOVE(PRF_FLAGS(vict), PRF_QUEST); break; - case 44: /* questpoints */ - GET_QUESTPOINTS(vict) = RANGE(0, 100000000); - break; - case 45: /* 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; - case 46: /* room */ + case 43: /* room */ if ((rnum = real_room(value)) == NOWHERE) { send_to_char(ch, "No room exists with that number.\r\n"); return (0); @@ -3481,24 +3155,24 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c char_from_room(vict); char_to_room(vict, rnum); break; - case 47: /* screenwidth */ + case 44: /* screenwidth */ GET_SCREEN_WIDTH(vict) = RANGE(40, 200); break; - case 48: /* sex */ + 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 49: /* showvnums */ + case 46: /* showvnums */ SET_OR_REMOVE(PRF_FLAGS(vict), PRF_SHOWVNUMS); break; - case 50: /* siteok */ + case 47: /* siteok */ SET_OR_REMOVE(PLR_FLAGS(vict), PLR_SITEOK); break; - case 51: /* str */ - if (IS_NPC(vict) || IS_ADMIN(vict, ADMLVL_GRGOD)) + case 48: /* str */ + if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_GRGOD) RANGE(3, 25); else RANGE(3, 18); @@ -3506,16 +3180,16 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c vict->real_abils.str_add = 0; affect_total(vict); break; - case 52: /* stradd */ + case 49: /* stradd */ vict->real_abils.str_add = RANGE(0, 100); if (value > 0) vict->real_abils.str = 18; affect_total(vict); break; - case 53: /* thief */ + case 50: /* thief */ SET_OR_REMOVE(PLR_FLAGS(vict), PLR_THIEF); break; - case 54: /* thirst */ + 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)); @@ -3529,25 +3203,45 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c return (0); } break; - case 55: /* title */ + 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 56: /* variable */ + case 53: /* variable */ return perform_set_dg_var(ch, vict, val_arg); break; - case 57: /* weight */ + case 54: /* weight */ GET_WEIGHT(vict) = value; affect_total(vict); break; - case 58: /* wis */ - if (IS_NPC(vict) || IS_ADMIN(vict, ADMLVL_GRGOD)) + 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); @@ -3573,9 +3267,9 @@ void show_set_help(struct char_data *ch) 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_ADMLEVEL(ch)) { + 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) - ADMLVL_IMMORT)], + 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; @@ -3676,7 +3370,7 @@ ACMD(do_set) ACMD(do_saveall) { - if (!IS_ADMIN(ch, ADMLVL_BUILDER)) + if (GET_LEVEL(ch) < LVL_BUILDER) send_to_char (ch, "You are not holy enough to use this privelege.\n\r"); else { save_all(); @@ -3736,7 +3430,7 @@ ACMD(do_links) #define MAX_HITROLL_ALLOWED MAX(GET_LEVEL(mob)/3, 1) #define MAX_MOB_GOLD_ALLOWED GET_LEVEL(mob)*3000 #define MAX_EXP_ALLOWED GET_LEVEL(mob)*GET_LEVEL(mob) * 120 -#define MAX_LEVEL_ALLOWED CONFIG_MAX_LEVEL +#define MAX_LEVEL_ALLOWED LVL_IMPL #define GET_OBJ_AVG_DAM(obj) (((GET_OBJ_VAL(obj, 2) + 1) / 2.0) * GET_OBJ_VAL(obj, 1)) /* arbitrary limit for per round dam */ #define MAX_MOB_DAM_ALLOWED 500 @@ -4011,10 +3705,10 @@ ACMD (do_zcheck) GET_OBJ_COST(obj), MAX_OBJ_COST); } - if (GET_OBJ_LEVEL(obj) > CONFIG_MAX_LEVEL && (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), CONFIG_MAX_LEVEL); + GET_OBJ_LEVEL(obj), LVL_IMMORT-1); if (obj->action_description && *obj->action_description && GET_OBJ_TYPE(obj) != ITEM_STAFF && @@ -4511,7 +4205,7 @@ ACMD(do_zpurge) send_to_char(ch, "That isn't a valid zone number!\r\n"); return; } - if (!IS_ADMIN(ch, ADMLVL_GOD) && !can_edit_zone(ch, zone)) { + if (GET_LEVEL(ch) < LVL_GOD && !can_edit_zone(ch, zone)) { send_to_char(ch, "You can only purge your own zone!\r\n"); return; } @@ -4520,14 +4214,14 @@ 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(ADMLVL_GRGOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s purged zone %d (%s)", GET_NAME(ch), 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 { for (room = 0; room <= top_of_world; room++) { purge_room(room); } send_to_char(ch, "Purged world.\r\n"); - mudlog(NRM, MAX(ADMLVL_GRGOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s purged entire world.", GET_NAME(ch)); + mudlog(NRM, MAX(LVL_GRGOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s purged entire world.", GET_NAME(ch)); } } @@ -4563,23 +4257,23 @@ ACMD(do_file) char *file; /* The file location, relative to the working dir. */ int read_backwards; /* Should the file be read backwards by default? */ } fields[] = { - { "xnames", ADMLVL_GOD, XNAME_FILE, TRUE}, - { "levels", ADMLVL_GOD, LEVELS_LOGFILE, TRUE}, - { "rip", ADMLVL_GOD, RIP_LOGFILE, TRUE}, - { "players", ADMLVL_GOD, NEWPLAYERS_LOGFILE, TRUE}, - { "rentgone", ADMLVL_GOD, RENTGONE_LOGFILE, TRUE}, - { "errors", ADMLVL_GOD, ERRORS_LOGFILE, TRUE}, - { "godcmds", ADMLVL_GOD, GODCMDS_LOGFILE, TRUE}, - { "syslog", ADMLVL_GOD, SYSLOG_LOGFILE, TRUE}, - { "crash", ADMLVL_GOD, CRASH_LOGFILE, TRUE}, - { "help", ADMLVL_GOD, HELP_LOGFILE, TRUE}, - { "changelog", ADMLVL_GOD, CHANGE_LOG_FILE, FALSE}, - { "deletes", ADMLVL_GOD, DELETES_LOGFILE, TRUE}, - { "restarts", ADMLVL_GOD, RESTARTS_LOGFILE, TRUE}, - { "usage", ADMLVL_GOD, USAGE_LOGFILE, TRUE}, - { "badpws", ADMLVL_GOD, BADPWS_LOGFILE, TRUE}, - { "olc", ADMLVL_GOD, OLC_LOGFILE, TRUE}, - { "trigger", ADMLVL_GOD, TRIGGER_LOGFILE, TRUE}, + { "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 */ }; @@ -4595,7 +4289,7 @@ ACMD(do_file) if (!*argument) { send_to_char(ch, "USAGE: file \r\n\r\nFile options:\r\n"); for (j = 0, i = 0; fields[i].level; i++) - if (fields[i].level <= GET_ADMLEVEL(ch)) + if (fields[i].level <= GET_LEVEL(ch)) send_to_char(ch, "%-15s%s\r\n", fields[i].cmd, fields[i].file); return; } @@ -4616,7 +4310,7 @@ ACMD(do_file) return; } - if (GET_ADMLEVEL(ch) < fields[l].level) { + 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; @@ -4642,7 +4336,7 @@ ACMD(do_file) /* 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, ADMLVL_IMPL, TRUE, + mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: Error opening file %s using 'file' command.", fields[l].file); return; @@ -4718,19 +4412,19 @@ ACMD(do_changelog) sprintf(buf, "%s.bak", CHANGE_LOG_FILE); if (rename(CHANGE_LOG_FILE, buf)) { - mudlog(BRF, ADMLVL_IMPL, TRUE, + mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: Error making backup changelog file (%s)", buf); return; } if (!(fl = fopen(buf, "r"))) { - mudlog(BRF, ADMLVL_IMPL, TRUE, + mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: Error opening backup changelog file (%s)", buf); return; } if (!(new = fopen(CHANGE_LOG_FILE, "w"))) { - mudlog(BRF, ADMLVL_IMPL, TRUE, + mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: Error opening new changelog file (%s)", CHANGE_LOG_FILE); return; } @@ -4771,8 +4465,7 @@ ACMD(do_plist) int i, len = 0, count = 0; char mode, buf[MAX_STRING_LENGTH * 20], name_search[MAX_NAME_LENGTH], time_str[MAX_STRING_LENGTH]; struct time_info_data time_away; - int low = 0, high = CONFIG_MAX_LEVEL, low_day = 0, high_day = 10000, low_hr = 0, high_hr = 24; - bool imm_only = FALSE, mort_only = FALSE; + 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) */ @@ -4798,11 +4491,11 @@ ACMD(do_plist) break; case 'i': strcpy(buf, buf1); - imm_only = TRUE; + low = LVL_IMMORT; break; case 'm': strcpy(buf, buf1); - mort_only = TRUE; + high = LVL_IMMORT - 1; break; case 'd': half_chop(buf1, arg, buf); @@ -4825,21 +4518,14 @@ ACMD(do_plist) } len = 0; - len += snprintf(buf + len, sizeof(buf) - len, - "%s[ Id] (Lv Admin-Level) Name Last\r\n" - "%s-------------------------------------------------%s\r\n", - QBWHT, QCYN, QNRM); + len += snprintf(buf + len, sizeof(buf) - len, "@W[ Id] (Lv) Name Last@n\r\n" + "%s-------------------------------------%s\r\n", CCCYN(ch, C_NRM), + CCNRM(ch, C_NRM)); for (i = 0; i <= top_of_p_table; i++) { if (player_table[i].level < low || player_table[i].level > high) continue; - if (imm_only && player_table[i].admlevel < ADMLVL_IMMORT) - continue; - - if (mort_only && player_table[i].admlevel >= ADMLVL_IMMORT) - continue; - time_away = *real_time_passed(time(0), player_table[i].last); if (*name_search && str_cmp(name_search, player_table[i].name)) @@ -4853,13 +4539,13 @@ ACMD(do_plist) strcpy(time_str, asctime(localtime(&player_table[i].last))); time_str[strlen(time_str) - 1] = '\0'; - len += snprintf(buf + len, sizeof(buf) - len, "[%3ld] (%2d %11s) %c%-15s %s\r\n", - player_table[i].id, player_table[i].level, admin_level_names[(player_table[i].admlevel)], + len += snprintf(buf + len, sizeof(buf) - len, "[%3ld] (%2d) %c%-15s %s\r\n", + player_table[i].id, player_table[i].level, UPPER(*player_table[i].name), player_table[i].name + 1, time_str); count++; } - snprintf(buf + len, sizeof(buf) - len, "%s-------------------------------------------------%s\r\n" - "%d players listed.\r\n", QCYN, QNRM, count); + snprintf(buf + len, sizeof(buf) - len, "%s-------------------------------------%s\r\n" + "%d players listed.\r\n", CCCYN(ch, C_NRM), CCNRM(ch, C_NRM), count); page_string(ch->desc, buf, TRUE); } @@ -4952,7 +4638,7 @@ bool change_player_name(struct char_data *ch, struct char_data *vict, char *new_ /* Save the changed player index - the pfile is saved by perform_set */ save_player_index(); - mudlog(BRF, ADMLVL_IMMORT, TRUE, "(GC) %s changed the name of %s to %s", GET_NAME(ch), old_name, new_name); + 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), @@ -4981,7 +4667,7 @@ ACMD(do_zlock) return; } if (is_abbrev(arg, "all")) { - if (!IS_ADMIN(ch, ADMLVL_GRGOD)) { + if (GET_LEVEL(ch) < LVL_GRGOD) { send_to_char(ch, "You do not have sufficient access to lock all zones.\r\n"); return; } @@ -5019,7 +4705,7 @@ ACMD(do_zlock) return; } send_to_char(ch, "%d zones have now been locked.\r\n", counter); - mudlog(BRF, ADMLVL_GOD, TRUE, "(GC) %s has locked ALL zones!", GET_NAME(ch)); + mudlog(BRF, LVL_GOD, TRUE, "(GC) %s has locked ALL zones!", GET_NAME(ch)); return; } if (is_abbrev(arg, "list")) { @@ -5050,7 +4736,7 @@ ACMD(do_zlock) } /* Check the builder list */ - if (!IS_ADMIN(ch, ADMLVL_GRGOD) && !is_name(GET_NAME(ch), zone_table[zn].builders) && GET_OLC_ZONE(ch) != znvnum) { + if (GET_LEVEL(ch) < LVL_GRGOD && !is_name(GET_NAME(ch), zone_table[zn].builders) && GET_OLC_ZONE(ch) != znvnum) { send_to_char(ch, "You do not have sufficient access to lock that zone!\r\n"); return; } @@ -5062,7 +4748,7 @@ ACMD(do_zlock) } SET_BIT_AR(ZONE_FLAGS(zn), ZONE_NOBUILD); if (save_zone(zn)) { - mudlog(NRM, ADMLVL_GRGOD, TRUE, "(GC) %s has locked zone %d", GET_NAME(ch), znvnum); + mudlog(NRM, LVL_GRGOD, TRUE, "(GC) %s has locked zone %d", GET_NAME(ch), znvnum); } else { @@ -5089,7 +4775,7 @@ ACMD(do_zunlock) return; } if (is_abbrev(arg, "all")) { - if (!IS_ADMIN(ch, ADMLVL_GRGOD)) { + if (GET_LEVEL(ch) < LVL_GRGOD) { send_to_char(ch, "You do not have sufficient access to lock zones.\r\n"); return; } @@ -5113,7 +4799,7 @@ ACMD(do_zunlock) return; } send_to_char(ch, "%d zones have now been unlocked.\r\n", counter); - mudlog(BRF, ADMLVL_GOD, TRUE, "(GC) %s has unlocked ALL zones!", GET_NAME(ch)); + mudlog(BRF, LVL_GOD, TRUE, "(GC) %s has unlocked ALL zones!", GET_NAME(ch)); return; } if (is_abbrev(arg, "list")) { @@ -5144,7 +4830,7 @@ ACMD(do_zunlock) } /* Check the builder list */ - if (!IS_ADMIN(ch, ADMLVL_GRGOD) && !is_name(GET_NAME(ch), zone_table[zn].builders) && GET_OLC_ZONE(ch) != znvnum) { + if (GET_LEVEL(ch) < LVL_GRGOD && !is_name(GET_NAME(ch), zone_table[zn].builders) && GET_OLC_ZONE(ch) != znvnum) { send_to_char(ch, "You do not have sufficient access to unlock that zone!\r\n"); return; } @@ -5156,7 +4842,7 @@ ACMD(do_zunlock) } REMOVE_BIT_AR(ZONE_FLAGS(zn), ZONE_NOBUILD); if (save_zone(zn)) { - mudlog(NRM, ADMLVL_GRGOD, TRUE, "(GC) %s has unlocked zone %d", GET_NAME(ch), znvnum); + mudlog(NRM, LVL_GRGOD, TRUE, "(GC) %s has unlocked zone %d", GET_NAME(ch), znvnum); } else { @@ -5245,7 +4931,7 @@ ACMD(do_recent) limit = atoi(arg); } - if (IS_ADMIN(ch, ADMLVL_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"); @@ -5265,7 +4951,7 @@ ACMD(do_recent) if ((limit == 0) || (count < limit)) { - if (IS_ADMIN(ch, ADMLVL_GRGOD)) /* If High-Level Imm, then show Host IP */ + if (GET_LEVEL(ch) >= LVL_GRGOD) /* If High-Level Imm, then show Host IP */ { if (this->new_player == TRUE) { send_to_char(ch, "%3d | %-19.19s | %s%-37s%s | %s %s(New Player)%s\r\n", this->vnum, tmstr, loc ? QRED : "", this->host, QNRM, this->name, QYEL, QNRM); diff --git a/src/aedit.c b/src/aedit.c index 7fa1bf5..cdd5cb7 100644 --- a/src/aedit.c +++ b/src/aedit.c @@ -41,7 +41,7 @@ ACMD(do_oasis_aedit) /* No building as a mob or while being forced. */ if (IS_NPC(ch) || !ch->desc || STATE(ch->desc) != CON_PLAYING) return; - + if (CONFIG_NEW_SOCIALS == 0) { send_to_char(ch, "Socials cannot be edited at the moment.\r\n"); return; @@ -68,7 +68,7 @@ ACMD(do_oasis_aedit) d = ch->desc; if (!str_cmp("save", arg)) { - mudlog(CMP, MAX(ADMLVL_BUILDER, GET_INVIS_LEV(ch)), TRUE, "OLC: %s saves socials.", GET_NAME(ch)); + mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE, "OLC: %s saves socials.", GET_NAME(ch)); send_to_char(ch, "Writing social file.\r\n"); aedit_save_to_disk(d); send_to_char(ch, "Done.\r\n"); @@ -77,7 +77,7 @@ ACMD(do_oasis_aedit) /* Give descriptor an OLC structure. */ if (d->olc) { - mudlog(BRF, ADMLVL_IMMORT, TRUE, "SYSERR: do_oasis: Player already had olc structure."); + mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: do_oasis: Player already had olc structure."); free(d->olc); } CREATE(d->olc, struct oasis_olc_data, 1); @@ -104,7 +104,7 @@ ACMD(do_oasis_aedit) STATE(d) = CON_AEDIT; act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM); SET_BIT_AR(PLR_FLAGS(ch), PLR_WRITING); - mudlog(CMP, ADMLVL_IMMORT, TRUE, "OLC: %s starts editing actions.", GET_NAME(ch)); + mudlog(CMP, LVL_IMMORT, TRUE, "OLC: %s starts editing actions.", GET_NAME(ch)); } static void aedit_setup_new(struct descriptor_data *d) { @@ -253,7 +253,7 @@ static void aedit_disp_menu(struct descriptor_data * d) { "%s-- Action editor\r\n" "%sn%s) Command : %s%-15.15s%s %s1%s) Sort as Command : %s%-15.15s%s\r\n" "%s2%s) Min Position[CH]: %s%-8.8s %s3%s) Min Position [VT]: %s%-8.8s\r\n" - "%s4%s) Min AdmLevel[CH]: %s%-3d %s5%s) Show if Invisible: %s%s\r\n" + "%s4%s) Min Level [CH]: %s%-3d %s5%s) Show if Invisible: %s%s\r\n" "%sa%s) Char [NO ARG]: %s%s\r\n" "%sb%s) Others [NO ARG]: %s%s\r\n" "%sc%s) Char [NOT FOUND]: %s%s\r\n" @@ -321,7 +321,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) { switch (*arg) { case 'y': case 'Y': aedit_save_internally(d); - mudlog (CMP, ADMLVL_IMPL, TRUE, "OLC: %s edits action %s", + mudlog (CMP, LVL_IMPL, TRUE, "OLC: %s edits action %s", GET_NAME(d->character), OLC_ACTION(d)->command); /* do not free the strings.. just the structure */ @@ -425,7 +425,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) { OLC_MODE(d) = AEDIT_MIN_VICT_POS; return; case '4': - write_to_output(d, "Enter new minimum admin level for social: "); + write_to_output(d, "Enter new minimum level for social: "); OLC_MODE(d) = AEDIT_MIN_CHAR_LEVEL; return; case '5': @@ -586,7 +586,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) { return; } i = atoi(arg); - if ((i < ADMLVL_MORTAL) && (i > ADMLVL_IMPL)) { + if ((i < 0) && (i > LVL_IMPL)) { aedit_disp_menu(d); return; } diff --git a/src/asciimap.c b/src/asciimap.c index 9d5579b..a16e1fe 100644 --- a/src/asciimap.c +++ b/src/asciimap.c @@ -215,7 +215,7 @@ bool can_see_map(struct char_data *ch) { /* Is the map funcionality disabled? */ if (CONFIG_MAP == MAP_OFF) return FALSE; - else if ((CONFIG_MAP == MAP_IMM_ONLY) && (!IS_ADMIN(ch, ADMLVL_IMMORT))) + else if ((CONFIG_MAP == MAP_IMM_ONLY) && (GET_LEVEL(ch) < LVL_IMMORT)) return FALSE; return TRUE; @@ -259,7 +259,7 @@ static void MapArea(room_rnum room, struct char_data *ch, int x, int y, int min, if ( (pexit = world[room].dir_option[door]) != NULL && (pexit->to_room > 0 ) && (pexit->to_room != NOWHERE) && (!IS_SET(pexit->exit_info, EX_CLOSED)) && - (!IS_SET(pexit->exit_info, EX_HIDDEN) || ADM_FLAGGED(ch, ADM_SEESECRET)) ) + (!IS_SET(pexit->exit_info, EX_HIDDEN) || PRF_FLAGGED(ch, PRF_HOLYLIGHT)) ) { /* A real exit */ /* But is the door here... */ @@ -607,11 +607,9 @@ ACMD(do_map) { if (IS_DARK(IN_ROOM(ch)) && !CAN_SEE_IN_DARK(ch)) { send_to_char(ch, "It is too dark to see the map.\r\n"); return; - } else if (AFF_FLAGGED(ch, AFF_BLIND) && !IS_ADMIN(ch, ADMLVL_IMMORT)) { + } else if (AFF_FLAGGED(ch, AFF_BLIND) && GET_LEVEL(ch) < LVL_IMMORT) { send_to_char(ch, "You can't see the map while blind!\r\n"); return; } perform_map(ch, argument, show_worldmap(ch)); } - - diff --git a/src/ban.c b/src/ban.c index c6ea2a5..a69e622 100644 --- a/src/ban.c +++ b/src/ban.c @@ -186,7 +186,7 @@ ACMD(do_ban) ban_node->next = ban_list; ban_list = ban_node; - mudlog(NRM, MAX(ADMLVL_GOD, GET_INVIS_LEV(ch)), TRUE, "%s has banned %s for %s players.", + mudlog(NRM, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "%s has banned %s for %s players.", GET_NAME(ch), site, ban_types[ban_node->type]); send_to_char(ch, "Site banned.\r\n"); write_ban_list(); @@ -218,7 +218,7 @@ ACMD(do_unban) } REMOVE_FROM_LIST(ban_node, ban_list, next); send_to_char(ch, "Site unbanned.\r\n"); - mudlog(NRM, MAX(ADMLVL_GOD, GET_INVIS_LEV(ch)), TRUE, "%s removed the %s-player ban on %s.", + mudlog(NRM, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "%s removed the %s-player ban on %s.", GET_NAME(ch), ban_types[ban_node->type], ban_node->site); free(ban_node); @@ -234,12 +234,12 @@ int valid_name(char *newname) struct descriptor_data *dt; char tempname[MAX_INPUT_LENGTH]; - /* Make sure someone isn't trying to create this same name. We want to do a + /* Make sure someone isn't trying to create this same name. We want to do a * 'str_cmp' so people can't do 'Bob' and 'BoB'. The creating login will not - * have a character name yet and other people sitting at the prompt won't - * have characters yet. New, unindexed characters (i.e., characters who are - * in the process of creating) will have an idnum of -1, set by clear_char() - * in db.c. If someone is creating a character by the same name as the one + * have a character name yet and other people sitting at the prompt won't + * have characters yet. New, unindexed characters (i.e., characters who are + * in the process of creating) will have an idnum of -1, set by clear_char() + * in db.c. If someone is creating a character by the same name as the one * we are checking, then the name is invalid, to prevent character duping. * THIS SHOULD FIX THE 'invalid name' if disconnected from OLC-bug - Welcor */ for (dt = descriptor_list; dt; dt = dt->next) diff --git a/src/boards.c b/src/boards.c index 8a2aedb..9fb5674 100644 --- a/src/boards.c +++ b/src/boards.c @@ -45,17 +45,16 @@ /* Board appearance order. */ #define NEWEST_AT_TOP FALSE -/* Format: vnum, read lvl, write lvl, remove lvl, filename, 0 at end. Be sure +/* Format: vnum, read lvl, write lvl, remove lvl, filename, 0 at end. Be sure * to also change NUM_OF_BOARDS in board.h*/ struct board_info_type board_info[NUM_OF_BOARDS] = { -/* VNUM Read Level Write Level Remove Level Filename Zero */ - {3099, ADMLVL_MORTAL, ADMLVL_MORTAL, ADMLVL_GOD, LIB_ETC "board.mortal", 0}, - {3098, ADMLVL_IMMORT, ADMLVL_IMMORT, ADMLVL_GRGOD, LIB_ETC "board.immortal", 0}, - {3097, ADMLVL_IMMORT, ADMLVL_GRGOD, ADMLVL_IMPL, LIB_ETC "board.freeze", 0}, - {3096, ADMLVL_MORTAL, ADMLVL_MORTAL, ADMLVL_IMMORT, LIB_ETC "board.social", 0}, - {1226, ADMLVL_MORTAL, ADMLVL_MORTAL, ADMLVL_IMPL, LIB_ETC "board.builder", 0}, - {1227, ADMLVL_MORTAL, ADMLVL_MORTAL, ADMLVL_IMPL, LIB_ETC "board.staff", 0}, - {1228, ADMLVL_MORTAL, ADMLVL_MORTAL, ADMLVL_IMPL, LIB_ETC "board.advertising", 0}, + {3099, 0, 0, LVL_GOD, LIB_ETC "board.mortal", 0}, + {3098, LVL_IMMORT, LVL_IMMORT, LVL_GRGOD, LIB_ETC "board.immortal", 0}, + {3097, LVL_IMMORT, LVL_GRGOD, LVL_IMPL, LIB_ETC "board.freeze", 0}, + {3096, 0, 0, LVL_IMMORT, LIB_ETC "board.social", 0}, + {1226, 0, 0, LVL_IMPL, LIB_ETC "board.builder", 0}, + {1227, 0, 0, LVL_IMPL, LIB_ETC "board.staff", 0}, + {1228, 0, 0, LVL_IMPL, LIB_ETC "board.advertising", 0}, }; /* local (file scope) global variables */ @@ -94,7 +93,7 @@ static int find_board(struct char_data *ch) if (BOARD_RNUM(i) == GET_OBJ_RNUM(obj)) return (i); - if (IS_ADMIN(ch, ADMLVL_IMMORT)) + if (GET_LEVEL(ch) >= LVL_IMMORT) for (obj = ch->carrying; obj; obj = obj->next_content) for (i = 0; i < NUM_OF_BOARDS; i++) if (BOARD_RNUM(i) == GET_OBJ_RNUM(obj)) @@ -138,7 +137,7 @@ SPECIAL(gen_board) /* These were originally globals for some unknown reason. */ int ACMD_READ, ACMD_LOOK, ACMD_EXAMINE, ACMD_WRITE, ACMD_REMOVE; - + if (!loaded) { init_boards(); loaded = 1; @@ -177,7 +176,7 @@ int board_write_message(int board_type, struct char_data *ch, char *arg, struct time_t ct; char buf[MAX_INPUT_LENGTH], buf2[MAX_NAME_LENGTH + 3], tmstr[MAX_STRING_LENGTH]; - if (!IS_ADMIN(ch, WRITE_LVL(board_type))) { + if (GET_LEVEL(ch) < WRITE_LVL(board_type)) { send_to_char(ch, "You are not holy enough to write on this board.\r\n"); return (1); } @@ -233,7 +232,7 @@ int board_show_board(int board_type, struct char_data *ch, char *arg, struct obj if (!*tmp || !isname(tmp, board->name)) return (0); - if (!IS_ADMIN(ch, READ_LVL(board_type))) { + if (GET_LEVEL(ch) < READ_LVL(board_type)) { send_to_char(ch, "You try but fail to understand the holy words.\r\n"); return (1); } @@ -296,7 +295,7 @@ int board_display_msg(int board_type, struct char_data *ch, char *arg, struct ob if (!(msg = atoi(number))) return (0); - if (!IS_ADMIN(ch, READ_LVL(board_type))) { + if (GET_LEVEL(ch) < READ_LVL(board_type)) { send_to_char(ch, "You try but fail to understand the holy words.\r\n"); return (1); } @@ -367,7 +366,7 @@ int board_remove_msg(int board_type, struct char_data *ch, char *arg, struct obj return (1); } snprintf(buf, sizeof(buf), "(%s)", GET_NAME(ch)); - if (!IS_ADMIN(ch, REMOVE_LVL(board_type)) && + if (GET_LEVEL(ch) < REMOVE_LVL(board_type) && !(strstr(MSG_HEADING(board_type, ind), buf))) { send_to_char(ch, "You are not holy enough to remove other people's messages.\r\n"); return (1); diff --git a/src/boards.h b/src/boards.h index 22ee41f..8394621 100644 --- a/src/boards.h +++ b/src/boards.h @@ -1,13 +1,13 @@ /** * @file boards.h * Header file for the bulletin board system (boards.c). -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* -* All rights reserved. See license for complete information. -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * */ #ifndef _BOARDS_H_ @@ -31,9 +31,9 @@ struct board_msginfo { struct board_info_type { obj_vnum vnum; /* vnum of this board */ - int read_lvl; /* min admin level to read messages on this board */ - int write_lvl; /* min admin level to write messages on this board */ - int remove_lvl; /* min admin level to remove messages from this board */ + int read_lvl; /* min level to read messages on this board */ + int write_lvl; /* min level to write messages on this board */ + int remove_lvl; /* min level to remove messages from this board */ char filename[50]; /* file to save this board to */ obj_rnum rnum; /* rnum of this board */ }; diff --git a/src/cedit.c b/src/cedit.c index 12a96be..7e6b54d 100644 --- a/src/cedit.c +++ b/src/cedit.c @@ -46,7 +46,7 @@ ACMD(do_oasis_cedit) /* Parse any arguments. */ one_argument(argument, buf1); - if (!ADM_FLAGGED(ch, ADM_CEDIT)) { + if (GET_LEVEL(ch) < LVL_IMPL) { send_to_char(ch, "You can't modify the game configuration.\r\n"); return; } @@ -61,7 +61,7 @@ ACMD(do_oasis_cedit) act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM); SET_BIT_AR(PLR_FLAGS(ch), PLR_WRITING); - mudlog(BRF, ADMLVL_IMMORT, TRUE, + mudlog(BRF, LVL_IMMORT, TRUE, "OLC: %s starts editing the game configuration.", GET_NAME(ch)); return; } else if (str_cmp("save", buf1) != 0) { @@ -70,7 +70,7 @@ ACMD(do_oasis_cedit) } send_to_char(ch, "Saving the game configuration.\r\n"); - mudlog(CMP, MAX(ADMLVL_BUILDER, GET_INVIS_LEV(ch)), TRUE, + mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE, "OLC: %s saves the game configuration.", GET_NAME(ch)); cedit_save_to_disk(); @@ -92,7 +92,6 @@ static void cedit_setup(struct descriptor_data *d) OLC_CONFIG(d)->play.max_exp_loss = CONFIG_MAX_EXP_LOSS; OLC_CONFIG(d)->play.max_npc_corpse_time = CONFIG_MAX_NPC_CORPSE_TIME; OLC_CONFIG(d)->play.max_pc_corpse_time = CONFIG_MAX_PC_CORPSE_TIME; - OLC_CONFIG(d)->play.max_mortal_level = CONFIG_MAX_LEVEL; OLC_CONFIG(d)->play.idle_void = CONFIG_IDLE_VOID; OLC_CONFIG(d)->play.idle_rent_time = CONFIG_IDLE_RENT_TIME; OLC_CONFIG(d)->play.idle_max_level = CONFIG_IDLE_MAX_LEVEL; @@ -135,23 +134,10 @@ static void cedit_setup(struct descriptor_data *d) OLC_CONFIG(d)->operation.nameserver_is_slow = CONFIG_NS_IS_SLOW; OLC_CONFIG(d)->operation.medit_advanced = CONFIG_MEDIT_ADVANCED; OLC_CONFIG(d)->operation.ibt_autosave = CONFIG_IBT_AUTOSAVE; - /* Autowiz */ OLC_CONFIG(d)->autowiz.use_autowiz = CONFIG_USE_AUTOWIZ; OLC_CONFIG(d)->autowiz.min_wizlist_lev = CONFIG_MIN_WIZLIST_LEV; - /* Mudmail */ - OLC_CONFIG(d)->mail.mail_allowed = CONFIG_CAN_MAIL; - OLC_CONFIG(d)->mail.objects_allowed = CONFIG_CAN_MAIL_OBJ; - OLC_CONFIG(d)->mail.gold_allowed = CONFIG_CAN_MAIL_GOLD; - OLC_CONFIG(d)->mail.stamp_cost = CONFIG_STAMP_COST; - OLC_CONFIG(d)->mail.min_level = CONFIG_MIN_MAIL_LEVEL; - OLC_CONFIG(d)->mail.min_free_level = CONFIG_FREE_MAIL_LEVEL; - OLC_CONFIG(d)->mail.allow_drafts = CONFIG_DRAFTS_ALLOWED; - OLC_CONFIG(d)->mail.draft_timeout = CONFIG_DRAFT_TIMEOUT; - OLC_CONFIG(d)->mail.safe_mailing = CONFIG_SAFE_MAILING; - OLC_CONFIG(d)->mail.min_mail_anywhere = CONFIG_MIN_MAIL_ANYWHERE; - OLC_CONFIG(d)->mail.min_send_to_all = CONFIG_MIN_SEND_TO_ALL; /* Allocate space for the strings. */ OLC_CONFIG(d)->play.OK = str_udup(CONFIG_OK); @@ -205,13 +191,12 @@ static void cedit_save_internally(struct descriptor_data *d) CONFIG_MAX_EXP_LOSS = OLC_CONFIG(d)->play.max_exp_loss; CONFIG_MAX_NPC_CORPSE_TIME = OLC_CONFIG(d)->play.max_npc_corpse_time; CONFIG_MAX_PC_CORPSE_TIME = OLC_CONFIG(d)->play.max_pc_corpse_time; - CONFIG_MAX_LEVEL = OLC_CONFIG(d)->play.max_mortal_level; CONFIG_IDLE_VOID = OLC_CONFIG(d)->play.idle_void; CONFIG_IDLE_RENT_TIME = OLC_CONFIG(d)->play.idle_rent_time; CONFIG_IDLE_MAX_LEVEL = OLC_CONFIG(d)->play.idle_max_level; CONFIG_DTS_ARE_DUMPS = OLC_CONFIG(d)->play.dts_are_dumps; - CONFIG_LOAD_INVENTORY = OLC_CONFIG(d)->play.load_into_inventory; - CONFIG_TRACK_T_DOORS = OLC_CONFIG(d)->play.track_through_doors; + CONFIG_LOAD_INVENTORY = OLC_CONFIG(d)->play.load_into_inventory; + CONFIG_TRACK_T_DOORS = OLC_CONFIG(d)->play.track_through_doors; CONFIG_NO_MORT_TO_IMMORT = OLC_CONFIG(d)->play.no_mort_to_immort; CONFIG_DISP_CLOSED_DOORS = OLC_CONFIG(d)->play.disp_closed_doors; CONFIG_DIAGONAL_DIRS = OLC_CONFIG(d)->play.diagonal_dirs; @@ -252,20 +237,6 @@ static void cedit_save_internally(struct descriptor_data *d) CONFIG_USE_AUTOWIZ = OLC_CONFIG(d)->autowiz.use_autowiz; CONFIG_MIN_WIZLIST_LEV = OLC_CONFIG(d)->autowiz.min_wizlist_lev; - /* Mudmail */ - CONFIG_CAN_MAIL = OLC_CONFIG(d)->mail.mail_allowed; - CONFIG_CAN_MAIL_OBJ = OLC_CONFIG(d)->mail.objects_allowed; - CONFIG_CAN_MAIL_GOLD = OLC_CONFIG(d)->mail.gold_allowed; - CONFIG_STAMP_COST = OLC_CONFIG(d)->mail.stamp_cost; - CONFIG_OBJECT_COST = OLC_CONFIG(d)->mail.object_cost; - CONFIG_MIN_MAIL_LEVEL = OLC_CONFIG(d)->mail.min_level; - CONFIG_FREE_MAIL_LEVEL = OLC_CONFIG(d)->mail.min_free_level; - CONFIG_DRAFTS_ALLOWED = OLC_CONFIG(d)->mail.allow_drafts; - CONFIG_DRAFT_TIMEOUT = OLC_CONFIG(d)->mail.draft_timeout; - CONFIG_SAFE_MAILING = OLC_CONFIG(d)->mail.safe_mailing; - CONFIG_MIN_MAIL_ANYWHERE = OLC_CONFIG(d)->mail.min_mail_anywhere; - CONFIG_MIN_SEND_TO_ALL = OLC_CONFIG(d)->mail.min_send_to_all; - /* Allocate space for the strings. */ if (CONFIG_OK) free(CONFIG_OK); @@ -376,13 +347,11 @@ int save_config( IDXTYPE nowhere ) "max_npc_corpse_time = %d\n\n", CONFIG_MAX_NPC_CORPSE_TIME); fprintf(fl, "* Number of tics before PC corpses decompose.\n" "max_pc_corpse_time = %d\n\n", CONFIG_MAX_PC_CORPSE_TIME); - fprintf(fl, "* The maximum mortal level.\n" - "max_mortal_level = %d\n\n", CONFIG_MAX_LEVEL); fprintf(fl, "* Number of tics before a PC is sent to the void.\n" "idle_void = %d\n\n", CONFIG_IDLE_VOID); fprintf(fl, "* Number of tics before a PC is autorented.\n" "idle_rent_time = %d\n\n", CONFIG_IDLE_RENT_TIME); - fprintf(fl, "* Admin Level and above of players whom are immune to idle penalties.\n" + fprintf(fl, "* Level and above of players whom are immune to idle penalties.\n" "idle_max_level = %d\n\n", CONFIG_IDLE_MAX_LEVEL); fprintf(fl, "* Should the items in death traps be junked automatically?\n" "dts_are_dumps = %d\n\n", CONFIG_DTS_ARE_DUMPS); @@ -395,7 +364,7 @@ int save_config( IDXTYPE nowhere ) fprintf(fl, "* Should closed doors be shown on autoexit / exit?\n" "disp_closed_doors = %d\n\n", CONFIG_DISP_CLOSED_DOORS); fprintf(fl, "* Are diagonal directions enabled?\n" - "diagonal_dirs_enabled = %d\n\n", CONFIG_DIAGONAL_DIRS); + "diagonal_dirs = %d\n\n", CONFIG_DIAGONAL_DIRS); fprintf(fl, "* Who can use the map functions? 0=off, 1=on, 2=imm_only\n" "map_option = %d\n\n", CONFIG_MAP); fprintf(fl, "* Default size of map shown by 'map' command\n" @@ -559,8 +528,8 @@ int save_config( IDXTYPE nowhere ) CONFIG_MEDIT_ADVANCED); fprintf(fl, "* Should the idea, bug and typo commands autosave (1) or not (0).\n" - "ibt_autosave = %d\n\n", - CONFIG_IBT_AUTOSAVE); + "ibt_autosave = %d\n\n", + CONFIG_IBT_AUTOSAVE); fprintf(fl, "\n\n\n* [ Autowiz Options ]\n"); @@ -569,60 +538,10 @@ int save_config( IDXTYPE nowhere ) "use_autowiz = %d\n\n", CONFIG_USE_AUTOWIZ); - fprintf(fl, "* If yes, what is the lowest admin level which should be on the wizlist?\n" + fprintf(fl, "* If yes, what is the lowest level which should be on the wizlist?\n" "min_wizlist_lev = %d\n\n", CONFIG_MIN_WIZLIST_LEV); - /* MUDMAIL OPTIONS */ - fprintf(fl, "\n\n\n* [ Mudmail Options ]\n"); - - fprintf(fl, "* Enable/Disable the whole mudmail system\n" - "can_mail = %d\n\n", - CONFIG_CAN_MAIL); - - fprintf(fl, "* Can objects be sent via mudmail?\n" - "mail_objects_allowed = %d\n\n", - CONFIG_CAN_MAIL_OBJ); - - fprintf(fl, "* Can gold coins be sent via mudmail?\n" - "mail_gold_allowed = %d\n\n", - CONFIG_CAN_MAIL_GOLD); - - fprintf(fl, "* How much does it cost to send mudmails\n" - "mail_stamp_cost = %d\n\n", - CONFIG_STAMP_COST); - - fprintf(fl, "* How much extra does it cost to add each object mudmails\n" - "mail_object_cost = %d\n\n", - CONFIG_OBJECT_COST); - - fprintf(fl, "* The minimum player level that's allowed to send mudmails\n" - "mail_min_level = %d\n\n", - CONFIG_MIN_MAIL_LEVEL); - - fprintf(fl, "* The minimum level that can send mudmails for free\n" - "mail_min_free_level = %d\n\n", - CONFIG_FREE_MAIL_LEVEL); - - fprintf(fl, "* Are players allowed to create draft mails for sending later?\n" - "mail_drafts_allowed = %d\n\n", - CONFIG_DRAFTS_ALLOWED); - - fprintf(fl, "* Number of days before a draft mail is autoremoved (0 for never) \n" - "mail_draft_timeout = %d\n\n", - CONFIG_DRAFT_TIMEOUT); - - fprintf(fl, "* When on, the player cannot be attacked or stolen from while mailing. \n" - "mail_safe_mailing = %d\n\n", - CONFIG_SAFE_MAILING); - - fprintf(fl, "* This is the minimum level that can send mail from any location (not just at postmaster). \n" - "mail_min_mail_anywhere = %d\n\n", - CONFIG_MIN_MAIL_ANYWHERE); - - fprintf(fl, "* This is the minimum level that can send mail to all players. \n" - "mail_min_send_to_all = %d\n\n", - CONFIG_MIN_SEND_TO_ALL); fclose(fl); @@ -647,7 +566,6 @@ static void cedit_disp_menu(struct descriptor_data *d) "%sR%s) Room Numbers\r\n" "%sO%s) Operation Options\r\n" "%sA%s) Autowiz Options\r\n" - "%sM%s) Mudmail Options\r\n" "%sQ%s) Quit\r\n" "Enter your choice : ", @@ -656,7 +574,6 @@ static void cedit_disp_menu(struct descriptor_data *d) grn, nrm, grn, nrm, grn, nrm, - grn, nrm, grn, nrm ); @@ -682,16 +599,15 @@ static void cedit_disp_game_play_options(struct descriptor_data *d) "%sG%s) Maximum Experience Loss : %s%d\r\n" "%sH%s) Max Time for NPC Corpse : %s%d\r\n" "%sI%s) Max Time for PC Corpse : %s%d\r\n" - "%sJ%s) Max Mortal Level : %s%d\r\n" - "%sK%s) Tics before PC sent to void : %s%d\r\n" - "%sL%s) Tics before PC is autosaved : %s%d\r\n" - "%sM%s) Imm Level Immune To IDLE : %s%d\r\n" - "%sN%s) Death Traps Junk Items : %s%s\r\n" - "%sO%s) Objects Load Into Inventory : %s%s\r\n" - "%sP%s) Track Through Doors : %s%s\r\n" - "%sR%s) Display Closed Doors : %s%s\r\n" - "%sS%s) Diagonal Directions : %s%s\r\n" - "%sT%s) Mortals Level To Immortal : %s%s\r\n" + "%sJ%s) Tics before PC sent to void : %s%d\r\n" + "%sK%s) Tics before PC is autosaved : %s%d\r\n" + "%sL%s) Level Immune To IDLE : %s%d\r\n" + "%sM%s) Death Traps Junk Items : %s%s\r\n" + "%sN%s) Objects Load Into Inventory : %s%s\r\n" + "%sO%s) Track Through Doors : %s%s\r\n" + "%sP%s) Display Closed Doors : %s%s\r\n" + "%sR%s) Diagonal Directions : %s%s\r\n" + "%sS%s) Mortals Level To Immortal : %s%s\r\n" "%s1%s) OK Message Text : %s%s" "%s2%s) NOPERSON Message Text : %s%s" "%s3%s) NOEFFECT Message Text : %s%s" @@ -710,7 +626,6 @@ static void cedit_disp_game_play_options(struct descriptor_data *d) grn, nrm, cyn, OLC_CONFIG(d)->play.max_exp_loss, grn, nrm, cyn, OLC_CONFIG(d)->play.max_npc_corpse_time, grn, nrm, cyn, OLC_CONFIG(d)->play.max_pc_corpse_time, - grn, nrm, cyn, OLC_CONFIG(d)->play.max_mortal_level, grn, nrm, cyn, OLC_CONFIG(d)->play.idle_void, grn, nrm, cyn, OLC_CONFIG(d)->play.idle_rent_time, @@ -790,18 +705,6 @@ static void cedit_disp_room_numbers(struct descriptor_data *d) OLC_MODE(d) = CEDIT_ROOM_NUMBERS_MENU; } -static void cedit_disp_admin_levels(struct descriptor_data *d) -{ - int i; - get_char_colors(d->character); - clear_screen(d); - - write_to_output(d, "\r\n\r\n"); - for (i=ADMLVL_IMMORT; i<=ADMLVL_IMPL; i++) { - write_to_output(d, "%s%d%s) %s%s%s\r\n", grn, i, nrm, cyn, admin_level_names[i], nrm); - } -} - static void cedit_disp_operation_options(struct descriptor_data *d) { get_char_colors(d->character); @@ -866,50 +769,6 @@ static void cedit_disp_autowiz_options(struct descriptor_data *d) OLC_MODE(d) = CEDIT_AUTOWIZ_OPTIONS_MENU; } -void cedit_disp_mudmail_options(struct descriptor_data *d) -{ - char timeout[MAX_INPUT_LENGTH]; - get_char_colors(d->character); - clear_screen(d); - - if (OLC_CONFIG(d)->mail.draft_timeout > 0) - sprintf(timeout, "%d days", OLC_CONFIG(d)->mail.draft_timeout); - else - sprintf(timeout, "%s", cyn); - - write_to_output(d, "\r\n\r\n" - "%sA%s) Use mudmail system : %s%s\r\n" - "%sB%s) Allow object attachments : %s%s\r\n" - "%sC%s) Allow gold attachments : %s%s\r\n" - "%sD%s) Stamp Cost (Normal Mails) : %s%d coins\r\n" - "%sE%s) Cost per object attached : %s%d coins\r\n" - "%sF%s) Allow draft mudmails : %s%s\r\n" - "%sG%s) Draft mail timeout : %s%s\r\n" - "%sH%s) Min. level that can mail : %s%d\r\n" - "%sI%s) Min. level for free mail : %s%d\r\n" - "%sJ%s) Safe while mailing? : %s%s\r\n" - "%sK%s) Min level to mail anywhere : %s%d\r\n" - "%sL%s) Min level to send to all : %s%d\r\n" - "%sQ%s) Exit To The Main Menu\r\n" - "Enter your choice : ", - grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->mail.mail_allowed), - grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->mail.objects_allowed), - grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->mail.gold_allowed), - grn, nrm, yel, OLC_CONFIG(d)->mail.stamp_cost, - grn, nrm, yel, OLC_CONFIG(d)->mail.object_cost, - grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->mail.allow_drafts), - grn, nrm, yel, timeout, - grn, nrm, yel, OLC_CONFIG(d)->mail.min_level, - grn, nrm, yel, OLC_CONFIG(d)->mail.min_free_level, - grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->mail.safe_mailing), - grn, nrm, yel, OLC_CONFIG(d)->mail.min_mail_anywhere, - grn, nrm, yel, OLC_CONFIG(d)->mail.min_send_to_all, - grn, nrm - ); - - OLC_MODE(d) = CEDIT_MUDMAIL_OPTIONS_MENU; -} - /* The event handler. */ void cedit_parse(struct descriptor_data *d, char *arg) { @@ -921,7 +780,7 @@ void cedit_parse(struct descriptor_data *d, char *arg) case 'y': case 'Y': cedit_save_internally(d); - mudlog(CMP, MAX(ADMLVL_BUILDER, GET_INVIS_LEV(d->character)), TRUE, + mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), TRUE, "OLC: %s modifies the game configuration.", GET_NAME(d->character)); cleanup_olc(d, CLEANUP_CONFIG); if (CONFIG_AUTO_SAVE) { @@ -973,12 +832,6 @@ void cedit_parse(struct descriptor_data *d, char *arg) OLC_MODE(d) = CEDIT_AUTOWIZ_OPTIONS_MENU; break; - case 'm': - case 'M': - cedit_disp_mudmail_options(d); - OLC_MODE(d) = CEDIT_MUDMAIL_OPTIONS_MENU; - break; - case 'q': case 'Q': write_to_output(d, "Do you wish to save your changes? : "); @@ -1048,57 +901,50 @@ void cedit_parse(struct descriptor_data *d, char *arg) case 'j': case 'J': - write_to_output(d, "Enter the highest possible mortal level (0-254) : "); - OLC_MODE(d) = CEDIT_MAX_LEVEL; - return; - - case 'k': - case 'K': write_to_output(d, "Enter the number of tics before PC's are sent to the void (idle) : "); OLC_MODE(d) = CEDIT_IDLE_VOID; return; - case 'l': - case 'L': + case 'k': + case 'K': write_to_output(d, "Enter the number of tics before PC's are automatically rented and forced to quit : "); OLC_MODE(d) = CEDIT_IDLE_RENT_TIME; return; - case 'm': - case 'M': - cedit_disp_admin_levels(d); - write_to_output(d, "Enter the admin level a player must be to become immune to IDLE : "); + case 'l': + case 'L': + write_to_output(d, "Enter the level a player must be to become immune to IDLE : "); OLC_MODE(d) = CEDIT_IDLE_MAX_LEVEL; return; + case 'm': + case 'M': + TOGGLE_VAR(OLC_CONFIG(d)->play.dts_are_dumps); + break; + case 'n': case 'N': - TOGGLE_VAR(OLC_CONFIG(d)->play.dts_are_dumps); + TOGGLE_VAR(OLC_CONFIG(d)->play.load_into_inventory); break; case 'o': case 'O': - TOGGLE_VAR(OLC_CONFIG(d)->play.load_into_inventory); + TOGGLE_VAR(OLC_CONFIG(d)->play.track_through_doors); break; case 'p': case 'P': - TOGGLE_VAR(OLC_CONFIG(d)->play.track_through_doors); + TOGGLE_VAR(OLC_CONFIG(d)->play.disp_closed_doors); break; case 'r': case 'R': - TOGGLE_VAR(OLC_CONFIG(d)->play.disp_closed_doors); - break; - - case 's': - case 'S': - TOGGLE_VAR(OLC_CONFIG(d)->play.diagonal_dirs); - break; - - case 't': - case 'T': - TOGGLE_VAR(OLC_CONFIG(d)->play.no_mort_to_immort); + TOGGLE_VAR(OLC_CONFIG(d)->play.diagonal_dirs); + break; + + case 's': + case 'S': + TOGGLE_VAR(OLC_CONFIG(d)->play.no_mort_to_immort); break; case '1': @@ -1367,10 +1213,10 @@ void cedit_parse(struct descriptor_data *d, char *arg) TOGGLE_VAR(OLC_CONFIG(d)->operation.medit_advanced); break; - case 'p': - case 'P': - TOGGLE_VAR(OLC_CONFIG(d)->operation.ibt_autosave); - break; + case 'p': + case 'P': + TOGGLE_VAR(OLC_CONFIG(d)->operation.ibt_autosave); + break; case 'q': case 'Q': @@ -1393,8 +1239,7 @@ void cedit_parse(struct descriptor_data *d, char *arg) case 'b': case 'B': - cedit_disp_admin_levels(d); - write_to_output(d, "\r\nEnter the minimum admin level for players to appear on the wizlist : "); + write_to_output(d, "Enter the minimum level for players to appear on the wizlist : "); OLC_MODE(d) = CEDIT_MIN_WIZLIST_LEV; return; @@ -1410,87 +1255,6 @@ void cedit_parse(struct descriptor_data *d, char *arg) cedit_disp_autowiz_options(d); return; - case CEDIT_MUDMAIL_OPTIONS_MENU: - switch (*arg) { - case 'a': - case 'A': - TOGGLE_VAR(OLC_CONFIG(d)->mail.mail_allowed); - break; - - case 'b': - case 'B': - TOGGLE_VAR(OLC_CONFIG(d)->mail.objects_allowed); - break; - - case 'c': - case 'C': - TOGGLE_VAR(OLC_CONFIG(d)->mail.gold_allowed); - break; - - case 'd': - case 'D': - write_to_output(d, "Enter the cost per mail (without attachments) : "); - OLC_MODE(d) = CEDIT_STAMP_COST; - return; - - case 'e': - case 'E': - write_to_output(d, "Enter the cost per object attachment : "); - OLC_MODE(d) = CEDIT_OBJECT_COST; - return; - - case 'f': - case 'F': - TOGGLE_VAR(OLC_CONFIG(d)->mail.allow_drafts); - break; - - case 'g': - case 'G': - write_to_output(d, "Enter the timeout (in days) before draft mails are auto-removed (0=off) : "); - OLC_MODE(d) = CEDIT_DRAFT_TIMEOUT; - return; - - case 'h': - case 'H': - write_to_output(d, "Enter the minimum admin level that can send mudmails : "); - OLC_MODE(d) = CEDIT_MIN_MAIL_LEVEL; - return; - - case 'i': - case 'I': - write_to_output(d, "Enter the minimum admin level for free mudmails : "); - OLC_MODE(d) = CEDIT_MIN_FREE_LEVEL; - return; - - case 'j': - case 'J': - TOGGLE_VAR(OLC_CONFIG(d)->mail.safe_mailing); - break; - - case 'k': - case 'K': - write_to_output(d, "Enter the minimum admin level that can send mail from anywhere : "); - OLC_MODE(d) = CEDIT_MAIL_ANYWHERE; - return; - - case 'l': - case 'L': - write_to_output(d, "Enter the minimum admin level that can send to all players : "); - OLC_MODE(d) = CEDIT_MAIL_ALL_PLAYERS; - return; - - case 'q': - case 'Q': - cedit_disp_menu(d); - return; - - default: - write_to_output(d, "\r\nThat is an invalid choice!\r\n"); - } - - cedit_disp_mudmail_options(d); - return; - case CEDIT_LEVEL_CAN_SHOUT: if (!*arg) { write_to_output(d, @@ -1560,15 +1324,6 @@ void cedit_parse(struct descriptor_data *d, char *arg) } break; - case CEDIT_MAX_LEVEL: - /* Note: Some things, such as spell_info, use (CONFIG_MAX_LEVEL + 1) */ - /* Do not use the max possible for the variable type */ - if (*arg) - OLC_CONFIG(d)->play.max_mortal_level = MIN(MAX(atoi(arg),0),254); - - cedit_disp_game_play_options(d); - break; - case CEDIT_IDLE_VOID: if (!*arg) { write_to_output(d, @@ -1593,12 +1348,9 @@ void cedit_parse(struct descriptor_data *d, char *arg) case CEDIT_IDLE_MAX_LEVEL: if (!*arg) { - write_to_output(d, "Value not changed!\r\n"); - cedit_disp_game_play_options(d); - } else if ((atoi(arg) < ADMLVL_MORTAL) || (atoi(arg) > ADMLVL_IMPL)) { write_to_output(d, "That is an invalid choice!\r\n" - "Enter the admin level a player must be to become immune to IDLE : "); + "Enter the level a player must be to become immune to IDLE : "); } else { OLC_CONFIG(d)->play.idle_max_level = atoi(arg); cedit_disp_game_play_options(d); @@ -1840,13 +1592,10 @@ void cedit_parse(struct descriptor_data *d, char *arg) break; case CEDIT_MIN_WIZLIST_LEV: - if (!*arg) { - write_to_output(d, "Value not changed.\r\n"); - cedit_disp_autowiz_options(d); - } else if ((atoi(arg) < ADMLVL_IMMORT) || (atoi(arg) > ADMLVL_IMPL)) { + if (atoi(arg) > LVL_IMPL) { write_to_output(d, "The minimum wizlist level can't be greater than %d.\r\n" - "Enter the minimum admin level for players to appear on the wizlist : ", ADMLVL_IMPL); + "Enter the minimum level for players to appear on the wizlist : ", LVL_IMPL); } else { OLC_CONFIG(d)->autowiz.min_wizlist_lev = atoi(arg); cedit_disp_autowiz_options(d); @@ -1887,44 +1636,9 @@ void cedit_parse(struct descriptor_data *d, char *arg) } break; - case CEDIT_STAMP_COST: - OLC_CONFIG(d)->mail.stamp_cost = MIN(MAX(atoi(arg), 0), 1000); - cedit_disp_mudmail_options(d); - break; - - case CEDIT_OBJECT_COST: - OLC_CONFIG(d)->mail.object_cost = MIN(MAX(atoi(arg), 0), 1000); - cedit_disp_mudmail_options(d); - break; - - case CEDIT_DRAFT_TIMEOUT: - OLC_CONFIG(d)->mail.draft_timeout = MIN(MAX(atoi(arg), 0), 3653); /* up to 10 years */ - cedit_disp_mudmail_options(d); - break; - - case CEDIT_MIN_MAIL_LEVEL: - OLC_CONFIG(d)->mail.min_level = MIN(MAX(atoi(arg), 0), ADMLVL_IMPL); - cedit_disp_mudmail_options(d); - break; - - case CEDIT_MIN_FREE_LEVEL: - OLC_CONFIG(d)->mail.min_free_level = MIN(MAX(atoi(arg), 0), ADMLVL_IMPL); - cedit_disp_mudmail_options(d); - break; - - case CEDIT_MAIL_ANYWHERE: - OLC_CONFIG(d)->mail.min_mail_anywhere = MIN(MAX(atoi(arg), 0), ADMLVL_IMPL); - cedit_disp_mudmail_options(d); - break; - - case CEDIT_MAIL_ALL_PLAYERS: - OLC_CONFIG(d)->mail.min_send_to_all = MIN(MAX(atoi(arg), 0), ADMLVL_IMPL); - cedit_disp_mudmail_options(d); - break; - default: /* We should never get here, but just in case... */ cleanup_olc(d, CLEANUP_CONFIG); - mudlog(BRF, ADMLVL_BUILDER, TRUE, "SYSERR: OLC: cedit_parse(): Reached default case!"); + mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: cedit_parse(): Reached default case!"); write_to_output(d, "Oops...\r\n"); break; } diff --git a/src/class.c b/src/class.c index fe4b750..75e9223 100644 --- a/src/class.c +++ b/src/class.c @@ -179,16 +179,16 @@ byte saving_throws(int class_num, int type, int level) case 28: return 32; case 29: return 30; case 30: return 28; - case 31: return 25; - case 32: return 23; - case 33: return 21; - case 34: return 18; - case 35: return 15; - case 36: return 12; - case 37: return 10; - case 38: return 7; - case 39: return 5; - case 40: return 3; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; default: log("SYSERR: Missing level for mage paralyzation saving throw."); break; @@ -226,16 +226,16 @@ byte saving_throws(int class_num, int type, int level) case 28: return 11; case 29: return 10; case 30: return 9; - case 31: return 8; - case 32: return 8; - case 33: return 7; - case 34: return 6; - case 35: return 5; - case 36: return 5; - case 37: return 4; - case 38: return 3; - case 39: return 2; - case 40: return 1; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; default: log("SYSERR: Missing level for mage rod saving throw."); break; @@ -273,16 +273,16 @@ byte saving_throws(int class_num, int type, int level) case 28: return 17; case 29: return 15; case 30: return 13; - case 31: return 12; - case 32: return 11; - case 33: return 10; - case 34: return 9; - case 35: return 7; - case 36: return 6; - case 37: return 5; - case 38: return 4; - case 39: return 3; - case 40: return 3; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; default: log("SYSERR: Missing level for mage petrification saving throw."); break; @@ -320,16 +320,16 @@ byte saving_throws(int class_num, int type, int level) case 28: return 27; case 29: return 25; case 30: return 23; - case 31: return 22; - case 32: return 20; - case 33: return 19; - case 34: return 18; - case 35: return 17; - case 36: return 16; - case 37: return 15; - case 38: return 14; - case 39: return 13; - case 40: return 12; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; default: log("SYSERR: Missing level for mage breath saving throw."); break; @@ -367,16 +367,16 @@ byte saving_throws(int class_num, int type, int level) case 28: return 12; case 29: return 10; case 30: return 8; - case 31: return 7; - case 32: return 6; - case 33: return 6; - case 34: return 5; - case 35: return 4; - case 36: return 4; - case 37: return 3; - case 38: return 2; - case 39: return 1; - case 40: return 1; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; default: log("SYSERR: Missing level for mage spell saving throw."); break; @@ -421,15 +421,15 @@ byte saving_throws(int class_num, int type, int level) case 28: return 9; case 29: return 8; case 30: return 7; - case 31: return 6; - case 32: return 6; - case 33: return 5; - case 34: return 4; - case 35: return 3; - case 36: return 3; - case 37: return 2; - case 38: return 2; - case 39: return 1; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; case 40: return 0; default: log("SYSERR: Missing level for cleric paralyzation saving throw."); @@ -468,16 +468,16 @@ byte saving_throws(int class_num, int type, int level) case 28: return 29; case 29: return 28; case 30: return 27; - case 31: return 26; - case 32: return 25; - case 33: return 24; - case 34: return 23; - case 35: return 22; - case 36: return 21; - case 37: return 20; - case 38: return 19; - case 39: return 18; - case 40: return 17; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; default: log("SYSERR: Missing level for cleric rod saving throw."); break; @@ -515,16 +515,16 @@ byte saving_throws(int class_num, int type, int level) case 28: return 24; case 29: return 23; case 30: return 22; - case 31: return 21; - case 32: return 20; - case 33: return 19; - case 34: return 18; - case 35: return 17; - case 36: return 16; - case 37: return 15; - case 38: return 14; - case 39: return 13; - case 40: return 13; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; default: log("SYSERR: Missing level for cleric petrification saving throw."); break; @@ -562,16 +562,16 @@ byte saving_throws(int class_num, int type, int level) case 28: return 39; case 29: return 38; case 30: return 37; - case 31: return 35; - case 32: return 34; - case 33: return 33; - case 34: return 32; - case 35: return 31; - case 36: return 31; - case 37: return 30; - case 38: return 29; - case 39: return 29; - case 40: return 28; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; default: log("SYSERR: Missing level for cleric breath saving throw."); break; @@ -609,16 +609,16 @@ byte saving_throws(int class_num, int type, int level) case 28: return 34; case 29: return 33; case 30: return 32; - case 31: return 31; - case 32: return 30; - case 33: return 29; - case 34: return 28; - case 35: return 27; - case 36: return 26; - case 37: return 26; - case 38: return 25; - case 39: return 24; - case 40: return 23; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; default: log("SYSERR: Missing level for cleric spell saving throw."); break; @@ -663,16 +663,16 @@ byte saving_throws(int class_num, int type, int level) case 28: return 38; case 29: return 37; case 30: return 36; - case 31: return 35; - case 32: return 34; - case 33: return 33; - case 34: return 32; - case 35: return 31; - case 36: return 31; - case 37: return 30; - case 38: return 29; - case 39: return 29; - case 40: return 28; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; default: log("SYSERR: Missing level for thief paralyzation saving throw."); break; @@ -710,16 +710,16 @@ byte saving_throws(int class_num, int type, int level) case 28: return 16; case 29: return 14; case 30: return 13; - case 31: return 12; - case 32: return 11; - case 33: return 10; - case 34: return 9; - case 35: return 8; - case 36: return 7; - case 37: return 6; - case 38: return 5; - case 39: return 4; - case 40: return 4; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; default: log("SYSERR: Missing level for thief rod saving throw."); break; @@ -757,16 +757,16 @@ byte saving_throws(int class_num, int type, int level) case 28: return 33; case 29: return 32; case 30: return 31; - case 31: return 30; - case 32: return 29; - case 33: return 28; - case 34: return 27; - case 35: return 26; - case 36: return 25; - case 37: return 24; - case 38: return 23; - case 39: return 23; - case 40: return 22; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; default: log("SYSERR: Missing level for thief petrification saving throw."); break; @@ -804,16 +804,16 @@ byte saving_throws(int class_num, int type, int level) case 28: return 53; case 29: return 52; case 30: return 51; - case 31: return 50; - case 32: return 49; - case 33: return 48; - case 34: return 48; - case 35: return 47; - case 36: return 46; - case 37: return 45; - case 38: return 44; - case 39: return 43; - case 40: return 42; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; default: log("SYSERR: Missing level for thief breath saving throw."); break; @@ -851,16 +851,16 @@ byte saving_throws(int class_num, int type, int level) case 28: return 21; case 29: return 19; case 30: return 17; - case 31: return 16; - case 32: return 15; - case 33: return 14; - case 34: return 13; - case 35: return 12; - case 36: return 11; - case 37: return 10; - case 38: return 9; - case 39: return 8; - case 40: return 7; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; default: log("SYSERR: Missing level for thief spell saving throw."); break; @@ -915,8 +915,8 @@ byte saving_throws(int class_num, int type, int level) case 38: return 4; case 39: return 3; case 40: return 2; - case 41: return 1; - case 42: return 1; + case 41: return 1; /* Some mobiles. */ + case 42: return 0; case 43: return 0; case 44: return 0; case 45: return 0; @@ -1211,12 +1211,6 @@ int thaco(int class_num, int level) case 32: return 10; case 33: return 10; case 34: return 9; - case 35: return 9; - case 36: return 9; - case 37: return 8; - case 38: return 8; - case 39: return 8; - case 40: return 8; default: log("SYSERR: Missing level for mage thac0."); } @@ -1257,12 +1251,6 @@ int thaco(int class_num, int level) case 32: return 1; case 33: return 1; case 34: return 1; - case 35: return 1; - case 36: return 0; - case 37: return 0; - case 38: return 0; - case 39: return 0; - case 40: return 0; default: log("SYSERR: Missing level for cleric thac0."); } @@ -1303,12 +1291,6 @@ int thaco(int class_num, int level) case 32: return 5; case 33: return 4; case 34: return 4; - case 35: return 4; - case 36: return 3; - case 37: return 3; - case 38: return 3; - case 39: return 2; - case 40: return 2; default: log("SYSERR: Missing level for thief thac0."); } @@ -1349,12 +1331,6 @@ int thaco(int class_num, int level) case 32: return 1; case 33: return 1; case 34: return 1; - case 35: return 1; - case 36: return 0; - case 37: return 0; - case 38: return 0; - case 39: return 0; - case 40: return 0; default: log("SYSERR: Missing level for warrior thac0."); } @@ -1440,7 +1416,6 @@ void roll_real_abils(struct char_data *ch) void do_start(struct char_data *ch) { GET_LEVEL(ch) = 1; - GET_ADMLEVEL(ch) = ADMLVL_MORTAL; GET_EXP(ch) = 1; set_title(ch, NULL); @@ -1535,9 +1510,7 @@ void advance_level(struct char_data *ch) else GET_PRACTICES(ch) += MIN(2, MAX(1, wis_app[GET_WIS(ch)].bonus)); - /* Auto-advance to immortality? */ - if (!CONFIG_NO_MORT_TO_IMMORT && GET_LEVEL(ch) >= CONFIG_MAX_LEVEL && !IS_ADMIN(ch, ADMLVL_IMMORT)) { - set_admin_level(ch, ADMLVL_IMMORT); /* Increase admin level and set default admin flags */ + if (GET_LEVEL(ch) >= LVL_IMMORT) { for (i = 0; i < 3; i++) GET_COND(ch, i) = (char) -1; SET_BIT_AR(PRF_FLAGS(ch), PRF_HOLYLIGHT); @@ -1561,8 +1534,10 @@ int backstab_mult(int level) return 4; /* level 14 - 20 */ else if (level <= 28) return 5; /* level 21 - 28 */ - else + else if (level < LVL_IMMORT) return 6; /* all remaining mortal levels */ + else + return 20; /* immortals */ } /* invalid_class is used by handler.c to determine if a piece of equipment is @@ -1670,11 +1645,17 @@ void init_spell_levels(void) /* Function to return the exp required for each class/level */ int level_exp(int chclass, int level) { - if (level > CONFIG_MAX_LEVEL || level < 0) { - log("SYSERR: Requesting exp for invalid mortal level %d!", level); + if (level > LVL_IMPL || level < 0) { + log("SYSERR: Requesting exp for invalid level %d!", level); return 0; } + /* Gods have exp close to EXP_MAX. This statement should never have to + * changed, regardless of how many mortal or immortal levels exist. */ + if (level > LVL_IMMORT) { + return EXP_MAX - ((LVL_IMPL - level) * 1000); + } + /* Exp required for normal mortals is below */ switch (chclass) { @@ -1712,9 +1693,7 @@ int level_exp(int chclass, int level) case 29: return 6850000; case 30: return 7400000; /* add new levels here */ - default: - log("SYSERR: Magic User XP tables not set up correctly in level_exp in class.c!"); - return 123456; + case LVL_IMMORT: return 8000000; } break; @@ -1752,9 +1731,7 @@ int level_exp(int chclass, int level) case 29: return 6000000; case 30: return 6400000; /* add new levels here */ - default: - log("SYSERR: Cleric XP tables not set up correctly in level_exp in class.c!"); - return 123456; + case LVL_IMMORT: return 7000000; } break; @@ -1792,9 +1769,7 @@ int level_exp(int chclass, int level) case 29: return 6300000; case 30: return 6650000; /* add new levels here */ - default: - log("SYSERR: Thief XP tables not set up correctly in level_exp in class.c!"); - return 123456; + case LVL_IMMORT: return 7000000; } break; @@ -1832,9 +1807,7 @@ int level_exp(int chclass, int level) case 29: return 6850000; case 30: return 7400000; /* add new levels here */ - default: - log("SYSERR: Warrior XP tables not set up correctly in level_exp in class.c!"); - return 123456; + case LVL_IMMORT: return 8000000; } break; } @@ -1849,8 +1822,10 @@ int level_exp(int chclass, int level) /* Default titles of male characters. */ const char *title_male(int chclass, int level) { - if (level <= 0 || level > CONFIG_MAX_LEVEL) + if (level <= 0 || level > LVL_IMPL) return "the Man"; + if (level == LVL_IMPL) + return "the Implementor"; switch (chclass) { @@ -1886,6 +1861,9 @@ const char *title_male(int chclass, int level) case 28: return "the Shaman"; case 29: return "the Keeper of Talismans"; case 30: return "the Archmage"; + case LVL_IMMORT: return "the Immortal Warlock"; + case LVL_GOD: return "the Avatar of Magic"; + case LVL_GRGOD: return "the God of Magic"; default: return "the Mage"; } break; @@ -1913,6 +1891,9 @@ const char *title_male(int chclass, int level) case 19: return "the Arch Bishop"; case 20: return "the Patriarch"; /* no one ever thought up these titles 21-30 */ + case LVL_IMMORT: return "the Immortal Cardinal"; + case LVL_GOD: return "the Inquisitor"; + case LVL_GRGOD: return "the God of Good and Evil"; default: return "the Cleric"; } break; @@ -1940,6 +1921,9 @@ const char *title_male(int chclass, int level) case 19: return "the Brigand"; case 20: return "the Cut-Throat"; /* no one ever thought up these titles 21-30 */ + case LVL_IMMORT: return "the Immortal Assassin"; + case LVL_GOD: return "the Demi God of Thieves"; + case LVL_GRGOD: return "the God of Thieves and Tradesmen"; default: return "the Thief"; } break; @@ -1967,6 +1951,9 @@ const char *title_male(int chclass, int level) case 19: return "the Cavalier"; case 20: return "the Knight"; /* no one ever thought up these titles 21-30 */ + case LVL_IMMORT: return "the Immortal Warlord"; + case LVL_GOD: return "the Extirpator"; + case LVL_GRGOD: return "the God of War"; default: return "the Warrior"; } break; @@ -1979,8 +1966,10 @@ const char *title_male(int chclass, int level) /* Default titles of female characters. */ const char *title_female(int chclass, int level) { - if (level <= 0 || level > CONFIG_MAX_LEVEL) + if (level <= 0 || level > LVL_IMPL) return "the Woman"; + if (level == LVL_IMPL) + return "the Implementress"; switch (chclass) { @@ -2016,6 +2005,9 @@ const char *title_female(int chclass, int level) case 28: return "Shaman"; case 29: return "the Keeper of Talismans"; case 30: return "Archwitch"; + case LVL_IMMORT: return "the Immortal Enchantress"; + case LVL_GOD: return "the Empress of Magic"; + case LVL_GRGOD: return "the Goddess of Magic"; default: return "the Witch"; } break; @@ -2043,6 +2035,9 @@ const char *title_female(int chclass, int level) case 19: return "the Arch Lady of the Church"; case 20: return "the Matriarch"; /* no one ever thought up these titles 21-30 */ + case LVL_IMMORT: return "the Immortal Priestess"; + case LVL_GOD: return "the Inquisitress"; + case LVL_GRGOD: return "the Goddess of Good and Evil"; default: return "the Cleric"; } break; @@ -2070,6 +2065,9 @@ const char *title_female(int chclass, int level) case 19: return "the Brigand"; case 20: return "the Cut-Throat"; /* no one ever thought up these titles 21-30 */ + case LVL_IMMORT: return "the Immortal Assassin"; + case LVL_GOD: return "the Demi Goddess of Thieves"; + case LVL_GRGOD: return "the Goddess of Thieves and Tradesmen"; default: return "the Thief"; } break; @@ -2097,6 +2095,9 @@ const char *title_female(int chclass, int level) case 19: return "the Cavalier"; case 20: return "the Lady Knight"; /* no one ever thought up these titles 21-30 */ + case LVL_IMMORT: return "the Immortal Lady of War"; + case LVL_GOD: return "the Queen of Destruction"; + case LVL_GRGOD: return "the Goddess of War"; default: return "the Warrior"; } break; diff --git a/src/comm.c b/src/comm.c index dba7e26..c8a372b 100644 --- a/src/comm.c +++ b/src/comm.c @@ -163,7 +163,6 @@ static sigfunc *my_signal(int signo, sigfunc *func); static RETSIGTYPE websterlink(int sig); static size_t proc_colors(char *txt, size_t maxlen, int parse); static void handle_webster_file(); -static void msdp_update(void); /* externally defined functions, used locally */ #ifdef __CXREF__ @@ -467,7 +466,7 @@ void copyover_recover() /* Add to the list of 'recent' players (since last reboot) with copyover flag */ if (AddRecentPlayer(GET_NAME(d->character), d->host, FALSE, TRUE) == FALSE) { - mudlog(BRF, MAX(ADMLVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "Failure to AddRecentPlayer (returned FALSE)."); + mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "Failure to AddRecentPlayer (returned FALSE)."); } } } @@ -917,13 +916,13 @@ void game_loop(socket_t local_mother_desc) /* Check for any signals we may have received. */ if (reread_wizlist) { reread_wizlist = FALSE; - mudlog(CMP, ADMLVL_IMMORT, TRUE, "Signal received - rereading wizlists."); + mudlog(CMP, LVL_IMMORT, TRUE, "Signal received - rereading wizlists."); reboot_wizlists(); } /* Orphaned right now as signal trapping is used for Webster lookup if (emergency_unban) { emergency_unban = FALSE; - mudlog(BRF, ADMLVL_IMMORT, TRUE, "Received SIGUSR2 - completely unrestricting game (emergent)"); + mudlog(BRF, LVL_IMMORT, TRUE, "Received SIGUSR2 - completely unrestricting game (emergent)"); ban_list = NULL; circle_restrict = 0; num_invalid = 0; @@ -966,9 +965,6 @@ void heartbeat(int heart_pulse) if (!(heart_pulse % PULSE_VIOLENCE)) perform_violence(); - if (!(heart_pulse % PASSES_PER_SEC)) - msdp_update(); - if (!(heart_pulse % (SECS_PER_MUD_HOUR * PASSES_PER_SEC))) { /* Tick ! */ next_tick = SECS_PER_MUD_HOUR; /* Reset tick coundown */ weather_and_time(1); @@ -1339,12 +1335,6 @@ size_t vwrite_to_output(struct descriptor_data *t, const char *format, va_list a return (0); wantsize = size = vsnprintf(txt, sizeof(txt), format, args); - - strcpy(txt, ProtocolOutput( t, txt, (int*)&wantsize )); - size = wantsize; - if ( t->pProtocol->WriteOOB > 0 ) - --t->pProtocol->WriteOOB; - if (t->character) wantsize = size = proc_colors(txt, sizeof(txt), COLOR_ON(t->character)); /* If exceeding the size of the buffer, truncate it for the overflow message */ @@ -1509,7 +1499,6 @@ static void init_descriptor (struct descriptor_data *newd, int desc) if (++last_desc == 1000) last_desc = 1; newd->desc_num = last_desc; - newd->pProtocol = ProtocolCreate(); } static int new_descriptor(socket_t s) @@ -1569,7 +1558,7 @@ static int new_descriptor(socket_t s) /* determine if the site is banned */ if (isbanned(newd->host) == BAN_ALL) { CLOSE_SOCKET(desc); - mudlog(CMP, ADMLVL_GOD, TRUE, "Connection attempt denied from [%s]", newd->host); + mudlog(CMP, LVL_GOD, TRUE, "Connection attempt denied from [%s]", newd->host); free(newd); return (0); } @@ -1581,8 +1570,6 @@ static int new_descriptor(socket_t s) newd->next = descriptor_list; descriptor_list = newd; - ProtocolNegotiate(newd); /* <--- Add this line */ - /* This is where the greetings are actually sent to the new player */ /* Adjusted by Jamdog to show color codes on the greetings page */ *greet_copy = '\0'; @@ -1616,16 +1603,14 @@ static int process_output(struct descriptor_data *t) /* add the extra CRLF if the person isn't in compact mode */ if (STATE(t) == CON_PLAYING && t->character && !IS_NPC(t->character) && !PRF_FLAGGED(t->character, PRF_COMPACT)) - if ( !t->pProtocol->WriteOOB ) strcat(osb, "\r\n"); /* strcpy: OK (osb:MAX_SOCK_BUF-2 reserves space) */ /* add a prompt */ - if ( !t->pProtocol->WriteOOB ) strcat(i, make_prompt(t)); /* strcpy: OK (i:MAX_SOCK_BUF reserves space) */ /* now, send the output. If this is an 'interruption', use the prepended * CRLF, otherwise send the straight output sans CRLF. */ - if (t->has_prompt && !t->pProtocol->WriteOOB) { + if (t->has_prompt) { t->has_prompt = FALSE; result = write_to_descriptor(t->descriptor, i); if (result >= 2) @@ -1875,9 +1860,6 @@ static int process_input(struct descriptor_data *t) size_t space_left; char *ptr, *read_point, *write_point, *nl_pos = NULL; char tmp[MAX_INPUT_LENGTH]; - - static char read_buf[PROTOCOL_BUFFER]; - read_buf[0] = '\0'; /* first, find the point where we left off reading data */ buf_length = strlen(t->inbuf); @@ -1890,14 +1872,7 @@ static int process_input(struct descriptor_data *t) return (-1); } - bytes_read = perform_socket_read(t->descriptor, read_buf, 2048); - - if ( bytes_read >= 0 ) - { - read_buf[bytes_read] = '\0'; - ProtocolInput( t, read_buf, bytes_read, t->inbuf ); - bytes_read = strlen(t->inbuf); - } + bytes_read = perform_socket_read(t->descriptor, read_point, space_left); if (bytes_read < 0) /* Error, disconnect them. */ return (-1); @@ -2122,13 +2097,13 @@ void close_socket(struct descriptor_data *d) /* We are guaranteed to have a person. */ act("$n has lost $s link.", TRUE, link_challenged, 0, 0, TO_ROOM); save_char(link_challenged); - mudlog(NRM, MAX(ADMLVL_IMMORT, GET_INVIS_LEV(link_challenged)), TRUE, "Closing link to: %s.", GET_NAME(link_challenged)); + mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(link_challenged)), TRUE, "Closing link to: %s.", GET_NAME(link_challenged)); } else { - mudlog(CMP, ADMLVL_IMMORT, TRUE, "Losing player: %s.", GET_NAME(d->character) ? GET_NAME(d->character) : ""); + mudlog(CMP, LVL_IMMORT, TRUE, "Losing player: %s.", GET_NAME(d->character) ? GET_NAME(d->character) : ""); free_char(d->character); } } else - mudlog(CMP, ADMLVL_IMMORT, TRUE, "Losing descriptor without char."); + mudlog(CMP, LVL_IMMORT, TRUE, "Losing descriptor without char."); /* JE 2/22/95 -- part of my unending quest to make switch stable */ if (d->original && d->original->desc) @@ -2148,8 +2123,6 @@ void close_socket(struct descriptor_data *d) if (d->showstr_count) free(d->showstr_vector); - ProtocolDestroy( d->pProtocol ); - /*. Kill any OLC stuff .*/ switch (d->connected) { case CON_OEDIT: @@ -2821,61 +2794,3 @@ static void handle_webster_file(void) { send_to_char(ch, "You get this feedback from Merriam-Webster:\r\n"); page_string(ch->desc, retval, 1); } - -static void msdp_update( void ) -{ - struct descriptor_data *d; - int PlayerCount = 0; - - for (d = descriptor_list; d; d = d->next) - { - struct char_data *ch = d->character; - if ( ch && !IS_NPC(ch) && d->connected == CON_PLAYING ) - { - struct char_data *pOpponent = FIGHTING(ch); - ++PlayerCount; - - MSDPSetString( d, eMSDP_CHARACTER_NAME, GET_NAME(ch) ); - MSDPSetNumber( d, eMSDP_ALIGNMENT, GET_ALIGNMENT(ch) ); - MSDPSetNumber( d, eMSDP_EXPERIENCE, GET_EXP(ch) ); - - MSDPSetNumber( d, eMSDP_HEALTH, GET_HIT(ch) ); - MSDPSetNumber( d, eMSDP_HEALTH_MAX, GET_MAX_HIT(ch) ); - MSDPSetNumber( d, eMSDP_LEVEL, GET_LEVEL(ch) ); - - MSDPSetNumber( d, eMSDP_CLASS, GET_CLASS(ch) ); - - MSDPSetNumber( d, eMSDP_MANA, GET_MANA(ch) ); - MSDPSetNumber( d, eMSDP_MANA_MAX, GET_MAX_MANA(ch) ); - MSDPSetNumber( d, eMSDP_WIMPY, GET_WIMP_LEV(ch) ); - MSDPSetNumber( d, eMSDP_MONEY, GET_GOLD(ch) ); - MSDPSetNumber( d, eMSDP_MOVEMENT, GET_MOVE(ch) ); - MSDPSetNumber( d, eMSDP_MOVEMENT_MAX, GET_MAX_MOVE(ch) ); - MSDPSetNumber( d, eMSDP_AC, compute_armor_class(ch) ); - - /* This would be better moved elsewhere */ - if ( pOpponent != NULL ) - { - int hit_points = (GET_HIT(pOpponent) * 100) / GET_MAX_HIT(pOpponent); - MSDPSetNumber( d, eMSDP_OPPONENT_HEALTH, hit_points ); - MSDPSetNumber( d, eMSDP_OPPONENT_HEALTH_MAX, 100 ); - MSDPSetNumber( d, eMSDP_OPPONENT_LEVEL, GET_LEVEL(pOpponent) ); - MSDPSetString( d, eMSDP_OPPONENT_NAME, PERS(pOpponent, ch) ); - } - else /* Clear the values */ - { - MSDPSetNumber( d, eMSDP_OPPONENT_HEALTH, 0 ); - MSDPSetNumber( d, eMSDP_OPPONENT_LEVEL, 0 ); - MSDPSetString( d, eMSDP_OPPONENT_NAME, "" ); - } - - MSDPUpdate( d ); - } - - /* Ideally this should be called once at startup, and again whenever - * someone leaves or joins the mud. But this works, and it keeps the - * snippet simple. Optimise as you see fit. - */ - MSSPSetPlayers( PlayerCount ); - } -} diff --git a/src/config.c b/src/config.c index 028e66d..1bf1893 100644 --- a/src/config.c +++ b/src/config.c @@ -69,15 +69,12 @@ int max_exp_loss = 500000; /* max losable per death */ int max_npc_corpse_time = 5; int max_pc_corpse_time = 10; -/* The maximum mortal level that can be obtained */ -int max_mortal_level = 30; - /* How many ticks before a player is sent to the void or idle-rented. */ int idle_void = 8; int idle_rent_time = 48; -/* This admin level and up is immune to idling, LVL_IMPL+1 will disable it. */ -int idle_max_level = ADMLVL_GOD; +/* This level and up is immune to idling, LVL_IMPL+1 will disable it. */ +int idle_max_level = LVL_GOD; /* Should items in death traps automatically be junked? */ int dts_are_dumps = YES; @@ -105,8 +102,8 @@ int track_through_doors = YES; int no_mort_to_immort = YES; /* Are diagonal directions enabled? - * If set to NO, then only the 6 directions n,e,s,w,u,d are allowed */ -int diagonal_dirs_enabled = NO; +* If set to NO, then only the 6 directions n,e,s,w,u,d are allowed */ +int diagonal_dirs = NO; /* RENT/CRASHSAVE OPTIONS */ /* Should the MUD allow you to 'rent' for free? (i.e. if you just quit, your @@ -154,8 +151,9 @@ int auto_pwipe = NO; * Element 3, level 4, days 7: Players level 2 through 4 are wiped if they haven't logged on in the past 7 days. * Element 4, level 10, days 30: Players level 5-10 get 30 days. - * Element 5, level CONFIG_MAX_LEVEL, days 60: All other mortals get 60 days. - * Element 6: Because -2 is less than CONFIG_MAX_LEVEL, this is assumed to be the end + * Element 5, level LVL_IMMORT - 1, days 60: All other mortals get 60 days. + * Element 6, level LVL_IMPL, days 90: Immortals get 90 days. + * Element 7: Because -2 is less than LVL_IMPL, this is assumed to be the end of the criteria. The days entry is not used in this case. */ struct pclean_criteria_data pclean_criteria[] = { /* LEVEL DAYS */ @@ -163,7 +161,8 @@ struct pclean_criteria_data pclean_criteria[] = { { 1 ,4 }, { 4 ,7 }, { 10 ,30 }, - { 30 ,60 }, /* highest mortal - NOTE: Should be CONFIG_MAX_LEVEL */ + { LVL_IMMORT - 1 ,60 }, /* highest mortal */ + { LVL_IMPL ,90 }, /* all immortals */ { -1 ,0 } /* no more level checks */ }; @@ -292,7 +291,7 @@ int use_autowiz = YES; /* If yes, what is the lowest level which should be on the wizlist? (All immort * levels below the level you specify will go on the immlist instead.) */ -int min_wizlist_lev = ADMLVL_GOD; +int min_wizlist_lev = LVL_GOD; /* To mimic stock behavior set to NO. To allow mortals to see doors in exits * set to YES. */ @@ -307,6 +306,6 @@ int default_minimap_size = 2; /* Medit Stats menu - show 'advanced' options? */ int medit_advanced_stats = YES; -/** Does "bug resolve" autosave ? */ -int ibt_autosave = YES; +/* Does "bug resolve" autosave ? */ +int ibt_autosave = YES; diff --git a/src/config.h b/src/config.h index 01db69f..96cccec 100644 --- a/src/config.h +++ b/src/config.h @@ -25,7 +25,6 @@ extern int max_exp_gain; extern int max_exp_loss; extern int max_npc_corpse_time; extern int max_pc_corpse_time; -extern int max_mortal_level; extern int idle_void; extern int idle_rent_time; extern int idle_max_level; @@ -36,7 +35,7 @@ extern const char *NOPERSON; extern const char *NOEFFECT; extern int track_through_doors; extern int no_mort_to_immort; -extern int diagonal_dirs_enabled; +extern int diagonal_dirs; extern int free_rent; extern int max_obj_save; extern int min_rent_cost; diff --git a/src/constants.c b/src/constants.c index d133821..6223784 100644 --- a/src/constants.c +++ b/src/constants.c @@ -40,7 +40,7 @@ const char *dirs[] = "west", "up", "down", - "northwest", /* Diagonals only used if CONFIG_DIAGONAL_DIRS is set */ + "northwest", /* Diagonals only used if CONFIG_DIAGONAL_DIRS is set */ "northeast", "southeast", "southwest", @@ -62,82 +62,6 @@ const char *autoexits[] = "\n" }; -/** Administrative level names - * @pre Must be in the same order as the ADMLVL_ defines. - * Must end array with a single newline. */ -const char *admin_level_names[ADMLVL_IMPL + 2] = { - "Mortal", // ADMLVL_NONE - "Immortal", // ADMLVL_IMMORTAL - "God", // ADMLVL_GOD - "Great God", // ADMLVL_GRGOD - "Implementor", // ADMLVL_IMPL - "\n", -}; - -/** Administrative flag short names - * @pre Must be in the same order as the ADMIN_ defines. - * Must end array with a single newline. */ -const char *admin_flag_names[] = { - "TellAll", - "SeeInventory", - "SeeSecret", - "KnowWeather", - "FullWhere", - "Money", - "EatAnything", - "NoPoison", - "WalkAnywhere", - "NoKeys", - "InstantKill", - "NoSteal", - "TransAll", - "SwitchMortal", - "ForceMass", - "AllHouses", - "NoDamage", - "AllShops", - "CEDIT", - "Build", - "AdvBuild", - "Poof", - "Admin", - "SetQP", - "AdvancedIBT", - "\n" -}; - -/** Administrative flag descriptions - * @pre Must be in the same order as the ADMIN_ defines. - * Must end array with a single newline. */ -const char *admin_flags[] = { - "You may use 'page all'", - "You can see other players inventories", - "You may see secret doors", - "You may know weather data", - "You know fully where things are", - "You do not require money", - "You can eat anything", - "You cannot be poisoned", - "You can walk anywhere", - "You do not require keys", - "You have the touch of death", - "You cannot be stolen from", - "You may use 'trans all'", - "You can use 'switch'", - "You may use 'force all'", - "You may enter any house", - "You do not take damage", - "You may use any shop", - "You may use cedit", - "You may use basic OLC tools", - "You may use advanced OLC tools", - "You may use goto and set poofs", - "You may set admin privs", - "You can give and remove qp", - "You can use advanced IBT commands", - "\n" -}; - /** Room flag descriptions. * @pre Must be in the same order as the defines. * Must end array with a single newline. */ @@ -159,7 +83,6 @@ const char *room_bits[] = { "OLC", "*", /* The BFS Mark. */ "WORLDMAP", - "MAIL", "\n" }; @@ -286,7 +209,6 @@ const char *action_bits[] = { "NO_BASH", "NO_BLIND", "NO_KILL", - "MAILMAN", "DEAD", /* You should never see this. */ "\n" }; @@ -571,31 +493,6 @@ const char *container_bits[] = { "\n", }; -/** Flag descriptions for HOUSE_ flags - * @pre Must be in the same order as the defines. - * Must end array with a single newline. */ -const char *house_bits[] = { -"NO_GUEST", -"FREE", -"NO_IMM", -"IMP_ONLY", -"RENTFREE", -"SAVE_!RENT", -"NO_SAVE", -"NO_SPEC", -"\n" -}; - -/** House mode types for HOUSE_ mode values - * @pre Must be in the same order as the defines. - * Must end array with a single newline. */ -const char *house_types[] = { -"PLAYER_OWNED", -"IMM_OWNED", -"PLAYER_SHOP", -"\n" -}; - /** Describes the liquid description. * @pre Must be in the same order as the defines. * Must end array with a single newline. */ diff --git a/src/constants.h b/src/constants.h index 1c9ad93..660c780 100644 --- a/src/constants.h +++ b/src/constants.h @@ -15,9 +15,6 @@ extern const char *tbamud_version; extern const char *dirs[]; extern const char *autoexits[]; -extern const char *admin_level_names[]; -extern const char *admin_flag_names[]; -extern const char *admin_flags[]; extern const char *room_bits[]; extern const char *zone_bits[]; extern const char *exit_bits[]; @@ -36,8 +33,6 @@ extern const char *wear_bits[]; extern const char *extra_bits[]; extern const char *apply_types[]; extern const char *container_bits[]; -extern const char *house_bits[]; -extern const char *house_types[]; extern const char *drinks[]; extern const char *drinknames[]; extern const char *color_liquid[]; diff --git a/src/db.c b/src/db.c index 127152f..25804f9 100644 --- a/src/db.c +++ b/src/db.c @@ -80,7 +80,7 @@ qst_rnum total_quests = 0; /* top of autoquest table */ struct shop_data *shop_index; /* index table for shops */ int top_shop = -1; /* top of shop table */ -int can_mail = 1; /* mail enabled? */ +int no_mail = 0; /* mail disabled? */ int mini_mud = 0; /* mini-mud mode? */ int no_rent_check = 0; /* skip rent check on boot? */ time_t boot_time = 0; /* time of mud boot */ @@ -704,11 +704,10 @@ void boot_db(void) sort_spells(); log("Booting mail system."); - if (!build_mail_index()) { + if (!scan_file()) { log(" Mail boot failed -- Mail system disabled"); - can_mail = 0; + no_mail = 1; } - log("Reading banned site and invalid-name list."); load_banned(); read_invalid_list(); @@ -1244,7 +1243,7 @@ void parse_room(FILE *fl, int virtual_nr) world[room_nr].people = NULL; world[room_nr].light = 0; /* Zero light sources */ - for (i = 0; i < NUM_OF_DIRS; i++) /* NUM_OF_DIRS used here, not DIR_COUNT */ + for (i = 0; i < NUM_OF_DIRS; i++) /* NUM_OF_DIRS here, not DIR_COUNT */ world[room_nr].dir_option[i] = NULL; world[room_nr].ex_description = NULL; @@ -2465,7 +2464,7 @@ void zone_update(void) if (zone_table[update_u->zone_to_reset].reset_mode == 2 || is_empty(update_u->zone_to_reset)) { reset_zone(update_u->zone_to_reset); - mudlog(CMP, ADMLVL_IMPL, FALSE, "Auto zone reset: %s (Zone %d)", + mudlog(CMP, LVL_IMPL, FALSE, "Auto zone reset: %s (Zone %d)", zone_table[update_u->zone_to_reset].name, zone_table[update_u->zone_to_reset].number); /* dequeue */ if (update_u == reset_q.head) @@ -2487,8 +2486,8 @@ void zone_update(void) static void log_zone_error(zone_rnum zone, int cmd_no, const char *message) { - mudlog(NRM, ADMLVL_GOD, TRUE, "SYSERR: zone file: %s", message); - mudlog(NRM, ADMLVL_GOD, TRUE, "SYSERR: ...offending cmd: '%c' cmd in zone #%d, line %d", + mudlog(NRM, LVL_GOD, TRUE, "SYSERR: zone file: %s", message); + mudlog(NRM, LVL_GOD, TRUE, "SYSERR: ...offending cmd: '%c' cmd in zone #%d, line %d", ZCMD.command, zone_table[zone].number, ZCMD.line); } @@ -2742,7 +2741,7 @@ int is_empty(zone_rnum zone_nr) continue; /* If an immortal has nohassle off, he counts as present. Added for testing * zone reset triggers -Welcor */ - if ((!IS_NPC(i->character)) && (IS_ADMIN(i->character, ADMLVL_IMMORT)) && (PRF_FLAGGED(i->character, PRF_NOHASSLE))) + if ((!IS_NPC(i->character)) && (GET_LEVEL(i->character) >= LVL_IMMORT) && (PRF_FLAGGED(i->character, PRF_NOHASSLE))) continue; return (0); @@ -3377,8 +3376,7 @@ void init_char(struct char_data *ch) /* If this is our first player make him IMPL. */ if (top_of_p_table == 0) { - GET_LEVEL(ch) = CONFIG_MAX_LEVEL; - set_admin_level(ch, ADMLVL_IMPL); /* Set IMP level and IMP flags */ + GET_LEVEL(ch) = LVL_IMPL; GET_EXP(ch) = 7000000; /* The implementor never goes through do_start(). */ @@ -3423,7 +3421,7 @@ void init_char(struct char_data *ch) log("SYSERR: init_char: Character '%s' not found in player table.", GET_NAME(ch)); for (i = 1; i <= MAX_SKILLS; i++) { - if (!IS_ADMIN(ch, ADMLVL_IMPL)) + if (GET_LEVEL(ch) < LVL_IMPL) SET_SKILL(ch, i, 0); else SET_SKILL(ch, i, 100); @@ -3444,7 +3442,7 @@ void init_char(struct char_data *ch) ch->real_abils.cha = 25; for (i = 0; i < 3; i++) - GET_COND(ch, i) = (IS_ADMIN(ch, ADMLVL_IMPL) ? -1 : 24); + GET_COND(ch, i) = (GET_LEVEL(ch) == LVL_IMPL ? -1 : 24); GET_LOADROOM(ch) = NOWHERE; GET_SCREEN_WIDTH(ch) = PAGE_WIDTH; @@ -3669,7 +3667,7 @@ static int check_object_level(struct obj_data *obj, int val) { int error = FALSE; - if ((GET_OBJ_VAL(obj, val) < 0 || GET_OBJ_VAL(obj, val) > CONFIG_MAX_LEVEL) && (error = TRUE)) + if ((GET_OBJ_VAL(obj, val) < 0 || GET_OBJ_VAL(obj, val) > LVL_IMPL) && (error = TRUE)) log("SYSERR: Object #%d (%s) has out of range level #%d.", GET_OBJ_VNUM(obj), obj->short_description, GET_OBJ_VAL(obj, val)); @@ -3701,26 +3699,25 @@ static void load_default_config( void ) /* Game play options. */ CONFIG_PK_ALLOWED = pk_allowed; CONFIG_PT_ALLOWED = pt_allowed; - CONFIG_LEVEL_CAN_SHOUT = level_can_shout; - CONFIG_HOLLER_MOVE_COST = holler_move_cost; - CONFIG_TUNNEL_SIZE = tunnel_size; - CONFIG_MAX_EXP_GAIN = max_exp_gain; - CONFIG_MAX_EXP_LOSS = max_exp_loss; + CONFIG_LEVEL_CAN_SHOUT = level_can_shout; + CONFIG_HOLLER_MOVE_COST = holler_move_cost; + CONFIG_TUNNEL_SIZE = tunnel_size; + CONFIG_MAX_EXP_GAIN = max_exp_gain; + CONFIG_MAX_EXP_LOSS = max_exp_loss; CONFIG_MAX_NPC_CORPSE_TIME = max_npc_corpse_time; - CONFIG_MAX_PC_CORPSE_TIME = max_pc_corpse_time; - CONFIG_MAX_LEVEL = max_mortal_level; - CONFIG_IDLE_VOID = idle_void; - CONFIG_IDLE_RENT_TIME = idle_rent_time; - CONFIG_IDLE_MAX_LEVEL = idle_max_level; - CONFIG_DTS_ARE_DUMPS = dts_are_dumps; + CONFIG_MAX_PC_CORPSE_TIME = max_pc_corpse_time; + CONFIG_IDLE_VOID = idle_void; + CONFIG_IDLE_RENT_TIME = idle_rent_time; + CONFIG_IDLE_MAX_LEVEL = idle_max_level; + CONFIG_DTS_ARE_DUMPS = dts_are_dumps; CONFIG_LOAD_INVENTORY = load_into_inventory; - CONFIG_OK = strdup(OK); - CONFIG_NOPERSON = strdup(NOPERSON); - CONFIG_NOEFFECT = strdup(NOEFFECT); + CONFIG_OK = strdup(OK); + CONFIG_NOPERSON = strdup(NOPERSON); + CONFIG_NOEFFECT = strdup(NOEFFECT); CONFIG_TRACK_T_DOORS = track_through_doors; - CONFIG_NO_MORT_TO_IMMORT = no_mort_to_immort; + CONFIG_NO_MORT_TO_IMMORT = no_mort_to_immort; CONFIG_DISP_CLOSED_DOORS = display_closed_doors; - CONFIG_DIAGONAL_DIRS = diagonal_dirs_enabled; + CONFIG_DIAGONAL_DIRS = diagonal_dirs; CONFIG_MAP = map_option; CONFIG_MAP_SIZE = default_map_size; CONFIG_MINIMAP_SIZE = default_minimap_size; @@ -3730,7 +3727,7 @@ static void load_default_config( void ) CONFIG_FREE_RENT = free_rent; CONFIG_MAX_OBJ_SAVE = max_obj_save; CONFIG_MIN_RENT_COST = min_rent_cost; - CONFIG_AUTO_SAVE = auto_save; + CONFIG_AUTO_SAVE = auto_save; CONFIG_AUTOSAVE_TIME = autosave_time; CONFIG_CRASH_TIMEOUT = crash_file_timeout; CONFIG_RENT_TIMEOUT = rent_file_timeout; @@ -3769,8 +3766,7 @@ static void load_default_config( void ) CONFIG_WELC_MESSG = strdup(WELC_MESSG); CONFIG_START_MESSG = strdup(START_MESSG); CONFIG_MEDIT_ADVANCED = medit_advanced_stats; - CONFIG_IBT_AUTOSAVE = ibt_autosave; - + CONFIG_IBT_AUTOSAVE = ibt_autosave; /* Autowiz options. */ CONFIG_USE_AUTOWIZ = use_autowiz; CONFIG_MIN_WIZLIST_LEV = min_wizlist_lev; @@ -3811,14 +3807,12 @@ void load_config( void ) case 'c': if (!str_cmp(tag, "crash_file_timeout")) CONFIG_CRASH_TIMEOUT = num; - else if (!str_cmp(tag, "can_mail")) - CONFIG_CAN_MAIL = num; break; case 'd': if (!str_cmp(tag, "display_closed_doors")) CONFIG_DISP_CLOSED_DOORS = num; - else if (!str_cmp(tag, "diagonal_dirs_enabled")) + else if (!str_cmp(tag, "diagonal_dirs")) CONFIG_DIAGONAL_DIRS = num; else if (!str_cmp(tag, "dts_are_dumps")) CONFIG_DTS_ARE_DUMPS = num; @@ -3883,7 +3877,7 @@ void load_config( void ) else if (!str_cmp(tag, "immort_start_room")) CONFIG_IMMORTAL_START = num; else if (!str_cmp(tag, "ibt_autosave")) - CONFIG_IBT_AUTOSAVE = num; + CONFIG_IBT_AUTOSAVE = num; break; case 'l': @@ -3916,8 +3910,6 @@ void load_config( void ) CONFIG_MAX_OBJ_SAVE = num; else if (!str_cmp(tag, "max_pc_corpse_time")) CONFIG_MAX_PC_CORPSE_TIME = num; - else if (!str_cmp(tag, "max_mortal_level")) - CONFIG_MAX_LEVEL = num; else if (!str_cmp(tag, "max_playing")) CONFIG_MAX_PLAYING = num; else if (!str_cmp(tag, "menu")) { @@ -3935,26 +3927,6 @@ void load_config( void ) CONFIG_MAP = num; else if (!str_cmp(tag, "medit_advanced_stats")) CONFIG_MEDIT_ADVANCED = num; - else if (!str_cmp(tag, "mail_object_cost")) - CONFIG_OBJECT_COST = num; - else if (!str_cmp(tag, "mail_objects_allowed")) - CONFIG_CAN_MAIL_OBJ = num; - else if (!str_cmp(tag, "mail_gold_allowed")) - CONFIG_CAN_MAIL_GOLD = num; - else if (!str_cmp(tag, "mail_stamp_cost")) - CONFIG_STAMP_COST = num; - else if (!str_cmp(tag, "mail_min_level")) - CONFIG_MIN_MAIL_LEVEL = num; - else if (!str_cmp(tag, "mail_min_free_level")) - CONFIG_FREE_MAIL_LEVEL = num; - else if (!str_cmp(tag, "mail_drafts_allowed")) - CONFIG_DRAFTS_ALLOWED = num; - else if (!str_cmp(tag, "mail_draft_timeout")) - CONFIG_DRAFT_TIMEOUT = num; - else if (!str_cmp(tag, "mail_min_mail_anywhere")) - CONFIG_MIN_MAIL_ANYWHERE = num; - else if (!str_cmp(tag, "mail_min_send_to_all")) - CONFIG_MIN_SEND_TO_ALL = num; break; case 'n': diff --git a/src/db.h b/src/db.h index b08deda..42c1992 100644 --- a/src/db.h +++ b/src/db.h @@ -34,7 +34,6 @@ #define LIB_PLROBJS ":plrobjs:" #define LIB_PLRVARS ":plrvars:" #define LIB_PLRFILES ":plrfiles:" -#define LIB_MLFILES ":mudmail:" #define LIB_HOUSE ":house:" #define SLASH ":" #elif defined(CIRCLE_AMIGA) || defined(CIRCLE_UNIX) || defined(CIRCLE_WINDOWS) || defined(CIRCLE_ACORN) || defined(CIRCLE_VMS) @@ -48,7 +47,6 @@ #define LIB_PLRVARS "plrvars/" #define LIB_HOUSE "house/" #define LIB_PLRFILES "plrfiles/" -#define LIB_MLFILES "mudmail/" #define SLASH "/" #else #error "Unknown path components." @@ -58,7 +56,6 @@ #define SUF_TEXT "text" #define SUF_MEM "mem" #define SUF_PLR "plr" -#define SUF_MAIL "ml" #if defined(CIRCLE_AMIGA) #define EXE_FILE "/bin/circle" /* maybe use argv[0] but it's not reliable */ @@ -146,7 +143,6 @@ #define PINDEX_NODELETE (1 << 1) /* protected player */ #define PINDEX_SELFDELETE (1 << 2) /* player is selfdeleting*/ #define PINDEX_NOWIZLIST (1 << 3) /* Player shouldn't be on wizlist*/ -#define PINDEX_MORTAL (1 << 4) /* Player is currently mortal (shouldn't be on wizlist) */ #define REAL 0 #define VIRTUAL 1 @@ -217,7 +213,6 @@ struct player_index_element { char *name; long id; int level; - int admlevel; int flags; time_t last; }; @@ -354,7 +349,7 @@ extern int top_of_helpt; extern struct help_index_element *help_table; /* Mud configurable variables */ -extern int can_mail; +extern int no_mail; extern int mini_mud; extern int no_rent_check; extern time_t boot_time; diff --git a/src/dg_db_scripts.c b/src/dg_db_scripts.c index 9499803..54b61d2 100644 --- a/src/dg_db_scripts.c +++ b/src/dg_db_scripts.c @@ -142,7 +142,7 @@ void dg_read_trigger(FILE *fp, void *proto, int type) count = sscanf(line,"%7s %d",junk,&vnum); if (count != 2) { - mudlog(BRF, ADMLVL_BUILDER, TRUE, + mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: Error assigning trigger! - Line was\n %s", line); return; } @@ -151,17 +151,17 @@ void dg_read_trigger(FILE *fp, void *proto, int type) if (rnum == NOTHING) { switch(type) { case MOB_TRIGGER: - mudlog(BRF, ADMLVL_BUILDER, TRUE, + mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: dg_read_trigger: Trigger vnum #%d asked for but non-existant! (mob: %s - %d)", vnum, GET_NAME((char_data *)proto), GET_MOB_VNUM((char_data *)proto)); break; case WLD_TRIGGER: - mudlog(BRF, ADMLVL_BUILDER, TRUE, + mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: dg_read_trigger: Trigger vnum #%d asked for but non-existant! (room:%d)", vnum, GET_ROOM_VNUM( ((room_data *)proto)->number )); break; default: - mudlog(BRF, ADMLVL_BUILDER, TRUE, + mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: dg_read_trigger: Trigger vnum #%d asked for but non-existant! (?)", vnum); break; } @@ -203,13 +203,13 @@ void dg_read_trigger(FILE *fp, void *proto, int type) CREATE(room->script, struct script_data, 1); add_trigger(SCRIPT(room), read_trigger(rnum), -1); } else { - mudlog(BRF, ADMLVL_BUILDER, TRUE, + mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: non-existant trigger #%d assigned to room #%d", vnum, room->number); } break; default: - mudlog(BRF, ADMLVL_BUILDER, TRUE, + mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: Trigger vnum #%d assigned to non-mob/obj/room", vnum); } } @@ -223,14 +223,14 @@ void dg_obj_trigger(char *line, struct obj_data *obj) count = sscanf(line,"%s %d",junk,&vnum); if (count != 2) { - mudlog(BRF, ADMLVL_BUILDER, TRUE, + mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: dg_obj_trigger() : Error assigning trigger! - Line was:\n %s", line); return; } rnum = real_trigger(vnum); if (rnum==NOTHING) { - mudlog(BRF, ADMLVL_BUILDER, TRUE, + mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: Trigger vnum #%d asked for but non-existant! (Object: %s - %d)", vnum, obj->short_description, GET_OBJ_VNUM(obj)); return; @@ -265,7 +265,7 @@ void assign_triggers(void *i, int type) while (trg_proto) { rnum = real_trigger(trg_proto->vnum); if (rnum==NOTHING) { - mudlog(BRF, ADMLVL_BUILDER, TRUE, + mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: trigger #%d non-existant, for mob #%d", trg_proto->vnum, mob_index[mob->nr].vnum); } else { @@ -298,7 +298,7 @@ void assign_triggers(void *i, int type) while (trg_proto) { rnum = real_trigger(trg_proto->vnum); if (rnum==NOTHING) { - mudlog(BRF, ADMLVL_BUILDER, TRUE, + mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: trigger #%d non-existant, for room #%d", trg_proto->vnum, room->number); } else { @@ -310,7 +310,7 @@ void assign_triggers(void *i, int type) } break; default: - mudlog(BRF, ADMLVL_BUILDER, TRUE, + mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: unknown type for assign_triggers()"); break; } diff --git a/src/dg_misc.c b/src/dg_misc.c index cf55dff..659e549 100644 --- a/src/dg_misc.c +++ b/src/dg_misc.c @@ -278,10 +278,10 @@ int valid_dg_target(struct char_data *ch, int bitvector) return TRUE; /* all npcs are allowed as targets */ else if (ch->desc && (STATE(ch->desc) != CON_PLAYING)) return FALSE; /* Only PC's who are playing can be targetted */ - else if (!IS_ADMIN(ch, ADMLVL_IMMORT)) + else if (GET_LEVEL(ch) < LVL_IMMORT) return TRUE; /* as well as all mortals */ else if (!IS_SET(bitvector, DG_ALLOW_GODS) && - IS_ADMIN(ch, ADMLVL_GOD)) /* ADMLVL_GOD has the advance command. Can't allow them to be forced. */ + GET_LEVEL(ch) >= LVL_GRGOD) /* LVL_GOD has the advance command. Can't allow them to be forced. */ return FALSE; /* but not always the highest gods */ else if (!PRF_FLAGGED(ch, PRF_NOHASSLE)) return TRUE; /* the ones in between as allowed as long as they have no-hassle off. */ @@ -291,7 +291,7 @@ int valid_dg_target(struct char_data *ch, int bitvector) void script_damage(struct char_data *vict, int dam) { - if (IS_ADMIN(vict, ADMLVL_IMMORT) && (dam > 0)) { + if (GET_LEVEL(vict)>=LVL_IMMORT && (dam > 0)) { send_to_char(vict, "Being the cool immortal you are, you sidestep a trap, " "obviously placed to kill you.\r\n"); return; diff --git a/src/dg_mobcmd.c b/src/dg_mobcmd.c index 29c91c7..b56e7a5 100644 --- a/src/dg_mobcmd.c +++ b/src/dg_mobcmd.c @@ -22,13 +22,14 @@ #include "genzon.h" /* for real_zone_by_thing */ #include "act.h" #include "fight.h" -#include "mail.h" + /* Local file scope functions. */ +static void mob_log(char_data *mob, const char *format, ...); /* attaches mob's name and vnum to msg and sends it to script_log */ -void mob_log(char_data *mob, const char *format, ...) +static void mob_log(char_data *mob, const char *format, ...) { va_list args; char output[MAX_STRING_LENGTH]; @@ -43,7 +44,7 @@ void mob_log(char_data *mob, const char *format, ...) /* Macro to determine if a mob is permitted to use these commands. */ #define MOB_OR_IMPL(ch) \ - ((IS_NPC(ch) && (!(ch)->desc || GET_ADMLEVEL((ch)->desc->original) >= ADMLVL_IMPL)) || (SCRIPT(ch) && TRIGGERS(SCRIPT(ch)))) + ((IS_NPC(ch) && (!(ch)->desc || GET_LEVEL((ch)->desc->original) >= LVL_IMPL)) || (SCRIPT(ch) && TRIGGERS(SCRIPT(ch)))) #define MOB_OR_PLAYER(ch) (GET_LEVEL(ch) > 0) /* mob commands */ @@ -136,8 +137,8 @@ ACMD(do_mkill) return; } -/* Lets the mobile destroy an object in its inventory it can also destroy a - * worn object and it can destroy items using all.xxxxx or just plain all of +/* Lets the mobile destroy an object in its inventory it can also destroy a + * worn object and it can destroy items using all.xxxxx or just plain all of * them. */ ACMD(do_mjunk) { @@ -286,7 +287,7 @@ ACMD(do_mzoneecho) { int zone; char room_number[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH], *msg; - + if (!MOB_OR_IMPL(ch)) { send_to_char(ch, "Huh?!?\r\n"); @@ -307,7 +308,7 @@ ACMD(do_mzoneecho) } } -/* Lets the mobile load an item or mobile. All items are loaded into +/* Lets the mobile load an item or mobile. All items are loaded into * inventory, unless it is NO-TAKE. */ ACMD(do_mload) { @@ -328,7 +329,7 @@ ACMD(do_mload) if (AFF_FLAGGED(ch, AFF_CHARM)) return; - if (ch->desc && (!IS_ADMIN(ch->desc->original, ADMLVL_IMPL))) + if( ch->desc && GET_LEVEL(ch->desc->original) < LVL_IMPL) return; target = two_arguments(argument, arg1, arg2); @@ -412,8 +413,8 @@ ACMD(do_mload) mob_log(ch, "mload: bad type"); } -/* Lets the mobile purge all objects and other npcs in the room, or purge a - * specified object or mob in the room. It can purge itself, but this will +/* Lets the mobile purge all objects and other npcs in the room, or purge a + * specified object or mob in the room. It can purge itself, but this will * be the last command it does. */ ACMD(do_mpurge) { @@ -429,7 +430,7 @@ ACMD(do_mpurge) if (AFF_FLAGGED(ch, AFF_CHARM)) return; - if( ch->desc && !IS_ADMIN(ch->desc->original, ADMLVL_IMPL)) + if (ch->desc && (GET_LEVEL(ch->desc->original) < LVL_IMPL)) return; one_argument(argument, arg); @@ -554,7 +555,7 @@ ACMD(do_mat) } } -/* Lets the mobile transfer people. The all argument transfers everyone in the +/* Lets the mobile transfer people. The all argument transfers everyone in the * current room to the specified location. */ ACMD(do_mteleport) { @@ -652,7 +653,7 @@ ACMD(do_mdamage) { script_damage(vict, dam); } -/* Lets the mobile force someone to do something. must be mortal level and the +/* Lets the mobile force someone to do something. must be mortal level and the * all argument only affects those in the room with the mobile. */ ACMD(do_mforce) { @@ -666,7 +667,7 @@ ACMD(do_mforce) if (AFF_FLAGGED(ch, AFF_CHARM)) return; - if (ch->desc && (!IS_ADMIN(ch->desc->original, ADMLVL_IMPL))) + if (ch->desc && (GET_LEVEL(ch->desc->original) < LVL_IMPL)) return; argument = one_argument(argument, arg); @@ -727,7 +728,7 @@ ACMD(do_mhunt) if (AFF_FLAGGED(ch, AFF_CHARM)) return; - if (ch->desc && (!IS_ADMIN(ch->desc->original, ADMLVL_IMPL))) + if (ch->desc && (GET_LEVEL(ch->desc->original) < LVL_IMPL)) return; one_argument(argument, arg); @@ -769,7 +770,7 @@ ACMD(do_mremember) if (AFF_FLAGGED(ch, AFF_CHARM)) return; - if (ch->desc && (!IS_ADMIN(ch->desc->original, ADMLVL_IMPL))) + if (ch->desc && (GET_LEVEL(ch->desc->original) < LVL_IMPL)) return; argument = one_argument(argument, arg); @@ -820,7 +821,7 @@ ACMD(do_mforget) if (AFF_FLAGGED(ch, AFF_CHARM)) return; - if (ch->desc && (!IS_ADMIN(ch->desc->original, ADMLVL_IMPL))) + if (ch->desc && (GET_LEVEL(ch->desc->original) < LVL_IMPL)) return; one_argument(argument, arg); @@ -1135,7 +1136,7 @@ ACMD(do_mfollow) leader->followers = k; } -/* Prints the message to everyone in the range of numbers. Thanks to Jamie +/* Prints the message to everyone in the range of numbers. Thanks to Jamie * Nelson of 4D for this contribution */ ACMD(do_mrecho) { @@ -1154,101 +1155,3 @@ ACMD(do_mrecho) else send_to_range(atoi(start), atoi(finish), "%s\r\n", msg); } - -/* Mailing functions */ -ACMD(do_mmail) -{ - char arg[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH], *arg3; - char buf[MAX_STRING_LENGTH]; - char_data *victim; - long recipient = MAIL_TO_NOBODY; - obj_vnum o_num; - struct obj_data *obj; - - if (!MOB_OR_IMPL(ch)) { - send_to_char(ch, "Huh?!?\r\n"); - return; - } - - arg3 = two_arguments(argument, arg, arg2); - - if (!*arg) { - mob_log(ch, "mmail called with no argument"); - return; - } else if (!strcmp(arg, "recipient")) { - create_mob_mail(ch); - if (*arg2 == UID_CHAR) { - if (!(victim = get_char(arg2))) { - mob_log(ch, "mmail: recipient (%s) not found",arg2); - return; - } - } else if (!(victim = get_char_vis(ch, arg2, NULL, FIND_CHAR_WORLD))) { - /* Check special cases and mail groups */ - if ((recipient = get_mail_group_by_name(arg2)) == MAIL_TO_NOBODY) { - mob_log(ch,"mmail: victim (%s) does not exist", arg2); - return; - } - } else if (victim == ch) { - mob_log(ch, "mmail: victim is self"); - return; - } else if (IS_NPC(victim)) { - mob_log(ch, "mmail: victim is another mob"); - return; - } else { - /* all name checks passed - get the recipient ID */ - recipient = GET_ID(victim); - } - if (!add_recipient(MOB_MAIL(ch), recipient)) { - mob_log(ch, "mmail failed to add recipient"); - return; - } - } else if (!strcmp(arg, "object")) { - create_mob_mail(ch); - o_num = atoi(arg2); - if (!real_object(o_num)) { - mob_log(ch, "mmail: invalid object vnum"); - return; - } - if ((obj = read_object(o_num, VIRTUAL)) == NULL) { - mob_log(ch, "mmail: invalid object to load"); - return; - } - obj_to_mail(obj, MOB_MAIL(ch)->mail); - } else if (!strcmp(arg, "subject")) { - create_mob_mail(ch); - sprintf(buf, "%s%s", arg2, arg3); - if ((MOB_MAIL(ch)->mail)->subject) - free((MOB_MAIL(ch)->mail)->subject); - (MOB_MAIL(ch)->mail)->subject = strdup(buf); - } else if (!strcmp(arg, "body")) { - create_mob_mail(ch); - if ((MOB_MAIL(ch)->mail)->body) - free((MOB_MAIL(ch)->mail)->body); - (MOB_MAIL(ch)->mail)->body = strdup(buf); - } else if (!strcmp(arg, "gold")) { - create_mob_mail(ch); - (MOB_MAIL(ch)->mail)->coins = atol(arg2); - } else if (!strcmp(arg, "urgent")) { - create_mob_mail(ch); - TOGGLE_BIT_AR((MOB_MAIL(ch)->mail)->mail_flags, MAIL_URGENT); - } else if (!strcmp(arg, "cod")) { - create_mob_mail(ch); - TOGGLE_BIT_AR((MOB_MAIL(ch)->mail)->mail_flags, MAIL_COD); - } else if (!strcmp(arg, "send")) { - if (mail_from_mobile(ch)== FALSE) - mob_log(ch, "mmail: send failed."); - } else if (!strcmp(arg, "new")) { - create_mob_mail(ch); - clear_mail_data(MOB_MAIL(ch)->mail); - } else if ((!strcmp(arg, "view")) || - (!strcmp(arg, "show")) || - (!strcmp(arg, "echo")) || - (!strcmp(arg, "list")) ) { - create_mob_mail(ch); - send_to_room(IN_ROOM(ch), "%s\r\n", get_mail_text(MOB_MAIL(ch)->mail) ); - send_to_room(IN_ROOM(ch), "Recipients: %s\r\n", recipient_list(MOB_MAIL(ch)) ); - } else { - mob_log(ch, "mmail: unknown %mail% command (%s).", arg); - } - return; -} diff --git a/src/dg_objcmd.c b/src/dg_objcmd.c index 3a0a5cf..05d1fca 100644 --- a/src/dg_objcmd.c +++ b/src/dg_objcmd.c @@ -144,10 +144,10 @@ static OCMD(do_oecho) else if ((room = obj_room(obj)) != NOWHERE) { - if (world[room].people) { - sub_write(argument, world[room].people, TRUE, TO_ROOM); - sub_write(argument, world[room].people, TRUE, TO_CHAR); - } + if (world[room].people) { + sub_write(argument, world[room].people, TRUE, TO_ROOM); + sub_write(argument, world[room].people, TRUE, TO_CHAR); + } } else @@ -253,7 +253,7 @@ static OCMD(do_osend) obj_log(obj, "no target found for osend"); } -/* Prints the message to everyone in the range of numbers. Thanks to Jamie +/* Prints the message to everyone in the range of numbers. Thanks to Jamie * Nelson of 4D for this contribution. */ static OCMD(do_orecho) { @@ -285,7 +285,7 @@ static OCMD(do_otimer) GET_OBJ_TIMER(obj) = atoi(arg); } -/* Transform into a different object. Note: this shouldn't be used with +/* Transform into a different object. Note: this shouldn't be used with * containers unless both objects are containers! */ static OCMD(do_otransform) { @@ -582,8 +582,8 @@ static OCMD(do_oasound) (world[room].dir_option[door])->to_room != NOWHERE && (world[room].dir_option[door])->to_room != room && world[(world[room].dir_option[door])->to_room].people) { - sub_write(argument, world[(world[room].dir_option[door])->to_room].people, TRUE, TO_ROOM); - sub_write(argument, world[(world[room].dir_option[door])->to_room].people, TRUE, TO_CHAR); + sub_write(argument, world[(world[room].dir_option[door])->to_room].people, TRUE, TO_ROOM); + sub_write(argument, world[(world[room].dir_option[door])->to_room].people, TRUE, TO_CHAR); } } } @@ -735,7 +735,7 @@ static OCMD(do_oat) } if (isdigit(*arg)) loc = real_room(atoi(arg)); - else if ((ch = get_char_by_obj(obj, arg))) loc = IN_ROOM(ch); + else if ((ch = get_char_by_obj(obj, arg))) loc = IN_ROOM(ch); if (loc == NOWHERE) { obj_log(obj, "oat: location not found (%s)", arg); @@ -748,7 +748,7 @@ static OCMD(do_oat) obj_to_room(object, loc); obj_command_interpreter(object, command); - if (object->in_room == loc) + if (object->in_room == loc) extract_obj(object); } diff --git a/src/dg_olc.c b/src/dg_olc.c index ccc063c..902e71b 100644 --- a/src/dg_olc.c +++ b/src/dg_olc.c @@ -62,7 +62,7 @@ ACMD(do_oasis_trigedit) d = ch->desc; /* Give descriptor an OLC structure. */ if (d->olc) { - mudlog(BRF, ADMLVL_IMMORT, TRUE, + mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: do_oasis_trigedit: Player already had olc structure."); free(d->olc); } @@ -86,7 +86,7 @@ ACMD(do_oasis_trigedit) } OLC_NUM(d) = number; - /* If this is a new trigger, setup a new one, otherwise, setup the a copy of + /* If this is a new trigger, setup a new one, otherwise, setup the a copy of * the existing trigger. */ if ((real_num = real_trigger(number)) == NOTHING) trigedit_setup_new(d); @@ -99,11 +99,11 @@ ACMD(do_oasis_trigedit) act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM); SET_BIT_AR(PLR_FLAGS(ch), PLR_WRITING); - mudlog(CMP, ADMLVL_IMMORT, TRUE,"OLC: %s starts editing zone %d [trigger](allowed zone %d)", + mudlog(CMP, LVL_IMMORT, TRUE,"OLC: %s starts editing zone %d [trigger](allowed zone %d)", GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch)); } -/* Called when a mob or object is being saved to disk, so its script can be +/* Called when a mob or object is being saved to disk, so its script can be * saved. */ void script_save_to_disk(FILE *fp, void *item, int type) { @@ -170,7 +170,7 @@ void trigedit_setup_existing(struct descriptor_data *d, int rtrg_num) strcat(OLC_STORAGE(d), "\r\n"); c = c->next; } - /* Now trig->cmdlist is something to pass to the text editor it will be + /* Now trig->cmdlist is something to pass to the text editor it will be * converted back to a real cmdlist_element list later. */ OLC_TRIG(d) = trig; @@ -321,7 +321,7 @@ void trigedit_parse(struct descriptor_data *d, char *arg) switch(tolower(*arg)) { case 'y': trigedit_save(d); - mudlog(CMP, MAX(ADMLVL_BUILDER, GET_INVIS_LEV(d->character)), TRUE, + mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), TRUE, "OLC: %s edits trigger %d", GET_NAME(d->character), OLC_NUM(d)); /* fall through */ @@ -565,9 +565,9 @@ void trigedit_save(struct descriptor_data *d) } /* now write the trigger out to disk, along with the rest of the triggers for - * this zone. We write this to disk NOW instead of letting the builder have - * control because if we lose this after having assigned a new trigger to an - * item, we will get SYSERR's upton reboot that could make things hard to + * this zone. We write this to disk NOW instead of letting the builder have + * control because if we lose this after having assigned a new trigger to an + * item, we will get SYSERR's upton reboot that could make things hard to * debug. */ zone = zone_table[OLC_ZNUM(d)].number; top = zone_table[OLC_ZNUM(d)].top; @@ -579,7 +579,7 @@ void trigedit_save(struct descriptor_data *d) #endif if (!(trig_file = fopen(fname, "w"))) { - mudlog(BRF, MAX(ADMLVL_GOD, GET_INVIS_LEV(d->character)), TRUE, + mudlog(BRF, MAX(LVL_GOD, GET_INVIS_LEV(d->character)), TRUE, "SYSERR: OLC: Can't open trig file \"%s\"", fname); return; } @@ -589,7 +589,7 @@ void trigedit_save(struct descriptor_data *d) trig = trig_index[rnum]->proto; if (fprintf(trig_file, "#%d\n", i) < 0) { - mudlog(BRF, MAX(ADMLVL_GOD, GET_INVIS_LEV(d->character)), TRUE, + mudlog(BRF, MAX(LVL_GOD, GET_INVIS_LEV(d->character)), TRUE, "SYSERR: OLC: Can't write trig file!"); fclose(trig_file); return; @@ -647,10 +647,10 @@ static void trigedit_create_index(int znum, char *type) snprintf(new_name, sizeof(new_name), "%s/newindex", prefix); if (!(oldfile = fopen(old_name, "r"))) { - mudlog(BRF, ADMLVL_IMPL, TRUE, "SYSERR: DG_OLC: Failed to open %s", old_name); + mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: DG_OLC: Failed to open %s", old_name); return; } else if (!(newfile = fopen(new_name, "w"))) { - mudlog(BRF, ADMLVL_IMPL, TRUE, "SYSERR: DG_OLC: Failed to open %s", new_name); + mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: DG_OLC: Failed to open %s", new_name); return; } @@ -752,20 +752,20 @@ int dg_script_edit_parse(struct descriptor_data *d, char *arg) switch(tolower(*arg)) { case 'q': /* This was buggy. First we created a copy of a thing, but maintained - * pointers to scripts, then if we altered the scripts, we freed the + * pointers to scripts, then if we altered the scripts, we freed the * pointers and added new ones to the OLC_THING. If we then choose NOT - * to save the changes, the pointers in the original pointed to + * to save the changes, the pointers in the original pointed to * garbage. If we saved changes the pointers were updated correctly. - * Solution: Here we just point the working copies to the new - * proto_scripts. We only update the original when choosing to save + * Solution: Here we just point the working copies to the new + * proto_scripts. We only update the original when choosing to save * internally, then free the unused memory there. -Welcor * Thanks to Jeremy Stanley and Torgny Bjers for the bug report. * After updating to OasisOLC 2.0.3 I discovered some malfunctions - * in this code, so I restructured it a bit. Now things work like - * this: OLC_SCRIPT(d) is assigned a copy of the edited things' + * in this code, so I restructured it a bit. Now things work like + * this: OLC_SCRIPT(d) is assigned a copy of the edited things' * proto_script. OLC_OBJ(d), etc.. are initalized with proto_script = * NULL; On save, the saved copy is updated with OLC_SCRIPT(d) as new - * proto_script (freeing the old one). On quit/nosave, OLC_SCRIPT is + * proto_script (freeing the old one). On quit/nosave, OLC_SCRIPT is * free()'d, and the prototype not touched. */ return 0; case 'n': diff --git a/src/dg_scripts.c b/src/dg_scripts.c index b189f8d..7238fba 100644 --- a/src/dg_scripts.c +++ b/src/dg_scripts.c @@ -1,15 +1,15 @@ /** * @file dg_scripts.c * Contains the main script driver interface. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* +* * This source code, which was not part of the CircleMUD legacy code, -* was created by the following people: -* $Author: Mark A. Heilpern/egreen/Welcor $ -* $Date: 2004/10/11 12:07:00$ -* $Revision: 1.0.14 $ +* was created by the following people: +* $Author: Mark A. Heilpern/egreen/Welcor $ +* $Date: 2004/10/11 12:07:00$ +* $Revision: 1.0.14 $ */ #include "conf.h" @@ -76,8 +76,8 @@ static struct obj_data *find_obj_by_uid_in_lookup_table(long uid); static EVENTFUNC(trig_wait_event); -/* Return pointer to first occurrence of string ct in cs, or NULL if not - * present. Case insensitive. All of ct must be found in cs for it to be +/* Return pointer to first occurrence of string ct in cs, or NULL if not + * present. Case insensitive. All of ct must be found in cs for it to be * a match. * @todo Move this function to string util library. * @param cs The string to search. @@ -117,7 +117,7 @@ char *str_str(char *cs, char *ct) * @param vnum The virtual number of a room. * @retval int Returns -1 if the room does not exist, or the total number of * PCs and NPCs in the room. */ -int trgvar_in_room(room_vnum vnum) +int trgvar_in_room(room_vnum vnum) { room_rnum rnum = real_room(vnum); int i = 0; @@ -139,8 +139,8 @@ int trgvar_in_room(room_vnum vnum) * @param name Either the unique id of an object or a string identifying the * object. Note the unique id must be prefixed with UID_CHAR. * @param list The list of objects to look through. - * @retval obj_data * Pointer to the object if it is found in the list of - * objects, NULL if the object is not found in the list. + * @retval obj_data * Pointer to the object if it is found in the list of + * objects, NULL if the object is not found in the list. */ obj_data *get_obj_in_list(char *name, obj_data *list) { @@ -153,7 +153,7 @@ obj_data *get_obj_in_list(char *name, obj_data *list) for (i = list; i; i = i->next_content) if (id == GET_ID(i)) return i; - + } else { for (i = list; i; i = i->next_content) if (isname(name, i->name)) @@ -207,8 +207,8 @@ obj_data *get_object_in_equip(char_data * ch, char *name) } /** Figures out if the argument is a valid location to 'wear' equipment. - * Handles 'held', 'light' and 'wield' positions - Welcor. After idea from - * Byron Ellacott. + * Handles 'held', 'light' and 'wield' positions - Welcor. After idea from + * Byron Ellacott. * @param arg Either the name of the position, or the number of a wear * location definition to check for. * @retval int If arg is not a valid wear location name or number, return @@ -330,8 +330,8 @@ static room_data *find_room(long n) } /* Generic searches based only on name. */ -/** Search the entire world for an NPC or PC by name. - * @param name String describing the name or the unique id of the char. +/** Search the entire world for an NPC or PC by name. + * @param name String describing the name or the unique id of the char. * Note the unique id must be prefixed with UID_CHAR. * @retval char_data * Pointer to the char or NULL if char is not found. */ char_data *get_char(char *name) @@ -355,11 +355,11 @@ char_data *get_char(char *name) /** Find a character by name in the same room as a known object. * @todo Should this function not be constrained to the same room as an object - * if 'name' is a unique id? + * if 'name' is a unique id? * @param obj An object that will constrain the search to the location that * the object is in *if* the name argument is not a unique id. * @param name Character name keyword to search for, or unique ID. Unique - * id must be prefixed with UID_CHAR. + * id must be prefixed with UID_CHAR. * @retval char_data * Pointer to the the char if found, NULL if not. Will * only find god characters if DG_ALLOW_GODS is on. */ char_data *get_char_near_obj(obj_data *obj, char *name) @@ -384,12 +384,12 @@ char_data *get_char_near_obj(obj_data *obj, char *name) } /** Find a character by name in a specific room. - * @todo Should this function not be constrained to the room - * if 'name' is a unique id? - * @param room A room that will constrain the search to that location + * @todo Should this function not be constrained to the room + * if 'name' is a unique id? + * @param room A room that will constrain the search to that location * *if* the name argument is not a unique id. * @param name Character name keyword to search for, or unique ID. Unique - * id must be prefixed with UID_CHAR. + * id must be prefixed with UID_CHAR. * @retval char_data * Pointer to the the char if found, NULL if not. Will * only find god characters if DG_ALLOW_GODS is on. */ char_data *get_char_in_room(room_data *room, char *name) @@ -491,7 +491,7 @@ room_data *get_room(char *name) return &world[nr]; } -/* Returns a pointer to the first character in world by name name, or NULL if +/* Returns a pointer to the first character in world by name name, or NULL if * none found. Starts searching with the person owing the object. */ char_data *get_char_by_obj(obj_data *obj, char *name) { @@ -522,7 +522,7 @@ char_data *get_char_by_obj(obj_data *obj, char *name) return NULL; } -/* Returns a pointer to the first character in world by name name, or NULL if +/* Returns a pointer to the first character in world by name name, or NULL if * none found. Starts searching in room room first. */ char_data *get_char_by_room(room_data *room, char *name) { @@ -548,7 +548,7 @@ char_data *get_char_by_room(room_data *room, char *name) return NULL; } -/* Returns the object in the world with name name, or NULL if not found search +/* Returns the object in the world with name name, or NULL if not found search * based on obj. */ obj_data *get_obj_by_obj(obj_data *obj, char *name) { @@ -909,7 +909,7 @@ void do_sstat_character(char_data *ch, char_data *k) script_stat(ch, SCRIPT(k)); } -/* Adds the trigger t to script sc in in location loc. loc = -1 means add to +/* Adds the trigger t to script sc in in location loc. loc = -1 means add to * the end, loc = 0 means add before all other triggers. */ void add_trigger(struct script_data *sc, trig_data *t, int loc) { @@ -991,8 +991,8 @@ ACMD(do_attach) if (IS_NPC(victim)) send_to_char(ch, "Trigger %d (%s) attached to %s [%d].\r\n", tn, GET_TRIG_NAME(trig), GET_SHORT(victim), GET_MOB_VNUM(victim)); - else - send_to_char(ch, "Trigger %d (%s) attached to player named %s.\r\n", + else + send_to_char(ch, "Trigger %d (%s) attached to player named %s.\r\n", tn, GET_TRIG_NAME(trig), GET_NAME(victim)); } @@ -1076,10 +1076,10 @@ ACMD(do_attach) } /* Removes the trigger specified by name, and the script of o if it removes the - * last trigger. name can either be a number, or a 'silly' name for the + * last trigger. name can either be a number, or a 'silly' name for the * trigger, including things like 2.beggar-death. Returns 0 if did not find the - * trigger, otherwise 1. If it matters, you might need to check to see if all - * the triggers were removed after this function returns, in order to remove + * trigger, otherwise 1. If it matters, you might need to check to see if all + * the triggers were removed after this function returns, in order to remove * the script. */ static int remove_trigger(struct script_data *sc, char *name) { @@ -1108,7 +1108,7 @@ static int remove_trigger(struct script_data *sc, char *name) break; } - /* This isn't clean. A numeric value will match if it's position OR vnum + /* This isn't clean. A numeric value will match if it's position OR vnum * is found. originally the number was position-only. */ else if (++n >= num) break; @@ -1244,8 +1244,8 @@ ACMD(do_detach) return; } - if (!SCRIPT(victim)) - send_to_char(ch, "That %s doesn't have any triggers.\r\n", IS_NPC(victim) ? "mob" : "player"); + if (!SCRIPT(victim)) + send_to_char(ch, "That %s doesn't have any triggers.\r\n", IS_NPC(victim) ? "mob" : "player"); else if (!can_edit_zone(ch, real_zone_by_thing(GET_MOB_VNUM(victim))) && IS_NPC(victim)) { send_to_char(ch, "You can only detach triggers in your own zone\r\n"); return; @@ -1290,31 +1290,31 @@ ACMD(do_detach) } } -/* Logs any errors caused by scripts to the system log. Will eventually allow +/* Logs any errors caused by scripts to the system log. Will eventually allow * on-line view of script errors. */ void script_vlog(const char *format, va_list args) { char output[MAX_STRING_LENGTH]; struct descriptor_data *i; - /* parse the args, making the error message */ - vsnprintf(output, sizeof(output) - 2, format, args); + /* parse the args, making the error message */ + vsnprintf(output, sizeof(output) - 2, format, args); - /* Save to the syslog file */ - basic_mud_log("SCRIPT ERROR: %s", output); + /* Save to the syslog file */ + basic_mud_log("SCRIPT ERROR: %s", output); - /* And send to imms */ - for (i = descriptor_list; i; i = i->next) { - if (STATE(i) != CON_PLAYING || IS_NPC(i->character)) /* switch */ - continue; - if (!IS_ADMIN((i->character), ADMLVL_BUILDER)) - continue; - if (PLR_FLAGGED(i->character, PLR_WRITING)) - continue; - if (NRM > (PRF_FLAGGED(i->character, PRF_LOG1) ? 1 : 0) + (PRF_FLAGGED(i->character, PRF_LOG2) ? 2 : 0)) - continue; + /* And send to imms */ + for (i = descriptor_list; i; i = i->next) { + if (STATE(i) != CON_PLAYING || IS_NPC(i->character)) /* switch */ + continue; + if (GET_LEVEL(i->character) < LVL_BUILDER) + continue; + if (PLR_FLAGGED(i->character, PLR_WRITING)) + continue; + if (NRM > (PRF_FLAGGED(i->character, PRF_LOG1) ? 1 : 0) + (PRF_FLAGGED(i->character, PRF_LOG2) ? 2 : 0)) + continue; - send_to_char(i->character, "%s[ %s ]%s\r\n", CCGRN(i->character, C_NRM), output, CCNRM(i->character, C_NRM)); + send_to_char(i->character, "%s[ %s ]%s\r\n", CCGRN(i->character, C_NRM), output, CCNRM(i->character, C_NRM)); } } @@ -1327,7 +1327,7 @@ void script_log(const char *format, ...) va_end(args); } -/* Returns 1 if string is all digits, else 0. Bugfixed - would have returned +/* Returns 1 if string is all digits, else 0. Bugfixed - would have returned * true on num="------". */ static int is_num(char *arg) { @@ -1445,7 +1445,7 @@ static void eval_op(char *op, char *lhs, char *rhs, char *result, void *go, } } -/* p points to the first quote, returns the matching end quote, or the last +/* p points to the first quote, returns the matching end quote, or the last * non-null char in p.*/ char *matching_quote(char *p) { @@ -1460,7 +1460,7 @@ char *matching_quote(char *p) return p; } -/* p points to the first paren. returns a pointer to the matching closing +/* p points to the first paren. returns a pointer to the matching closing * paren, or the last non-null char in p. */ static char *matching_paren(char *p) { @@ -1533,7 +1533,7 @@ static int eval_lhs_op_rhs(char *expr, char *result, void *go, struct script_dat p = strcpy(line, expr); - /* Initialize tokens, an array of pointers to locations in line where the + /* Initialize tokens, an array of pointers to locations in line where the * ops could possibly occur. */ for (j = 0; *p; j++) { tokens[j] = p; @@ -1613,7 +1613,7 @@ static struct cmdlist_element *find_end(trig_data *trig, struct cmdlist_element return c; } -/* Searches for valid elseif, else, or end to continue execution at. Returns +/* Searches for valid elseif, else, or end to continue execution at. Returns * line of elseif, else, or end if found, or last line of trigger. */ static struct cmdlist_element *find_else_end(trig_data *trig, struct cmdlist_element *cl, void *go, struct script_data *sc, int type) @@ -2034,7 +2034,7 @@ static void makeuid_var(void *go, struct script_data *sc, trig_data *trig, add_var(&GET_TRIG_VARS(trig), varname, uid, sc ? sc->context : 0); } -/* Processes a script return command. Returns the new value for the script to +/* Processes a script return command. Returns the new value for the script to * return. */ static int process_return(trig_data *trig, char *cmd) { @@ -2052,7 +2052,7 @@ static int process_return(trig_data *trig, char *cmd) return atoi(arg2); } -/* Removes a variable from the global vars of sc, or the local vars of trig if +/* Removes a variable from the global vars of sc, or the local vars of trig if * not found in global list. */ static void process_unset(struct script_data *sc, trig_data *trig, char *cmd) { @@ -2123,7 +2123,7 @@ static void process_remote(struct script_data *sc, trig_data *trig, char *cmd) return; } - /* For all but PC's, context comes from the existing context. For PC's, + /* For all but PC's, context comes from the existing context. For PC's, * context is 0 (global) */ context = vd->context; @@ -2145,7 +2145,7 @@ static void process_remote(struct script_data *sc, trig_data *trig, char *cmd) add_var(&(sc_remote->global_vars), vd->name, vd->value, context); } -/* Command-line interface to rdelete. Named vdelete so people didn't think it +/* Command-line interface to rdelete. Named vdelete so people didn't think it * was to delete rooms. */ ACMD(do_vdelete) { @@ -2234,7 +2234,7 @@ ACMD(do_vdelete) send_to_char(ch, "Deleted.\r\n"); } -/* Called from do_set - return 0 for failure, 1 for success. ch and vict are +/* Called from do_set - return 0 for failure, 1 for success. ch and vict are * verified. */ int perform_set_dg_var(struct char_data *ch, struct char_data *vict, char *val_arg) { @@ -2398,7 +2398,7 @@ static void extract_value(struct script_data *sc, trig_data *trig, char *cmd) /* Thanks to Jamie Nelson for 4 dimensions for this addition. * Syntax : - * dg_letter . + * dg_letter . * set string L337-String * dg_letter var1 4 %string% * dg_letter var2 11 %string% @@ -2441,7 +2441,7 @@ static void dg_letter_value(struct script_data *sc, trig_data *trig, char *cmd) /* This is the core driver for scripts. * Arguments: * void *go_adress - * A pointer to a pointer to the entity running the script. The reason for + * A pointer to a pointer to the entity running the script. The reason for * this approcah is that we want to be able to see from the calling function, * if the entity has been free'd. * @@ -2502,9 +2502,9 @@ int script_driver(void *go_adress, trig_data *trig, int type, int mode) extract_script(go, type); - /* extract_script() works on rooms, but on mobiles and objects, it will be - * called again if the caller is load_mtrigger or load_otrigger if it is - * one of these, we must make sure the script is not just reloaded on the + /* extract_script() works on rooms, but on mobiles and objects, it will be + * called again if the caller is load_mtrigger or load_otrigger if it is + * one of these, we must make sure the script is not just reloaded on the * next mob. We make the calling code decide how to handle it, so it does * not get totally removed unless it's a load_xtrigger(). */ return SCRIPT_ERROR_CODE; @@ -2736,7 +2736,7 @@ ACMD(do_tstat) send_to_char(ch, "Usage: tstat \r\n"); } -/* Scans for a case/default instance. Returns the line containg the correct +/* Scans for a case/default instance. Returns the line containg the correct * case instance, or the last line of the trigger if not found. */ static struct cmdlist_element * find_case(struct trig_data *trig, struct cmdlist_element *cl, @@ -2772,8 +2772,8 @@ find_case(struct trig_data *trig, struct cmdlist_element *cl, return c; } -/* Scans for end of while/switch-blocks. Returns the line containg 'end', or - * the last line of the trigger if not found. Malformed scripts may cause NULL +/* Scans for end of while/switch-blocks. Returns the line containg 'end', or + * the last line of the trigger if not found. Malformed scripts may cause NULL * to be returned. */ static struct cmdlist_element *find_done(struct cmdlist_element *cl) { @@ -2806,13 +2806,13 @@ void read_saved_vars(struct char_data *ch) char varname[32]; char context_str[16]; - /* If getting to the menu from inside the game, the vars aren't removed. So + /* If getting to the menu from inside the game, the vars aren't removed. So * let's not allocate them again. */ if (SCRIPT(ch)) return; /* Create the space for the script structure which holds the vars. We need to - * do this first, because later calls to 'remote' will need. A script already + * do this first, because later calls to 'remote' will need. A script already * assigned. */ CREATE(SCRIPT(ch), struct script_data, 1); @@ -2850,7 +2850,7 @@ void save_char_vars(struct char_data *ch) char fn[127]; struct trig_var_data *vars; - /* Immediate return if no script (and therefore no variables) structure has + /* Immediate return if no script (and therefore no variables) structure has * been created. this will happen when the player is logging in */ if (SCRIPT(ch) == NULL) return; @@ -2866,12 +2866,12 @@ void save_char_vars(struct char_data *ch) file = fopen(fn,"wt"); if (!file) { - mudlog( NRM, ADMLVL_GOD, TRUE, + mudlog( NRM, LVL_GOD, TRUE, "SYSERR: Could not open player variable file %s for writing.:%s", fn, strerror(errno)); return; } - /* Note that currently, context will always be zero. This may change in the + /* Note that currently, context will always be zero. This may change in the * future. */ while (vars) { if (*vars->name != '-') /* don't save if it begins with - */ @@ -2891,7 +2891,7 @@ void read_saved_vars_ascii(FILE *file, struct char_data *ch, int count) char context_str[READ_SIZE]; int i; - /* If getting to the menu from inside the game, the vars aren't removed. So + /* If getting to the menu from inside the game, the vars aren't removed. So * let's not allocate them again. */ if (SCRIPT(ch)) return; @@ -2922,7 +2922,7 @@ void save_char_vars_ascii(FILE *file, struct char_data *ch) { struct trig_var_data *vars; int count = 0; - /* Immediate return if no script (and therefore no variables) structure has + /* Immediate return if no script (and therefore no variables) structure has * been created. this will happen when the player is logging in */ if (SCRIPT(ch) == NULL) return; @@ -2932,7 +2932,7 @@ void save_char_vars_ascii(FILE *file, struct char_data *ch) /* make sure this char has global variables to save */ if (ch->script->global_vars == NULL) return; - /* Note that currently, context will always be zero. This may change in the + /* Note that currently, context will always be zero. This may change in the * future */ for (vars = ch->script->global_vars;vars;vars = vars->next) if (*vars->name != '-') @@ -3019,7 +3019,7 @@ void remove_from_lookup_table(long uid) int bucket = (int) (uid & (BUCKET_COUNT - 1)); struct lookup_table_t *lt = &lookup_table[bucket], *flt = NULL; - /* This is not supposed to happen. UID 0 is not used. However, while I'm + /* This is not supposed to happen. UID 0 is not used. However, while I'm * debugging the issue, let's just return right away. - Welcor */ if (uid == 0) return; @@ -3039,29 +3039,29 @@ void remove_from_lookup_table(long uid) log("remove_from_lookup. UID %ld not found.", uid); } -bool check_flags_by_name_ar(int *array, int numflags, char *search, const char *namelist[]) -{ - int i, item=-1; +bool check_flags_by_name_ar(int *array, int numflags, char *search, const char *namelist[]) +{ + int i, item=-1; - for (i=0; inext) - if (GET_TRIG_VNUM(t) == trig_num) - return 1; + for (t = TRIGGERS(sc); t; t = t->next) + if (GET_TRIG_VNUM(t) == trig_num) + return 1; - return 0; + return 0; } diff --git a/src/dg_scripts.h b/src/dg_scripts.h index 79319ad..cbf73aa 100644 --- a/src/dg_scripts.h +++ b/src/dg_scripts.h @@ -363,7 +363,6 @@ int valid_dg_target(char_data *ch, int bitvector); void script_damage(char_data *vict, int dam); /* from dg_mobcmd.c */ -void mob_log(char_data *mob, const char *format, ...); ACMD(do_masound); ACMD(do_mat); ACMD(do_mdamage); @@ -378,7 +377,6 @@ ACMD(do_mhunt); ACMD(do_mjunk); ACMD(do_mkill); ACMD(do_mload); -ACMD(do_mmail); ACMD(do_mpurge); ACMD(do_mrecho); ACMD(do_mremember); diff --git a/src/dg_triggers.c b/src/dg_triggers.c index 881c20d..f721023 100644 --- a/src/dg_triggers.c +++ b/src/dg_triggers.c @@ -310,7 +310,7 @@ int command_mtrigger(char_data *actor, char *cmd, char *argument) continue; if (!GET_TRIG_ARG(t) || !*GET_TRIG_ARG(t)) { - mudlog(NRM, ADMLVL_BUILDER, TRUE, "SYSERR: Command Trigger #%d has no text argument!", + mudlog(NRM, LVL_BUILDER, TRUE, "SYSERR: Command Trigger #%d has no text argument!", GET_TRIG_VNUM(t)); continue; } @@ -350,7 +350,7 @@ void speech_mtrigger(char_data *actor, char *str) continue; if (!GET_TRIG_ARG(t) || !*GET_TRIG_ARG(t)) { - mudlog(NRM, ADMLVL_BUILDER, TRUE, "SYSERR: Speech Trigger #%d has no text argument!", + mudlog(NRM, LVL_BUILDER, TRUE, "SYSERR: Speech Trigger #%d has no text argument!", GET_TRIG_VNUM(t)); continue; } @@ -380,7 +380,7 @@ void act_mtrigger(const char_data *ch, char *str, char_data *actor, continue; if (!GET_TRIG_ARG(t) || !*GET_TRIG_ARG(t)) { - mudlog(NRM, ADMLVL_BUILDER, TRUE, "SYSERR: Act Trigger #%d has no text argument!", + mudlog(NRM, LVL_BUILDER, TRUE, "SYSERR: Act Trigger #%d has no text argument!", GET_TRIG_VNUM(t)); continue; } @@ -700,7 +700,7 @@ int cmd_otrig(obj_data *obj, char_data *actor, char *cmd, if (IS_SET(GET_TRIG_NARG(t), type) && (!GET_TRIG_ARG(t) || !*GET_TRIG_ARG(t))) { - mudlog(NRM, ADMLVL_BUILDER, TRUE, "SYSERR: O-Command Trigger #%d has no text argument!", + mudlog(NRM, LVL_BUILDER, TRUE, "SYSERR: O-Command Trigger #%d has no text argument!", GET_TRIG_VNUM(t)); continue; } @@ -1060,7 +1060,7 @@ int command_wtrigger(char_data *actor, char *cmd, char *argument) continue; if (!GET_TRIG_ARG(t) || !*GET_TRIG_ARG(t)) { - mudlog(NRM, ADMLVL_BUILDER, TRUE, "SYSERR: W-Command Trigger #%d has no text argument!", + mudlog(NRM, LVL_BUILDER, TRUE, "SYSERR: W-Command Trigger #%d has no text argument!", GET_TRIG_VNUM(t)); continue; } @@ -1095,7 +1095,7 @@ void speech_wtrigger(char_data *actor, char *str) continue; if (!GET_TRIG_ARG(t) || !*GET_TRIG_ARG(t)) { - mudlog(NRM, ADMLVL_BUILDER, TRUE, "SYSERR: W-Speech Trigger #%d has no text argument!", + mudlog(NRM, LVL_BUILDER, TRUE, "SYSERR: W-Speech Trigger #%d has no text argument!", GET_TRIG_VNUM(t)); continue; } diff --git a/src/dg_variables.c b/src/dg_variables.c index ce66b49..72ea3fd 100644 --- a/src/dg_variables.c +++ b/src/dg_variables.c @@ -232,7 +232,6 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig, char *recho[] = {"mrecho ", "orecho ", "wrecho " }; /* there is no such thing as mmove, thus the mecho below */ char *omove[] = {"mecho ", "omove ", "wmove " }; - char *mail[] = {"mmail ", "oecho ", "wecho " }; *str = '\0'; @@ -301,8 +300,6 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig, snprintf(str, slen, "%s", recho[type]); else if (!str_cmp(var, "move")) snprintf(str, slen, "%s", omove[type]); - else if (!str_cmp(var, "mail")) - snprintf(str, slen, "%s", mail[type]); else *str = '\0'; } @@ -397,7 +394,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig, else if (!str_cmp(field, "gold") && IS_HAPPYHOUR) snprintf(str, slen, "%d", HAPPY_GOLD); else snprintf(str, slen, "%d", HAPPY_TIME); - return; + return; } else if (!str_cmp(var, "time")) { if (!str_cmp(field, "hour")) @@ -520,7 +517,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig, } else { doors = 0; room = &world[in_room]; - for (i = 0; i < DIR_COUNT ; i++) + for (i = 0; i < DIR_COUNT; i++) if (R_EXIT(room, i)) doors++; @@ -555,19 +552,6 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig, switch (LOWER(*field)) { case 'a': - if (!str_cmp(field, "admlevel")) { - if (subfield && *subfield) { - int al; - if ((al = get_admin_level_by_string(subfield)) >= ADMLVL_MORTAL) { - if (IS_ADMIN(c, al)) - strcpy(str, "1"); - else - strcpy(str, "0"); - } else - strcpy(str, "0"); - } else - snprintf(str, slen, "%d", GET_ADMLEVEL(c)); - } if (!str_cmp(field, "affect")) { if (subfield && *subfield) { int spell = find_skill_num(subfield); @@ -601,7 +585,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig, else if (!str_cmp(field, "cha")) { if (subfield && *subfield) { int addition = atoi(subfield); - int max = (IS_NPC(c) || IS_ADMIN(c, ADMLVL_GRGOD)) ? 25 : 18; + int max = (IS_NPC(c) || GET_LEVEL(c) >= LVL_GRGOD) ? 25 : 18; GET_CHA(c) += addition; if (GET_CHA(c) > max) GET_CHA(c) = max; if (GET_CHA(c) < 3) GET_CHA(c) = 3; @@ -623,7 +607,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig, else if (!str_cmp(field, "con")) { if (subfield && *subfield) { int addition = atoi(subfield); - int max = (IS_NPC(c) || IS_ADMIN(c, ADMLVL_GRGOD)) ? 25 : 18; + int max = (IS_NPC(c) || GET_LEVEL(c) >= LVL_GRGOD) ? 25 : 18; GET_CON(c) += addition; if (GET_CON(c) > max) GET_CON(c) = max; if (GET_CON(c) < 3) GET_CON(c) = 3; @@ -636,17 +620,16 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig, if (subfield && *subfield) { int addition = atoi(subfield); GET_DAMROLL(c) = MAX(1, GET_DAMROLL(c) + addition); - } - snprintf(str, slen, "%d", GET_DAMROLL(c)); - } - else if (!str_cmp(field, "dex")) { - if (subfield && *subfield) { - int addition = atoi(subfield); - int max = (IS_NPC(c) || IS_ADMIN(c, ADMLVL_GRGOD)) ? 25 : 18; - GET_DEX(c) += addition; - if (GET_DEX(c) > max) GET_DEX(c) = max; - if (GET_DEX(c) < 3) GET_DEX(c) = 3; - } + } + snprintf(str, slen, "%d", GET_DAMROLL(c)); + } else if (!str_cmp(field, "dex")) { + if (subfield && *subfield) { + int addition = atoi(subfield); + int max = (IS_NPC(c) || GET_LEVEL(c) >= LVL_GRGOD) ? 25 : 18; + GET_DEX(c) += addition; + if (GET_DEX(c) > max) GET_DEX(c) = max; + if (GET_DEX(c) < 3) GET_DEX(c) = 3; + } snprintf(str, slen, "%d", GET_DEX(c)); } else if (!str_cmp(field, "drunk")) { @@ -739,12 +722,12 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig, snprintf(str, slen, "%d", GET_HIT(c)); } else if (!str_cmp(field, "hitroll")) { - if (subfield && *subfield) { - int addition = atoi(subfield); - GET_HITROLL(c) = MAX(1, GET_HITROLL(c) + addition); - } - snprintf(str, slen, "%d", GET_HITROLL(c)); - } + if (subfield && *subfield) { + int addition = atoi(subfield); + GET_HITROLL(c) = MAX(1, GET_HITROLL(c) + addition); + } + snprintf(str, slen, "%d", GET_HITROLL(c)); + } else if (!str_cmp(field, "hunger")) { if (subfield && *subfield) { int addition = atoi(subfield); @@ -766,7 +749,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig, else if (!str_cmp(field, "int")) { if (subfield && *subfield) { int addition = atoi(subfield); - int max = (IS_NPC(c) || IS_ADMIN(c, ADMLVL_GRGOD)) ? 25 : 18; + int max = (IS_NPC(c) || GET_LEVEL(c) >= LVL_GRGOD) ? 25 : 18; GET_INT(c) += addition; if (GET_INT(c) > max) GET_INT(c) = max; if (GET_INT(c) < 3) GET_INT(c) = 3; @@ -820,7 +803,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig, if (!str_cmp(field, "level")) { if (subfield && *subfield) { int lev = atoi(subfield); - GET_LEVEL(c) = MIN(MAX(lev, 1), CONFIG_MAX_LEVEL); + GET_LEVEL(c) = MIN(MAX(lev, 0), LVL_IMMORT-1); } else snprintf(str, slen, "%d", GET_LEVEL(c)); } @@ -1011,7 +994,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig, else if (!str_cmp(field, "str")) { if (subfield && *subfield) { int addition = atoi(subfield); - int max = (IS_NPC(c) || IS_ADMIN(c, ADMLVL_GRGOD)) ? 25 : 18; + int max = (IS_NPC(c) || GET_LEVEL(c) >= LVL_GRGOD) ? 25 : 18; GET_STR(c) += addition; if (GET_STR(c) > max) GET_STR(c) = max; if (GET_STR(c) < 3) GET_STR(c) = 3; @@ -1079,7 +1062,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig, else if (!str_cmp(field, "wis")) { if (subfield && *subfield) { int addition = atoi(subfield); - int max = (IS_NPC(c) || IS_ADMIN(c, ADMLVL_GRGOD)) ? 25 : 18; + int max = (IS_NPC(c) || GET_LEVEL(c) >= LVL_GRGOD) ? 25 : 18; GET_WIS(c) += addition; if (GET_WIS(c) > max) GET_WIS(c) = max; if (GET_WIS(c) < 3) GET_WIS(c) = 3; diff --git a/src/dg_wldcmd.c b/src/dg_wldcmd.c index a85d0b8..6d954a9 100644 --- a/src/dg_wldcmd.c +++ b/src/dg_wldcmd.c @@ -74,8 +74,8 @@ void act_to_room(char *str, room_data *room) if (!room->people) return; - /* Since you can't use act(..., TO_ROOM) for an room, send it TO_ROOM and - * TO_CHAR for some char in the room. (just dont use $n or you might get + /* Since you can't use act(..., TO_ROOM) for an room, send it TO_ROOM and + * TO_CHAR for some char in the room. (just dont use $n or you might get * strange results). */ act(str, FALSE, room->people, 0, 0, TO_ROOM); act(str, FALSE, room->people, 0, 0, TO_CHAR); @@ -533,20 +533,20 @@ WCMD(do_wdamage) { script_damage(ch, dam); } -WCMD(do_wat) +WCMD(do_wat) { room_rnum loc = NOWHERE; struct char_data *ch; - char arg[MAX_INPUT_LENGTH], *command; + char arg[MAX_INPUT_LENGTH], *command; - command = any_one_arg(argument, arg); + command = any_one_arg(argument, arg); if (!*arg) { wld_log(room, "wat called with no args"); return; } - skip_spaces(&command); + skip_spaces(&command); if (!*command) { wld_log(room, "wat called without a command"); @@ -555,7 +555,7 @@ WCMD(do_wat) if (isdigit(*arg)) loc = real_room(atoi(arg)); else if ((ch = get_char_by_room(room, arg))) loc = IN_ROOM(ch); - + if (loc == NOWHERE) { wld_log(room, "wat: location not found (%s)", arg); return; diff --git a/src/fight.c b/src/fight.c index ec5503d..f00ca24 100644 --- a/src/fight.c +++ b/src/fight.c @@ -78,7 +78,7 @@ void appear(struct char_data *ch) REMOVE_BIT_AR(AFF_FLAGS(ch), AFF_INVISIBLE); REMOVE_BIT_AR(AFF_FLAGS(ch), AFF_HIDE); - if (!IS_ADMIN(ch, ADMLVL_IMMORT)) + if (GET_LEVEL(ch) < LVL_IMMORT) act("$n slowly fades into existence.", FALSE, ch, 0, 0, TO_ROOM); else act("You feel a strange presence as $n appears, seemingly from nowhere.", @@ -203,7 +203,7 @@ void check_killer(struct char_data *ch, struct char_data *vict) SET_BIT_AR(PLR_FLAGS(ch), PLR_KILLER); send_to_char(ch, "If you want to be a PLAYER KILLER, so be it...\r\n"); - mudlog(BRF, ADMLVL_IMMORT, TRUE, "PC Killer bit set on %s for initiating attack on %s at %s.", + mudlog(BRF, LVL_IMMORT, TRUE, "PC Killer bit set on %s for initiating attack on %s at %s.", GET_NAME(ch), GET_NAME(vict), world[IN_ROOM(vict)].name); } @@ -579,7 +579,7 @@ static void dam_message(int dam, struct char_data *ch, struct char_data *victim, act(buf, FALSE, ch, NULL, victim, TO_NOTVICT); /* damage message to damager */ - if (IS_ADMIN(ch, ADMLVL_IMMORT)) + if (GET_LEVEL(ch) >= LVL_IMMORT) send_to_char(ch, "(%d) ", dam); buf = replace_string(dam_weapons[msgnum].to_char, attack_hit_text[w_type].singular, attack_hit_text[w_type].plural); @@ -587,7 +587,7 @@ static void dam_message(int dam, struct char_data *ch, struct char_data *victim, send_to_char(ch, CCNRM(ch, C_CMP)); /* damage message to damagee */ - if (IS_ADMIN(victim, ADMLVL_IMMORT)) + if (GET_LEVEL(victim) >= LVL_IMMORT) send_to_char(victim, "@R(%d)", dam); buf = replace_string(dam_weapons[msgnum].to_victim, attack_hit_text[w_type].singular, attack_hit_text[w_type].plural); @@ -609,54 +609,54 @@ int skill_message(int dam, struct char_data *ch, struct char_data *vict, if (fight_messages[i].a_type == attacktype) { nr = dice(1, fight_messages[i].number_of_attacks); for (j = 1, msg = fight_messages[i].msg; (j < nr) && msg; j++) - msg = msg->next; + msg = msg->next; - if (IS_ADMIN(vict, ADMLVL_IMPL)) { - act(msg->god_msg.attacker_msg, FALSE, ch, weap, vict, TO_CHAR); - act(msg->god_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT); - act(msg->god_msg.room_msg, FALSE, ch, weap, vict, TO_NOTVICT); + if (!IS_NPC(vict) && (GET_LEVEL(vict) >= LVL_IMPL)) { + act(msg->god_msg.attacker_msg, FALSE, ch, weap, vict, TO_CHAR); + act(msg->god_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT); + act(msg->god_msg.room_msg, FALSE, ch, weap, vict, TO_NOTVICT); } else if (dam != 0) { /* * Don't send redundant color codes for TYPE_SUFFERING & other types * of damage without attacker_msg. */ - if (GET_POS(vict) == POS_DEAD) { + if (GET_POS(vict) == POS_DEAD) { if (msg->die_msg.attacker_msg) { send_to_char(ch, CCYEL(ch, C_CMP)); act(msg->die_msg.attacker_msg, FALSE, ch, weap, vict, TO_CHAR); send_to_char(ch, CCNRM(ch, C_CMP)); } - send_to_char(vict, CCRED(vict, C_CMP)); - act(msg->die_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT | TO_SLEEP); - send_to_char(vict, CCNRM(vict, C_CMP)); + send_to_char(vict, CCRED(vict, C_CMP)); + act(msg->die_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT | TO_SLEEP); + send_to_char(vict, CCNRM(vict, C_CMP)); - act(msg->die_msg.room_msg, FALSE, ch, weap, vict, TO_NOTVICT); - } else { + act(msg->die_msg.room_msg, FALSE, ch, weap, vict, TO_NOTVICT); + } else { if (msg->hit_msg.attacker_msg) { - send_to_char(ch, CCYEL(ch, C_CMP)); - act(msg->hit_msg.attacker_msg, FALSE, ch, weap, vict, TO_CHAR); - send_to_char(ch, CCNRM(ch, C_CMP)); + send_to_char(ch, CCYEL(ch, C_CMP)); + act(msg->hit_msg.attacker_msg, FALSE, ch, weap, vict, TO_CHAR); + send_to_char(ch, CCNRM(ch, C_CMP)); } - send_to_char(vict, CCRED(vict, C_CMP)); - act(msg->hit_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT | TO_SLEEP); - send_to_char(vict, CCNRM(vict, C_CMP)); + send_to_char(vict, CCRED(vict, C_CMP)); + act(msg->hit_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT | TO_SLEEP); + send_to_char(vict, CCNRM(vict, C_CMP)); - act(msg->hit_msg.room_msg, FALSE, ch, weap, vict, TO_NOTVICT); - } + act(msg->hit_msg.room_msg, FALSE, ch, weap, vict, TO_NOTVICT); + } } else if (ch != vict) { /* Dam == 0 */ if (msg->miss_msg.attacker_msg) { - send_to_char(ch, CCYEL(ch, C_CMP)); - act(msg->miss_msg.attacker_msg, FALSE, ch, weap, vict, TO_CHAR); - send_to_char(ch, CCNRM(ch, C_CMP)); + send_to_char(ch, CCYEL(ch, C_CMP)); + act(msg->miss_msg.attacker_msg, FALSE, ch, weap, vict, TO_CHAR); + send_to_char(ch, CCNRM(ch, C_CMP)); } - send_to_char(vict, CCRED(vict, C_CMP)); - act(msg->miss_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT | TO_SLEEP); - send_to_char(vict, CCNRM(vict, C_CMP)); + send_to_char(vict, CCRED(vict, C_CMP)); + act(msg->miss_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT | TO_SLEEP); + send_to_char(vict, CCNRM(vict, C_CMP)); - act(msg->miss_msg.room_msg, FALSE, ch, weap, vict, TO_NOTVICT); + act(msg->miss_msg.room_msg, FALSE, ch, weap, vict, TO_NOTVICT); } return (1); } @@ -700,7 +700,7 @@ int damage(struct char_data *ch, struct char_data *victim, int dam, int attackty } /* You can't damage an immortal! */ - if (!IS_NPC(victim) && (IS_ADMIN(victim, ADMLVL_IMPL) || ADM_FLAGGED(victim, ADM_NODAMAGE)) ) + if (!IS_NPC(victim) && ((GET_LEVEL(victim) >= LVL_IMMORT) && PRF_FLAGGED(victim, PRF_NOHASSLE))) dam = 0; if (victim != ch) { @@ -712,7 +712,7 @@ int damage(struct char_data *ch, struct char_data *victim, int dam, int attackty if (GET_POS(victim) > POS_STUNNED && (FIGHTING(victim) == NULL)) { set_fighting(victim, ch); if (MOB_FLAGGED(victim, MOB_MEMORY) && !IS_NPC(ch)) - remember(victim, ch); + remember(victim, ch); } } @@ -792,7 +792,7 @@ int damage(struct char_data *ch, struct char_data *victim, int dam, int attackty send_to_char(victim, "%sYou wish that your wounds would stop BLEEDING so much!%s\r\n", CCRED(victim, C_SPR), CCNRM(victim, C_SPR)); if (ch != victim && MOB_FLAGGED(victim, MOB_WIMPY)) - do_flee(victim, NULL, 0, 0); + do_flee(victim, NULL, 0, 0); } if (!IS_NPC(victim) && GET_WIMP_LEV(victim) && (victim != ch) && GET_HIT(victim) < GET_WIMP_LEV(victim) && GET_HIT(victim) > 0) { @@ -821,15 +821,15 @@ int damage(struct char_data *ch, struct char_data *victim, int dam, int attackty if (GET_POS(victim) == POS_DEAD) { if (ch != victim && (IS_NPC(victim) || victim->desc)) { if (AFF_FLAGGED(ch, AFF_GROUP)) - group_gain(ch, victim); + group_gain(ch, victim); else solo_gain(ch, victim); } if (!IS_NPC(victim)) { - mudlog(BRF, ADMLVL_IMMORT, TRUE, "%s killed by %s at %s", GET_NAME(victim), GET_NAME(ch), world[IN_ROOM(victim)].name); + mudlog(BRF, LVL_IMMORT, TRUE, "%s killed by %s at %s", GET_NAME(victim), GET_NAME(ch), world[IN_ROOM(victim)].name); if (MOB_FLAGGED(ch, MOB_MEMORY)) - forget(ch, victim); + forget(ch, victim); } /* Cant determine GET_GOLD on corpse, so do now and store */ if (IS_NPC(victim)) { @@ -949,9 +949,9 @@ void hit(struct char_data *ch, struct char_data *victim, int type) } else { /* If no weapon, add bare hand damage instead */ if (IS_NPC(ch)) - dam += dice(ch->mob_specials.damnodice, ch->mob_specials.damsizedice); + dam += dice(ch->mob_specials.damnodice, ch->mob_specials.damsizedice); else - dam += rand_number(0, 2); /* Max 2 bare hand damage for players */ + dam += rand_number(0, 2); /* Max 2 bare hand damage for players */ } /* Include a damage multiplier if victim isn't ready to fight: @@ -995,13 +995,13 @@ void perform_violence(void) if (IS_NPC(ch)) { if (GET_MOB_WAIT(ch) > 0) { - GET_MOB_WAIT(ch) -= PULSE_VIOLENCE; - continue; + GET_MOB_WAIT(ch) -= PULSE_VIOLENCE; + continue; } GET_MOB_WAIT(ch) = 0; if (GET_POS(ch) < POS_FIGHTING) { - GET_POS(ch) = POS_FIGHTING; - act("$n scrambles to $s feet!", TRUE, ch, 0, 0, TO_ROOM); + GET_POS(ch) = POS_FIGHTING; + act("$n scrambles to $s feet!", TRUE, ch, 0, 0, TO_ROOM); } } diff --git a/src/genmob.c b/src/genmob.c index f39b472..ba74661 100644 --- a/src/genmob.c +++ b/src/genmob.c @@ -269,7 +269,7 @@ int save_mobiles(zone_rnum rznum) vznum = zone_table[rznum].number; snprintf(mobfname, sizeof(mobfname), "%s%d.new", MOB_PREFIX, vznum); if ((mobfd = fopen(mobfname, "w")) == NULL) { - mudlog(BRF, ADMLVL_GOD, TRUE, "SYSERR: GenOLC: Cannot open mob file for writing."); + mudlog(BRF, LVL_GOD, TRUE, "SYSERR: GenOLC: Cannot open mob file for writing."); return FALSE; } @@ -392,7 +392,7 @@ void check_mobile_string(mob_vnum i, char **string, const char *desc) if (*string == NULL || **string == '\0') { char smbuf[128]; sprintf(smbuf, "GenOLC: Mob #%d has an invalid %s.", i, desc); - mudlog(BRF, ADMLVL_GOD, TRUE, "%s", smbuf); + mudlog(BRF, LVL_GOD, TRUE, "%s", smbuf); if (*string) free(*string); *string = strdup("An undefined string.\n"); diff --git a/src/genobj.c b/src/genobj.c index 7409fe0..1187e66 100644 --- a/src/genobj.c +++ b/src/genobj.c @@ -196,7 +196,7 @@ int save_objects(zone_rnum zone_num) snprintf(filename, sizeof(filename), "%s/%d.new", OBJ_PREFIX, zone_table[zone_num].number); if (!(fp = fopen(filename, "w+"))) { - mudlog(BRF, ADMLVL_IMMORT, TRUE, "SYSERR: OLC: Cannot open objects file %s!", filename); + mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: OLC: Cannot open objects file %s!", filename); return FALSE; } /* Start running through all objects in this zone. */ @@ -256,7 +256,7 @@ int save_objects(zone_rnum zone_num) for (ex_desc = obj->ex_description; ex_desc; ex_desc = ex_desc->next) { /* Sanity check to prevent nasty protection faults. */ if (!ex_desc->keyword || !ex_desc->description || !*ex_desc->keyword || !*ex_desc->description) { - mudlog(BRF, ADMLVL_IMMORT, TRUE, "SYSERR: OLC: oedit_save_to_disk: Corrupt ex_desc!"); + mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: OLC: oedit_save_to_disk: Corrupt ex_desc!"); continue; } strncpy(buf, ex_desc->description, sizeof(buf) - 1); diff --git a/src/genolc.c b/src/genolc.c index 880d7fd..1c1a85f 100644 --- a/src/genolc.c +++ b/src/genolc.c @@ -277,111 +277,111 @@ int sprintascii(char *out, bitvector_t bits) return j; } -/* converts illegal filename chars into appropriate equivalents */ -char *fix_filename(char *str) -{ - static char good_file_name[MAX_STRING_LENGTH]; - char *cindex = good_file_name; - - while(*str) { - switch(*str) { - case ' ': *cindex = '_'; cindex++; break; - case '(': *cindex = '{'; cindex++; break; - case ')': *cindex = '}'; cindex++; break; - - /* skip the following */ - case '\'': break; - case '"': break; - - /* Legal character */ - default: *cindex = *str; cindex++;break; - } - str++; - } - *cindex = '\0'; - - return good_file_name; +/* converts illegal filename chars into appropriate equivalents */ +char *fix_filename(char *str) +{ + static char good_file_name[MAX_STRING_LENGTH]; + char *cindex = good_file_name; + + while(*str) { + switch(*str) { + case ' ': *cindex = '_'; cindex++; break; + case '(': *cindex = '{'; cindex++; break; + case ')': *cindex = '}'; cindex++; break; + + /* skip the following */ + case '\'': break; + case '"': break; + + /* Legal character */ + default: *cindex = *str; cindex++;break; + } + str++; + } + *cindex = '\0'; + + return good_file_name; } -/* Export command by Kyle */ -ACMD(do_export_zone) -{ - zone_rnum zrnum; - zone_vnum zvnum; - char sysbuf[MAX_INPUT_LENGTH]; - char zone_name[MAX_INPUT_LENGTH], *f; - int success, i; +/* Export command by Kyle */ +ACMD(do_export_zone) +{ + zone_rnum zrnum; + zone_vnum zvnum; + char sysbuf[MAX_INPUT_LENGTH]; + char zone_name[MAX_INPUT_LENGTH], *f; + int success, i; - /* system command locations are relative to - * where the binary IS, not where it was run - * from, thus we act like we are in the bin - * folder, because we are*/ - char *path = "../lib/world/export/"; + /* system command locations are relative to + * where the binary IS, not where it was run + * from, thus we act like we are in the bin + * folder, because we are*/ + char *path = "../lib/world/export/"; - if (!IS_ADMIN(ch, ADMLVL_IMPL)) - return; + if (IS_NPC(ch) || GET_LEVEL(ch) < LVL_IMPL) + return; - skip_spaces(&argument); - if (!*argument){ - send_to_char(ch, "Syntax: export "); - return; + skip_spaces(&argument); + if (!*argument){ + send_to_char(ch, "Syntax: export "); + return; + } + + zvnum = atoi(argument); + zrnum = real_zone(zvnum); + + if (zrnum == NOWHERE) { + send_to_char(ch, "Export which zone?\r\n"); + return; + } + + /* If we fail, it might just be because the + * directory didn't exist. Can't hurt to try + * again. Do it silently though ( no logs ). */ + if (!export_info_file(zrnum)) { + sprintf(sysbuf, "mkdir %s", path); + i = system(sysbuf); + } + + if (!(success = export_info_file(zrnum))) + send_to_char(ch, "Info file not saved!\r\n"); + if (!(success = export_save_shops(zrnum))) + send_to_char(ch, "Shops not saved!\r\n"); + if (!(success = export_save_mobiles(zrnum))) + send_to_char(ch, "Mobiles not saved!\r\n"); + if (!(success = export_save_objects(zrnum))) + send_to_char(ch, "Objects not saved!\r\n"); + if (!(success = export_save_zone(zrnum))) + send_to_char(ch, "Zone info not saved!\r\n"); + if (!(success = export_save_rooms(zrnum))) + send_to_char(ch, "Rooms not saved!\r\n"); + if (!(success = export_save_triggers(zrnum))) + send_to_char(ch, "Triggers not saved!\r\n"); + + /* If anything went wrong, don't try to tar the files. */ + if (success) { + send_to_char(ch, "Individual files saved to /lib/world/export.\r\n"); + snprintf(zone_name, sizeof(zone_name), "%s", zone_table[zrnum].name); + } else { + send_to_char(ch, "Ran into problems writing to files.\r\n"); + return; } + /* Make sure the name of the zone doesn't make the filename illegal. */ + f = fix_filename(zone_name); - zvnum = atoi(argument); - zrnum = real_zone(zvnum); + /* Remove the old copy. */ + sprintf(sysbuf, "rm %s%s.tar.gz", path, f); + i = system(sysbuf); - if (zrnum == NOWHERE) { - send_to_char(ch, "Export which zone?\r\n"); - return; - } - - /* If we fail, it might just be because the - * directory didn't exist. Can't hurt to try - * again. Do it silently though ( no logs ). */ - if (!export_info_file(zrnum)) { - sprintf(sysbuf, "mkdir %s", path); - i = system(sysbuf); - } - - if (!(success = export_info_file(zrnum))) - send_to_char(ch, "Info file not saved!\r\n"); - if (!(success = export_save_shops(zrnum))) - send_to_char(ch, "Shops not saved!\r\n"); - if (!(success = export_save_mobiles(zrnum))) - send_to_char(ch, "Mobiles not saved!\r\n"); - if (!(success = export_save_objects(zrnum))) - send_to_char(ch, "Objects not saved!\r\n"); - if (!(success = export_save_zone(zrnum))) - send_to_char(ch, "Zone info not saved!\r\n"); - if (!(success = export_save_rooms(zrnum))) - send_to_char(ch, "Rooms not saved!\r\n"); - if (!(success = export_save_triggers(zrnum))) - send_to_char(ch, "Triggers not saved!\r\n"); - - /* If anything went wrong, don't try to tar the files. */ - if (success) { - send_to_char(ch, "Individual files saved to /lib/world/export.\r\n"); - snprintf(zone_name, sizeof(zone_name), "%s", zone_table[zrnum].name); - } else { - send_to_char(ch, "Ran into problems writing to files.\r\n"); - return; - } - /* Make sure the name of the zone doesn't make the filename illegal. */ - f = fix_filename(zone_name); - - /* Remove the old copy. */ - sprintf(sysbuf, "rm %s%s.tar.gz", path, f); - i = system(sysbuf); - - /* Tar the new copy. */ + /* Tar the new copy. */ sprintf(sysbuf, "tar -cf %s%s.tar %sqq.info %sqq.wld %sqq.zon %sqq.mob %sqq.obj %sqq.trg %sqq.shp", path, f, path, path, path, path, path, path, path); - i = system(sysbuf); + i = system(sysbuf); - /* Gzip it. */ - sprintf(sysbuf, "gzip %s%s.tar", path, f); - i = system(sysbuf); + /* Gzip it. */ + sprintf(sysbuf, "gzip %s%s.tar", path, f); + i = system(sysbuf); - send_to_char(ch, "Files tar'ed to \"%s%s.tar.gz\"\r\n", path, f); + send_to_char(ch, "Files tar'ed to \"%s%s.tar.gz\"\r\n", path, f); } static int export_info_file(zone_rnum zrnum) @@ -390,10 +390,10 @@ static int export_info_file(zone_rnum zrnum) FILE *info_file; if (!(info_file = fopen("world/export/qq.info", "w"))) { - mudlog(BRF, ADMLVL_GOD, TRUE, "SYSERR: export_info_file : Cannot open file!"); + mudlog(BRF, LVL_GOD, TRUE, "SYSERR: export_info_file : Cannot open file!"); return FALSE; } else if (fprintf(info_file, "tbaMUD Area file.\n") < 0) { - mudlog(BRF, ADMLVL_GOD, TRUE, "SYSERR: export_info_file: Cannot write to file!"); + mudlog(BRF, LVL_GOD, TRUE, "SYSERR: export_info_file: Cannot write to file!"); fclose(info_file); return FALSE; } @@ -463,10 +463,10 @@ static int export_save_shops(zone_rnum zrnum) struct shop_data *shop; if (!(shop_file = fopen("world/export/qq.shp", "w"))) { - mudlog(BRF, ADMLVL_GOD, TRUE, "SYSERR: export_save_shops : Cannot open shop file!"); + mudlog(BRF, LVL_GOD, TRUE, "SYSERR: export_save_shops : Cannot open shop file!"); return FALSE; } else if (fprintf(shop_file, "CircleMUD v3.0 Shop File~\n") < 0) { - mudlog(BRF, ADMLVL_GOD, TRUE, "SYSERR: export_save_shops: Cannot write to shop file!"); + mudlog(BRF, LVL_GOD, TRUE, "SYSERR: export_save_shops: Cannot write to shop file!"); fclose(shop_file); return FALSE; } @@ -553,7 +553,7 @@ static int export_save_mobiles(zone_rnum rznum) mob_rnum rmob; if (!(mob_file = fopen("world/export/qq.mob", "w"))) { - mudlog(BRF, ADMLVL_GOD, TRUE, "SYSERR: export_save_mobiles : Cannot open file!"); + mudlog(BRF, LVL_GOD, TRUE, "SYSERR: export_save_mobiles : Cannot open file!"); return FALSE; } @@ -624,7 +624,7 @@ static int export_save_zone(zone_rnum zrnum) FILE *zone_file; if (!(zone_file = fopen("world/export/qq.zon", "w"))) { - mudlog(BRF, ADMLVL_GOD, TRUE, "SYSERR: export_save_zone : Cannot open file!"); + mudlog(BRF, LVL_GOD, TRUE, "SYSERR: export_save_zone : Cannot open file!"); return FALSE; } @@ -735,7 +735,7 @@ static int export_save_zone(zone_rnum zrnum) /* Invalid commands are replaced with '*' - Ignore them. */ continue; default: - mudlog(BRF, ADMLVL_BUILDER, TRUE, "SYSERR: export_save_zone(): Unknown cmd '%c' - NOT saving", ZCMD(zrnum, subcmd).command); + mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: export_save_zone(): Unknown cmd '%c' - NOT saving", ZCMD(zrnum, subcmd).command); continue; } } @@ -759,7 +759,7 @@ static int export_save_objects(zone_rnum zrnum) struct extra_descr_data *ex_desc; if (!(obj_file = fopen("world/export/qq.obj", "w"))) { - mudlog(BRF, ADMLVL_GOD, TRUE, "SYSERR: export_save_objects : Cannot open file!"); + mudlog(BRF, LVL_GOD, TRUE, "SYSERR: export_save_objects : Cannot open file!"); return FALSE; } /* Start running through all objects in this zone. */ @@ -829,7 +829,7 @@ static int export_save_objects(zone_rnum zrnum) for (ex_desc = obj->ex_description; ex_desc; ex_desc = ex_desc->next) { /* Sanity check to prevent nasty protection faults. */ if (!ex_desc->keyword || !ex_desc->description || !*ex_desc->keyword || !*ex_desc->description) { - mudlog(BRF, ADMLVL_IMMORT, TRUE, "SYSERR: OLC: export_save_objects: Corrupt ex_desc!"); + mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: OLC: export_save_objects: Corrupt ex_desc!"); continue; } strncpy(buf, ex_desc->description, sizeof(buf) - 1); @@ -865,7 +865,7 @@ static int export_save_rooms(zone_rnum zrnum) char buf1[MAX_STRING_LENGTH]; if (!(room_file = fopen("world/export/qq.wld", "w"))) { - mudlog(BRF, ADMLVL_GOD, TRUE, "SYSERR: export_save_rooms : Cannot open file!"); + mudlog(BRF, LVL_GOD, TRUE, "SYSERR: export_save_rooms : Cannot open file!"); return FALSE; } @@ -1003,7 +1003,7 @@ static int export_save_triggers(zone_rnum zrnum) char bitBuf[MAX_INPUT_LENGTH]; if (!(trig_file = fopen("world/export/qq.trg", "w"))) { - mudlog(BRF, ADMLVL_GOD, TRUE, "SYSERR: export_save_triggers : Cannot open file!"); + mudlog(BRF, LVL_GOD, TRUE, "SYSERR: export_save_triggers : Cannot open file!"); return FALSE; } diff --git a/src/genqst.c b/src/genqst.c index 2708bf0..865a446 100644 --- a/src/genqst.c +++ b/src/genqst.c @@ -111,14 +111,14 @@ int add_quest(struct aq_data *nqst) if (qmrnum != NOBODY && mob_index[qmrnum].func && mob_index[qmrnum].func != questmaster) QST_FUNC(rnum) = mob_index[qmrnum].func; - if(qmrnum != NOBODY) + if(qmrnum != NOBODY) mob_index[qmrnum].func = questmaster; /* And make sure we save the updated quest information to disk */ if (rznum != NOWHERE) add_to_save_list(zone_table[rznum].number, SL_QST); else - mudlog(BRF, ADMLVL_BUILDER, TRUE, + mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: GenOLC: Cannot determine quest zone."); return rnum; @@ -136,7 +136,7 @@ int delete_quest(qst_rnum rnum) if (rnum >= total_quests) return FALSE; - rznum = real_zone_by_thing(QST_NUM(rnum)); + rznum = real_zone_by_thing(QST_NUM(rnum)); log("GenOLC: delete_quest: Deleting quest #%d (%s).", QST_NUM(rnum), QST_NAME(rnum)); /* make a note of the quest master's secondary spec proc */ @@ -152,12 +152,12 @@ int delete_quest(qst_rnum rnum) RECREATE(aquest_table, struct aq_data, total_quests); else { free(aquest_table); - aquest_table = NULL; + aquest_table = NULL; } if (rznum != NOWHERE) add_to_save_list(zone_table[rznum].number, SL_QST); else - mudlog(BRF, ADMLVL_BUILDER, TRUE, + mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: GenOLC: Cannot determine quest zone."); /* does the questmaster mob have any quests left? */ if (qm != NOBODY) { diff --git a/src/genshp.c b/src/genshp.c index 97bb04f..ef38b1f 100644 --- a/src/genshp.c +++ b/src/genshp.c @@ -302,7 +302,7 @@ int add_shop(struct shop_data *nshp) if (rznum != NOWHERE) add_to_save_list(zone_table[rznum].number, SL_SHP); else - mudlog(BRF, ADMLVL_BUILDER, TRUE, "SYSERR: GenOLC: Cannot determine shop zone."); + mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: GenOLC: Cannot determine shop zone."); return rshop; } @@ -336,7 +336,7 @@ int add_shop(struct shop_data *nshp) if (rznum != NOWHERE) add_to_save_list(zone_table[rznum].number, SL_SHP); else - mudlog(BRF, ADMLVL_BUILDER, TRUE, "SYSERR: GenOLC: Cannot determine shop zone."); + mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: GenOLC: Cannot determine shop zone."); return rshop; } @@ -359,10 +359,10 @@ int save_shops(zone_rnum zone_num) snprintf(fname, sizeof(fname), "%s/%d.new", SHP_PREFIX, zone_table[zone_num].number); if (!(shop_file = fopen(fname, "w"))) { - mudlog(BRF, ADMLVL_GOD, TRUE, "SYSERR: OLC: Cannot open shop file!"); + mudlog(BRF, LVL_GOD, TRUE, "SYSERR: OLC: Cannot open shop file!"); return FALSE; } else if (fprintf(shop_file, "CircleMUD v3.0 Shop File~\n") < 0) { - mudlog(BRF, ADMLVL_GOD, TRUE, "SYSERR: OLC: Cannot write to shop file!"); + mudlog(BRF, LVL_GOD, TRUE, "SYSERR: OLC: Cannot write to shop file!"); fclose(shop_file); return FALSE; } diff --git a/src/genwld.c b/src/genwld.c index e392cf6..a7fb728 100644 --- a/src/genwld.c +++ b/src/genwld.c @@ -19,7 +19,7 @@ #include "dg_olc.h" -/* This function will copy the strings so be sure you free your own copies of +/* This function will copy the strings so be sure you free your own copies of * the description, title, and such. */ room_rnum add_room(struct room_data *room) { @@ -95,7 +95,7 @@ room_rnum add_room(struct room_data *room) /* Known zone entries we don't care about. */ break; default: - mudlog(BRF, ADMLVL_GOD, TRUE, "SYSERR: GenOLC: add_room: Unknown zone entry found!"); + mudlog(BRF, LVL_GOD, TRUE, "SYSERR: GenOLC: add_room: Unknown zone entry found!"); } /* Update the loadroom table. Adds 1 or 0. */ @@ -149,7 +149,7 @@ int delete_room(room_rnum rnum) r_frozen_start_room = 0; /* The Void */ } - /* Dump the contents of this room into the Void. We could also just extract + /* Dump the contents of this room into the Void. We could also just extract * the people, mobs, and objects here. */ for (obj = world[rnum].contents; obj; obj = next_obj) { next_obj = obj->next_content; @@ -167,12 +167,12 @@ int delete_room(room_rnum rnum) extract_script(room, WLD_TRIGGER); free_proto_script(room, WLD_TRIGGER); - /* Change any exit going to this room to go the void. Also fix all the exits + /* Change any exit going to this room to go the void. Also fix all the exits * pointing to rooms above this. */ i = top_of_world + 1; do { i--; - for (j = 0; j < NUM_OF_DIRS; j++) { /* NUM_OF_DIRS, not DIR_COUNT */ + for (j = 0; j < DIR_COUNT; j++) { if (W_EXIT(i, j) == NULL) continue; else if (W_EXIT(i, j)->to_room > rnum) @@ -221,7 +221,7 @@ int delete_room(room_rnum rnum) /* Known zone entries we don't care about. */ break; default: - mudlog(BRF, ADMLVL_GOD, TRUE, "SYSERR: GenOLC: delete_room: Unknown zone entry found!"); + mudlog(BRF, LVL_GOD, TRUE, "SYSERR: GenOLC: delete_room: Unknown zone entry found!"); } /* Remove this room from all shop lists. */ @@ -296,8 +296,8 @@ int save_rooms(zone_rnum rzone) room->number, room->name ? room->name : "Untitled", STRING_TERMINATOR, buf, STRING_TERMINATOR, - zone_table[room->zone].number, room->room_flags[0], room->room_flags[1], room->room_flags[2], - room->room_flags[3], room->sector_type + zone_table[room->zone].number, room->room_flags[0], room->room_flags[1], room->room_flags[2], + room->room_flags[3], room->sector_type ); /* Now you write out the exits for the room. */ @@ -316,9 +316,10 @@ int save_rooms(zone_rnum rzone) dflag = 2; else dflag = 1; - - if (IS_SET(R_EXIT(room, j)->exit_info, EX_HIDDEN)) - dflag += 2; + + if (IS_SET(R_EXIT(room, j)->exit_info, EX_HIDDEN)) + dflag += 2; + } else dflag = 0; @@ -382,8 +383,8 @@ int copy_room(struct room_data *to, struct room_data *from) return TRUE; } -/* Copy strings over so bad things don't happen. We do not free the existing - * strings here because copy_room() did a shallow copy previously and we'd be +/* Copy strings over so bad things don't happen. We do not free the existing + * strings here because copy_room() did a shallow copy previously and we'd be * freeing the very strings we're copying. If this function is used elsewhere, * be sure to free_room_strings() the 'dest' room first. */ int copy_room_strings(struct room_data *dest, struct room_data *source) @@ -429,7 +430,7 @@ int free_room_strings(struct room_data *room) free_ex_descriptions(room->ex_description); /* Free exits. */ - for (i = 0; i < NUM_OF_DIRS; i++) { /* NUM_OF_DIRS, not DIR_COUNT */ + for (i = 0; i < DIR_COUNT; i++) { if (room->dir_option[i]) { if (room->dir_option[i]->general_description) free(room->dir_option[i]->general_description); diff --git a/src/genzon.c b/src/genzon.c index 62638e6..6d361dc 100644 --- a/src/genzon.c +++ b/src/genzon.c @@ -85,7 +85,7 @@ zone_rnum create_new_zone(zone_vnum vzone_num, room_vnum bottom, room_vnum top, /* Create the zone file. */ snprintf(buf, sizeof(buf), "%s/%d.zon", ZON_PREFIX, vzone_num); if (!(fp = fopen(buf, "w"))) { - mudlog(BRF, ADMLVL_IMPL, TRUE, "SYSERR: OLC: Can't write new zone file."); + mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: OLC: Can't write new zone file."); *error = "Could not write zone file.\r\n"; return NOWHERE; } @@ -95,7 +95,7 @@ zone_rnum create_new_zone(zone_vnum vzone_num, room_vnum bottom, room_vnum top, /* Create the room file. */ snprintf(buf, sizeof(buf), "%s/%d.wld", WLD_PREFIX, vzone_num); if (!(fp = fopen(buf, "w"))) { - mudlog(BRF, ADMLVL_IMPL, TRUE, "SYSERR: OLC: Can't write new world file."); + mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: OLC: Can't write new world file."); *error = "Could not write world file.\r\n"; return NOWHERE; } @@ -105,7 +105,7 @@ zone_rnum create_new_zone(zone_vnum vzone_num, room_vnum bottom, room_vnum top, /* Create the mobile file. */ snprintf(buf, sizeof(buf), "%s/%d.mob", MOB_PREFIX, vzone_num); if (!(fp = fopen(buf, "w"))) { - mudlog(BRF, ADMLVL_IMPL, TRUE, "SYSERR: OLC: Can't write new mob file."); + mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: OLC: Can't write new mob file."); *error = "Could not write mobile file.\r\n"; return NOWHERE; } @@ -115,7 +115,7 @@ zone_rnum create_new_zone(zone_vnum vzone_num, room_vnum bottom, room_vnum top, /* Create the object file. */ snprintf(buf, sizeof(buf), "%s/%d.obj", OBJ_PREFIX, vzone_num); if (!(fp = fopen(buf, "w"))) { - mudlog(BRF, ADMLVL_IMPL, TRUE, "SYSERR: OLC: Can't write new obj file."); + mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: OLC: Can't write new obj file."); *error = "Could not write object file.\r\n"; return NOWHERE; } @@ -125,7 +125,7 @@ zone_rnum create_new_zone(zone_vnum vzone_num, room_vnum bottom, room_vnum top, /* Create the shop file. */ snprintf(buf, sizeof(buf), "%s/%d.shp", SHP_PREFIX, vzone_num); if (!(fp = fopen(buf, "w"))) { - mudlog(BRF, ADMLVL_IMPL, TRUE, "SYSERR: OLC: Can't write new shop file."); + mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: OLC: Can't write new shop file."); *error = "Could not write shop file.\r\n"; return NOWHERE; } @@ -135,7 +135,7 @@ zone_rnum create_new_zone(zone_vnum vzone_num, room_vnum bottom, room_vnum top, /* Create the quests file */ snprintf(buf, sizeof(buf), "%s/%d.qst", QST_PREFIX, vzone_num); if (!(fp = fopen(buf, "w"))) { - mudlog(BRF, ADMLVL_IMPL, TRUE, "SYSERR: OLC: Can't write new quest file"); + mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: OLC: Can't write new quest file"); *error = "Could not write quest file.\r\n"; return NOWHERE; } @@ -145,7 +145,7 @@ zone_rnum create_new_zone(zone_vnum vzone_num, room_vnum bottom, room_vnum top, /* Create the trigger file. */ snprintf(buf, sizeof(buf), "%s/%d.trg", TRG_PREFIX, vzone_num); if (!(fp = fopen(buf, "w"))) { - mudlog(BRF, ADMLVL_IMPL, TRUE, "SYSERR: OLC: Can't write new trigger file"); + mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: OLC: Can't write new trigger file"); *error = "Could not write trigger file.\r\n"; return NOWHERE; } @@ -248,10 +248,10 @@ void create_world_index(int znum, const char *type) snprintf(new_name, sizeof(new_name), "%s/newindex", prefix); if (!(oldfile = fopen(old_name, "r"))) { - mudlog(BRF, ADMLVL_IMPL, TRUE, "SYSERR: OLC: Failed to open %s.", old_name); + mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: OLC: Failed to open %s.", old_name); return; } else if (!(newfile = fopen(new_name, "w"))) { - mudlog(BRF, ADMLVL_IMPL, TRUE, "SYSERR: OLC: Failed to open %s.", new_name); + mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: OLC: Failed to open %s.", new_name); fclose(oldfile); return; } @@ -338,7 +338,7 @@ int save_zone(zone_rnum zone_num) snprintf(fname, sizeof(fname), "%s/%d.new", ZON_PREFIX, zone_table[zone_num].number); if (!(zfile = fopen(fname, "w"))) { - mudlog(BRF, ADMLVL_BUILDER, TRUE, "SYSERR: OLC: save_zones: Can't write zone %d.", zone_table[zone_num].number); + mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: save_zones: Can't write zone %d.", zone_table[zone_num].number); return FALSE; } @@ -463,7 +463,7 @@ int save_zone(zone_rnum zone_num) /* Invalid commands are replaced with '*' - Ignore them. */ continue; default: - mudlog(BRF, ADMLVL_BUILDER, TRUE, "SYSERR: OLC: z_save_to_disk(): Unknown cmd '%c' - NOT saving", ZCMD(zone_num, subcmd).command); + mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: z_save_to_disk(): Unknown cmd '%c' - NOT saving", ZCMD(zone_num, subcmd).command); continue; } if (ZCMD(zone_num, subcmd).command != 'V') diff --git a/src/graph.c b/src/graph.c index 03e7534..08670a0 100644 --- a/src/graph.c +++ b/src/graph.c @@ -89,8 +89,8 @@ static void bfs_clear_queue(void) bfs_dequeue(); } -/* find_first_step: given a source room and a target room, find the first step - * on the shortest path from the source to the target. Intended usage: in +/* find_first_step: given a source room and a target room, find the first step + * on the shortest path from the source to the target. Intended usage: in * mobile_activity, give a mob a dir to go if they're tracking another mob or a * PC. Or, a 'track' skill for PCs. */ static int find_first_step(room_rnum src, room_rnum target) diff --git a/src/handler.c b/src/handler.c index d1e4c64..4a0c568 100644 --- a/src/handler.c +++ b/src/handler.c @@ -22,7 +22,6 @@ #include "class.h" #include "fight.h" #include "quest.h" -#include "mail.h" /* local file scope variables */ static int extractions_pending = 0; @@ -255,7 +254,7 @@ void affect_total(struct char_data *ch) affect_modify_ar(ch, af->location, af->modifier, af->bitvector, TRUE); /* Make certain values are between 0..25, not < 0 and not > 25! */ - i = (IS_NPC(ch) || IS_ADMIN(ch, ADMLVL_GRGOD)) ? 25 : 18; + i = (IS_NPC(ch) || GET_LEVEL(ch) >= LVL_GRGOD) ? 25 : 18; GET_DEX(ch) = MAX(0, MIN(GET_DEX(ch), i)); GET_INT(ch) = MAX(0, MIN(GET_INT(ch), i)); @@ -766,37 +765,6 @@ void obj_from_obj(struct obj_data *obj) obj->next_content = NULL; } -/* Attach an object into a mudmail */ -void obj_to_mail(struct obj_data *object, struct mail_data *mail) -{ - if (!object || !mail) - log("SYSERR: Illegal value(s) passed to obj_to_mail. (Mail ID %ld, obj %p)", mail ? mail->mail_id : 0, object); - else { - object->next_content = mail->attachment; - mail->attachment = object; - IN_MAIL(object) = mail; - IN_ROOM(object) = NOWHERE; - object->carried_by = NULL; - } -} - -/* Take an object from a mudmail */ -void obj_from_mail(struct obj_data *object) -{ - struct obj_data *temp; - - if (!object || IN_ROOM(object) != NOWHERE || object->carried_by) { - log("SYSERR: NULL object (%p) or obj not attached to a mail passed to obj_from_mail", object); - return; - } - - REMOVE_FROM_LIST(object, (IN_MAIL(object))->attachment, next_content); - - IN_MAIL(object) = NULL; - IN_ROOM(object) = NOWHERE; - object->next_content = NULL; -} - /* Set all carried_by to point to new owner */ void object_list_new_owner(struct obj_data *list, struct char_data *ch) { diff --git a/src/handler.h b/src/handler.h index e4ee1bc..da14948 100644 --- a/src/handler.h +++ b/src/handler.h @@ -1,13 +1,13 @@ /** * @file handler.h * Prototypes of handling and utility functions. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* -* All rights reserved. See license for complete information. -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. */ #ifndef _HANDLER_H_ #define _HANDLER_H_ @@ -41,8 +41,6 @@ void obj_to_room(struct obj_data *object, room_rnum room); void obj_from_room(struct obj_data *object); void obj_to_obj(struct obj_data *obj, struct obj_data *obj_to); void obj_from_obj(struct obj_data *obj); -void obj_to_mail(struct obj_data *object, struct mail_data *mail); -void obj_from_mail(struct obj_data *object); void object_list_new_owner(struct obj_data *list, struct char_data *ch); void extract_obj(struct obj_data *obj); diff --git a/src/hedit.c b/src/hedit.c index 375401e..cdcce3a 100644 --- a/src/hedit.c +++ b/src/hedit.c @@ -64,7 +64,7 @@ ACMD(do_oasis_hedit) d = ch->desc; if (!str_cmp("save", argument)) { - mudlog(CMP, MAX(ADMLVL_BUILDER, GET_INVIS_LEV(ch)), TRUE, "OLC: %s saves help files.", + mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE, "OLC: %s saves help files.", GET_NAME(ch)); hedit_save_to_disk(d); send_to_char(ch, "Saving help files.\r\n"); @@ -73,14 +73,14 @@ ACMD(do_oasis_hedit) /* Give descriptor an OLC structure. */ if (d->olc) { - mudlog(BRF, ADMLVL_IMMORT, TRUE, "SYSERR: do_oasis: Player already had olc structure."); + mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: do_oasis: Player already had olc structure."); free(d->olc); } CREATE(d->olc, struct oasis_olc_data, 1); OLC_NUM(d) = 0; OLC_STORAGE(d) = strdup(arg); - OLC_ZNUM(d) = search_help(OLC_STORAGE(d), ADMLVL_IMPL); + OLC_ZNUM(d) = search_help(OLC_STORAGE(d), LVL_IMPL); if (OLC_ZNUM(d) == NOWHERE) { send_to_char(ch, "Do you wish to add the '%s' help file? ", OLC_STORAGE(d)); @@ -93,7 +93,7 @@ ACMD(do_oasis_hedit) STATE(d) = CON_HEDIT; act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM); SET_BIT_AR(PLR_FLAGS(ch), PLR_WRITING); - mudlog(CMP, ADMLVL_IMMORT, TRUE, "OLC: %s starts editing help files.", GET_NAME(d->character)); + mudlog(CMP, LVL_IMMORT, TRUE, "OLC: %s starts editing help files.", GET_NAME(d->character)); } static void hedit_setup_new(struct descriptor_data *d) @@ -170,7 +170,7 @@ static void hedit_save_to_disk(struct descriptor_data *d) remove_from_save_list(HEDIT_PERMISSION, SL_HLP); /* Reboot the help files. */ - free_help_table(); + free_help_table(); index_boot(DB_BOOT_HLP); } @@ -206,7 +206,7 @@ void hedit_parse(struct descriptor_data *d, char *arg) case 'Y': snprintf(buf, sizeof(buf), "OLC: %s edits help for %s.", GET_NAME(d->character), OLC_HELP(d)->keywords); - mudlog(TRUE, MAX(ADMLVL_BUILDER, GET_INVIS_LEV(d->character)), CMP, "%s", buf); + mudlog(TRUE, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), CMP, "%s", buf); write_to_output(d, "Help saved to disk.\r\n"); hedit_save_internally(d); @@ -229,9 +229,9 @@ void hedit_parse(struct descriptor_data *d, char *arg) case 'y': case 'Y': hedit_setup_existing(d, OLC_ZNUM(d)); break; - case 'q': case 'Q': + case 'q': case 'Q': cleanup_olc(d, CLEANUP_ALL); - break; + break; case 'n': case 'N': OLC_ZNUM(d)++; for (; OLC_ZNUM(d) < top_of_helpt; OLC_ZNUM(d)++) @@ -248,7 +248,7 @@ void hedit_parse(struct descriptor_data *d, char *arg) write_to_output(d, "Do you wish to edit the '%s' help file? ", help_table[OLC_ZNUM(d)].keywords); OLC_MODE(d) = HEDIT_CONFIRM_EDIT; - } + } break; default: write_to_output(d, "Invalid choice!\r\n" @@ -300,7 +300,7 @@ void hedit_parse(struct descriptor_data *d, char *arg) OLC_VAL(d) = 1; break; case '2': - write_to_output(d, "Enter min admin level : "); + write_to_output(d, "Enter min level : "); OLC_MODE(d) = HEDIT_MIN_LEVEL; break; default: @@ -321,13 +321,13 @@ void hedit_parse(struct descriptor_data *d, char *arg) case HEDIT_ENTRY: /* We will NEVER get here, we hope. */ - mudlog(TRUE, ADMLVL_BUILDER, BRF, "SYSERR: Reached HEDIT_ENTRY case in parse_hedit"); + mudlog(TRUE, LVL_BUILDER, BRF, "SYSERR: Reached HEDIT_ENTRY case in parse_hedit"); break; case HEDIT_MIN_LEVEL: number = atoi(arg); - if ((number < ADMLVL_MORTAL) || (number > ADMLVL_IMPL)) - write_to_output(d, "That is not a valid choice!\r\nEnter min admin level:-\r\n] "); + if ((number < 0) || (number > LVL_IMPL)) + write_to_output(d, "That is not a valid choice!\r\nEnter min level:-\r\n] "); else { OLC_HELP(d)->min_level = number; break; @@ -336,7 +336,7 @@ void hedit_parse(struct descriptor_data *d, char *arg) default: /* We should never get here. */ - mudlog(TRUE, ADMLVL_BUILDER, BRF, "SYSERR: Reached default case in parse_hedit"); + mudlog(TRUE, LVL_BUILDER, BRF, "SYSERR: Reached default case in parse_hedit"); break; } @@ -361,10 +361,9 @@ ACMD(do_helpcheck) int i, count = 0; size_t len = 0, nlen; - for (i = 1; *(complete_cmd_info[i].command) != '\n'; i++) { if (complete_cmd_info[i].command_pointer != do_action && complete_cmd_info[i].minimum_level >= 0) { - if (search_help(complete_cmd_info[i].command, ADMLVL_IMPL) == NOWHERE) { + if (search_help(complete_cmd_info[i].command, LVL_IMPL) == NOWHERE) { nlen = snprintf(buf + len, sizeof(buf) - len, "%-20.20s%s", complete_cmd_info[i].command, (++count % 3 ? "" : "\r\n")); if (len + nlen >= sizeof(buf)) @@ -377,12 +376,12 @@ ACMD(do_helpcheck) nlen = snprintf(buf + len, sizeof(buf) - len, "\r\n"); if (ch->desc) { - if (len == 0) - send_to_char(ch, "All commands have help entries.\r\n"); - else { - send_to_char(ch, "Commands without help entries:\r\n"); - page_string(ch->desc, buf, TRUE); - } + if (len == 0) + send_to_char(ch, "All commands have help entries.\r\n"); + else { + send_to_char(ch, "Commands without help entries:\r\n"); + page_string(ch->desc, buf, TRUE); + } } } diff --git a/src/house.c b/src/house.c index a780c1c..71a54fd 100644 --- a/src/house.c +++ b/src/house.c @@ -16,34 +16,25 @@ #include "handler.h" #include "db.h" #include "interpreter.h" -#include "act.h" #include "house.h" #include "constants.h" #include "modify.h" -#include "genolc.h" -#include "screen.h" -/* local globals */ -struct house_control_data *house_control = NULL; - -/* External Functions */ -const char *get_spec_func_name(SPECIAL(*func)); +/* local (file scope only) globals */ +static struct house_control_rec house_control[MAX_HOUSES]; +static int num_of_houses = 0; /* local functions */ static int House_get_filename(room_vnum vnum, char *filename, size_t maxlen); static int House_load(room_vnum vnum); static void House_restore_weight(struct obj_data *obj); +static void House_delete_file(room_vnum vnum); +static int find_house(room_vnum vnum); +static void House_save_control(void); static void hcontrol_build_house(struct char_data *ch, char *arg); static void hcontrol_destroy_house(struct char_data *ch, char *arg); static void hcontrol_pay_house(struct char_data *ch, char *arg); static void House_listrent(struct char_data *ch, room_vnum vnum); - -/* Control List Functions */ - -/* House loading */ -static void parse_house_flags(struct house_control_data *h, char *line); -static void parse_house_guests(struct house_control_data *h, FILE *fl); - /* CONVERSION code starts here -- see comment below. */ static int ascii_convert_house(struct char_data *ch, obj_vnum vnum); static void hcontrol_convert_houses(struct char_data *ch); @@ -95,22 +86,14 @@ static int House_load(room_vnum vnum) return (1); } -/* Save all objects for a house (recursive; initial call must be followed by a +/* Save all objects for a house (recursive; initial call must be followed by a * call to House_restore_weight) Assumes file is open already. */ int House_save(struct obj_data *obj, FILE *fp) { - struct house_control_data *hse; struct obj_data *tmp; int result; - room_vnum rv; - if (!obj) return(1); - - rv = world[(IN_ROOM(obj))].number; - hse = find_house(rv); - - /* NORENT objects are skipped, unless house is flagged to save them */ - if ( obj && (!OBJ_FLAGGED(obj, ITEM_NORENT) || HOUSE_FLAGGED(hse, HOUSE_SAVENORENT)) ) { + if (obj) { House_save(obj->contains, fp); House_save(obj->next_content, fp); result = objsave_save_obj_record(obj, fp, 0); @@ -140,11 +123,6 @@ void House_crashsave(room_vnum vnum) int rnum; char buf[MAX_STRING_LENGTH]; FILE *fp; - struct house_control_data *hse; - - hse = find_house(vnum); - if (hse && HOUSE_FLAGGED(hse, HOUSE_NOSAVE)) - return; if ((rnum = real_room(vnum)) == NOWHERE) return; @@ -164,7 +142,7 @@ void House_crashsave(room_vnum vnum) } /* Delete a house save file */ -void House_delete_file(room_vnum vnum) +static void House_delete_file(room_vnum vnum) { char filename[MAX_INPUT_LENGTH]; FILE *fl; @@ -185,17 +163,11 @@ void House_delete_file(room_vnum vnum) static void House_listrent(struct char_data *ch, room_vnum vnum) { FILE *fl; - struct house_control_data *hse; char filename[MAX_STRING_LENGTH]; char buf[MAX_STRING_LENGTH]; obj_save_data *loaded, *current; int len = 0; - hse = find_house(vnum); - if (hse && HOUSE_FLAGGED(hse, HOUSE_RENTFREE)) { - send_to_char(ch, "House #%d is rent free!\r\n", vnum); - } - if (!House_get_filename(vnum, filename, sizeof(filename))) return; if (!(fl = fopen(filename, "rb"))) { @@ -226,548 +198,85 @@ static void House_listrent(struct char_data *ch, room_vnum vnum) } /* Functions for house administration (creation, deletion, etc. */ -struct house_control_data *find_house(room_vnum vnum) -{ - struct house_control_data *h = NULL, *next_h = NULL; - - for (h = house_control; h; h = next_h) { - next_h = h->next; - if (h->vnum == vnum) - return (h); - } - return (NULL); -} - -void clear_house_control_data(struct house_control_data *h) +static int find_house(room_vnum vnum) { int i; - h->vnum = NOWHERE; - h->atrium = NOWHERE; - h->owner = NOBODY; - h->mode = HOUSE_PRIVATE; - h->exit_num = 0; - h->built_on = 0; - h->built_by = NOBODY; - h->last_payment = 0; - h->receptionist = NOBODY; - h->guests = NULL; - h->next = NULL; + for (i = 0; i < num_of_houses; i++) + if (house_control[i].vnum == vnum) + return (i); - for (i=0; i< HS_ARRAY_MAX; i++) - h->house_flags[i] = 0; -} - -/* Create a new house control struct with 'default' values, not in the list */ -struct house_control_data *new_house(void) -{ - struct house_control_data *h; - - CREATE(h, struct house_control_data, 1); - - clear_house_control_data(h); - - return(h); -} - -/* Add a guest ID to the specified house */ -void add_house_guest(struct house_control_data *h_data, long guest_id) -{ - struct guest_data *g = NULL; - - if (!h_data || guest_id <= 0 || guest_id == NOBODY) return; - - CREATE(g, struct guest_data, 1); - - if (!g) { - log("SYSERR: Unable to add house guest (vnum=%d, id=%ld)", h_data->vnum, guest_id); - } - /* Store the ID */ - g->id = guest_id; - - /* add it onto the front of the list */ - g->next = h_data->guests; - h_data->guests = g; -} - -/* Return the number of house guests in the specified house */ -int count_house_guests(struct house_control_data *h) -{ - int count = 0; - struct guest_data *g, *next_g; - - for (g=h->guests, count=0; g; g = next_g) { - next_g = g->next; - count++; - } - return count; -} - -/* Return TRUE if the specified player ID is in the house guest list */ -bool is_house_guest(struct house_control_data *h, long id_num) -{ - int count = 0; - struct guest_data *g, *next_g; - - for (g=h->guests, count=0; g; g = next_g) { - next_g = g->next; - if (g->id == id_num) return TRUE; - } - return FALSE; -} - -/* remove a guest from the guest list for the house */ -bool remove_house_guest(struct house_control_data *h, long id_num) -{ - int count = 0; - struct guest_data *g, *next_g; - - /* First entry in the list? */ - g = (h->guests); - if (g->id == id_num) { - next_g = g->next; - free (g); - h->guests = next_g; - } - - for (g=h->guests, count=0; g; g = next_g) { - next_g = g->next; - if (next_g->id == id_num) { - g->next = next_g->next; - free(next_g); - return TRUE; - } - } - return FALSE; -} - -/* Return the number of houses in the list */ -int count_houses(void) -{ - int count = 0; - struct house_control_data *h, *next_h; - - for (h=house_control, count=0; h; h = next_h) { - next_h = h->next; - count++; - } - return count; -} - -/* Add a house to the house_control list, allocating memory for it */ -struct house_control_data *add_house(struct house_control_data *h_data) -{ - struct house_control_data *h; - struct guest_data *g, *next_g = NULL; - room_rnum real_house, real_atrium; - - /* Only valid houses can be added to the list, ignore all others */ - if (get_name_by_id(h_data->owner) == NULL) - return NULL; /* owner no longer exists -- skip */ - - if ((real_house = real_room(h_data->vnum)) == NOWHERE) - return NULL; /* this vnum doesn't exist -- skip */ - - if (find_house(h_data->vnum) != NULL) - return NULL; /* this vnum is already a house -- skip */ - - if ((real_atrium = real_room(h_data->atrium)) == NOWHERE) - return NULL; /* house doesn't have an atrium -- skip */ - - if (h_data->exit_num < 0 || h_data->exit_num >= DIR_COUNT) - return NULL; /* invalid exit num -- skip */ - - if (TOROOM(real_house, h_data->exit_num) != real_atrium) - return NULL; /* exit num mismatch -- skip */ - - /* All checks passed, add this house to the house_control list */ - h = new_house(); - - /* Copy the data from the temp struct */ - *h = *h_data; - - /* Except the pointer to the guest list */ - h->guests = NULL; - - /* Then, add the guests */ - for (g=h_data->guests; g; g=next_g) { - next_g = g->next; - add_house_guest(h,g->id); - } - - /* Finally, add it to the current list */ - h->next = house_control; - house_control = h; - - return (h); -} - -/* Set up a house with flags, contents and receptionist */ -void set_house(struct house_control_data *h) -{ - struct char_data *mob = NULL; - room_rnum real_house, real_atrium; - mob_rnum real_mob; - SPECIAL(*sp_func); - - if ((real_house = real_room(h->vnum)) == NOWHERE) - return; /* this vnum doesn't exist -- skip */ - - if ((real_atrium = real_room(h->atrium)) == NOWHERE) - return; /* house doesn't have an atrium -- skip */ - - /* House is OK, set flags and load contents */ - SET_BIT_AR(ROOM_FLAGS(real_house), ROOM_HOUSE); - SET_BIT_AR(ROOM_FLAGS(real_house), ROOM_PRIVATE); - SET_BIT_AR(ROOM_FLAGS(real_atrium), ROOM_ATRIUM); - House_load(h->vnum); - - if ((real_mob = real_mobile(h->receptionist)) == NOBODY) - return; /* Invalid Receptionist Mob VNUM */ - - /* Attach the required 'standard' Spec-Proc, unless flagged */ - if (!HOUSE_FLAGGED(h, HOUSE_NOSPEC)) { - switch (h->mode) { - case HOUSE_PRIVATE: - case HOUSE_GOD: - /* Load a standard receptionist */ - sp_func = house_receptionist; - break; - - case HOUSE_SHOP: - /* Load a Player-Owned Shopkeeper */ - sp_func = house_shopkeeper; - break; - - default: - sp_func = NULL; - break; - } - - /* NOTE: if the mob had a previous spec-proc assigned, it loses it */ - if (sp_func) { - if ((mob_index[(real_mob)].func) && (sp_func != mob_index[(real_mob)].func)) { - log("SYSERR: House %d, receptionist %d already had %s spec-proc in set_house", - h->vnum, h->receptionist, get_spec_func_name(mob_index[(real_mob)].func)); - } - mob_index[(real_mob)].func = sp_func; - } - - /* Finally, load the mob */ - mob = read_mobile(real_mob, REAL); - char_to_room(mob, real_atrium); - } - House_crashsave(h->vnum); -} - -/* Free memory used by house guest list for the specified house */ -void free_house_guests(struct house_control_data *h) -{ - struct guest_data *g; - - while (h->guests) { - g = (h->guests)->next; - free(h->guests); - h->guests = g; - } -} - -/* Free memory used by specifed house */ -void free_house(struct house_control_data *h) -{ - /* Free guest list */ - if (h->guests) - free_house_guests(h); - - /* Free house struct */ - free(h); -} - -/* erase all houses, and free memory */ -void free_house_list(void) -{ - struct house_control_data *h; - - while (house_control) { - h = house_control->next; - free_house(house_control); - house_control = h; - } -} - -/* Remove a house from the control list, and free memory */ -bool delete_house_control(struct house_control_data *to_del) -{ - struct house_control_data *h, *next_h = NULL; - - if (!house_control) return FALSE; - - /* Is it the first in the list */ - if (house_control == to_del) { - h = house_control; - house_control = h->next; - free_house(h); - return TRUE; - } - - /* Find it in the list */ - for (h = house_control; h; h = next_h) { - next_h = h->next; - if (next_h == to_del) { - h->next = next_h->next; - free_house(next_h); - return TRUE; - } - } - - return FALSE; + return (NOWHERE); } /* Save the house control information */ -void House_save_control(void) +static void House_save_control(void) { FILE *fl; - char bits[127], bits2[127], bits3[127], bits4[127]; - struct house_control_data *h, *next_h; - struct guest_data *g, *next_g; + int i; - if (!(fl = fopen(HCONTROL_FILE, "w"))) { + if (!(fl = fopen(HCONTROL_FILE, "wb"))) { perror("SYSERR: Unable to open house control file."); return; } - for (h=house_control; h; h = next_h) { - next_h = h->next; - fprintf(fl, "#%d\n", h->vnum); /* New House, Room VNUM */ - - fprintf(fl, "Atrm: %d\n", h->atrium); /* Atrium Room VNUM */ - fprintf(fl, "ADir: %d\n", h->exit_num); /* Atrium Direction */ - - fprintf(fl, "Bldr: %ld\n", h->built_by); /* House Builder ID */ - fprintf(fl, "BldT: %d\n", (int)(h->built_on)); /* House Build Date/Time */ - - sprintascii(bits, h->house_flags[0]); - sprintascii(bits2, h->house_flags[1]); - sprintascii(bits3, h->house_flags[2]); - sprintascii(bits4, h->house_flags[3]); - fprintf(fl, "Flgs: %s %s %s %s\n", bits, bits2, bits3, bits4); /* House Flags */ - - if (h->guests) { - fprintf(fl, "Gsts: \n"); /* Guest List */ - for (g=(h->guests); g; g = next_g) { - next_g = g->next; - fprintf(fl, "%ld\n", g->id); /* Individual Guest */ - } - fprintf(fl, "~\n"); /* End Guest List */ - } - - fprintf(fl, "Mode: %d\n", h->mode); /* House Mode (Type) */ - fprintf(fl, "Ownr: %ld\n", h->owner); /* Owner ID Number */ - fprintf(fl, "Paym: %d\n", (int)(h->last_payment)); /* Last Payment Date */ - fprintf(fl, "Recp: %d\n", h->receptionist); /* Receptionist VNUM */ - } - fprintf(fl, "$\n"); /* End of file */ + /* write all the house control recs in one fell swoop. Pretty nifty, eh? */ + i = fwrite(house_control, sizeof(struct house_control_rec), num_of_houses, fl); fclose(fl); } -static void parse_house_flags(struct house_control_data *h, char *line) -{ - char f1[128], f2[128], f3[128], f4[128]; - - if (sscanf(line, "%s %s %s %s", f1, f2, f3, f4) == 4) { - h->house_flags[0] = asciiflag_conv(f1); - h->house_flags[1] = asciiflag_conv(f2); - h->house_flags[2] = asciiflag_conv(f3); - h->house_flags[3] = asciiflag_conv(f4); - } else - h->house_flags[0] = asciiflag_conv(line); -} - -static void parse_house_guests(struct house_control_data *h, FILE *fl) -{ - long num = 0; - char line[MAX_INPUT_LENGTH + 1]; - - do { - get_line(fl, line); - /* Add guest if line isn't end of list or a comment */ - if ((*line != '*') && (*line != '~')) { - sscanf(line, "%ld", &num); - if (num != 0) - add_house_guest(h, num); - } - } while (!feof(fl) && *line && *line != '~' && *line != '$' && num != 0); -} - -/* Call from boot_db - will load control recs, load objs, set atrium bits. +/* Call from boot_db - will load control recs, load objs, set atrium bits. * Should do sanity checks on vnums & remove invalid records. */ void House_boot(void) { - struct house_control_data temp_house, *h; + struct house_control_rec temp_house; + room_rnum real_house, real_atrium; FILE *fl; - char line[MAX_INPUT_LENGTH + 1], tag[6];; - bool first = TRUE, bad_tag = FALSE; + int i; - /* Clear any old lists in memory */ - if (house_control) free_house_list(); + memset((char *)house_control,0,sizeof(struct house_control_rec)*MAX_HOUSES); - if (!(fl = fopen(HCONTROL_FILE, "r"))) { + if (!(fl = fopen(HCONTROL_FILE, "rb"))) { if (errno == ENOENT) log(" No houses to load. File '%s' does not exist.", HCONTROL_FILE); else perror("SYSERR: " HCONTROL_FILE); return; } + while (!feof(fl) && num_of_houses < MAX_HOUSES) { + i = fread(&temp_house, sizeof(struct house_control_rec), 1, fl); - while (get_line(fl, line)) { - while (*line == '*') { - get_line(fl, line); /* Skip comment lines */ - } - /* Start a new house or end of file? */ - if (*line == '#' || *line == '$' || feof(fl)) { - /* Save the current house */ - if (!first) { - if ((h = add_house(&temp_house)) != NULL) - set_house(h); /* Set up the room flags, contents and spec mob */ - } else { - first = FALSE; - } - if (*line == '$') { - /* End of file reached, tidy up, and get out */ - fclose(fl); - House_save_control(); /* Re-save, losing invalid houses */ - return; - } else if (feof(fl)) { - /* End of file incorrectly reached, warn, tidy up, and get out */ - log("SYSERR: End of house control file reached before '$'"); - fclose(fl); - House_save_control(); /* Re-save, losing invalid houses */ - return; - } - /* We didn't reach the end of the file, so start a new house */ - clear_house_control_data(&temp_house); - temp_house.vnum = atoi(line+1); - } else { - tag_argument(line, tag); + if (feof(fl)) + break; - switch (*tag) { - case 'A': - if (!strcmp(tag, "Atrm")) temp_house.atrium = atoi(line); - else if (!strcmp(tag, "ADir")) temp_house.exit_num = atoi(line); - else bad_tag = TRUE; - break; + if (get_name_by_id(temp_house.owner) == NULL) + continue; /* owner no longer exists -- skip */ - case 'B': - if (!strcmp(tag, "Bldr")) temp_house.built_by = atol(line); - else if (!strcmp(tag, "BldT")) temp_house.built_on = atol(line); - else bad_tag = TRUE; - break; + if ((real_house = real_room(temp_house.vnum)) == NOWHERE) + continue; /* this vnum doesn't exist -- skip */ - case 'F': - if (!strcmp(tag, "Flgs")) parse_house_flags(&temp_house, line); - else bad_tag = TRUE; - break; + if (find_house(temp_house.vnum) != NOWHERE) + continue; /* this vnum is already a house -- skip */ - case 'G': - if (!strcmp(tag, "Gsts")) parse_house_guests(&temp_house, fl); - else bad_tag = TRUE; - break; + if ((real_atrium = real_room(temp_house.atrium)) == NOWHERE) + continue; /* house doesn't have an atrium -- skip */ - case 'M': - if (!strcmp(tag, "Mode")) temp_house.mode = atoi(line); - else bad_tag = TRUE; - break; + if (temp_house.exit_num < 0 || temp_house.exit_num >= DIR_COUNT) + continue; /* invalid exit num -- skip */ - case 'O': - if (!strcmp(tag, "Ownr")) temp_house.owner = atol(line); - else bad_tag = TRUE; - break; + if (TOROOM(real_house, temp_house.exit_num) != real_atrium) + continue; /* exit num mismatch -- skip */ - case 'P': - if (!strcmp(tag, "Paym")) temp_house.last_payment = atol(line); - else bad_tag = TRUE; - break; + house_control[num_of_houses++] = temp_house; - case 'R': - if (!strcmp(tag, "Recp")) temp_house.receptionist = (mob_vnum)(atoi(line)); - else bad_tag = TRUE; - break; - - default: - bad_tag = TRUE; - break; - } - - if (bad_tag) { - bad_tag = FALSE; - log("SYSERR: Unknown tag %s in house control file %s", tag, HCONTROL_FILE); - } - } + SET_BIT_AR(ROOM_FLAGS(real_house), ROOM_HOUSE); + SET_BIT_AR(ROOM_FLAGS(real_house), ROOM_PRIVATE); + SET_BIT_AR(ROOM_FLAGS(real_atrium), ROOM_ATRIUM); + House_load(temp_house.vnum); } - /* End of file incorrectly reached, warn, tidy up, and get out */ - log("SYSERR: End of house control file reached before '$'"); fclose(fl); - - House_save_control(); /* Re-save, losing invalid houses */ -} - -void stat_house(struct char_data *ch, struct house_control_data *hse) -{ - room_rnum rm; - char *timestr; - char built_on[128], last_pay[128], buf[MAX_STRING_LENGTH]; - - if (!ch || !hse) return; - - if (hse->built_on) { - timestr = asctime(localtime(&(hse->built_on))); - *(timestr + 10) = '\0'; - strlcpy(built_on, timestr, sizeof(built_on)); - } else - strcpy(built_on, "Unknown"); /* strcpy: OK (for 'strlen("Unknown") < 128') */ - - if (hse->last_payment) { - timestr = asctime(localtime(&(hse->last_payment))); - *(timestr + 10) = '\0'; - strlcpy(last_pay, timestr, sizeof(last_pay)); - } else - strcpy(last_pay, "None"); /* strcpy: OK (for 'strlen("None") < 128') */ - - send_to_char(ch, "House Type : %s%d%s - %s%s%s\r\n", - QYEL, hse->mode, QNRM, - QCYN, house_types[(hse->mode)], QNRM); - - send_to_char(ch, "Owner : %s[%s%5ld%s]%s - %s%s%s\r\n", - QCYN, QYEL, hse->owner, QCYN, QNRM, - QCYN, CAP(get_name_by_id(hse->owner)), QNRM); - - rm = real_room(hse->vnum); - send_to_char(ch, "Private Room: %s[%s%5d%s]%s - %s%s%s\r\n", - QCYN, QYEL, hse->vnum, QCYN, QNRM, - QCYN, (rm == NOWHERE) ? "" : world[rm].name, QNRM); - - rm = real_room(hse->atrium); - send_to_char(ch, "Atrium Room : %s[%s%5d%s]%s - %s%s%s\r\n", - QCYN, QYEL, hse->atrium, QCYN, QNRM, - QCYN, (rm == NOWHERE) ? "" : world[rm].name, QNRM); - - send_to_char(ch, "House Built : %s%s%s by %s%s%s\r\n", - QYEL, built_on, QNRM, - QCYN, (get_name_by_id(hse->built_by) == NULL) ? "" : CAP(get_name_by_id(hse->built_by)), QNRM); - - send_to_char(ch, "Last Payment: %s%s%s\r\n", - QYEL, last_pay, QNRM); - - sprintbitarray((hse->house_flags), house_bits, HS_ARRAY_MAX, buf); - send_to_char(ch, "House Flags : %s%s%s\r\n", - QCYN, buf, QNRM); - - send_to_char(ch, "There are %d guests:\r\n", count_house_guests(hse)); - House_list_guests(ch, hse, TRUE); - - send_to_char(ch, "Rent Info:\r\n"); - House_listrent(ch, hse->vnum); + House_save_control(); } /* "House Control" functions */ @@ -779,26 +288,27 @@ const char *HCONTROL_FORMAT = void hcontrol_list_houses(struct char_data *ch, char *arg) { - struct house_control_data *h = NULL, *next_h = NULL; + int i; char *timestr, *temp; char built_on[128], last_pay[128], own_name[MAX_NAME_LENGTH + 1]; - room_vnum toshow; - if (arg && *arg) { - if (*arg == '.') - toshow = GET_ROOM_VNUM(IN_ROOM(ch)); - else - toshow = atoi(arg); + if (arg && *arg) { + room_vnum toshow; - if ((h = find_house(toshow)) == NULL) { - send_to_char(ch, "Unknown house, \"%s\".\r\n", arg); - return; - } - stat_house(ch, h); - return; - } + if (*arg == '.') + toshow = GET_ROOM_VNUM(IN_ROOM(ch)); + else + toshow = atoi(arg); - if (!house_control) { + if ((i = find_house(toshow)) == NOWHERE) { + send_to_char(ch, "Unknown house, \"%s\".\r\n", arg); + return; + } + House_listrent(ch, toshow); + return; + } + + if (!num_of_houses) { send_to_char(ch, "No houses have been defined.\r\n"); return; } @@ -806,22 +316,20 @@ void hcontrol_list_houses(struct char_data *ch, char *arg) "Address Atrium Build Date Guests Owner Last Paymt\r\n" "------- ------ ---------- ------ ------------ ----------\r\n"); - for (h = house_control; h; h = next_h) { - next_h = h->next; - + for (i = 0; i < num_of_houses; i++) { /* Avoid seeing entries from self-deleted people. -gg 6/21/98 */ - if ((temp = get_name_by_id(h->owner)) == NULL) + if ((temp = get_name_by_id(house_control[i].owner)) == NULL) continue; - if (h->built_on) { - timestr = asctime(localtime(&(h->built_on))); + if (house_control[i].built_on) { + timestr = asctime(localtime(&(house_control[i].built_on))); *(timestr + 10) = '\0'; strlcpy(built_on, timestr, sizeof(built_on)); } else strcpy(built_on, "Unknown"); /* strcpy: OK (for 'strlen("Unknown") < 128') */ - if (h->last_payment) { - timestr = asctime(localtime(&(h->last_payment))); + if (house_control[i].last_payment) { + timestr = asctime(localtime(&(house_control[i].last_payment))); *(timestr + 10) = '\0'; strlcpy(last_pay, timestr, sizeof(last_pay)); } else @@ -830,23 +338,23 @@ void hcontrol_list_houses(struct char_data *ch, char *arg) /* Now we need a copy of the owner's name to capitalize. -gg 6/21/98 */ strcpy(own_name, temp); /* strcpy: OK (names guaranteed <= MAX_NAME_LENGTH+1) */ send_to_char(ch, "%7d %7d %-10s %2d %-12s %s\r\n", - h->vnum, h->atrium, built_on, - count_house_guests(h), CAP(own_name), last_pay); + house_control[i].vnum, house_control[i].atrium, built_on, + house_control[i].num_of_guests, CAP(own_name), last_pay); - House_list_guests(ch, h, TRUE); + House_list_guests(ch, i, TRUE); } } static void hcontrol_build_house(struct char_data *ch, char *arg) { char arg1[MAX_INPUT_LENGTH]; - struct house_control_data *temp_house, *h = NULL; + struct house_control_rec temp_house; room_vnum virt_house, virt_atrium; room_rnum real_house, real_atrium; sh_int exit_num; long owner; - if (count_houses() >= MAX_HOUSES) { + if (num_of_houses >= MAX_HOUSES) { send_to_char(ch, "Max houses already defined.\r\n"); return; } @@ -862,7 +370,7 @@ static void hcontrol_build_house(struct char_data *ch, char *arg) send_to_char(ch, "No such room exists.\r\n"); return; } - if ((find_house(virt_house)) != NULL) { + if ((find_house(virt_house)) != NOWHERE) { send_to_char(ch, "House already exists.\r\n"); return; } @@ -900,33 +408,22 @@ static void hcontrol_build_house(struct char_data *ch, char *arg) send_to_char(ch, "Unknown player '%s'.\r\n", arg1); return; } - /* allocate memory for temp_house */ - if ((temp_house = new_house()) == NULL) { - send_to_char(ch, "Unable to build a house right now...\r\n"); - log("SYSERR: Unable to allocate memory for a house in hcontrol_build_house"); - return; - } - temp_house->mode = HOUSE_PRIVATE; - temp_house->vnum = virt_house; - temp_house->atrium = virt_atrium; - temp_house->exit_num = exit_num; - temp_house->built_on = time(0); - temp_house->last_payment = 0; - temp_house->owner = owner; - temp_house->guests = NULL; + temp_house.mode = HOUSE_PRIVATE; + temp_house.vnum = virt_house; + temp_house.atrium = virt_atrium; + temp_house.exit_num = exit_num; + temp_house.built_on = time(0); + temp_house.last_payment = 0; + temp_house.owner = owner; + temp_house.num_of_guests = 0; - if ((h = add_house(temp_house)) != NULL) { - set_house(h); - } else { - send_to_char(ch, "Unable to build a house right now...\r\n"); - log("SYSERR: Unable to add a house in hcontrol_build_house"); - free_house(temp_house); - return; - } + house_control[num_of_houses++] = temp_house; - /* A new house is added to the list, so free memory used by temp_house */ - free_house(temp_house); + SET_BIT_AR(ROOM_FLAGS(real_house), ROOM_HOUSE); + SET_BIT_AR(ROOM_FLAGS(real_house), ROOM_PRIVATE); + SET_BIT_AR(ROOM_FLAGS(real_atrium), ROOM_ATRIUM); + House_crashsave(virt_house); send_to_char(ch, "House built. Mazel tov!\r\n"); House_save_control(); @@ -934,59 +431,58 @@ static void hcontrol_build_house(struct char_data *ch, char *arg) static void hcontrol_destroy_house(struct char_data *ch, char *arg) { - struct house_control_data *h = NULL, *next_h = NULL; + int i, j; room_rnum real_atrium, real_house; if (!*arg) { send_to_char(ch, "%s", HCONTROL_FORMAT); return; } - if ((h = find_house(atoi(arg))) == NULL) { + if ((i = find_house(atoi(arg))) == NOWHERE) { send_to_char(ch, "Unknown house.\r\n"); return; } - if ((real_atrium = real_room(h->atrium)) == NOWHERE) - log("SYSERR: House %d had invalid atrium %d!", atoi(arg), h->atrium); + if ((real_atrium = real_room(house_control[i].atrium)) == NOWHERE) + log("SYSERR: House %d had invalid atrium %d!", atoi(arg), house_control[i].atrium); else REMOVE_BIT_AR(ROOM_FLAGS(real_atrium), ROOM_ATRIUM); - if ((real_house = real_room(h->vnum)) == NOWHERE) - log("SYSERR: House %d had invalid vnum %d!", atoi(arg), h->vnum); + if ((real_house = real_room(house_control[i].vnum)) == NOWHERE) + log("SYSERR: House %d had invalid vnum %d!", atoi(arg), house_control[i].vnum); else { REMOVE_BIT_AR(ROOM_FLAGS(real_house), ROOM_HOUSE); REMOVE_BIT_AR(ROOM_FLAGS(real_house), ROOM_PRIVATE); REMOVE_BIT_AR(ROOM_FLAGS(real_house), ROOM_HOUSE_CRASH); } - House_delete_file(h->vnum); + House_delete_file(house_control[i].vnum); - delete_house_control(h); + for (j = i; j < num_of_houses - 1; j++) + house_control[j] = house_control[j + 1]; + + num_of_houses--; send_to_char(ch, "House deleted.\r\n"); House_save_control(); - /* Now, reset the ROOM_ATRIUM flag on all existing houses' atriums, just in + /* Now, reset the ROOM_ATRIUM flag on all existing houses' atriums, just in * case the house we just deleted shared an atrium with another house. -JE */ - for (h = house_control; h; h = next_h) { - next_h = h->next; - if ((real_atrium = real_room(h->atrium)) != NOWHERE) + for (i = 0; i < num_of_houses; i++) + if ((real_atrium = real_room(house_control[i].atrium)) != NOWHERE) SET_BIT_AR(ROOM_FLAGS(real_atrium), ROOM_ATRIUM); - } } static void hcontrol_pay_house(struct char_data *ch, char *arg) { - struct house_control_data *hse; + int i; if (!*arg) send_to_char(ch, "%s", HCONTROL_FORMAT); - else if ((hse = find_house(atoi(arg))) == NULL) + else if ((i = find_house(atoi(arg))) == NOWHERE) send_to_char(ch, "Unknown house.\r\n"); - else if (HOUSE_FLAGGED(hse, HOUSE_FREE)) - send_to_char(ch, "That is a FREE house. Payment cannot be taken.\r\n"); else { - mudlog(NRM, MAX(ADMLVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "Payment for house %s collected by %s.", arg, GET_NAME(ch)); + mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "Payment for house %s collected by %s.", arg, GET_NAME(ch)); - hse->last_payment = time(0); + house_control[i].last_payment = time(0); House_save_control(); send_to_char(ch, "Payment recorded.\r\n"); } @@ -1018,39 +514,41 @@ ACMD(do_hcontrol) /* The house command, used by mortal house owners to assign guests */ ACMD(do_house) { - struct house_control_data *hse = NULL; char arg[MAX_INPUT_LENGTH]; - long id; + int i, j, id; one_argument(argument, arg); if (!ROOM_FLAGGED(IN_ROOM(ch), ROOM_HOUSE)) send_to_char(ch, "You must be in your house to set guests.\r\n"); - else if ((hse = find_house(GET_ROOM_VNUM(IN_ROOM(ch)))) == NULL) + else if ((i = find_house(GET_ROOM_VNUM(IN_ROOM(ch)))) == NOWHERE) send_to_char(ch, "Um.. this house seems to be screwed up.\r\n"); - else if (HOUSE_FLAGGED(hse, HOUSE_NOGUESTS)) - send_to_char(ch, "Sorry, this house can't have a guest list.\r\n"); - else if (GET_IDNUM(ch) != hse->owner) + else if (GET_IDNUM(ch) != house_control[i].owner) send_to_char(ch, "Only the primary owner can set guests.\r\n"); else if (!*arg) - House_list_guests(ch, hse, FALSE); + House_list_guests(ch, i, FALSE); else if ((id = get_id_by_name(arg)) < 0) send_to_char(ch, "No such player.\r\n"); else if (id == GET_IDNUM(ch)) send_to_char(ch, "It's your house!\r\n"); else { - if (is_house_guest(hse, id)) { - remove_house_guest(hse, id); - send_to_char(ch, "Guest deleted.\r\n"); - } else { - if (count_house_guests(hse) == MAX_GUESTS) { - send_to_char(ch, "You have too many guests.\r\n"); - return; + for (j = 0; j < house_control[i].num_of_guests; j++) + if (house_control[i].guests[j] == id) { + for (; j < house_control[i].num_of_guests; j++) + house_control[i].guests[j] = house_control[i].guests[j + 1]; + house_control[i].num_of_guests--; + House_save_control(); + send_to_char(ch, "Guest deleted.\r\n"); + return; } - add_house_guest(hse, id); - send_to_char(ch, "Guest added.\r\n"); + if (house_control[i].num_of_guests == MAX_GUESTS) { + send_to_char(ch, "You have too many guests.\r\n"); + return; } + j = house_control[i].num_of_guests++; + house_control[i].guests[j] = id; House_save_control(); + send_to_char(ch, "Guest added.\r\n"); } } @@ -1058,79 +556,41 @@ ACMD(do_house) /* crash-save all the houses */ void House_save_all(void) { - struct house_control_data *hse = NULL, *next_hse = NULL; + int i; room_rnum real_house; - for (hse = house_control; hse; hse = next_hse) { - next_hse = hse->next; - if ((real_house = real_room(hse->vnum)) != NOWHERE) + for (i = 0; i < num_of_houses; i++) + if ((real_house = real_room(house_control[i].vnum)) != NOWHERE) if (ROOM_FLAGGED(real_house, ROOM_HOUSE_CRASH)) - House_crashsave(hse->vnum); - } + House_crashsave(house_control[i].vnum); } /* note: arg passed must be house vnum, so there. */ int House_can_enter(struct char_data *ch, room_vnum house) { - struct house_control_data *hse = NULL; - struct guest_data *g, *next_g = NULL; + int i, j; - /* Not a house? */ - if ((hse = find_house(house)) == NULL) + if (GET_LEVEL(ch) >= LVL_GRGOD || (i = find_house(house)) == NOWHERE) return (1); - /* Even when admin-flagged able to enter all houses, there may be restrictions */ - if (ADM_FLAGGED(ch, ADM_ALLHOUSES)) { - if (HOUSE_FLAGGED(hse, HOUSE_IMPONLY) && IS_ADMIN(ch, ADMLVL_IMPL)) + switch (house_control[i].mode) { + case HOUSE_PRIVATE: + if (GET_IDNUM(ch) == house_control[i].owner) return (1); - else if (IS_ADMIN(ch, ADMLVL_GOD)) - return (1); - else if (!HOUSE_FLAGGED(hse, HOUSE_NOIMMS) && IS_ADMIN(ch, ADMLVL_IMMORT)) - return (1); - } - - if (GET_IDNUM(ch) == hse->owner) - return (1); - - switch (hse->mode) { - case HOUSE_PRIVATE: - case HOUSE_SHOP: - for (g = hse->guests; g; g = next_g) { - next_g = g->next; - if (GET_IDNUM(ch) == g->id) - return (1); - } - break; - - case HOUSE_GOD: - for (g = hse->guests; g; g = next_g) { - next_g = g->next; - if (GET_IDNUM(ch) == g->id) { - if (HOUSE_FLAGGED(hse, HOUSE_IMPONLY) && IS_ADMIN(ch, ADMLVL_IMPL)) - return (1); - else if (IS_ADMIN(ch, ADMLVL_GOD)) - return (1); - else if (!HOUSE_FLAGGED(hse, HOUSE_NOIMMS) && IS_ADMIN(ch, ADMLVL_IMMORT)) - return (1); - } - } - break; - - default: - log("SYSERR: Unhandled mode (%d) for house %d in House_can_enter", hse->mode, hse->vnum ); - break; + for (j = 0; j < house_control[i].num_of_guests; j++) + if (GET_IDNUM(ch) == house_control[i].guests[j]) + return (1); } return (0); } -void House_list_guests(struct char_data *ch, struct house_control_data *h, int quiet) +void House_list_guests(struct char_data *ch, int i, int quiet) { - struct guest_data *g, *next_g = NULL; - int num_printed; + int j, num_printed; char *temp; - if (count_house_guests(h) == 0) { + if (house_control[i].num_of_guests == 0) { if (!quiet) send_to_char(ch, " Guests: None\r\n"); return; @@ -1138,11 +598,9 @@ void House_list_guests(struct char_data *ch, struct house_control_data *h, int q send_to_char(ch, " Guests: "); - for (num_printed = 0, g = h->guests; g; g = next_g) { - next_g = g->next; - + for (num_printed = j = 0; j < house_control[i].num_of_guests; j++) { /* Avoid . -gg 6/21/98 */ - if ((temp = get_name_by_id(g->id)) == NULL) + if ((temp = get_name_by_id(house_control[i].guests[j])) == NULL) continue; num_printed++; @@ -1168,37 +626,36 @@ void House_list_guests(struct char_data *ch, struct house_control_data *h, int q /* Code for conversion to ascii house rent files. */ static void hcontrol_convert_houses(struct char_data *ch) { - struct house_control_data *h, *next_h = NULL; + int i; - if (!IS_ADMIN(ch, ADMLVL_IMPL)) + if (GET_LEVEL(ch) < LVL_IMPL) { send_to_char(ch, "Sorry, but you are not powerful enough to do that.\r\n"); return; } - if (!house_control) { + if (!num_of_houses) { send_to_char(ch, "No houses have been defined.\r\n"); return; } send_to_char(ch, "Converting houses:\r\n"); - for (h = house_control; h; h = next_h) { - next_h = h->next; - send_to_char(ch, " %d", h->vnum); + for (i = 0; i < num_of_houses; i++) { + send_to_char(ch, " %d", house_control[i].vnum); - if (!ascii_convert_house(ch, h->vnum)) - { - /* Let ascii_convert_house() tell about the error. */ - return; - } - else - { - send_to_char(ch, "...done\r\n"); - } + if (!ascii_convert_house(ch, house_control[i].vnum)) + { + /* Let ascii_convert_house() tell about the error. */ + return; + } + else + { + send_to_char(ch, "...done\r\n"); + } } - send_to_char(ch, "All done.\r\n"); + send_to_char(ch, "All done.\r\n"); } static int ascii_convert_house(struct char_data *ch, obj_vnum vnum) @@ -1296,165 +753,3 @@ static struct obj_data *Obj_from_store(struct obj_file_elem object, int *locatio return (obj); } - -/* Standard House Receptionist (house guard mob) */ -/* Mob Special Function */ -/* Prevents non-guests from entering a house */ -SPECIAL(house_receptionist) -{ - struct house_control_data *h, *next_h; - struct char_data *guard = (struct char_data *) me; - - if (!IS_MOVE(cmd) || IS_AFFECTED(guard, AFF_BLIND)) - return FALSE; - - if (ADM_FLAGGED(ch, ADM_ALLHOUSES)) - return FALSE; - - /* Go through house list */ - for (h = house_control; h; h = next_h) - { - next_h = h->next; - - /* Is this the correct House Number, and moving in the right direction*/ - if ((world[(IN_ROOM(ch))].number == h->atrium) && IS_MOVE(cmd) && (cmd == rev_dir[(h->exit_num)])) - { - /* Always allow the house owner and guests */ - if ( (GET_IDNUM(ch) == h->owner) || (is_house_guest(h, GET_IDNUM(ch))) ) - { - return FALSE; - } - } - } - - - /* Not house owner or guest - refuse admission */ - act("$N humiliates you, and blocks your way.", FALSE, ch, 0, guard, TO_CHAR); - act("$N humiliates $n, and blocks $s way.", FALSE, ch, 0, guard, TO_ROOM); - - return TRUE; -} - -/* Player owned shops - Created by Jamdog - 22nd February 2007 */ -/* Mob Special Function */ -/* 'Stock-room' must also be created and made into a player house */ -/* so that only the shop owner can get the piles of gold left there */ -SPECIAL(house_shopkeeper) -{ - room_rnum private_room; - struct obj_data *i, *j; - int num=1, num_items=0; - struct house_control_data *hse = NULL, *next_hse = NULL; - char *temp, shop_owner[MAX_NAME_LENGTH + 1], buf[MAX_STRING_LENGTH]; - bool found=FALSE; - - if (!cmd) - return FALSE; - - /* Gross. */ - private_room = + 1; - - /* Grab the name of the shop owner */ - for (hse = house_control; hse && !found; hse = next_hse) - { - next_hse = hse->next; - if (hse->atrium == world[(IN_ROOM(ch))].number) - { - /* Avoid seeing entries from self-deleted people. */ - if ((temp = get_name_by_id(hse->owner)) == NULL) - { - sprintf(shop_owner, "Someone"); - } - else - { - sprintf(shop_owner, "%s", CAP(get_name_by_id(hse->owner)) ); - } - private_room = real_room(hse->vnum); - found=TRUE; - } - } - - if (found==FALSE) { - log("SYSERR: player_owned_shop spec_proc on a mob that's not in a house! (atrium room %d)", world[IN_ROOM(ch)].number); - return FALSE; - } - - if (private_room == NOWHERE) { - log("SYSERR: player_owned_shop has invalid private room! (atrium room %d)", world[IN_ROOM(ch)].number); - return FALSE; - } - - if (CMD_IS("list")) - { - if (IS_NPC(ch)) - { - send_to_char(ch, "Mobiles can't buy from a player-owned shop!\r\n"); - return TRUE; - } - sprintf(buf, "Owner: @W%s@n", shop_owner); - send_to_char(ch, "Player-owned Shop %*s\r\n", count_color_chars(buf)+55, buf); - send_to_char(ch, " ## Available Item Cost\r\n"); - send_to_char(ch, "-------------------------------------------------------------------------\r\n"); - - for (i = world[private_room].contents; i; i = i->next_content) - { - num_items = 0; - for (j = world[private_room].contents; j != i; j = j->next_content) - if (!strcmp(j->short_description, i->short_description)) - break; - - if (j != i) - continue; - - for (j = i; j; j = j->next_content) - if (!strcmp(j->short_description, i->short_description)) - num_items++; - - if (CAN_SEE_OBJ(ch, i) && (*i->description != '.' || ADM_FLAGGED(ch, ADM_SEESECRET)) && !(GET_OBJ_TYPE(i) == ITEM_MONEY)) - { - send_to_char(ch, "%3d) %5d %-*s %11d\r\n", num++, num_items, count_color_chars(i->short_description)+44, i->short_description, GET_OBJ_COST(i)); - } - } - - return (TRUE); - } else if (CMD_IS("buy")) { - - skip_spaces(&argument); - - i = get_obj_in_list_vis(ch, argument, NULL, world[private_room].contents); - - if ((i == NULL) || (GET_OBJ_TYPE(i) == ITEM_MONEY)) - { - send_to_char(ch, "There is no such item for sale!\r\n"); - return (TRUE); - } - if (GET_GOLD(ch) < GET_OBJ_COST(i)) - { - send_to_char(ch, "You don't have enough gold!\r\n"); - return (TRUE); - } - - /* Just to avoid crashes, if the object has no cost, then don't try to make a pile of no gold */ - if (GET_OBJ_COST(i) > 0) - { - /* Take gold from player */ - decrease_gold(ch, GET_OBJ_COST(i)); - - /* Put gold in stock-room */ - j = create_money(GET_OBJ_COST(i)); - obj_to_room(j, private_room); - } - - /* Move item from stock-room to player's inventory */ - obj_from_room(i); - obj_to_char(i, ch); - - /* Let everyone know what's happening */ - send_to_char(ch, "%s hands you %s, and takes your payment.\r\n", CAP(GET_NAME((struct char_data *)me)), i->short_description); - act("$n buys $p from $N.", FALSE, ch, i, (struct char_data *)me, TO_ROOM); - send_to_char(ch, "%s thanks you for your custom, please come again!\r\n", shop_owner); - - return (TRUE); - } - return(FALSE); -} diff --git a/src/house.h b/src/house.h index 03d1c81..10aee3d 100644 --- a/src/house.h +++ b/src/house.h @@ -1,72 +1,40 @@ /** * @file house.h * Player house structures, prototypes and defines. -* +* * Part of the core tbaMUD source code distribution, which is a derivative * of, and continuation of, CircleMUD. -* -* All rights reserved. See license for complete information. -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. +* +* All rights reserved. See license for complete information. +* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University +* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. */ #ifndef _HOUSE_H_ #define _HOUSE_H_ -#define MAX_HOUSES 100 /* Maximum number of houses in the MUD */ -#define MAX_GUESTS 10 /* Maximum number of guests per house */ +#define MAX_HOUSES 100 +#define MAX_GUESTS 10 -/* House modes/types */ -#define HOUSE_PRIVATE 0 /* A Normal Player-Owned House */ -#define HOUSE_GOD 1 /* Imm owned house */ -#define HOUSE_SHOP 2 /* Player-Owned Shop */ +#define HOUSE_PRIVATE 0 -#define NUM_HOUSE_TYPES 3 - -/* House Flags - also see string constants, in constants.c */ -#define HOUSE_NOGUESTS 0 /* Owner cannot add guests */ -#define HOUSE_FREE 1 /* House does not require payments */ -#define HOUSE_NOIMMS 2 /* Imms below level 2 cannot enter */ -#define HOUSE_IMPONLY 3 /* Imms below level 4 cannot enter */ -#define HOUSE_RENTFREE 4 /* No rent is charged on items left here */ -#define HOUSE_SAVENORENT 5 /* NORENT items are crashsaved too */ -#define HOUSE_NOSAVE 6 /* Do not crash save this room - private only */ -#define HOUSE_NOSPEC 7 /* Don't use 'standard' spec proc for house type */ - -#define HOUSE_NUM_FLAGS 8 - -/** House flags. - * @param loc The house_control_data structure. */ -#define HOUSE_FLAGS(loc) ((loc)->house_flags) - -/** House flagged. - * @param loc The house_control_data structure. * - * flag The house flag (see above) */ -#define HOUSE_FLAGGED(loc, flag) ((loc) && IS_SET_AR(HOUSE_FLAGS(loc), (flag))) - - -#define TOROOM(room, dir) (world[room].dir_option[dir] ? \ - world[room].dir_option[dir]->to_room : NOWHERE) - -/* List structure for house guests */ -struct guest_data { - long id; /**< The ID number of this guest */ - struct guest_data *next; /**< pointer to next guest in list */ -}; - -/* List structure for houses */ -struct house_control_data { - room_vnum vnum; /**< vnum of this house */ - room_vnum atrium; /**< vnum of atrium */ - sh_int exit_num; /**< direction of house's exit */ - time_t built_on; /**< date this house was built */ - long built_by; /**< The ID of the builder (hsedit) */ - long owner; /**< idnum of house's owner */ - int mode; /**< mode of ownership */ - struct guest_data *guests; /**< idnums of house's guests */ - time_t last_payment; /**< date of last house payment */ - int house_flags[HS_ARRAY_MAX]; /**< House Flags (hsedit) */ - mob_vnum receptionist; /**< The Receptionist/Shopkeeper */ - struct house_control_data *next; /**< pointer to next house in list */ +struct house_control_rec { + room_vnum vnum; /* vnum of this house */ + room_vnum atrium; /* vnum of atrium */ + sh_int exit_num; /* direction of house's exit */ + time_t built_on; /* date this house was built */ + int mode; /* mode of ownership */ + long owner; /* idnum of house's owner */ + int num_of_guests; /* how many guests for house */ + long guests[MAX_GUESTS]; /* idnums of house's guests */ + time_t last_payment; /* date of last house payment */ + long spare0; + long spare1; + long spare2; + long spare3; + long spare4; + long spare5; + long spare6; + long spare7; }; #define TOROOM(room, dir) (world[room].dir_option[dir] ? \ @@ -74,36 +42,16 @@ struct house_control_data { /* Functions in house.c made externally available */ /* Utility Functions */ -void House_boot(void); -void House_save_all(void); -int House_can_enter(struct char_data *ch, room_vnum house); -void House_crashsave(room_vnum vnum); -void House_list_guests(struct char_data *ch, struct house_control_data *h, int quiet); -int House_save(struct obj_data *obj, FILE *fp); -void House_save_control(void); -void House_delete_file(room_vnum vnum); +void House_boot(void); +void House_save_all(void); +int House_can_enter(struct char_data *ch, room_vnum house); +void House_crashsave(room_vnum vnum); +void House_list_guests(struct char_data *ch, int i, int quiet); +int House_save(struct obj_data *obj, FILE *fp); void hcontrol_list_houses(struct char_data *ch, char *arg); -void set_house(struct house_control_data *h); -void free_house_guests(struct house_control_data *h); -void clear_house_control_data(struct house_control_data *h); -void add_house_guest(struct house_control_data *h_data, long guest_id); -int count_house_guests(struct house_control_data *h); -bool is_house_guest(struct house_control_data *h, long id_num); -bool remove_house_guest(struct house_control_data *h, long id_num); -int count_houses(void); -void free_house(struct house_control_data *h); -void free_house_list(void); -bool delete_house_control(struct house_control_data *to_del); -struct house_control_data *new_house(void); -struct house_control_data *add_house(struct house_control_data *h_data); -struct house_control_data *find_house(room_vnum vnum); - /* In game Commands */ ACMD(do_hcontrol); ACMD(do_house); -/* Spec-procs in house.c */ -SPECIAL(house_shopkeeper); -SPECIAL(house_receptionist); #endif /* _HOUSE_H_ */ diff --git a/src/ibt.c b/src/ibt.c index b520fb3..cd2cb4c 100755 --- a/src/ibt.c +++ b/src/ibt.c @@ -443,7 +443,7 @@ ACMD(do_ibt) int i, num_res, num_unres; IBT_DATA *ibtData, *first_ibt, *last_ibt; int ano=0; - + if (IS_NPC(ch)) return; @@ -454,7 +454,7 @@ ACMD(do_ibt) last_ibt = get_last_ibt(subcmd); if ((!*arg)){ - if (ADM_FLAGGED(ch, ADM_ADVIBT)) { + if (GET_LEVEL(ch) >= LVL_GRGOD){ send_to_char(ch, "Usage: %s%s submit
%s\r\n" " %s%s list%s\r\n" " %s%s show %s\r\n" @@ -468,7 +468,7 @@ ACMD(do_ibt) QYEL, CMD_NAME, QNRM, QYEL, CMD_NAME, QNRM); return; - } else if (IS_ADMIN(ch, ADMLVL_IMMORT)) { + } else if (GET_LEVEL(ch) >= LVL_IMMORT) { send_to_char(ch, "Usage: %s%s submit
%s\r\n" " %s%s list%s\r\n" " %s%s show %s\r\n", @@ -499,12 +499,12 @@ ACMD(do_ibt) send_to_char(ch, "That %s doesn't exist.\r\n", CMD_NAME); return; } else { - if ((!IS_ADMIN(ch, ADMLVL_IMMORT)) && (!is_ibt_logger(ibtData, ch))) { + if ((GET_LEVEL(ch) < LVL_IMMORT) && (!is_ibt_logger(ibtData, ch))) { send_to_char(ch, "Sorry but you may only view %ss you have posted yourself.\n\r", ibt_types[subcmd]); } else { send_to_char(ch, "%s%s by %s%s\r\n",QCYN, ibt_types[subcmd], QYEL, ibtData->name); - if (IS_ADMIN(ch, ADMLVL_IMMORT)) { + if (GET_LEVEL(ch) >= LVL_IMMORT) { send_to_char(ch, "%sLevel: %s%d\r\n",QCYN, QYEL, ibtData->level); send_to_char(ch, "%sRoom : %s%d\r\n",QCYN, QYEL, ibtData->room); } @@ -527,7 +527,7 @@ ACMD(do_ibt) if (first_ibt) { - if (!IS_ADMIN(ch, ADMLVL_IMMORT)) { + if (GET_LEVEL(ch) < LVL_IMMORT) { send_to_char(ch,"%s No %s|%s Description\r\n", QCYN, QGRN, QCYN); send_to_char(ch,"%s ---|--------------------------------------------------%s\r\n", QGRN, QNRM); } else { @@ -539,7 +539,7 @@ ACMD(do_ibt) i++; /* For mortals, skip IBT's that they didn't log */ - if ((!IS_ADMIN(ch, ADMLVL_IMMORT)) && !is_ibt_logger(ibtData,ch)) + if ((GET_LEVEL(ch) < LVL_IMMORT) && !is_ibt_logger(ibtData,ch)) continue; /* Set up the 'important' flag */ @@ -549,7 +549,7 @@ ACMD(do_ibt) sprintf(imp, "%c", ' '); if (IBT_FLAGGED(ibtData, IBT_RESOLVED)) { - if (!IS_ADMIN(ch, ADMLVL_IMMORT)) { + if (GET_LEVEL(ch) < LVL_IMMORT) { send_to_char(ch, "%s%s%3d|%s%s\r\n", imp, QGRN, i, ibtData->text, QNRM); } else { @@ -562,7 +562,7 @@ ACMD(do_ibt) } num_res++; } else if (IBT_FLAGGED(ibtData, IBT_INPROGRESS)) { - if (!IS_ADMIN(ch, ADMLVL_IMMORT)) { + if (GET_LEVEL(ch) < LVL_IMMORT) { send_to_char(ch, "%s%s%3d%s|%s%s%s\r\n", imp, QYEL, i, QGRN, QYEL, ibtData->text, QNRM); @@ -576,7 +576,7 @@ ACMD(do_ibt) } num_unres++; } else { - if (!IS_ADMIN(ch, ADMLVL_IMMORT)) { + if (GET_LEVEL(ch) < LVL_IMMORT) { send_to_char(ch, "%s%s%3d%s|%s%s%s\r\n", imp, QRED, i, QGRN, QRED, ibtData->text, QNRM); @@ -599,7 +599,7 @@ ACMD(do_ibt) } else { send_to_char(ch,"No %ss have been found that were reported by you!\r\n", CMD_NAME); } - if (ADM_FLAGGED(ch, ADM_ADVIBT)) { + if (GET_LEVEL(ch) >= LVL_GRGOD) { send_to_char(ch,"%sYou may use %s remove, resolve or edit to change the list..%s\r\n", QCYN, CMD_NAME, QNRM); } send_to_char(ch,"%sYou may use %s%s show %s to see more indepth about the %s.%s\r\n", QCYN, QYEL, CMD_NAME, QCYN, CMD_NAME, QNRM); @@ -635,7 +635,6 @@ ACMD(do_ibt) string_write(ch->desc, &(ibtData->body),MAX_IBT_LENGTH, 0, NULL); - ibtData->room = GET_ROOM_VNUM(IN_ROOM(ch)); ibtData->level = GET_LEVEL(ch); ibtData->text = STRALLOC(arg_text); @@ -649,12 +648,12 @@ ACMD(do_ibt) case SCMD_TYPO: LINK( ibtData, first_typo, last_typo, next, prev ); break; } - mudlog(NRM,ADMLVL_IMMORT, FALSE, "%s has posted %s %s!", GET_NAME(ch), TANA(CMD_NAME), CMD_NAME); + mudlog(NRM,LVL_IMMORT, FALSE, "%s has posted %s %s!", GET_NAME(ch), TANA(CMD_NAME), CMD_NAME); return; } else if (is_abbrev(arg,"resolve")) { - if (!ADM_FLAGGED(ch, ADM_ADVIBT)) { + if (GET_LEVEL(ch) < LVL_GRGOD){ send_to_char(ch, "%s what?\r\n", ibt_types[subcmd]); return; } @@ -675,13 +674,13 @@ ACMD(do_ibt) send_to_char(ch,"%s %d resolved!\r\n", ibt_types[subcmd], ano); SET_BIT_AR(IBT_FLAGS(ibtData), IBT_RESOLVED); if (CONFIG_IBT_AUTOSAVE) { - save_ibt_file(subcmd); - } + save_ibt_file(subcmd); + } } } return; } else if (is_abbrev(arg,"remove")) { - if (!ADM_FLAGGED(ch, ADM_ADVIBT)) { + if (GET_LEVEL(ch) < LVL_GRGOD){ send_to_char(ch, "%s what?\r\n", ibt_types[subcmd]); return; } @@ -699,29 +698,29 @@ ACMD(do_ibt) if (free_ibt(subcmd, ibtData)) { send_to_char(ch,"%s%s Number %d removed.%s\r\n", QCYN, ibt_types[subcmd], ano, QNRM); if (CONFIG_IBT_AUTOSAVE) { - save_ibt_file(subcmd); - } + save_ibt_file(subcmd); + } } else { send_to_char(ch,"%sUnable to remove %s %d!%s\r\n", QRED, CMD_NAME, ano, QNRM); } } return; } else if (is_abbrev(arg,"save")) { - if (!ADM_FLAGGED(ch, ADM_ADVIBT)) { + if (GET_LEVEL(ch) < LVL_GRGOD){ send_to_char(ch, "%s what?\r\n", ibt_types[subcmd]); return; } save_ibt_file(subcmd); send_to_char(ch,"%s list saved.\r\n", ibt_types[subcmd]); } else if (is_abbrev(arg,"edit")) { - if (!ADM_FLAGGED(ch, ADM_ADVIBT)) { + if (GET_LEVEL(ch) < LVL_GRGOD){ send_to_char(ch, "%s what?\r\n", ibt_types[subcmd]); return; } /* Pass control to the OLC without the 'edit' arg */ do_oasis_ibtedit(ch, arg_text, cmd, subcmd); } else { - if (!ADM_FLAGGED(ch, ADM_ADVIBT)) { + if (GET_LEVEL(ch) < LVL_GRGOD){ send_to_char(ch, "%s what?\r\n", ibt_types[subcmd]); send_to_char(ch, "Usage: %s submit \r\n", ibt_types[subcmd]); return; @@ -782,7 +781,7 @@ ACMD(do_oasis_ibtedit) /* Give descriptor an OLC structure. */ if (d->olc) { - mudlog(BRF, ADMLVL_IMMORT, TRUE, "SYSERR: do_oasis_ibtedit: Player already had olc structure."); + mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: do_oasis_ibtedit: Player already had olc structure."); free(d->olc); } @@ -805,7 +804,7 @@ ACMD(do_oasis_ibtedit) act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM); SET_BIT_AR(PLR_FLAGS(ch), PLR_WRITING); - mudlog(CMP, ADMLVL_IMMORT, TRUE,"OLC: %s starts editing %s %d", + mudlog(CMP, LVL_IMMORT, TRUE,"OLC: %s starts editing %s %d", GET_NAME(ch), IBT_TYPE, OLC_NUM(d)); } @@ -885,23 +884,29 @@ static void ibtedit_save(struct descriptor_data *d) } void free_olc_ibt(IBT_DATA *toFree) { - if (!toFree) - return; - - if (toFree->text) { - STRFREE(toFree->text); - } - if (toFree->body) { - STRFREE(toFree->body); - } - if (toFree->name) { - STRFREE(toFree->name); - } - if (toFree->notes) { - STRFREE(toFree->notes); - } - free(toFree); + + if (!toFree) + return; + + if (toFree->text) { + STRFREE(toFree->text); + } + + if (toFree->body) { + STRFREE(toFree->body); + } + + if (toFree->name) { + STRFREE(toFree->name); + } + + if (toFree->notes) { + STRFREE(toFree->notes); + } + + free(toFree); } + /*-------------------------------------------------------------------*/ /* main ibtedit menu function... */ static void ibtedit_disp_main_menu(struct descriptor_data *d) @@ -967,7 +972,7 @@ void ibtedit_parse(struct descriptor_data *d, char *arg) case 'Y': /* Save the IBT in memory and to disk. */ ibtedit_save(d); - mudlog(CMP, MAX(ADMLVL_BUILDER, GET_INVIS_LEV(d->character)), TRUE, "OLC: %s edits %s %d", GET_NAME(d->character), IBT_TYPE, OLC_NUM(d)); + mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), TRUE, "OLC: %s edits %s %d", GET_NAME(d->character), IBT_TYPE, OLC_NUM(d)); cleanup_olc(d, CLEANUP_ALL); return; case 'n': @@ -1082,21 +1087,21 @@ void ibtedit_parse(struct descriptor_data *d, char *arg) case IBTEDIT_BODY: /* We should never get here, modify.c throws user through ibtedit_string_cleanup. */ cleanup_olc(d, CLEANUP_ALL); - mudlog(BRF, ADMLVL_BUILDER, TRUE, "SYSERR: OLC: ibtedit_parse(): Reached BODY case!"); + mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: ibtedit_parse(): Reached BODY case!"); write_to_output(d, "Oops...\r\n"); break; case IBTEDIT_NOTES: /* We should never get here, modify.c throws user through ibtedit_string_cleanup. */ cleanup_olc(d, CLEANUP_ALL); - mudlog(BRF, ADMLVL_BUILDER, TRUE, "SYSERR: OLC: ibtedit_parse(): Reached NOTES case!"); + mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: ibtedit_parse(): Reached NOTES case!"); write_to_output(d, "Oops...\r\n"); break; default: /* We should never get here. */ cleanup_olc(d, CLEANUP_ALL); - mudlog(BRF, ADMLVL_BUILDER, TRUE, "SYSERR: OLC: ibtedit_parse(): Reached default case!"); + mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: ibtedit_parse(): Reached default case!"); write_to_output(d, "Oops...\r\n"); break; } diff --git a/src/improved-edit.c b/src/improved-edit.c index 2615d36..a0831d8 100644 --- a/src/improved-edit.c +++ b/src/improved-edit.c @@ -446,7 +446,7 @@ void parse_edit_action(int command, char *string, struct descriptor_data *d) strcat(buf, buf2); if ((s = strchr(s, '\n')) != NULL) { /* This means that we are at the END of the line, we want out of there, - * but we want s to point to the beginning of the line. AFTER the line + * but we want s to point to the beginning of the line. AFTER the line * we want edited. */ s++; /* Now put the last 'good' half of buffer into storage. */ @@ -468,12 +468,12 @@ void parse_edit_action(int command, char *string, struct descriptor_data *d) break; default: write_to_output(d, "Invalid option.\r\n"); - mudlog(BRF, ADMLVL_IMPL, TRUE, "SYSERR: invalid command passed to parse_edit_action"); + mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: invalid command passed to parse_edit_action"); return; } } -/* Re-formats message type formatted char *. (for strings edited with d->str) +/* Re-formats message type formatted char *. (for strings edited with d->str) * (mostly olc and mail). */ int format_text(char **ptr_string, int mode, struct descriptor_data *d, unsigned int maxlen, int low, int high) { @@ -540,7 +540,7 @@ int format_text(char **ptr_string, int mode, struct descriptor_data *d, unsigned cap_next = TRUE; } - /* This is so that if we stopped on a sentence, we move off the sentence + /* This is so that if we stopped on a sentence, we move off the sentence * delimiter. */ while (strchr(".!?", *flow)) { cap_next_next = TRUE; @@ -549,8 +549,8 @@ int format_text(char **ptr_string, int mode, struct descriptor_data *d, unsigned /* Special case: if we're at the end of the last line, and the last * character is a delimiter, the flow++ above will have *flow pointing - * to the \r (or \n) character after the delimiter. Thus *flow will be - * non-null, and an extra (blank) line might be added erroneously. We + * to the \r (or \n) character after the delimiter. Thus *flow will be + * non-null, and an extra (blank) line might be added erroneously. We * fix it by skipping the newline characters in between. - Welcor */ if (strchr("\n\r", *flow)) { *flow = '\0'; /* terminate 'start' string */ diff --git a/src/interpreter.c b/src/interpreter.c index de55513..915f120 100644 --- a/src/interpreter.c +++ b/src/interpreter.c @@ -41,10 +41,10 @@ /* local (file scope) functions */ static int perform_dupe_check(struct descriptor_data *d); -static bool perform_new_char_dupe_check(struct descriptor_data *d); static struct alias_data *find_alias(struct alias_data *alias_list, char *str); static void perform_complex_alias(struct txt_q *input_q, char *orig, struct alias_data *a); static int _parse_name(char *arg, char *name); +static bool perform_new_char_dupe_check(struct descriptor_data *d); /* sort_commands utility */ static int sort_commands_helper(const void *a, const void *b); @@ -61,323 +61,306 @@ struct command_info *complete_cmd_info; * commands such as "at" should have high priority; infrequently used and * dangerously destructive commands should have low priority. */ -/* The new command list has 8 columns, which are: - * command - The full command typed by players - * sort by - Ensure a command is sorted before a similar social - * min pos - Minimum position for player to use the command - * ACMD func - The handler function called when commmand is used - * Min Level - The minimum mortal level for this command - * Min Admin - Min. Admin level - over-rides mortal level unless ADMLVL_MORTAL - * Admin Flag - Required admin flag - over-rides admin level unless ADM_NONE - * Subcommand - Subcommand passed to handler function - * - * If Admin flag is set, admin level should be what would normally be set for the command, even - * though it's not used. This then shows in wizhelp or commands. -*/ cpp_extern const struct command_info cmd_info[] = { - { "RESERVED", "", 0, 0, 0, 0, 0, 0 }, /* this must be first -- for specprocs */ + { "RESERVED", "", 0, 0, 0, 0 }, /* this must be first -- for specprocs */ /* directions must come before other commands but after RESERVED */ - { "north" , "n" , POS_STANDING, do_move , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_NORTH }, - { "east" , "e" , POS_STANDING, do_move , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_EAST }, - { "south" , "s" , POS_STANDING, do_move , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_SOUTH }, - { "west" , "w" , POS_STANDING, do_move , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_WEST }, - { "up" , "u" , POS_STANDING, do_move , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_UP }, - { "down" , "d" , POS_STANDING, do_move , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_DOWN }, - { "northwest", "northw" , POS_STANDING, do_move , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_NW }, - { "nw" , "nw" , POS_STANDING, do_move , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_NW }, - { "northeast", "northe" , POS_STANDING, do_move , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_NE }, - { "ne" , "ne" , POS_STANDING, do_move , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_NE }, - { "southeast", "southe" , POS_STANDING, do_move , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_SE }, - { "se" , "se" , POS_STANDING, do_move , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_SE }, - { "southwest", "southw" , POS_STANDING, do_move , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_SW }, - { "sw" , "sw" , POS_STANDING, do_move , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_SW }, - + { "north" , "n" , POS_STANDING, do_move , 0, SCMD_NORTH }, + { "east" , "e" , POS_STANDING, do_move , 0, SCMD_EAST }, + { "south" , "s" , POS_STANDING, do_move , 0, SCMD_SOUTH }, + { "west" , "w" , POS_STANDING, do_move , 0, SCMD_WEST }, + { "up" , "u" , POS_STANDING, do_move , 0, SCMD_UP }, + { "down" , "d" , POS_STANDING, do_move , 0, SCMD_DOWN }, + { "northwest", "northw" , POS_STANDING, do_move , 0, SCMD_NW }, + { "nw" , "nw" , POS_STANDING, do_move , 0, SCMD_NW }, + { "northeast", "northe" , POS_STANDING, do_move , 0, SCMD_NE }, + { "ne" , "ne" , POS_STANDING, do_move , 0, SCMD_NE }, + { "southeast", "southe" , POS_STANDING, do_move , 0, SCMD_SE }, + { "se" , "se" , POS_STANDING, do_move , 0, SCMD_SE }, + { "southwest", "southw" , POS_STANDING, do_move , 0, SCMD_SW }, + { "sw" , "sw" , POS_STANDING, do_move , 0, SCMD_SW }, + /* now, the main list */ - { "at" , "at" , POS_DEAD , do_at , 0, ADMLVL_IMMORT, ADM_NONE, 0 }, - { "admin" , "adm" , POS_DEAD , do_admin , 0, ADMLVL_IMPL, ADM_ADMIN, 0 }, - { "advance" , "adv" , POS_DEAD , do_advance , 0, ADMLVL_GOD, ADM_NONE, 0 }, - { "aedit" , "aed" , POS_DEAD , do_oasis_aedit,0, ADMLVL_GOD, ADM_NONE, 0 }, - { "alias" , "ali" , POS_DEAD , do_alias , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "afk" , "afk" , POS_DEAD , do_gen_tog , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_AFK }, - { "areas" , "are" , POS_DEAD , do_areas , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "assist" , "as" , POS_FIGHTING, do_assist , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "ask" , "ask" , POS_RESTING , do_spec_comm , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_ASK }, - { "astat" , "ast" , POS_DEAD , do_astat , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "attach" , "attach" , POS_DEAD , do_attach , 0, ADMLVL_BUILDER, ADM_BUILD, 0 }, - { "auction" , "auc" , POS_SLEEPING, do_gen_comm , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_AUCTION }, - { "autoexits" , "autoex" , POS_DEAD , do_gen_tog , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_AUTOEXIT }, - { "autoassist","autoass" , POS_DEAD , do_gen_tog , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_AUTOASSIST }, - { "autodoor" , "autodoor", POS_DEAD , do_gen_tog , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_AUTODOOR }, - { "autogold" , "autogold", POS_DEAD , do_gen_tog , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_AUTOGOLD }, - { "autokey" , "autokey" , POS_DEAD , do_gen_tog , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_AUTOKEY }, - { "autoloot" , "autoloot", POS_DEAD , do_gen_tog , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_AUTOLOOT }, - { "automap" , "automap" , POS_DEAD , do_gen_tog , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_AUTOMAP }, - { "autosac" , "autosac" , POS_DEAD , do_gen_tog , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_AUTOSAC }, - { "autosplit", "autospl" , POS_DEAD , do_gen_tog , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_AUTOSPLIT }, + { "at" , "at" , POS_DEAD , do_at , LVL_IMMORT, 0 }, + { "advance" , "adv" , POS_DEAD , do_advance , LVL_GOD, 0 }, + { "aedit" , "aed" , POS_DEAD , do_oasis_aedit, LVL_GOD, 0 }, + { "alias" , "ali" , POS_DEAD , do_alias , 0, 0 }, + { "afk" , "afk" , POS_DEAD , do_gen_tog , 0, SCMD_AFK }, + { "areas" , "are" , POS_DEAD , do_areas , 0, 0 }, + { "assist" , "as" , POS_FIGHTING, do_assist , 1, 0 }, + { "ask" , "ask" , POS_RESTING , do_spec_comm, 0, SCMD_ASK }, + { "astat" , "ast" , POS_DEAD , do_astat , 0, 0 }, + { "attach" , "attach" , POS_DEAD , do_attach , LVL_BUILDER, 0 }, + { "auction" , "auc" , POS_SLEEPING, do_gen_comm , 0, SCMD_AUCTION }, + { "autoexits" , "autoex" , POS_DEAD , do_gen_tog , 0, SCMD_AUTOEXIT }, + { "autoassist","autoass" , POS_DEAD , do_gen_tog , 0, SCMD_AUTOASSIST }, + { "autodoor" , "autodoor", POS_DEAD , do_gen_tog , 0, SCMD_AUTODOOR }, + { "autogold" , "autogold", POS_DEAD , do_gen_tog , 0, SCMD_AUTOGOLD }, + { "autokey" , "autokey" , POS_DEAD , do_gen_tog , 0, SCMD_AUTOKEY }, + { "autoloot" , "autoloot", POS_DEAD , do_gen_tog , 0, SCMD_AUTOLOOT }, + { "automap" , "automap" , POS_DEAD , do_gen_tog , 0, SCMD_AUTOMAP }, + { "autosac" , "autosac" , POS_DEAD , do_gen_tog , 0, SCMD_AUTOSAC }, + { "autosplit", "autospl" , POS_DEAD , do_gen_tog , 0, SCMD_AUTOSPLIT }, - { "backstab" , "ba" , POS_STANDING, do_backstab , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "ban" , "ban" , POS_DEAD , do_ban , 0, ADMLVL_GRGOD, ADM_NONE, 0 }, - { "balance" , "bal" , POS_STANDING, do_not_here , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "bash" , "bas" , POS_FIGHTING, do_bash , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "brief" , "br" , POS_DEAD , do_gen_tog , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_BRIEF }, - { "buildwalk", "buildwalk",POS_STANDING, do_gen_tog , 0, ADMLVL_BUILDER, ADM_NONE, SCMD_BUILDWALK }, - { "buy" , "bu" , POS_STANDING, do_not_here , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "bug" , "bug" , POS_DEAD , do_ibt , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_BUG }, + { "backstab" , "ba" , POS_STANDING, do_backstab , 1, 0 }, + { "ban" , "ban" , POS_DEAD , do_ban , LVL_GRGOD, 0 }, + { "balance" , "bal" , POS_STANDING, do_not_here , 1, 0 }, + { "bash" , "bas" , POS_FIGHTING, do_bash , 1, 0 }, + { "brief" , "br" , POS_DEAD , do_gen_tog , 0, SCMD_BRIEF }, + { "buildwalk", "buildwalk", POS_STANDING, do_gen_tog , LVL_BUILDER, SCMD_BUILDWALK }, + { "buy" , "bu" , POS_STANDING, do_not_here , 0, 0 }, + { "bug" , "bug" , POS_DEAD , do_ibt , 0, SCMD_BUG }, - { "cast" , "c" , POS_SITTING , do_cast , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "cedit" , "cedit" , POS_DEAD , do_oasis_cedit,0, ADMLVL_IMPL, ADM_CEDIT, 0 }, - { "changelog", "cha" , POS_DEAD , do_changelog , 0, ADMLVL_IMPL, ADM_NONE, 0 }, - { "check" , "ch" , POS_STANDING, do_not_here , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "checkload", "checkl" , POS_DEAD , do_checkloadstatus,0, ADMLVL_GOD, ADM_ADVBUILD, 0 }, - { "close" , "cl" , POS_SITTING , do_gen_door , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_CLOSE }, - { "clear" , "cle" , POS_DEAD , do_gen_ps , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_CLEAR }, - { "cls" , "cls" , POS_DEAD , do_gen_ps , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_CLEAR }, - { "cmdinfo" , "cmd" , POS_DEAD , do_cmdinfo , 0, ADMLVL_IMMORT, ADM_NONE, 0 }, - { "consider" , "con" , POS_RESTING , do_consider , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "commands" , "com" , POS_DEAD , do_commands , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_COMMANDS }, - { "compact" , "comp" , POS_DEAD , do_gen_tog , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_COMPACT }, - { "copyover" , "copyover", POS_DEAD , do_copyover , 0, ADMLVL_GRGOD, ADM_NONE, 0 }, - { "credits" , "cred" , POS_DEAD , do_gen_ps , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_CREDITS }, + { "cast" , "c" , POS_SITTING , do_cast , 1, 0 }, + { "cedit" , "cedit" , POS_DEAD , do_oasis_cedit, LVL_IMPL, 0 }, + { "changelog", "cha" , POS_DEAD , do_changelog, LVL_IMPL, 0 }, + { "check" , "ch" , POS_STANDING, do_not_here , 1, 0 }, + { "checkload", "checkl" , POS_DEAD , do_checkloadstatus, LVL_GOD, 0 }, + { "close" , "cl" , POS_SITTING , do_gen_door , 0, SCMD_CLOSE }, + { "clear" , "cle" , POS_DEAD , do_gen_ps , 0, SCMD_CLEAR }, + { "cls" , "cls" , POS_DEAD , do_gen_ps , 0, SCMD_CLEAR }, + { "consider" , "con" , POS_RESTING , do_consider , 0, 0 }, + { "commands" , "com" , POS_DEAD , do_commands , 0, SCMD_COMMANDS }, + { "compact" , "comp" , POS_DEAD , do_gen_tog , 0, SCMD_COMPACT }, + { "copyover" , "copyover", POS_DEAD , do_copyover , LVL_GRGOD, 0 }, + { "credits" , "cred" , POS_DEAD , do_gen_ps , 0, SCMD_CREDITS }, - { "date" , "da" , POS_DEAD , do_date , 0, ADMLVL_IMMORT, ADM_NONE, SCMD_DATE }, - { "dc" , "dc" , POS_DEAD , do_dc , 0, ADMLVL_GOD, ADM_NONE, 0 }, - { "deposit" , "depo" , POS_STANDING, do_not_here , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "detach" , "detach" , POS_DEAD , do_detach , 0, ADMLVL_BUILDER, ADM_ADVBUILD, 0 }, - { "diagnose" , "diag" , POS_RESTING , do_diagnose , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "dig" , "dig" , POS_DEAD , do_dig , 0, ADMLVL_BUILDER, ADM_BUILD, 0 }, - { "display" , "disp" , POS_DEAD , do_display , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "donate" , "don" , POS_RESTING , do_drop , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_DONATE }, - { "drink" , "dri" , POS_RESTING , do_drink , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_DRINK }, - { "drop" , "dro" , POS_RESTING , do_drop , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_DROP }, + { "date" , "da" , POS_DEAD , do_date , LVL_IMMORT, SCMD_DATE }, + { "dc" , "dc" , POS_DEAD , do_dc , LVL_GOD, 0 }, + { "deposit" , "depo" , POS_STANDING, do_not_here , 1, 0 }, + { "detach" , "detach" , POS_DEAD , do_detach , LVL_BUILDER, 0 }, + { "diagnose" , "diag" , POS_RESTING , do_diagnose , 0, 0 }, + { "dig" , "dig" , POS_DEAD , do_dig , LVL_BUILDER, 0 }, + { "display" , "disp" , POS_DEAD , do_display , 0, 0 }, + { "donate" , "don" , POS_RESTING , do_drop , 0, SCMD_DONATE }, + { "drink" , "dri" , POS_RESTING , do_drink , 0, SCMD_DRINK }, + { "drop" , "dro" , POS_RESTING , do_drop , 0, SCMD_DROP }, - { "eat" , "ea" , POS_RESTING , do_eat , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_EAT }, - { "echo" , "ec" , POS_SLEEPING, do_echo , 0, ADMLVL_IMMORT, ADM_NONE, SCMD_ECHO }, - { "emote" , "em" , POS_RESTING , do_echo , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_EMOTE }, - { ":" , ":" , POS_RESTING, do_echo , 1, ADMLVL_MORTAL, ADM_NONE, SCMD_EMOTE }, - { "enter" , "ent" , POS_STANDING, do_enter , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "equipment", "eq" , POS_SLEEPING, do_equipment , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "exits" , "ex" , POS_RESTING , do_exits , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "examine" , "exa" , POS_SITTING , do_examine , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "export" , "export" , POS_DEAD , do_export_zone,0, ADMLVL_IMPL, ADM_NONE, 0 }, + { "eat" , "ea" , POS_RESTING , do_eat , 0, SCMD_EAT }, + { "echo" , "ec" , POS_SLEEPING, do_echo , LVL_IMMORT, SCMD_ECHO }, + { "emote" , "em" , POS_RESTING , do_echo , 0, SCMD_EMOTE }, + { ":" , ":" , POS_RESTING, do_echo , 1, SCMD_EMOTE }, + { "enter" , "ent" , POS_STANDING, do_enter , 0, 0 }, + { "equipment", "eq" , POS_SLEEPING, do_equipment, 0, 0 }, + { "exits" , "ex" , POS_RESTING , do_exits , 0, 0 }, + { "examine" , "exa" , POS_SITTING , do_examine , 0, 0 }, + { "export" , "export" , POS_DEAD , do_export_zone, LVL_IMPL, 0 }, - { "force" , "force" , POS_SLEEPING, do_force , 0, ADMLVL_GOD, ADM_NONE, 0 }, - { "fill" , "fil" , POS_STANDING, do_pour , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_FILL }, - { "file" , "file" , POS_SLEEPING, do_file , 0, ADMLVL_GOD, ADM_NONE, 0 }, - { "flee" , "fl" , POS_FIGHTING, do_flee , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "follow" , "fol" , POS_RESTING , do_follow , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "freeze" , "freeze" , POS_DEAD , do_wizutil , 0, ADMLVL_GRGOD, ADM_NONE, SCMD_FREEZE }, + { "force" , "force" , POS_SLEEPING, do_force , LVL_GOD, 0 }, + { "fill" , "fil" , POS_STANDING, do_pour , 0, SCMD_FILL }, + { "file" , "file" , POS_SLEEPING, do_file , LVL_GOD, 0 }, + { "flee" , "fl" , POS_FIGHTING, do_flee , 1, 0 }, + { "follow" , "fol" , POS_RESTING , do_follow , 0, 0 }, + { "freeze" , "freeze" , POS_DEAD , do_wizutil , LVL_GRGOD, SCMD_FREEZE }, - { "get" , "g" , POS_RESTING , do_get , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "gecho" , "gecho" , POS_DEAD , do_gecho , 0, ADMLVL_GOD, ADM_NONE, 0 }, - { "gemote" , "gem" , POS_SLEEPING, do_gen_comm , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_GEMOTE }, - { "give" , "giv" , POS_RESTING , do_give , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "goto" , "go" , POS_SLEEPING, do_goto , 0, ADMLVL_MORTAL, ADM_POOF, 0 }, - { "gold" , "gol" , POS_RESTING , do_gold , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "gossip" , "gos" , POS_SLEEPING, do_gen_comm , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_GOSSIP }, - { "group" , "gr" , POS_RESTING , do_group , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "grab" , "grab" , POS_RESTING , do_grab , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "grats" , "grat" , POS_SLEEPING, do_gen_comm , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_GRATZ }, - { "gsay" , "gsay" , POS_SLEEPING, do_gsay , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "gtell" , "gt" , POS_SLEEPING, do_gsay , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, + { "get" , "g" , POS_RESTING , do_get , 0, 0 }, + { "gecho" , "gecho" , POS_DEAD , do_gecho , LVL_GOD, 0 }, + { "gemote" , "gem" , POS_SLEEPING, do_gen_comm , 0, SCMD_GEMOTE }, + { "give" , "giv" , POS_RESTING , do_give , 0, 0 }, + { "goto" , "go" , POS_SLEEPING, do_goto , LVL_IMMORT, 0 }, + { "gold" , "gol" , POS_RESTING , do_gold , 0, 0 }, + { "gossip" , "gos" , POS_SLEEPING, do_gen_comm , 0, SCMD_GOSSIP }, + { "group" , "gr" , POS_RESTING , do_group , 1, 0 }, + { "grab" , "grab" , POS_RESTING , do_grab , 0, 0 }, + { "grats" , "grat" , POS_SLEEPING, do_gen_comm , 0, SCMD_GRATZ }, + { "gsay" , "gsay" , POS_SLEEPING, do_gsay , 0, 0 }, + { "gtell" , "gt" , POS_SLEEPING, do_gsay , 0, 0 }, - { "help" , "h" , POS_DEAD , do_help , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "happyhour", "ha" , POS_DEAD , do_happyhour , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "hedit" , "hedit" , POS_DEAD , do_oasis_hedit,0, ADMLVL_GOD, ADM_ADVBUILD, 0 }, - { "hindex" , "hind" , POS_DEAD , do_hindex , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "helpcheck", "helpch" , POS_DEAD , do_helpcheck , 0, ADMLVL_GOD, ADM_NONE, 0 }, - { "hide" , "hi" , POS_RESTING , do_hide , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "handbook" , "handb" , POS_DEAD , do_gen_ps , 0, ADMLVL_IMMORT, ADM_NONE, SCMD_HANDBOOK }, - { "hcontrol" , "hcontrol", POS_DEAD , do_hcontrol , 0, ADMLVL_GRGOD, ADM_NONE, 0 }, - { "history" , "history" , POS_DEAD , do_history , 0, ADMLVL_MORTAL, ADM_NONE, 0}, - { "hit" , "hit" , POS_FIGHTING, do_hit , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_HIT }, - { "hold" , "hold" , POS_RESTING , do_grab , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "holler" , "holler" , POS_RESTING , do_gen_comm , 1, ADMLVL_MORTAL, ADM_NONE, SCMD_HOLLER }, - { "holylight", "holy" , POS_DEAD , do_gen_tog , 0, ADMLVL_IMMORT, ADM_NONE, SCMD_HOLYLIGHT }, - { "house" , "house" , POS_RESTING , do_house , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "hsedit" , "hsedit" , POS_DEAD , do_oasis_hsedit,0,ADMLVL_GOD, ADM_ADVBUILD, 0 }, + { "help" , "h" , POS_DEAD , do_help , 0, 0 }, + { "happyhour", "ha" , POS_DEAD , do_happyhour, 0, 0 }, + { "hedit" , "hedit" , POS_DEAD , do_oasis_hedit, LVL_GOD , 0 }, + { "helpcheck", "helpch" , POS_DEAD , do_helpcheck, LVL_GOD, 0 }, + { "hide" , "hi" , POS_RESTING , do_hide , 1, 0 }, + { "hindex" , "hind" , POS_DEAD , do_hindex , 0, 0 }, + { "handbook" , "handb" , POS_DEAD , do_gen_ps , LVL_IMMORT, SCMD_HANDBOOK }, + { "hcontrol" , "hcontrol", POS_DEAD , do_hcontrol , LVL_GRGOD, 0 }, + { "history" , "history" , POS_DEAD , do_history, 0, 0}, + { "hit" , "hit" , POS_FIGHTING, do_hit , 0, SCMD_HIT }, + { "hold" , "hold" , POS_RESTING , do_grab , 1, 0 }, + { "holler" , "holler" , POS_RESTING , do_gen_comm , 1, SCMD_HOLLER }, + { "holylight", "holy" , POS_DEAD , do_gen_tog , LVL_IMMORT, SCMD_HOLYLIGHT }, + { "house" , "house" , POS_RESTING , do_house , 0, 0 }, - { "inventory", "i" , POS_DEAD , do_inventory , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "identify" , "id" , POS_STANDING, do_not_here , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "idea" , "ide" , POS_DEAD , do_ibt , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_IDEA }, - { "imotd" , "imo" , POS_DEAD , do_gen_ps , 0, ADMLVL_IMMORT, ADM_NONE, SCMD_IMOTD }, - { "immlist" , "imm" , POS_DEAD , do_gen_ps , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_IMMLIST }, - { "info" , "info" , POS_SLEEPING, do_gen_ps , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_INFO }, - { "invis" , "invi" , POS_DEAD , do_invis , 0, ADMLVL_IMMORT, ADM_NONE, 0 }, + { "inventory", "i" , POS_DEAD , do_inventory, 0, 0 }, + { "identify" , "id" , POS_STANDING, do_not_here , 1, 0 }, + { "idea" , "ide" , POS_DEAD , do_ibt , 0, SCMD_IDEA }, + { "imotd" , "imo" , POS_DEAD , do_gen_ps , LVL_IMMORT, SCMD_IMOTD }, + { "immlist" , "imm" , POS_DEAD , do_gen_ps , 0, SCMD_IMMLIST }, + { "info" , "info" , POS_SLEEPING, do_gen_ps , 0, SCMD_INFO }, + { "invis" , "invi" , POS_DEAD , do_invis , LVL_IMMORT, 0 }, - { "junk" , "j" , POS_RESTING , do_drop , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_JUNK }, + { "junk" , "j" , POS_RESTING , do_drop , 0, SCMD_JUNK }, - { "kill" , "k" , POS_FIGHTING, do_kill , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "kick" , "ki" , POS_FIGHTING, do_kick , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, + { "kill" , "k" , POS_FIGHTING, do_kill , 0, 0 }, + { "kick" , "ki" , POS_FIGHTING, do_kick , 1, 0 }, - { "look" , "l" , POS_RESTING , do_look , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_LOOK }, - { "last" , "last" , POS_DEAD , do_last , 0, ADMLVL_GOD, ADM_NONE, 0 }, - { "leave" , "lea" , POS_STANDING, do_leave , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "levels" , "lev" , POS_DEAD , do_levels , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "list" , "lis" , POS_STANDING, do_not_here , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "links" , "lin" , POS_STANDING, do_links , 0, ADMLVL_GOD, ADM_ADVBUILD, 0 }, - { "lock" , "loc" , POS_SITTING , do_gen_door , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_LOCK }, - { "load" , "load" , POS_DEAD , do_load , 0, ADMLVL_BUILDER, ADM_BUILD, 0 }, + { "look" , "l" , POS_RESTING , do_look , 0, SCMD_LOOK }, + { "last" , "last" , POS_DEAD , do_last , LVL_GOD, 0 }, + { "leave" , "lea" , POS_STANDING, do_leave , 0, 0 }, + { "levels" , "lev" , POS_DEAD , do_levels , 0, 0 }, + { "list" , "lis" , POS_STANDING, do_not_here , 0, 0 }, + { "links" , "lin" , POS_STANDING, do_links , LVL_GOD, 0 }, + { "lock" , "loc" , POS_SITTING , do_gen_door , 0, SCMD_LOCK }, + { "load" , "load" , POS_DEAD , do_load , LVL_BUILDER, 0 }, - { "motd" , "motd" , POS_DEAD , do_gen_ps , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_MOTD }, - { "mortal" , "mort" , POS_DEAD , do_mortal , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "mail" , "mail" , POS_STANDING, do_mail , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "map" , "map" , POS_STANDING, do_map , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "medit" , "med" , POS_DEAD , do_oasis_medit,0, ADMLVL_BUILDER, ADM_NONE, 0 }, - { "mlist" , "mlist" , POS_DEAD , do_oasis_list, 0, ADMLVL_BUILDER, ADM_BUILD, SCMD_OASIS_MLIST }, - { "mcopy" , "mcopy" , POS_DEAD , do_oasis_copy, 0, ADMLVL_GOD, ADM_ADVBUILD, CON_MEDIT }, - { "mute" , "mute" , POS_DEAD , do_wizutil , 0, ADMLVL_GOD, ADM_NONE, SCMD_MUTE }, + { "motd" , "motd" , POS_DEAD , do_gen_ps , 0, SCMD_MOTD }, + { "mail" , "mail" , POS_STANDING, do_not_here , 1, 0 }, + { "map" , "map" , POS_STANDING, do_map , 1, 0 }, + { "medit" , "med" , POS_DEAD , do_oasis_medit, LVL_BUILDER, 0 }, + { "mlist" , "mlist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_MLIST }, + { "mcopy" , "mcopy" , POS_DEAD , do_oasis_copy, LVL_GOD, CON_MEDIT }, + { "mute" , "mute" , POS_DEAD , do_wizutil , LVL_GOD, SCMD_MUTE }, - { "news" , "news" , POS_SLEEPING, do_gen_ps , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_NEWS }, - { "noauction", "noauction",POS_DEAD , do_gen_tog , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_NOAUCTION }, - { "nogossip" , "nogossip", POS_DEAD , do_gen_tog , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_NOGOSSIP }, - { "nograts" , "nograts" , POS_DEAD , do_gen_tog , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_NOGRATZ }, - { "nohassle" , "nohassle", POS_DEAD , do_gen_tog , 0, ADMLVL_IMMORT, ADM_NONE, SCMD_NOHASSLE }, - { "norepeat" , "norepeat", POS_DEAD , do_gen_tog , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_NOREPEAT }, - { "noshout" , "noshout" , POS_SLEEPING, do_gen_tog , 1, ADMLVL_MORTAL, ADM_NONE, SCMD_NOSHOUT }, - { "nosummon" , "nosummon", POS_DEAD , do_gen_tog , 1, ADMLVL_MORTAL, ADM_NONE, SCMD_NOSUMMON }, - { "notell" , "notell" , POS_DEAD , do_gen_tog , 1, ADMLVL_MORTAL, ADM_NONE, SCMD_NOTELL }, - { "notitle" , "notitle" , POS_DEAD , do_wizutil , 0, ADMLVL_GOD, ADM_NONE, SCMD_NOTITLE }, - { "nowiz" , "nowiz" , POS_DEAD , do_gen_tog , 0, ADMLVL_IMMORT, ADM_NONE, SCMD_NOWIZ }, + { "news" , "news" , POS_SLEEPING, do_gen_ps , 0, SCMD_NEWS }, + { "noauction", "noauction",POS_DEAD , do_gen_tog , 0, SCMD_NOAUCTION }, + { "nogossip" , "nogossip", POS_DEAD , do_gen_tog , 0, SCMD_NOGOSSIP }, + { "nograts" , "nograts" , POS_DEAD , do_gen_tog , 0, SCMD_NOGRATZ }, + { "nohassle" , "nohassle", POS_DEAD , do_gen_tog , LVL_IMMORT, SCMD_NOHASSLE }, + { "norepeat" , "norepeat", POS_DEAD , do_gen_tog , 0, SCMD_NOREPEAT }, + { "noshout" , "noshout" , POS_SLEEPING, do_gen_tog , 1, SCMD_NOSHOUT }, + { "nosummon" , "nosummon", POS_DEAD , do_gen_tog , 1, SCMD_NOSUMMON }, + { "notell" , "notell" , POS_DEAD , do_gen_tog , 1, SCMD_NOTELL }, + { "notitle" , "notitle" , POS_DEAD , do_wizutil , LVL_GOD, SCMD_NOTITLE }, + { "nowiz" , "nowiz" , POS_DEAD , do_gen_tog , LVL_IMMORT, SCMD_NOWIZ }, - { "open" , "o" , POS_SITTING , do_gen_door , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_OPEN }, - { "order" , "ord" , POS_RESTING , do_order , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "offer" , "off" , POS_STANDING, do_not_here , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "olc" , "olc" , POS_DEAD , do_show_save_list,0,ADMLVL_BUILDER,ADM_BUILD,0 }, - { "olist" , "olist" , POS_DEAD , do_oasis_list, 0, ADMLVL_BUILDER, ADM_BUILD, SCMD_OASIS_OLIST }, - { "oedit" , "oedit" , POS_DEAD , do_oasis_oedit,0, ADMLVL_BUILDER, ADM_BUILD, 0 }, - { "ocopy" , "ocopy" , POS_DEAD , do_oasis_copy, 0, ADMLVL_GOD, ADM_ADVBUILD, CON_OEDIT }, + { "open" , "o" , POS_SITTING , do_gen_door , 0, SCMD_OPEN }, + { "order" , "ord" , POS_RESTING , do_order , 1, 0 }, + { "offer" , "off" , POS_STANDING, do_not_here , 1, 0 }, + { "olc" , "olc" , POS_DEAD , do_show_save_list, LVL_BUILDER, 0 }, + { "olist" , "olist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_OLIST }, + { "oedit" , "oedit" , POS_DEAD , do_oasis_oedit, LVL_BUILDER, 0 }, + { "ocopy" , "ocopy" , POS_DEAD , do_oasis_copy, LVL_GOD, CON_OEDIT }, - { "put" , "p" , POS_RESTING , do_put , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "peace" , "pe" , POS_DEAD , do_peace , 0, ADMLVL_BUILDER, ADM_NONE, 0 }, - { "pick" , "pi" , POS_STANDING, do_gen_door , 1, ADMLVL_MORTAL, ADM_NONE, SCMD_PICK }, - { "practice" , "pr" , POS_RESTING , do_practice , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "page" , "pag" , POS_DEAD , do_page , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "pardon" , "pardon" , POS_DEAD , do_wizutil , 0, ADMLVL_GOD, ADM_NONE, SCMD_PARDON }, - { "plist" , "plist" , POS_DEAD , do_plist , 0, ADMLVL_GOD, ADM_NONE, 0 }, - { "policy" , "pol" , POS_DEAD , do_gen_ps , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_POLICIES }, - { "pour" , "pour" , POS_STANDING, do_pour , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_POUR }, - { "prompt" , "pro" , POS_DEAD , do_display , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "prefedit" , "pre" , POS_DEAD , do_oasis_prefedit,0,ADMLVL_MORTAL,ADM_NONE, 0 }, - { "purge" , "purge" , POS_DEAD , do_purge , 0, ADMLVL_BUILDER, ADM_BUILD, 0 }, + { "put" , "p" , POS_RESTING , do_put , 0, 0 }, + { "peace" , "pe" , POS_DEAD , do_peace , LVL_BUILDER, 0 }, + { "pick" , "pi" , POS_STANDING, do_gen_door , 1, SCMD_PICK }, + { "practice" , "pr" , POS_RESTING , do_practice , 1, 0 }, + { "page" , "pag" , POS_DEAD , do_page , 1, 0 }, + { "pardon" , "pardon" , POS_DEAD , do_wizutil , LVL_GOD, SCMD_PARDON }, + { "plist" , "plist" , POS_DEAD , do_plist , LVL_GOD, 0 }, + { "policy" , "pol" , POS_DEAD , do_gen_ps , 0, SCMD_POLICIES }, + { "pour" , "pour" , POS_STANDING, do_pour , 0, SCMD_POUR }, + { "prompt" , "pro" , POS_DEAD , do_display , 0, 0 }, + { "prefedit" , "pre" , POS_DEAD , do_oasis_prefedit , 0, 0 }, + { "purge" , "purge" , POS_DEAD , do_purge , LVL_BUILDER, 0 }, - { "qedit" , "qedit" , POS_DEAD , do_oasis_qedit,0, ADMLVL_BUILDER, ADM_BUILD, 0 }, - { "qlist" , "qlist" , POS_DEAD , do_oasis_list, 0, ADMLVL_BUILDER, ADM_BUILD, SCMD_OASIS_QLIST }, - { "quaff" , "qua" , POS_RESTING , do_use , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_QUAFF }, - { "qecho" , "qec" , POS_DEAD , do_qcomm , 0, ADMLVL_GOD, ADM_NONE, SCMD_QECHO }, - { "quest" , "que" , POS_DEAD , do_quest , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "qui" , "qui" , POS_DEAD , do_quit , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "quit" , "quit" , POS_DEAD , do_quit , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_QUIT }, - { "qsay" , "qsay" , POS_RESTING , do_qcomm , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_QSAY }, + { "qedit" , "qedit" , POS_DEAD , do_oasis_qedit, LVL_BUILDER, 0 }, + { "qlist" , "qlist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_QLIST }, + { "quaff" , "qua" , POS_RESTING , do_use , 0, SCMD_QUAFF }, + { "qecho" , "qec" , POS_DEAD , do_qcomm , LVL_GOD, SCMD_QECHO }, + { "quest" , "que" , POS_DEAD , do_quest , 0, 0 }, + { "qui" , "qui" , POS_DEAD , do_quit , 0, 0 }, + { "quit" , "quit" , POS_DEAD , do_quit , 0, SCMD_QUIT }, + { "qsay" , "qsay" , POS_RESTING , do_qcomm , 0, SCMD_QSAY }, - { "reply" , "r" , POS_SLEEPING, do_reply , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "rest" , "res" , POS_RESTING , do_rest , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "read" , "rea" , POS_RESTING , do_look , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_READ }, - { "reload" , "reload" , POS_DEAD , do_reboot , 0, ADMLVL_IMPL, ADM_NONE, 0 }, - { "recite" , "reci" , POS_RESTING , do_use , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_RECITE }, - { "receive" , "rece" , POS_STANDING, do_not_here , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "recent" , "recent" , POS_DEAD , do_recent , 0, ADMLVL_IMMORT, ADM_NONE, 0 }, - { "remove" , "rem" , POS_RESTING , do_remove , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "rent" , "rent" , POS_STANDING, do_not_here , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "report" , "repo" , POS_RESTING , do_report , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "reroll" , "rero" , POS_DEAD , do_wizutil , 0, ADMLVL_GRGOD, ADM_NONE, SCMD_REROLL }, - { "rescue" , "resc" , POS_FIGHTING, do_rescue , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "restore" , "resto" , POS_DEAD , do_restore , 0, ADMLVL_GOD, ADM_NONE, 0 }, - { "return" , "retu" , POS_DEAD , do_return , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "redit" , "redit" , POS_DEAD , do_oasis_redit,0, ADMLVL_BUILDER, ADM_BUILD, 0 }, - { "rlist" , "rlist" , POS_DEAD , do_oasis_list, 0, ADMLVL_BUILDER, ADM_BUILD, SCMD_OASIS_RLIST }, - { "rcopy" , "rcopy" , POS_DEAD , do_oasis_copy, 0, ADMLVL_GOD, ADM_ADVBUILD, CON_REDIT }, - { "roomflags", "roomflags", POS_DEAD , do_gen_tog , 0, ADMLVL_IMMORT, ADM_NONE, SCMD_SHOWVNUMS }, + { "reply" , "r" , POS_SLEEPING, do_reply , 0, 0 }, + { "rest" , "res" , POS_RESTING , do_rest , 0, 0 }, + { "read" , "rea" , POS_RESTING , do_look , 0, SCMD_READ }, + { "reload" , "reload" , POS_DEAD , do_reboot , LVL_IMPL, 0 }, + { "recite" , "reci" , POS_RESTING , do_use , 0, SCMD_RECITE }, + { "receive" , "rece" , POS_STANDING, do_not_here , 1, 0 }, + { "recent" , "recent" , POS_DEAD , do_recent , LVL_IMMORT, 0 }, + { "remove" , "rem" , POS_RESTING , do_remove , 0, 0 }, + { "rent" , "rent" , POS_STANDING, do_not_here , 1, 0 }, + { "report" , "repo" , POS_RESTING , do_report , 0, 0 }, + { "reroll" , "rero" , POS_DEAD , do_wizutil , LVL_GRGOD, SCMD_REROLL }, + { "rescue" , "resc" , POS_FIGHTING, do_rescue , 1, 0 }, + { "restore" , "resto" , POS_DEAD , do_restore , LVL_GOD, 0 }, + { "return" , "retu" , POS_DEAD , do_return , 0, 0 }, + { "redit" , "redit" , POS_DEAD , do_oasis_redit, LVL_BUILDER, 0 }, + { "rlist" , "rlist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_RLIST }, + { "rcopy" , "rcopy" , POS_DEAD , do_oasis_copy, LVL_GOD, CON_REDIT }, + { "roomflags", "roomflags", POS_DEAD , do_gen_tog , LVL_IMMORT, SCMD_SHOWVNUMS }, - { "say" , "s" , POS_RESTING , do_say , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "sacrifice", "sac" , POS_RESTING , do_sac , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "score" , "sc" , POS_DEAD , do_score , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "scan" , "sca" , POS_RESTING , do_scan , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "scopy" , "scopy" , POS_DEAD , do_oasis_copy, 0, ADMLVL_GOD, ADM_ADVBUILD, CON_SEDIT }, - { "sit" , "si" , POS_RESTING , do_sit , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "'" , "'" , POS_RESTING , do_say , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "save" , "sav" , POS_SLEEPING, do_save , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "saveall" , "saveall" , POS_DEAD , do_saveall , 0, ADMLVL_BUILDER, ADM_BUILD, 0}, - { "sell" , "sell" , POS_STANDING, do_not_here , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "sedit" , "sedit" , POS_DEAD , do_oasis_sedit,0, ADMLVL_BUILDER, ADM_BUILD, 0 }, - { "send" , "send" , POS_SLEEPING, do_send , 0, ADMLVL_GOD, ADM_NONE, 0 }, - { "set" , "set" , POS_DEAD , do_set , 0, ADMLVL_IMMORT, ADM_NONE, 0 }, - { "shout" , "sho" , POS_RESTING , do_gen_comm , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_SHOUT }, - { "show" , "show" , POS_DEAD , do_show , 0, ADMLVL_IMMORT, ADM_NONE, 0 }, - { "shutdow" , "shutdow" , POS_DEAD , do_shutdown , 0, ADMLVL_IMPL, ADM_NONE, 0 }, - { "shutdown" , "shutdown", POS_DEAD , do_shutdown , 0, ADMLVL_IMPL, ADM_NONE, SCMD_SHUTDOWN }, - { "sip" , "sip" , POS_RESTING , do_drink , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_SIP }, - { "skillset" , "skillset", POS_SLEEPING, do_skillset , 0, ADMLVL_GRGOD, ADM_NONE, 0 }, - { "sleep" , "sl" , POS_SLEEPING, do_sleep , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "slist" , "slist" , POS_SLEEPING, do_oasis_list, 0, ADMLVL_BUILDER, ADM_BUILD, SCMD_OASIS_SLIST }, - { "sneak" , "sneak" , POS_STANDING, do_sneak , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "snoop" , "snoop" , POS_DEAD , do_snoop , 0, ADMLVL_GOD, ADM_NONE, 0 }, - { "socials" , "socials" , POS_DEAD , do_commands , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_SOCIALS }, - { "split" , "split" , POS_SITTING , do_split , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "stand" , "st" , POS_RESTING , do_stand , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "stat" , "stat" , POS_DEAD , do_stat , 0, ADMLVL_IMMORT, ADM_NONE, 0 }, - { "steal" , "ste" , POS_STANDING, do_steal , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "switch" , "switch" , POS_DEAD , do_switch , 0, ADMLVL_GOD, ADM_NONE, 0 }, + { "sacrifice", "sac" , POS_RESTING , do_sac , 0, 0 }, + { "say" , "s" , POS_RESTING , do_say , 0, 0 }, + { "score" , "sc" , POS_DEAD , do_score , 0, 0 }, + { "scan" , "sca" , POS_RESTING , do_scan , 0, 0 }, + { "scopy" , "scopy" , POS_DEAD , do_oasis_copy, LVL_GOD, CON_SEDIT }, + { "sit" , "si" , POS_RESTING , do_sit , 0, 0 }, + { "'" , "'" , POS_RESTING , do_say , 0, 0 }, + { "save" , "sav" , POS_SLEEPING, do_save , 0, 0 }, + { "saveall" , "saveall" , POS_DEAD , do_saveall , LVL_BUILDER, 0}, + { "sell" , "sell" , POS_STANDING, do_not_here , 0, 0 }, + { "sedit" , "sedit" , POS_DEAD , do_oasis_sedit, LVL_BUILDER, 0 }, + { "send" , "send" , POS_SLEEPING, do_send , LVL_GOD, 0 }, + { "set" , "set" , POS_DEAD , do_set , LVL_IMMORT, 0 }, + { "shout" , "sho" , POS_RESTING , do_gen_comm , 0, SCMD_SHOUT }, + { "show" , "show" , POS_DEAD , do_show , LVL_IMMORT, 0 }, + { "shutdow" , "shutdow" , POS_DEAD , do_shutdown , LVL_IMPL, 0 }, + { "shutdown" , "shutdown", POS_DEAD , do_shutdown , LVL_IMPL, SCMD_SHUTDOWN }, + { "sip" , "sip" , POS_RESTING , do_drink , 0, SCMD_SIP }, + { "skillset" , "skillset", POS_SLEEPING, do_skillset , LVL_GRGOD, 0 }, + { "sleep" , "sl" , POS_SLEEPING, do_sleep , 0, 0 }, + { "slist" , "slist" , POS_SLEEPING, do_oasis_list, LVL_BUILDER, SCMD_OASIS_SLIST }, + { "sneak" , "sneak" , POS_STANDING, do_sneak , 1, 0 }, + { "snoop" , "snoop" , POS_DEAD , do_snoop , LVL_GOD, 0 }, + { "socials" , "socials" , POS_DEAD , do_commands , 0, SCMD_SOCIALS }, + { "split" , "split" , POS_SITTING , do_split , 1, 0 }, + { "stand" , "st" , POS_RESTING , do_stand , 0, 0 }, + { "stat" , "stat" , POS_DEAD , do_stat , LVL_IMMORT, 0 }, + { "steal" , "ste" , POS_STANDING, do_steal , 1, 0 }, + { "switch" , "switch" , POS_DEAD , do_switch , LVL_GOD, 0 }, - { "tell" , "t" , POS_DEAD , do_tell , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "take" , "ta" , POS_RESTING , do_get , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "taste" , "tas" , POS_RESTING , do_eat , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_TASTE }, - { "teleport" , "tele" , POS_DEAD , do_teleport , 0, ADMLVL_BUILDER, ADM_POOF, 0 }, - { "tedit" , "tedit" , POS_DEAD , do_tedit , 0, ADMLVL_GOD, ADM_ADVBUILD, 0 }, /* XXX: Oasisify */ - { "thaw" , "thaw" , POS_DEAD , do_wizutil , 0, ADMLVL_GRGOD, ADM_NONE, SCMD_THAW }, - { "title" , "title" , POS_DEAD , do_title , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "time" , "time" , POS_DEAD , do_time , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "toggle" , "toggle" , POS_DEAD , do_toggle , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "track" , "track" , POS_STANDING, do_track , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "transfer" , "transfer", POS_SLEEPING, do_trans , 0, ADMLVL_GOD, ADM_POOF, 0 }, - { "trigedit" , "trigedit", POS_DEAD , do_oasis_trigedit,0,ADMLVL_BUILDER,ADM_BUILD,0 }, - { "typo" , "typo" , POS_DEAD , do_ibt , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_TYPO }, - { "tlist" , "tlist" , POS_DEAD , do_oasis_list, 0, ADMLVL_BUILDER, ADM_BUILD, SCMD_OASIS_TLIST }, - { "tcopy" , "tcopy" , POS_DEAD , do_oasis_copy, 0, ADMLVL_GOD, ADM_ADVBUILD, CON_TRIGEDIT }, - { "tstat" , "tstat" , POS_DEAD , do_tstat , 0, ADMLVL_BUILDER, ADM_BUILD, 0 }, + { "tell" , "t" , POS_DEAD , do_tell , 0, 0 }, + { "take" , "ta" , POS_RESTING , do_get , 0, 0 }, + { "taste" , "tas" , POS_RESTING , do_eat , 0, SCMD_TASTE }, + { "teleport" , "tele" , POS_DEAD , do_teleport , LVL_BUILDER, 0 }, + { "tedit" , "tedit" , POS_DEAD , do_tedit , LVL_GOD, 0 }, /* XXX: Oasisify */ + { "thaw" , "thaw" , POS_DEAD , do_wizutil , LVL_GRGOD, SCMD_THAW }, + { "title" , "title" , POS_DEAD , do_title , 0, 0 }, + { "time" , "time" , POS_DEAD , do_time , 0, 0 }, + { "toggle" , "toggle" , POS_DEAD , do_toggle , 0, 0 }, + { "track" , "track" , POS_STANDING, do_track , 0, 0 }, + { "transfer" , "transfer", POS_SLEEPING, do_trans , LVL_GOD, 0 }, + { "trigedit" , "trigedit", POS_DEAD , do_oasis_trigedit, LVL_BUILDER, 0 }, + { "typo" , "typo" , POS_DEAD , do_ibt , 0, SCMD_TYPO }, + { "tlist" , "tlist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_TLIST }, + { "tcopy" , "tcopy" , POS_DEAD , do_oasis_copy, LVL_GOD, CON_TRIGEDIT }, + { "tstat" , "tstat" , POS_DEAD , do_tstat , LVL_BUILDER, 0 }, - { "unlock" , "unlock" , POS_SITTING , do_gen_door , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_UNLOCK }, - { "ungroup" , "ungroup" , POS_DEAD , do_ungroup , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "unban" , "unban" , POS_DEAD , do_unban , 0, ADMLVL_GRGOD, ADM_NONE, 0 }, - { "unaffect" , "unaffect", POS_DEAD , do_wizutil , 0, ADMLVL_GOD, ADM_NONE, SCMD_UNAFFECT }, - { "uptime" , "uptime" , POS_DEAD , do_date , 0, ADMLVL_GOD, ADM_NONE, SCMD_UPTIME }, - { "use" , "use" , POS_SITTING , do_use , 1, ADMLVL_MORTAL, ADM_NONE, SCMD_USE }, - { "users" , "users" , POS_DEAD , do_users , 0, ADMLVL_GOD, ADM_NONE, 0 }, + { "unlock" , "unlock" , POS_SITTING , do_gen_door , 0, SCMD_UNLOCK }, + { "ungroup" , "ungroup" , POS_DEAD , do_ungroup , 0, 0 }, + { "unban" , "unban" , POS_DEAD , do_unban , LVL_GRGOD, 0 }, + { "unaffect" , "unaffect", POS_DEAD , do_wizutil , LVL_GOD, SCMD_UNAFFECT }, + { "uptime" , "uptime" , POS_DEAD , do_date , LVL_GOD, SCMD_UPTIME }, + { "use" , "use" , POS_SITTING , do_use , 1, SCMD_USE }, + { "users" , "users" , POS_DEAD , do_users , LVL_GOD, 0 }, - { "value" , "val" , POS_STANDING, do_not_here , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "version" , "ver" , POS_DEAD , do_gen_ps , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_VERSION }, - { "visible" , "vis" , POS_RESTING , do_visible , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "vnum" , "vnum" , POS_DEAD , do_vnum , 0, ADMLVL_IMMORT, ADM_NONE, 0 }, - { "vstat" , "vstat" , POS_DEAD , do_vstat , 0, ADMLVL_IMMORT, ADM_NONE, 0 }, - { "vdelete" , "vdelete" , POS_DEAD , do_vdelete , 0, ADMLVL_BUILDER, ADM_BUILD, 0 }, + { "value" , "val" , POS_STANDING, do_not_here , 0, 0 }, + { "version" , "ver" , POS_DEAD , do_gen_ps , 0, SCMD_VERSION }, + { "visible" , "vis" , POS_RESTING , do_visible , 1, 0 }, + { "vnum" , "vnum" , POS_DEAD , do_vnum , LVL_IMMORT, 0 }, + { "vstat" , "vstat" , POS_DEAD , do_vstat , LVL_IMMORT, 0 }, + { "vdelete" , "vdelete" , POS_DEAD , do_vdelete , LVL_BUILDER, 0 }, - { "wake" , "wake" , POS_SLEEPING, do_wake , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "wear" , "wea" , POS_RESTING , do_wear , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "weather" , "weather" , POS_RESTING , do_weather , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "who" , "wh" , POS_DEAD , do_who , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "whois" , "whoi" , POS_DEAD , do_whois , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "whoami" , "whoami" , POS_DEAD , do_gen_ps , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_WHOAMI }, - { "where" , "where" , POS_RESTING , do_where , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "whisper" , "whisper" , POS_RESTING , do_spec_comm , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_WHISPER }, - { "wield" , "wie" , POS_RESTING , do_wield , 0, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "withdraw" , "withdraw", POS_STANDING, do_not_here , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, - { "wiznet" , "wiz" , POS_DEAD , do_wiznet , 0, ADMLVL_IMMORT, ADM_NONE, 0 }, - { ";" , ";" , POS_DEAD , do_wiznet , 0, ADMLVL_IMMORT, ADM_NONE, 0 }, - { "wizhelp" , "wizhelp" , POS_SLEEPING, do_commands , 0, ADMLVL_IMMORT, ADM_NONE, SCMD_WIZHELP }, - { "wizlist" , "wizlist" , POS_DEAD , do_gen_ps , 0, ADMLVL_MORTAL, ADM_NONE, SCMD_WIZLIST }, - { "wizupdate", "wizupde" , POS_DEAD , do_wizupdate , 0, ADMLVL_GRGOD, ADM_NONE, 0 }, - { "wizlock" , "wizlock" , POS_DEAD , do_wizlock , 0, ADMLVL_IMPL, ADM_NONE, 0 }, - { "write" , "write" , POS_STANDING, do_write , 1, ADMLVL_MORTAL, ADM_NONE, 0 }, + { "wake" , "wake" , POS_SLEEPING, do_wake , 0, 0 }, + { "wear" , "wea" , POS_RESTING , do_wear , 0, 0 }, + { "weather" , "weather" , POS_RESTING , do_weather , 0, 0 }, + { "who" , "wh" , POS_DEAD , do_who , 0, 0 }, + { "whois" , "whoi" , POS_DEAD , do_whois , 0, 0 }, + { "whoami" , "whoami" , POS_DEAD , do_gen_ps , 0, SCMD_WHOAMI }, + { "where" , "where" , POS_RESTING , do_where , 1, 0 }, + { "whisper" , "whisper" , POS_RESTING , do_spec_comm, 0, SCMD_WHISPER }, + { "wield" , "wie" , POS_RESTING , do_wield , 0, 0 }, + { "withdraw" , "withdraw", POS_STANDING, do_not_here , 1, 0 }, + { "wiznet" , "wiz" , POS_DEAD , do_wiznet , LVL_IMMORT, 0 }, + { ";" , ";" , POS_DEAD , do_wiznet , LVL_IMMORT, 0 }, + { "wizhelp" , "wizhelp" , POS_SLEEPING, do_commands , LVL_IMMORT, SCMD_WIZHELP }, + { "wizlist" , "wizlist" , POS_DEAD , do_gen_ps , 0, SCMD_WIZLIST }, + { "wizupdate", "wizupde" , POS_DEAD , do_wizupdate, LVL_GRGOD, 0 }, + { "wizlock" , "wizlock" , POS_DEAD , do_wizlock , LVL_IMPL, 0 }, + { "write" , "write" , POS_STANDING, do_write , 1, 0 }, - { "zreset" , "zreset" , POS_DEAD , do_zreset , 0, ADMLVL_BUILDER, ADM_BUILD, 0 }, - { "zedit" , "zedit" , POS_DEAD , do_oasis_zedit,0, ADMLVL_BUILDER, ADM_BUILD, 0 }, - { "zlist" , "zlist" , POS_DEAD , do_oasis_list, 0, ADMLVL_BUILDER, ADM_BUILD, SCMD_OASIS_ZLIST }, - { "zlock" , "zlock" , POS_DEAD , do_zlock , 0, ADMLVL_GOD, ADM_ADVBUILD, 0 }, - { "zunlock" , "zunlock" , POS_DEAD , do_zunlock , 0, ADMLVL_GOD, ADM_ADVBUILD, 0 }, - { "zcheck" , "zcheck" , POS_DEAD , do_zcheck , 0, ADMLVL_BUILDER, ADM_BUILD, 0 }, - { "zpurge" , "zpurge" , POS_DEAD , do_zpurge , 0, ADMLVL_BUILDER, ADM_BUILD, 0 }, + { "zreset" , "zreset" , POS_DEAD , do_zreset , LVL_BUILDER, 0 }, + { "zedit" , "zedit" , POS_DEAD , do_oasis_zedit, LVL_BUILDER, 0 }, + { "zlist" , "zlist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_ZLIST }, + { "zlock" , "zlock" , POS_DEAD , do_zlock , LVL_GOD, 0 }, + { "zunlock" , "zunlock" , POS_DEAD , do_zunlock , LVL_GOD, 0 }, + { "zcheck" , "zcheck" , POS_DEAD , do_zcheck , LVL_BUILDER, 0 }, + { "zpurge" , "zpurge" , POS_DEAD , do_zpurge , LVL_BUILDER, 0 }, - { "\n", "zzzzzzz", 0, 0, 0, 0, 0, 0 } }; /* this must be last */ + { "\n", "zzzzzzz", 0, 0, 0, 0 } }; /* this must be last */ /* Thanks to Melzaren for this change to allow DG Scripts to be attachable @@ -406,7 +389,6 @@ cpp_extern const struct command_info cmd_info[] = { { "mtransform", do_mtransform , 0 }, { "mzoneecho", do_mzoneecho, 0 }, { "mfollow" , do_mfollow , 0 }, - { "mmail" , do_mmail , 0 }, { "\n" , do_not_here , 0 } }; int script_command_interpreter(struct char_data *ch, char *arg) { @@ -483,22 +465,6 @@ void sort_commands(void) qsort(cmd_sort_info + 1, num_of_cmds - 2, sizeof(int), sort_commands_helper); } -/* Returns TRUE if 'ch' has sufficient access to use the command 'cmd' */ -bool can_use_command(struct char_data *ch, int cmd) -{ - if (cmd_info[cmd].admin_flag == ADM_NONE && - cmd_info[cmd].minimum_admlevel == ADMLVL_MORTAL && - GET_LEVEL(ch) >= cmd_info[cmd].minimum_level) - return TRUE; - - if (cmd_info[cmd].admin_flag == ADM_NONE && GET_ADMLEVEL(ch) >= cmd_info[cmd].minimum_admlevel) - return TRUE; - - if (cmd_info[cmd].admin_flag != ADM_NONE && ADM_FLAGGED(ch, cmd_info[cmd].admin_flag)) - return TRUE; - - return FALSE; -} /* This is the actual command interpreter called from game_loop() in comm.c * It makes sure you are the proper level and position to execute the command, @@ -537,39 +503,25 @@ void command_interpreter(struct char_data *ch, char *argument) } /* Allow IMPLs to switch into mobs to test the commands. */ - if (IS_NPC(ch) && ch->desc && IS_ADMIN(ch->desc->original, ADMLVL_IMPL)) { + if (IS_NPC(ch) && ch->desc && GET_LEVEL(ch->desc->original) >= LVL_IMPL) { if (script_command_interpreter(ch, argument)) return; } for (length = strlen(arg), cmd = 0; *complete_cmd_info[cmd].command != '\n'; cmd++) if(complete_cmd_info[cmd].command_pointer != do_action && - !strncmp(complete_cmd_info[cmd].command, arg, length)) { - if (complete_cmd_info[cmd].admin_flag == ADM_NONE && - complete_cmd_info[cmd].minimum_admlevel == ADMLVL_MORTAL && - GET_LEVEL(ch) >= complete_cmd_info[cmd].minimum_level) + !strncmp(complete_cmd_info[cmd].command, arg, length)) + if (GET_LEVEL(ch) >= complete_cmd_info[cmd].minimum_level) break; - if (complete_cmd_info[cmd].admin_flag == ADM_NONE && GET_ADMLEVEL(ch) >= complete_cmd_info[cmd].minimum_admlevel) - break; - if (complete_cmd_info[cmd].admin_flag != ADM_NONE && ADM_FLAGGED(ch, complete_cmd_info[cmd].admin_flag)) - break; - } /* it's not a 'real' command, so it's a social */ if(*complete_cmd_info[cmd].command == '\n') for (length = strlen(arg), cmd = 0; *complete_cmd_info[cmd].command != '\n'; cmd++) if (complete_cmd_info[cmd].command_pointer == do_action && - !strncmp(complete_cmd_info[cmd].command, arg, length)) { - if (complete_cmd_info[cmd].admin_flag == ADM_NONE && - complete_cmd_info[cmd].minimum_admlevel == ADMLVL_MORTAL && - GET_LEVEL(ch) >= complete_cmd_info[cmd].minimum_level) + !strncmp(complete_cmd_info[cmd].command, arg, length)) + if (GET_LEVEL(ch) >= complete_cmd_info[cmd].minimum_level) break; - if (complete_cmd_info[cmd].admin_flag == ADM_NONE && GET_ADMLEVEL(ch) >= complete_cmd_info[cmd].minimum_admlevel) - break; - if (complete_cmd_info[cmd].admin_flag != ADM_NONE && ADM_FLAGGED(ch, complete_cmd_info[cmd].admin_flag)) - break; - } if (*complete_cmd_info[cmd].command == '\n') { int found = 0; @@ -584,23 +536,20 @@ void command_interpreter(struct char_data *ch, char *argument) if ( (levenshtein_distance(arg, cmd_info[cmd].command) <= 2) && (cmd_info[cmd].minimum_level >= 0) ) { - /* Does this person have access to this command? */ - if (can_use_command(ch, cmd)) { - if (!found) - { - send_to_char(ch, "\r\nDid you mean:\r\n"); - found = 1; - } - send_to_char(ch, " %s\r\n", cmd_info[cmd].command); + if (!found) + { + send_to_char(ch, "\r\nDid you mean:\r\n"); + found = 1; } + send_to_char(ch, " %s\r\n", cmd_info[cmd].command); } } } - else if (!IS_NPC(ch) && PLR_FLAGGED(ch, PLR_FROZEN) && !IS_ADMIN(ch, ADMLVL_IMPL)) + else if (!IS_NPC(ch) && PLR_FLAGGED(ch, PLR_FROZEN) && GET_LEVEL(ch) < LVL_IMPL) send_to_char(ch, "You try, but the mind-numbing cold prevents you...\r\n"); else if (complete_cmd_info[cmd].command_pointer == NULL) send_to_char(ch, "Sorry, that command hasn't been implemented yet.\r\n"); - else if (IS_NPC(ch) && complete_cmd_info[cmd].minimum_admlevel >= ADMLVL_IMMORT) + else if (IS_NPC(ch) && complete_cmd_info[cmd].minimum_level >= LVL_IMMORT) send_to_char(ch, "You can't use immortal commands while switched.\r\n"); else if (GET_POS(ch) < complete_cmd_info[cmd].minimum_position) switch (GET_POS(ch)) { @@ -1099,11 +1048,11 @@ static int perform_dupe_check(struct descriptor_data *d) STATE(k) = CON_CLOSE; pref_temp=GET_PREF(k->character); if (!target) { - target = k->original; - mode = UNSWITCH; + target = k->original; + mode = UNSWITCH; } if (k->character) - k->character->desc = NULL; + k->character->desc = NULL; k->character = NULL; k->original = NULL; } else if (k->character && GET_IDNUM(k->character) == id && k->original) { @@ -1115,9 +1064,9 @@ static int perform_dupe_check(struct descriptor_data *d) pref_temp=GET_PREF(k->character); if (!target && STATE(k) == CON_PLAYING) { - write_to_output(k, "\r\nThis body has been usurped!\r\n"); - target = k->character; - mode = USURP; + write_to_output(k, "\r\nThis body has been usurped!\r\n"); + target = k->character; + mode = USURP; } k->character->desc = NULL; k->character = NULL; @@ -1194,8 +1143,8 @@ static int perform_dupe_check(struct descriptor_data *d) case RECON: write_to_output(d, "Reconnecting.\r\n"); act("$n has reconnected.", TRUE, d->character, 0, 0, TO_ROOM); - mudlog(NRM, MAX(ADMLVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "%s [%s] has reconnected.", GET_NAME(d->character), d->host); - if (has_mail(d->character)) + mudlog(NRM, MAX(0, GET_INVIS_LEV(d->character)), TRUE, "%s [%s] has reconnected.", GET_NAME(d->character), d->host); + if (has_mail(GET_IDNUM(d->character))) write_to_output(d, "You have mail waiting.\r\n"); break; case USURP: @@ -1203,12 +1152,12 @@ static int perform_dupe_check(struct descriptor_data *d) act("$n suddenly keels over in pain, surrounded by a white aura...\r\n" "$n's body has been taken over by a new spirit!", TRUE, d->character, 0, 0, TO_ROOM); - mudlog(NRM, MAX(ADMLVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, + mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "%s has re-logged in ... disconnecting old socket.", GET_NAME(d->character)); break; case UNSWITCH: write_to_output(d, "Reconnecting to unswitched char."); - mudlog(NRM, MAX(ADMLVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "%s [%s] has reconnected.", GET_NAME(d->character), d->host); + mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "%s [%s] has reconnected.", GET_NAME(d->character), d->host); break; } @@ -1241,10 +1190,10 @@ static bool perform_new_char_dupe_check(struct descriptor_data *d) write_to_output(k, "\r\nMultiple login detected -- disconnecting.\r\n"); STATE(k) = CON_CLOSE; - mudlog(NRM, ADMLVL_GOD, TRUE, "Multiple logins detected in char creation for %s.", GET_NAME(d->character)); + mudlog(NRM, LVL_GOD, TRUE, "Multiple logins detected in char creation for %s.", GET_NAME(d->character)); found = TRUE; - } else { + } else { /* Something went VERY wrong, boot both chars */ k->character->desc = NULL; k->character = NULL; @@ -1259,11 +1208,11 @@ static bool perform_new_char_dupe_check(struct descriptor_data *d) write_to_output(d, "\r\nPlease reconnect.\r\n"); STATE(d) = CON_CLOSE; - mudlog(NRM, ADMLVL_GOD, TRUE, "SYSERR: Multiple logins with 1st in-game and the 2nd in char creation."); + mudlog(NRM, LVL_GOD, TRUE, "SYSERR: Multiple logins with 1st in-game and the 2nd in char creation."); found = TRUE; - } - } + } + } } return (found); } @@ -1277,7 +1226,7 @@ int enter_player_game (struct descriptor_data *d) reset_char(d->character); if (PLR_FLAGGED(d->character, PLR_INVSTART)) - GET_INVIS_LEV(d->character) = GET_ADMLEVEL(d->character); + GET_INVIS_LEV(d->character) = GET_LEVEL(d->character); /* We have to place the character in a room before equipping them * or equip_char() will gripe about the person in NOWHERE. */ @@ -1286,7 +1235,7 @@ int enter_player_game (struct descriptor_data *d) /* If char was saved with NOWHERE, or real_room above failed... */ if (load_room == NOWHERE) { - if (IS_ADMIN(d->character, ADMLVL_IMMORT)) + if (GET_LEVEL(d->character) >= LVL_IMMORT) load_room = r_immort_start_room; else load_room = r_mortal_start_room; @@ -1315,8 +1264,6 @@ int enter_player_game (struct descriptor_data *d) /* Check for a login trigger in the players' start room */ login_wtrigger(&world[IN_ROOM(d->character)], d->character); - MXPSendTag( d, "" ); /* <--- Add this line */ - return load_result; } @@ -1343,8 +1290,6 @@ void nanny(struct descriptor_data *d, char *arg) { CON_QEDIT, qedit_parse }, { CON_PREFEDIT, prefedit_parse }, { CON_IBTEDIT, ibtedit_parse }, - { CON_HSEDIT, hsedit_parse }, - { CON_MAILEDIT, mailedit_parse }, { -1, NULL } }; @@ -1441,16 +1386,16 @@ void nanny(struct descriptor_data *d, char *arg) case CON_NAME_CNFRM: /* wait for conf. of new name */ if (UPPER(*arg) == 'Y') { if (isbanned(d->host) >= BAN_NEW) { - mudlog(NRM, ADMLVL_GOD, TRUE, "Request for new char %s denied from [%s] (siteban)", GET_PC_NAME(d->character), d->host); - write_to_output(d, "Sorry, new characters are not allowed from your site!\r\n"); - STATE(d) = CON_CLOSE; - return; + mudlog(NRM, LVL_GOD, TRUE, "Request for new char %s denied from [%s] (siteban)", GET_PC_NAME(d->character), d->host); + write_to_output(d, "Sorry, new characters are not allowed from your site!\r\n"); + STATE(d) = CON_CLOSE; + return; } if (circle_restrict) { - write_to_output(d, "Sorry, new players can't be created at the moment.\r\n"); - mudlog(NRM, ADMLVL_GOD, TRUE, "Request for new char %s denied from [%s] (wizlock)", GET_PC_NAME(d->character), d->host); - STATE(d) = CON_CLOSE; - return; + write_to_output(d, "Sorry, new players can't be created at the moment.\r\n"); + mudlog(NRM, LVL_GOD, TRUE, "Request for new char %s denied from [%s] (wizlock)", GET_PC_NAME(d->character), d->host); + STATE(d) = CON_CLOSE; + return; } perform_new_char_dupe_check(d); write_to_output(d, "New character.\r\nGive me a password for %s: ", GET_PC_NAME(d->character)); @@ -1483,17 +1428,17 @@ void nanny(struct descriptor_data *d, char *arg) STATE(d) = CON_CLOSE; else { if (strncmp(CRYPT(arg, GET_PASSWD(d->character)), GET_PASSWD(d->character), MAX_PWD_LENGTH)) { - mudlog(BRF, ADMLVL_GOD, TRUE, "Bad PW: %s [%s]", GET_NAME(d->character), d->host); - GET_BAD_PWS(d->character)++; - save_char(d->character); - if (++(d->bad_pws) >= CONFIG_MAX_BAD_PWS) { /* 3 strikes and you're out. */ - write_to_output(d, "Wrong password... disconnecting.\r\n"); - STATE(d) = CON_CLOSE; - } else { - write_to_output(d, "Wrong password.\r\nPassword: "); - echo_off(d); - } - return; + mudlog(BRF, LVL_GOD, TRUE, "Bad PW: %s [%s]", GET_NAME(d->character), d->host); + GET_BAD_PWS(d->character)++; + save_char(d->character); + if (++(d->bad_pws) >= CONFIG_MAX_BAD_PWS) { /* 3 strikes and you're out. */ + write_to_output(d, "Wrong password... disconnecting.\r\n"); + STATE(d) = CON_CLOSE; + } else { + write_to_output(d, "Wrong password.\r\nPassword: "); + echo_off(d); + } + return; } /* Password was correct. */ @@ -1503,35 +1448,35 @@ void nanny(struct descriptor_data *d, char *arg) if (isbanned(d->host) == BAN_SELECT && !PLR_FLAGGED(d->character, PLR_SITEOK)) { - write_to_output(d, "Sorry, this char has not been cleared for login from your site!\r\n"); - STATE(d) = CON_CLOSE; - mudlog(NRM, ADMLVL_GOD, TRUE, "Connection attempt for %s denied from %s", GET_NAME(d->character), d->host); - return; + write_to_output(d, "Sorry, this char has not been cleared for login from your site!\r\n"); + STATE(d) = CON_CLOSE; + mudlog(NRM, LVL_GOD, TRUE, "Connection attempt for %s denied from %s", GET_NAME(d->character), d->host); + return; } if (GET_LEVEL(d->character) < circle_restrict) { - write_to_output(d, "The game is temporarily restricted.. try again later.\r\n"); - STATE(d) = CON_CLOSE; - mudlog(NRM, ADMLVL_GOD, TRUE, "Request for login denied for %s [%s] (wizlock)", GET_NAME(d->character), d->host); - return; + write_to_output(d, "The game is temporarily restricted.. try again later.\r\n"); + STATE(d) = CON_CLOSE; + mudlog(NRM, LVL_GOD, TRUE, "Request for login denied for %s [%s] (wizlock)", GET_NAME(d->character), d->host); + return; } /* check and make sure no other copies of this player are logged in */ if (perform_dupe_check(d)) - return; + return; - if (IS_ADMIN(d->character, ADMLVL_IMMORT)) - write_to_output(d, "%s", imotd); + if (GET_LEVEL(d->character) >= LVL_IMMORT) + write_to_output(d, "%s", imotd); else - write_to_output(d, "%s", motd); + write_to_output(d, "%s", motd); if (GET_INVIS_LEV(d->character)) - mudlog(BRF, MAX(ADMLVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "%s has connected. (invis %d)", GET_NAME(d->character), GET_INVIS_LEV(d->character)); + mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "%s has connected. (invis %d)", GET_NAME(d->character), GET_INVIS_LEV(d->character)); else - mudlog(BRF, ADMLVL_IMMORT, TRUE, "%s has connected.", GET_NAME(d->character)); + mudlog(BRF, LVL_IMMORT, TRUE, "%s has connected.", GET_NAME(d->character)); /* Add to the list of 'recent' players (since last reboot) */ if (AddRecentPlayer(GET_NAME(d->character), d->host, FALSE, FALSE) == FALSE) { - mudlog(BRF, MAX(ADMLVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "Failure to AddRecentPlayer (returned FALSE)."); + mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "Failure to AddRecentPlayer (returned FALSE)."); } if (load_result) { @@ -1539,7 +1484,7 @@ void nanny(struct descriptor_data *d, char *arg) "%s%d LOGIN FAILURE%s SINCE LAST SUCCESSFUL LOGIN.%s\r\n", CCRED(d->character, C_SPR), load_result, (load_result > 1) ? "S" : "", CCNRM(d->character, C_SPR)); - GET_BAD_PWS(d->character) = 0; + GET_BAD_PWS(d->character) = 0; } write_to_output(d, "\r\n*** PRESS RETURN: "); STATE(d) = CON_RMOTD; @@ -1630,12 +1575,12 @@ void nanny(struct descriptor_data *d, char *arg) GET_PREF(d->character)= rand_number(1, 128000); GET_HOST(d->character)= strdup(d->host); - mudlog(NRM, ADMLVL_GOD, TRUE, "%s [%s] new player.", GET_NAME(d->character), d->host); + mudlog(NRM, LVL_GOD, TRUE, "%s [%s] new player.", GET_NAME(d->character), d->host); /* Add to the list of 'recent' players (since last reboot) */ if (AddRecentPlayer(GET_NAME(d->character), d->host, TRUE, FALSE) == FALSE) { - mudlog(BRF, MAX(ADMLVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "Failure to AddRecentPlayer (returned FALSE)."); + mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "Failure to AddRecentPlayer (returned FALSE)."); } break; @@ -1675,14 +1620,14 @@ void nanny(struct descriptor_data *d, char *arg) STATE(d) = CON_PLAYING; if (GET_LEVEL(d->character) == 0) { - do_start(d->character); - send_to_char(d->character, "%s", CONFIG_START_MESSG); + do_start(d->character); + send_to_char(d->character, "%s", CONFIG_START_MESSG); } look_at_room(d->character, 0); - if (has_mail(d->character)) - notify_on_login(d->character); + if (has_mail(GET_IDNUM(d->character))) + send_to_char(d->character, "You have mail waiting.\r\n"); if (load_result == 2) { /* rented items lost */ - send_to_char(d->character, "\r\n\007You could not afford your rent!\r\n" + send_to_char(d->character, "\r\n\007You could not afford your rent!\r\n" "Your possesions have been donated to the Salvation Army!\r\n"); } d->has_prompt = 0; @@ -1692,10 +1637,10 @@ void nanny(struct descriptor_data *d, char *arg) case '2': if (d->character->player.description) { - write_to_output(d, "Current description:\r\n%s", d->character->player.description); - /* Don't free this now... so that the old description gets loaded as the - * current buffer in the editor. Do setup the ABORT buffer here, however. */ - d->backstr = strdup(d->character->player.description); + write_to_output(d, "Current description:\r\n%s", d->character->player.description); + /* Don't free this now... so that the old description gets loaded as the + * current buffer in the editor. Do setup the ABORT buffer here, however. */ + d->backstr = strdup(d->character->player.description); } write_to_output(d, "Enter the new text you'd like others to see when they look at you.\r\n"); send_editor_help(d); @@ -1755,13 +1700,13 @@ void nanny(struct descriptor_data *d, char *arg) case CON_DELCNF2: if (!strcmp(arg, "yes") || !strcmp(arg, "YES")) { if (PLR_FLAGGED(d->character, PLR_FROZEN)) { - write_to_output(d, "You try to kill yourself, but the ice stops you.\r\n" + write_to_output(d, "You try to kill yourself, but the ice stops you.\r\n" "Character not deleted.\r\n\r\n"); - STATE(d) = CON_CLOSE; - return; + STATE(d) = CON_CLOSE; + return; } - if (!IS_ADMIN(d->character, ADMLVL_GRGOD)) - SET_BIT_AR(PLR_FLAGS(d->character), PLR_DELETED); + if (GET_LEVEL(d->character) < LVL_GRGOD) + SET_BIT_AR(PLR_FLAGS(d->character), PLR_DELETED); save_char(d->character); Crash_delete_file(GET_NAME(d->character)); /* If the selfdelete_fastwipe flag is set (in config.c), remove all the @@ -1774,7 +1719,7 @@ void nanny(struct descriptor_data *d, char *arg) delete_variables(GET_NAME(d->character)); write_to_output(d, "Character '%s' deleted! Goodbye.\r\n", GET_NAME(d->character)); - mudlog(NRM, ADMLVL_GOD, TRUE, "%s (lev %d) has self-deleted.", GET_NAME(d->character), GET_LEVEL(d->character)); + mudlog(NRM, LVL_GOD, TRUE, "%s (lev %d) has self-deleted.", GET_NAME(d->character), GET_LEVEL(d->character)); STATE(d) = CON_CLOSE; return; } else { @@ -1795,73 +1740,3 @@ void nanny(struct descriptor_data *d, char *arg) break; } } - -/* Command Info (here for convenience with command list) */ -ACMD(do_cmdinfo) -{ - char arg[MAX_INPUT_LENGTH]; - int i, c, length; - bool first=TRUE; - - one_argument(argument, arg); - - if (!*arg) { - send_to_char(ch, "Usage: %scmdinfo %s", QYEL, QNRM); - return; - } - - for (length = strlen(arg), c = 0; *complete_cmd_info[c].command != '\n'; c++) { - if(!strncmp(complete_cmd_info[c].command, arg, length)) - break; - } - - if ( *complete_cmd_info[c].command == '\n' ) { - send_to_char(ch, "Unrecognised command: %s\r\n", arg); - return; - } - - /* Found a match */ - send_to_char(ch, "Full Command : %s%s%s\r\n", QCYN, complete_cmd_info[c].command, QNRM); - - if (complete_cmd_info[c].command_pointer == do_action) { - if (complete_cmd_info[c].minimum_admlevel >= ADMLVL_MORTAL) { - send_to_char(ch, "Command Type : %sAdmin-only Social%s\r\n", QRED, QNRM); - } else { - send_to_char(ch, "Command Type : %sSocial%s\r\n", QYEL, QNRM); - } - } else if (complete_cmd_info[c].admin_flag != ADM_NONE) { - if (complete_cmd_info[c].minimum_admlevel >= ADMLVL_MORTAL) { - send_to_char(ch, "Command Type : %sAdmin Permission Required (not for mortals)%s\r\n", QYEL, QNRM); - } else { - send_to_char(ch, "Command Type : %sAdmin Permission Required%s\r\n", QYEL, QNRM); - } - } else if (complete_cmd_info[c].minimum_admlevel != ADMLVL_MORTAL) { - send_to_char(ch, "Command Type : %sAdmin/Imm-Only%s\r\n", QYEL, QNRM); - } else { - send_to_char(ch, "Command Type : %sPlayer Command%s\r\n", QYEL, QNRM); - } - - if (complete_cmd_info[c].admin_flag != ADM_NONE) { - send_to_char(ch, "Permission Required: %s%s%s\r\n", QCYN, admin_flag_names[(complete_cmd_info[c].admin_flag)], QNRM); - } - - send_to_char(ch, "Admin Level : %s%d%s (%s%s%s)\r\n", - ((complete_cmd_info[c].admin_flag == ADM_NONE) ? QYEL : QBLK), - complete_cmd_info[c].minimum_admlevel, QNRM, - ((complete_cmd_info[c].admin_flag == ADM_NONE) ? QCYN : QBLK), - admin_level_names[(complete_cmd_info[c].minimum_admlevel)], QNRM); - - if (complete_cmd_info[c].minimum_level == 0) { - send_to_char(ch, "Min Level : %s%s\r\n", QYEL, QNRM); - } else { - send_to_char(ch, "Min Level : %s%d%s\r\n", QYEL, complete_cmd_info[c].minimum_level, QNRM); - } - - send_to_char(ch, "Allowed Positions : %s", QCYN ); - for (i=complete_cmd_info[c].minimum_position; i unsigned conversion to avoid '-1' check. */ if (res < sizeof(buf)) { - mudlog(CMP, ADMLVL_IMMORT, FALSE, "Initiating autowiz."); + mudlog(CMP, LVL_IMMORT, FALSE, "Initiating autowiz."); i = system(buf); reboot_wizlists(); } else @@ -223,7 +223,7 @@ void gain_exp(struct char_data *ch, int gain) int is_altered = FALSE; int num_levels = 0; - if (!IS_NPC(ch) && ((GET_LEVEL(ch) < 1 || GET_LEVEL(ch) >= CONFIG_MAX_LEVEL))) + if (!IS_NPC(ch) && ((GET_LEVEL(ch) < 1 || GET_LEVEL(ch) >= LVL_IMMORT))) return; if (IS_NPC(ch)) { @@ -236,7 +236,7 @@ void gain_exp(struct char_data *ch, int gain) gain = MIN(CONFIG_MAX_EXP_GAIN, gain); /* put a cap on the max gain per kill */ GET_EXP(ch) += gain; - while (GET_LEVEL(ch) < CONFIG_MAX_LEVEL && + while (GET_LEVEL(ch) < LVL_IMMORT - CONFIG_NO_MORT_TO_IMMORT && GET_EXP(ch) >= level_exp(GET_CLASS(ch), GET_LEVEL(ch) + 1)) { GET_LEVEL(ch) += 1; num_levels++; @@ -245,20 +245,15 @@ void gain_exp(struct char_data *ch, int gain) } if (is_altered) { - mudlog(BRF, MAX(ADMLVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "%s advanced %d level%s to level %d.", + mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "%s advanced %d level%s to level %d.", GET_NAME(ch), num_levels, num_levels == 1 ? "" : "s", GET_LEVEL(ch)); if (num_levels == 1) send_to_char(ch, "You rise a level!\r\n"); else - send_to_char(ch, "You rise %d levels!\r\n", num_levels); + send_to_char(ch, "You rise %d levels!\r\n", num_levels); set_title(ch, NULL); - if (GET_LEVEL(ch) >= CONFIG_MAX_LEVEL) { - if (!IS_ADMIN(ch, ADMLVL_IMMORT) && !CONFIG_NO_MORT_TO_IMMORT) { - set_admin_level(ch, ADMLVL_IMMORT); - send_to_char(ch, "You have reached the maximum level and become immortal!\r\n"); - mudlog(NRM, ADMLVL_GOD, TRUE, "%s advanced to Immortal!", GET_NAME(ch)); - } - } + if (GET_LEVEL(ch) >= LVL_IMMORT && !PLR_FLAGGED(ch, PLR_NOWIZLIST)) + run_autowiz(); } } else if (gain < 0) { gain = MAX(-CONFIG_MAX_EXP_LOSS, gain); /* Cap max exp lost per death */ @@ -266,7 +261,9 @@ void gain_exp(struct char_data *ch, int gain) if (GET_EXP(ch) < 0) GET_EXP(ch) = 0; } -} + if (GET_LEVEL(ch) >= LVL_IMMORT && !PLR_FLAGGED(ch, PLR_NOWIZLIST)) + run_autowiz(); + } void gain_exp_regardless(struct char_data *ch, int gain) { @@ -281,7 +278,7 @@ void gain_exp_regardless(struct char_data *ch, int gain) GET_EXP(ch) = 0; if (!IS_NPC(ch)) { - while ((GET_LEVEL(ch) < CONFIG_MAX_LEVEL) && + while (GET_LEVEL(ch) < LVL_IMPL && GET_EXP(ch) >= level_exp(GET_CLASS(ch), GET_LEVEL(ch) + 1)) { GET_LEVEL(ch) += 1; num_levels++; @@ -290,22 +287,17 @@ void gain_exp_regardless(struct char_data *ch, int gain) } if (is_altered) { - mudlog(BRF, MAX(ADMLVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "%s advanced %d level%s to level %d.", + mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "%s advanced %d level%s to level %d.", GET_NAME(ch), num_levels, num_levels == 1 ? "" : "s", GET_LEVEL(ch)); if (num_levels == 1) send_to_char(ch, "You rise a level!\r\n"); else - send_to_char(ch, "You rise %d levels!\r\n", num_levels); + send_to_char(ch, "You rise %d levels!\r\n", num_levels); set_title(ch, NULL); - if (GET_LEVEL(ch) >= CONFIG_MAX_LEVEL) { - if (!IS_ADMIN(ch, ADMLVL_IMMORT) && !CONFIG_NO_MORT_TO_IMMORT) { - set_admin_level(ch, ADMLVL_IMMORT); - send_to_char(ch, "You have reached the maximum level and become immortal!\r\n"); - mudlog(NRM, ADMLVL_GOD, TRUE, "%s advanced to Immortal!", GET_NAME(ch)); - } - } } } + if (GET_LEVEL(ch) >= LVL_IMMORT && !PLR_FLAGGED(ch, PLR_NOWIZLIST)) + run_autowiz(); } void gain_condition(struct char_data *ch, int condition, int value) @@ -374,7 +366,7 @@ static void check_idling(struct char_data *ch) Crash_rentsave(ch, 0); else Crash_idlesave(ch); - mudlog(CMP, ADMLVL_GOD, TRUE, "%s force-rented and extracted (idle).", GET_NAME(ch)); + mudlog(CMP, LVL_GOD, TRUE, "%s force-rented and extracted (idle).", GET_NAME(ch)); add_llog_entry(ch, LAST_IDLEOUT); extract_char(ch); } @@ -403,19 +395,19 @@ void point_update(void) if (damage(i, i, 2, SPELL_POISON) == -1) continue; /* Oops, they died. -gg 6/24/98 */ if (GET_POS(i) <= POS_STUNNED) - update_pos(i); + update_pos(i); } else if (GET_POS(i) == POS_INCAP) { if (damage(i, i, 1, TYPE_SUFFERING) == -1) - continue; + continue; } else if (GET_POS(i) == POS_MORTALLYW) { if (damage(i, i, 2, TYPE_SUFFERING) == -1) - continue; + continue; } if (!IS_NPC(i)) { update_char_objects(i); (i->char_specials.timer)++; - if (GET_ADMLEVEL(i) < CONFIG_IDLE_MAX_LEVEL) - check_idling(i); + if (GET_LEVEL(i) < CONFIG_IDLE_MAX_LEVEL) + check_idling(i); } } @@ -427,32 +419,32 @@ void point_update(void) if (IS_CORPSE(j)) { /* timer count down */ if (GET_OBJ_TIMER(j) > 0) - GET_OBJ_TIMER(j)--; + GET_OBJ_TIMER(j)--; if (!GET_OBJ_TIMER(j)) { - if (j->carried_by) - act("$p decays in your hands.", FALSE, j->carried_by, j, 0, TO_CHAR); - else if ((IN_ROOM(j) != NOWHERE) && (world[IN_ROOM(j)].people)) { - act("A quivering horde of maggots consumes $p.", - TRUE, world[IN_ROOM(j)].people, j, 0, TO_ROOM); - act("A quivering horde of maggots consumes $p.", - TRUE, world[IN_ROOM(j)].people, j, 0, TO_CHAR); - } - for (jj = j->contains; jj; jj = next_thing2) { - next_thing2 = jj->next_content; /* Next in inventory */ - obj_from_obj(jj); + if (j->carried_by) + act("$p decays in your hands.", FALSE, j->carried_by, j, 0, TO_CHAR); + else if ((IN_ROOM(j) != NOWHERE) && (world[IN_ROOM(j)].people)) { + act("A quivering horde of maggots consumes $p.", + TRUE, world[IN_ROOM(j)].people, j, 0, TO_ROOM); + act("A quivering horde of maggots consumes $p.", + TRUE, world[IN_ROOM(j)].people, j, 0, TO_CHAR); + } + for (jj = j->contains; jj; jj = next_thing2) { + next_thing2 = jj->next_content; /* Next in inventory */ + obj_from_obj(jj); - if (j->in_obj) - obj_to_obj(jj, j->in_obj); - else if (j->carried_by) - obj_to_room(jj, IN_ROOM(j->carried_by)); - else if (IN_ROOM(j) != NOWHERE) - obj_to_room(jj, IN_ROOM(j)); - else - core_dump(); - } - extract_obj(j); + if (j->in_obj) + obj_to_obj(jj, j->in_obj); + else if (j->carried_by) + obj_to_room(jj, IN_ROOM(j->carried_by)); + else if (IN_ROOM(j) != NOWHERE) + obj_to_room(jj, IN_ROOM(j)); + else + core_dump(); + } + extract_obj(j); } } /* If the timer is set, count it down and at 0, try the trigger @@ -472,7 +464,7 @@ void point_update(void) HAPPY_EXP = 0; HAPPY_GOLD = 0; HAPPY_TIME = 0; - game_info("Happy hour has ended!"); + game_info("Happy hour has ended!"); } } diff --git a/src/magic.c b/src/magic.c index bd5b8de..872c0c9 100644 --- a/src/magic.c +++ b/src/magic.c @@ -199,11 +199,6 @@ int mag_damage(int level, struct char_data *ch, struct char_data *victim, if (victim == NULL || ch == NULL) return (0); - if (ADM_FLAGGED(victim, ADM_NODAMAGE)) { - send_to_char(ch, "Your spell is harmless to %s.\r\n", GET_NAME(victim)); - return 0; - } - switch (spellnum) { /* Mostly mages */ case SPELL_MAGIC_MISSILE: @@ -356,7 +351,7 @@ void mag_affects(int level, struct char_data *ch, struct char_data *victim, break; case SPELL_BLINDNESS: - if (MOB_FLAGGED(victim, MOB_NOBLIND) || IS_ADMIN(victim, ADMLVL_IMMORT) || mag_savingthrow(victim, savetype, 0)) { + if (MOB_FLAGGED(victim, MOB_NOBLIND) || GET_LEVEL(victim) >= LVL_IMMORT || mag_savingthrow(victim, savetype, 0)) { send_to_char(ch, "You fail.\r\n"); return; } @@ -447,7 +442,7 @@ void mag_affects(int level, struct char_data *ch, struct char_data *victim, break; case SPELL_POISON: - if (mag_savingthrow(victim, savetype, 0) || ADM_FLAGGED(victim, ADM_NOPOISON)) { + if (mag_savingthrow(victim, savetype, 0)) { send_to_char(ch, "%s", CONFIG_NOEFFECT); return; } @@ -658,13 +653,11 @@ void mag_areas(int level, struct char_data *ch, int spellnum, int savetype) * 2: immortals * 3: if no pk on this mud, skips over all players * 4: pets (charmed NPCs) - * 5: other players in the same group (if the spell is 'violent') - * 6: Flying people if earthquake is the spell */ + * 5: other players in the same group (if the spell is 'violent') + * 6: Flying people if earthquake is the spell */ if (tch == ch) continue; - if (IS_ADMIN(tch, ADMLVL_IMMORT)) - continue; - if (ADM_FLAGGED(tch, ADM_NODAMAGE)) + if (!IS_NPC(tch) && GET_LEVEL(tch) >= LVL_IMMORT) continue; if (!CONFIG_PK_ALLOWED && !IS_NPC(ch) && !IS_NPC(tch)) continue; @@ -673,9 +666,8 @@ void mag_areas(int level, struct char_data *ch, int spellnum, int savetype) if (!IS_NPC(tch) && spell_info[spellnum].violent && AFF_FLAGGED(tch, AFF_GROUP) && AFF_FLAGGED(ch, AFF_GROUP) && ( ((ch->master == NULL) ? ch : ch->master) == ((tch->master == NULL) ? tch : tch->master) ) ) continue; - if ((spellnum == SPELL_EARTHQUAKE) && AFF_FLAGGED(tch, AFF_FLYING)) - continue; - + if ((spellnum == SPELL_EARTHQUAKE) && AFF_FLAGGED(tch, AFF_FLYING)) + continue; /* Doesn't matter if they die here so we don't check. -gg 6/24/98 */ mag_damage(level, ch, tch, spellnum, 1); } diff --git a/src/mail.c b/src/mail.c index 02a8d96..138394b 100644 --- a/src/mail.c +++ b/src/mail.c @@ -1,2070 +1,375 @@ -/************************************************************************** -* File: mail.c Part of tbaMUD * -* Usage: Internal funcs and player spec-procs of mudmail system. * -* * -* All rights reserved. See license for complete information. * -* * -* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * -* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * -* By Jeremy Elson. Rewritten by Welcor and Jamdog * -**************************************************************************/ - -#include -#include - -#include "conf.h" -#include "sysdep.h" -#include "structs.h" -#include "utils.h" -#include "comm.h" -#include "db.h" -#include "interpreter.h" -#include "handler.h" -#include "modify.h" -#include "act.h" -#include "genolc.h" -#include "dg_scripts.h" -#include "mail.h" -#include "screen.h" - -/* Local Global Variables */ -struct mail_index *mail_table = NULL; /* mail_table is index - mails are loaded as necessary */ -int top_of_mail_table=-1; -int top_mail_idnum=-1; - -/* Also need an adjustment to perform_send_to_groups below */ -const struct mail_group mail_groups[NUM_MAIL_GROUPS+1] = { - {"immortals", MAIL_TO_IMMS}, - {"all", MAIL_TO_ALL}, - {"\n", MAIL_TO_NOBODY}}; - -/* build_mail_index: loads the mudmail index */ -bool build_mail_index(void) -{ - int rec_count = 0, i, count=0; - FILE *ml_index; - char index_name[40], line[256], bits[64]; - char subj[80], *strptr; - - sprintf(index_name, "%s%s", LIB_MLFILES, INDEX_FILE); - if (!(ml_index = fopen(index_name, "r"))) { - top_of_mail_table = -1; - log("No mail index file! Creating new one!"); - return (save_mail_index()); - } - - while (get_line(ml_index, line)) - if (*line != '~' && *line != '$' && *line != '#') /* Index file can end in ~ or $ */ - rec_count++; - rewind(ml_index); - - if (rec_count == 0) { - mail_table = NULL; - top_of_mail_table = -1; - return TRUE; - } - - CREATE(mail_table, struct mail_index, rec_count); - for (i = 0; i < rec_count; i++) { - get_line(ml_index, line); - while (*line && *line == '#') get_line(ml_index, line); /* Skip comments */ - if ((sscanf(line, "%ld %s %ld %ld %ld %s", &mail_table[i].mail_id, bits, &mail_table[i].sender, - &mail_table[i].recipient, &mail_table[i].sent_time, subj)) != 6) { - - } - if (!strcmp(subj, "(null)")) { - mail_table[i].subject = NULL; - } else { - count = 0; - /* sscanf only grabs the first word of the subject, get it all! */ - for (strptr=line; strptr && *strptr && count<5; strptr++) - if (*strptr == ' ') count++; - if (strptr && *strptr) { - mail_table[i].subject = strdup(strptr); - } else { - mail_table[i].subject = NULL; - } - } - mail_table[i].flags = asciiflag_conv(bits); - top_mail_idnum = MAX(top_mail_idnum, mail_table[i].mail_id); - } - - fclose(ml_index); - top_of_mail_table = i - 1; - return TRUE; -} - - -/* Find an usused unique mail ID */ -long new_mail_id(void) -{ - int i,j; - - /* Have we allocated all mail numbers yet? */ - if (top_mail_idnum < MAX_MAIL_ID) { - top_mail_idnum++; - return (top_mail_idnum); - } - - /* Oops, we reached the max! - check through all the other numbers to find one that has been deleted */ - for (i=0; isubject) - free(mail->subject); - - if (mail->body) - free(mail->body); - - /* Extract all attached objects */ - if (mail->attachment) { - obj = mail->attachment; - next_obj = obj->next_content; - while (obj) { - extract_obj(obj); - obj = next_obj; - } - } - - free(mail); -} - -int find_mail_by_id(long mail_id) -{ - int i; - - for (i=0; i<=top_of_mail_table; i++) - if (mail_table[i].mail_id == mail_id) - return i; - - /* Not found */ - return NO_MAIL; -} - -void copy_mail_index_entry(struct mail_index *to, struct mail_index *from) -{ -// to->mail_id = from->mail_id; - to->recipient = from->recipient; - to->sender = from->sender; - to->sent_time = from->sent_time; - to->flags = from->flags; - if (from->subject) - to->subject = strdup(from->subject); - else - to->subject = NULL; -} - -void copy_mail(struct mail_data *to, struct mail_data *from, int copy_mode) -{ - int i; - char new_subject[MAX_STRING_LENGTH]; - -// to->mail_id = from->mail_id; - to->recipient = from->recipient; - to->sender = from->sender; - to->sent_time = from->sent_time; - - switch (copy_mode) { - case MAIL_COPY_NORMAL : if (from->subject) - sprintf(new_subject, "%s", from->subject); - else - *new_subject='\0'; - break; - - case MAIL_COPY_FORWARD : if (from->subject) - sprintf(new_subject, "FW: %s", from->subject); - else - sprintf(new_subject, "FW: - No Subject -"); - break; - - case MAIL_COPY_REPLY : if (from->subject) - sprintf(new_subject, "RE: %s", from->subject); - else - sprintf(new_subject, "RE: - No Subject -"); - break; - - default: log("Invalid copy mode passed to mail_copy."); - *new_subject = '\0'; - break; - } - - for (i=0; imail_flags[i] = from->mail_flags[i]; - - if (*new_subject) - to->subject = strdup(new_subject); - else - to->subject = NULL; - - if (from->body) - to->body = strdup(from->body); - else - to->body = NULL; - - /* Attachments cannot be copied */ - to->attachment = NULL; - to->coins = 0; -} - -int create_mail_index_entry(struct mail_data *mail) -{ - int i, pos; - - /* Is this mail already listed? */ - if (mail->mail_id != NO_MAIL && find_mail_by_id(mail->mail_id) != NO_MAIL) { - log("SYSERR: create_mail_index_entry called for mail that already has an index entry (id=%ld)", mail->mail_id); - return NO_MAIL; - } - - if (top_of_mail_table < 0) { /* no table */ - pos = top_of_mail_table = 0; - CREATE(mail_table, struct mail_index, 1); - } else { /* add mail */ - i = ++top_of_mail_table + 1; - - RECREATE(mail_table, struct mail_index, i); - pos = top_of_mail_table; - } - - /* Allocate a new ID number */ - if ((mail_table[pos].mail_id = mail->mail_id = new_mail_id()) == NO_MAIL) { - log("SYSERR: Unable to allocate a unique mail ID for new mudmails"); - return NO_MAIL; - } - - /* copy subject and other vars */ - if (mail->subject && *(mail->subject)) { - mail_table[pos].subject = strdup(mail->subject); - } else { - mail_table[pos].subject = NULL; - } - mail_table[pos].recipient = mail->recipient; - mail_table[pos].sender = mail->sender; - mail_table[pos].sent_time = mail->sent_time; - - /* clear the bitflag in case we have garbage data */ - mail_table[pos].flags = 0; - - /* set urgent or deleted flag if required, and flag if object or gold attached */ - if (IS_SET_AR(mail->mail_flags, MAIL_URGENT)) SET_BIT(mail_table[pos].flags, MINDEX_URGENT); - if (IS_SET_AR(mail->mail_flags, MAIL_DELETED)) SET_BIT(mail_table[pos].flags, MINDEX_DELETED); - if (IS_SET_AR(mail->mail_flags, MAIL_COD)) SET_BIT(mail_table[pos].flags, MINDEX_IS_COD); - if (mail->attachment != NULL) SET_BIT(mail_table[pos].flags, MINDEX_HAS_OBJ); - if (mail->coins > 0) SET_BIT(mail_table[pos].flags, MINDEX_HAS_GOLD); - - return (pos); -} - -bool delete_mail_index_entry(int mail_id) -{ - int i, found=0; - struct mail_index *temp_mail; - bool ret; - - if (top_of_mail_table == -1 || mail_table == NULL) { /* no table */ - /* There is no table - this function shouldn't even have been called */ - log("SYSERR: Attempt to delete mail id %d, but no mail index exists", mail_id); - return FALSE; - } else { /* create a new smaller table */ - CREATE(temp_mail, struct mail_index, top_of_mail_table); - } - - /* Copy all index entries to new table */ - for (i=0; i<=top_of_mail_table; i++) { - /* Is this the one to be removed? */ - if (mail_table[i].mail_id == mail_id) { - /* Do not copy - just mark as 'found' */ - found++; - } else { - /* Not the one to be removed - copy over the data */ - copy_mail_index_entry(&(temp_mail[i-found]), &(mail_table[i])); - } - } - /* Freeing the index loses other vars, so back them up now */ - i = top_of_mail_table - 1; - found = top_mail_idnum; - - /* All done - free up the old index, and then set the new index as the current one */ - free_mail_index(); - mail_table = temp_mail; - - /* Restore vars */ - top_of_mail_table = i; - top_mail_idnum = found; - - /* And save the new index */ - ret = save_mail_index(); - - return ret; -} - -/* This function necessary to save a seperate ASCII mail index */ -bool save_mail_index(void) -{ - int i; - char index_name[50], bits[64]; - FILE *index_file; - - sprintf(index_name, "%s%s", LIB_MLFILES, INDEX_FILE); - if (!(index_file = fopen(index_name, "w"))) { - log("SYSERR: Could not write mudmail index file (%s)", index_name); - return FALSE; - } - - fprintf(index_file, "# tbaMUD mail index\n"); - fprintf(index_file, "# Format: