From 22ca85c4a5375f11b9192dc6b81a14ca4c760113 Mon Sep 17 00:00:00 2001 From: Fizban Date: Mon, 11 Aug 2008 12:23:06 +0000 Subject: [PATCH] Added sanity checks to zedit new. (Can no longer make zones that include negative vnums, also get the proper message when you have 3 of the 4 arguments.) You can now put objects in and remove objects from closed containers as an imm with nohassle. You can now walk through closed doors as an imm with nohassle on. You can now open locked containers and doors without unlocking them as an immortal with nohassle. You can now examine the contents of closed containers as an imm with nohassle. Made zedit new add the .qst file to the index file. Fixed various qedit related bugs. (thanks Mirad and Jamdog) Removed deprecated "murder" code. When pkill is on players can now order charmed mobs to attack other players. Fixed 'toggle automap'. Added a sacrifice command instead of their being autosac only. Also replaced Zizazat's name with more generic "The Gods" as it had obviously been ported from CWG previously. Fixed Warning relating to Automap. --- changelog | 13 +++++++++++++ src/Makefile.in | 2 +- src/act.h | 1 - src/act.informative.c | 22 +++++++++++----------- src/act.item.c | 6 +++--- src/act.movement.c | 5 +++-- src/act.offensive.c | 21 +++++---------------- src/act.social.c | 1 + src/constants.c | 1 + src/dg_mobcmd.c | 2 +- src/fight.c | 4 ++-- src/genqst.c | 1 - src/genzon.c | 3 ++- src/interpreter.c | 1 + src/utils.h | 2 +- src/zedit.c | 17 +++++++++-------- 16 files changed, 54 insertions(+), 48 deletions(-) diff --git a/changelog b/changelog index 1a275ce..7c6cc30 100644 --- a/changelog +++ b/changelog @@ -3,6 +3,19 @@ help, find any bugs, or have ideas for improvement please stop by TBA at telnet://tbamud.com:9091 or email rumble@tbamud.com --Rumble tbaMUD 3.56 +[Aug 10 2008] - Fizban + Added sanity checks to zedit new. (Can no longer make zones that include negative vnums, also get the proper message when you have 3 of the 4 arguments.) + You can now put objects in and remove objects from closed containers as an imm with nohassle. + You can now walk through closed doors as an imm with nohassle on. + You can now open locked containers and doors without unlocking them as an immortal with nohassle. + You can now examine the contents of closed containers as an imm with nohassle. + Made zedit new add the .qst file to the index file. + Fixed various qedit related bugs. (thanks Mirad and Jamdog) + Removed deprecated "murder" code. + When pkill is on players can now order charmed mobs to attack other players. + Fixed 'toggle automap'. + Added a sacrifice command instead of their being autosac only. Also replaced Zizazat's name with more generic "The Gods" as it had obviously been ported from CWG previously. + Fixed Warning relating to Automap. [Aug 03 2008] - Rumble You can now see your own communications while sleeping for gos, auc, gra, etc. (thanks Drefs) changed str_and_map to use target_room instead of IN_ROOM(ch). (thanks Vatiken) diff --git a/src/Makefile.in b/src/Makefile.in index de4f225..8e52bab 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -2,7 +2,7 @@ # Clean-up provided by seqwith. # C compiler to use -CC = @CC@ +CC = gcc # Any special flags you want to pass to the compiler MYFLAGS = @MYFLAGS@ diff --git a/src/act.h b/src/act.h index 6c14aa3..706d355 100644 --- a/src/act.h +++ b/src/act.h @@ -171,7 +171,6 @@ extern const char *cmd_door[]; /* do_hit */ ACMD(do_hit); #define SCMD_HIT 0 -#define SCMD_MURDER 1 /* Functions without subcommands */ ACMD(do_assist); ACMD(do_bash); diff --git a/src/act.informative.c b/src/act.informative.c index e3624b6..29e18a8 100644 --- a/src/act.informative.c +++ b/src/act.informative.c @@ -462,6 +462,8 @@ void look_at_room(struct char_data *ch, int ignore_brief) trig_data *t; struct room_data *rm = &world[IN_ROOM(ch)]; room_vnum target_room; + + target_room = IN_ROOM(ch); if (!ch->desc) return; @@ -547,7 +549,7 @@ static void look_in_obj(struct char_data *ch, char *arg) send_to_char(ch, "There's nothing inside that!\r\n"); else { if (GET_OBJ_TYPE(obj) == ITEM_CONTAINER) { - if (OBJVAL_FLAGGED(obj, CONT_CLOSED)) + 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)); @@ -1107,9 +1109,7 @@ ACMD(do_who) int max_level; int count; /* must always start as 0 */ } rank[] = { - { "Immortals\r\n---------\r\n", LVL_IMMORT, LVL_IMPL, 0}, - { "Mortals\r\n-------\r\n", 1, LVL_IMMORT - 1, 0 }, - { "\n", 0, 0, 0 } + }; skip_spaces(&argument); @@ -1290,7 +1290,8 @@ ACMD(do_who) send_to_char(ch, " (Configuration Edit)"); if (d->connected == CON_HEDIT) send_to_char(ch, " (Help edit)"); - + if (d->connected == CON_QEDIT) + send_to_char(ch, " (Quest Edit)"); if (PRF_FLAGGED(tch, PRF_BUILDWALK)) send_to_char(ch, " (Buildwalking)"); if (PRF_FLAGGED(tch, PRF_AFK)) @@ -1796,7 +1797,7 @@ ACMD(do_toggle) int toggle, tp, wimp_lev, result = 0, len = 0; const char *types[] = { "off", "brief", "normal", "on", "\n" }; - const struct { + const struct { char *command; bitvector_t toggle; /* this needs changing once hashmaps are implemented */ char min_level; @@ -1883,7 +1884,7 @@ ACMD(do_toggle) "Autoassist disabled.\r\n", "Autoassist enabled.\r\n"}, {"screenwidth", 0, 0, "\n", "\n"}, - {"automap", PRF_AUTOMAP, 0, + {"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"}, {"\n", 0, -1, "\n", "\n"} /* must be last */ @@ -2135,10 +2136,9 @@ ACMD(do_toggle) send_to_char(ch, "Value for %s must either be 'on' or 'off'.\r\n", tog_messages[toggle].command); return; } - } else { + } else send_to_char(ch, "Sorry, automap is currently disabled.\r\n"); - return; - } + break; default: if (!*arg2) { TOGGLE_BIT_AR(PRF_FLAGS(ch), tog_messages[toggle].toggle); @@ -2149,7 +2149,7 @@ 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; } } diff --git a/src/act.item.c b/src/act.item.c index 6af32be..8910e29 100644 --- a/src/act.item.c +++ b/src/act.item.c @@ -121,7 +121,7 @@ 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)) + 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 */ @@ -215,7 +215,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)) + 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))) { @@ -1537,7 +1537,7 @@ ACMD(do_sac) 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\nZizazat gives you %d experience points.\r\n", GET_OBJ_SHORT(j), (2*GET_OBJ_COST(j))); + 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: diff --git a/src/act.movement.c b/src/act.movement.c index a6bccc3..34c96c5 100644 --- a/src/act.movement.c +++ b/src/act.movement.c @@ -331,7 +331,7 @@ int perform_move(struct char_data *ch, int dir, int need_specials_check) return (0); 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)) { + else if (EXIT_FLAGGED(EXIT(ch, dir), EX_CLOSED) && (GET_LEVEL(ch) < LVL_IMMORT || !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 @@ -601,7 +601,8 @@ ACMD(do_gen_door) IS_SET(flags_door[subcmd], NEED_LOCKED)) send_to_char(ch, "Oh.. it wasn't locked, after all..\r\n"); else if (!(DOOR_IS_UNLOCKED(ch, obj, door)) && - IS_SET(flags_door[subcmd], NEED_UNLOCKED)) + IS_SET(flags_door[subcmd], NEED_UNLOCKED) && + (GET_LEVEL(ch) < LVL_IMMORT || !PRF_FLAGGED(ch, PRF_NOHASSLE))) send_to_char(ch, "It seems to be locked.\r\n"); else if (!has_key(ch, keynum) && (GET_LEVEL(ch) < LVL_GOD) && ((subcmd == SCMD_LOCK) || (subcmd == SCMD_UNLOCK))) diff --git a/src/act.offensive.c b/src/act.offensive.c index 6f17479..c46021a 100644 --- a/src/act.offensive.c +++ b/src/act.offensive.c @@ -54,8 +54,7 @@ ACMD(do_assist) act("You can't see who is fighting $M!", FALSE, ch, 0, helpee, TO_CHAR); /* prevent accidental pkill */ else if (!CONFIG_PK_ALLOWED && !IS_NPC(opponent)) - act("Use 'murder' if you really want to attack $N.", FALSE, - ch, 0, opponent, TO_CHAR); + send_to_char(ch, "You cannot kill other players.\r\n"); else { send_to_char(ch, "You join the fight!\r\n"); act("$N assists you!", 0, helpee, 0, ch, TO_CHAR); @@ -82,19 +81,9 @@ 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) { - if (!IS_NPC(vict) && !IS_NPC(ch)) { - if (subcmd != SCMD_MURDER) { - send_to_char(ch, "Use 'murder' to hit another player.\r\n"); - return; - } else { - check_killer(ch, vict); - } - } - if (AFF_FLAGGED(ch, AFF_CHARM) && ch->master && !IS_NPC(ch->master) && vict && !IS_NPC(vict)) - return; /* you can't order a charmed pet to attack a - * player */ - } + if (!CONFIG_PK_ALLOWED && !IS_NPC(vict) && !IS_NPC(ch)) + check_killer(ch, vict); + if ((GET_POS(ch) == POS_STANDING) && (vict != FIGHTING(ch))) { hit(ch, vict, TYPE_UNDEFINED); WAIT_STATE(ch, PULSE_VIOLENCE + 2); @@ -108,7 +97,7 @@ ACMD(do_kill) char arg[MAX_INPUT_LENGTH]; struct char_data *vict; - if (GET_LEVEL(ch) <= LVL_IMPL || IS_NPC(ch)) { + if (GET_LEVEL(ch) < LVL_IMMORT || IS_NPC(ch) || !PRF_FLAGGED(ch, PRF_NOHASSLE)) { do_hit(ch, argument, cmd, subcmd); return; } diff --git a/src/act.social.c b/src/act.social.c index 7149b3d..3db8e8a 100644 --- a/src/act.social.c +++ b/src/act.social.c @@ -16,6 +16,7 @@ #include "interpreter.h" #include "handler.h" #include "db.h" +#include "screen.h" #include "spells.h" #include "act.h" diff --git a/src/constants.c b/src/constants.c index 68e6ec4..8f4c61b 100644 --- a/src/constants.c +++ b/src/constants.c @@ -279,6 +279,7 @@ const char *connected_types[] = { "Social edit", "Trigger edit", "Help edit", + "Quest edit", "\n" }; diff --git a/src/dg_mobcmd.c b/src/dg_mobcmd.c index 0ed2aa3..3d34b9d 100644 --- a/src/dg_mobcmd.c +++ b/src/dg_mobcmd.c @@ -86,7 +86,7 @@ ACMD(do_masound) IN_ROOM(ch) = was_in_room; } -/* lets the mobile kill any player or mobile without murder*/ +/* lets the mobile kill any player or mobile */ ACMD(do_mkill) { char arg[MAX_INPUT_LENGTH]; diff --git a/src/fight.c b/src/fight.c index 90b9414..feed4af 100644 --- a/src/fight.c +++ b/src/fight.c @@ -576,7 +576,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 (GET_LEVEL(ch) >= LVL_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); @@ -687,7 +687,7 @@ int damage(struct char_data *ch, struct char_data *victim, int dam, int attackty return (0); /* You can't damage an immortal! */ - if (!IS_NPC(victim) && (GET_LEVEL(victim) >= LVL_IMMORT)) + if (!IS_NPC(victim) && ((GET_LEVEL(victim) >= LVL_IMMORT) && PRF_FLAGGED(victim, PRF_NOHASSLE))) dam = 0; if (victim != ch) { diff --git a/src/genqst.c b/src/genqst.c index d50abeb..2e6a447 100644 --- a/src/genqst.c +++ b/src/genqst.c @@ -15,7 +15,6 @@ #include "db.h" #include "quest.h" #include "genolc.h" -#include "genzon.h" #include "genzon.h" /* for create_world_index */ diff --git a/src/genzon.c b/src/genzon.c index 6eb51b2..e11ab5d 100644 --- a/src/genzon.c +++ b/src/genzon.c @@ -54,7 +54,7 @@ zone_rnum create_new_zone(zone_vnum vzone_num, room_vnum bottom, room_vnum top, int i; zone_rnum rznum; char buf[MAX_STRING_LENGTH]; - + #if CIRCLE_UNSIGNED_INDEX if (vzone_num == NOWHERE) { #else @@ -144,6 +144,7 @@ zone_rnum create_new_zone(zone_vnum vzone_num, room_vnum bottom, room_vnum top, fclose(fp); /* Update index files. */ + create_world_index(vzone_num, "qst"); create_world_index(vzone_num, "zon"); create_world_index(vzone_num, "wld"); create_world_index(vzone_num, "mob"); diff --git a/src/interpreter.c b/src/interpreter.c index ed9dc7e..0f786f6 100644 --- a/src/interpreter.c +++ b/src/interpreter.c @@ -249,6 +249,7 @@ cpp_extern const struct command_info cmd_info[] = { { "rcopy" , "rcopy" , POS_DEAD , do_oasis_copy, LVL_GOD, CON_REDIT }, { "roomflags", "roomflags", POS_DEAD , do_gen_tog , LVL_IMMORT, SCMD_SHOWVNUMS }, + { "sacrifice", "sac" , POS_RESTING , do_sac , 0, 0 }, { "say" , "s" , POS_RESTING , do_say , 0, 0 }, { "score" , "sc" , POS_DEAD , do_score , 0, 0 }, { "scopy" , "scopy" , POS_DEAD , do_oasis_copy, LVL_GOD, CON_SEDIT }, diff --git a/src/utils.h b/src/utils.h index 2b9fcb9..6b4f245 100644 --- a/src/utils.h +++ b/src/utils.h @@ -593,7 +593,7 @@ void char_from_furniture(struct char_data *ch); STATE(d) == CON_ZEDIT || STATE(d) == CON_SEDIT || \ STATE(d) == CON_CEDIT || STATE(d) == CON_PLAYING || \ STATE(d) == CON_TRIGEDIT || STATE(d) == CON_AEDIT || \ - STATE(d) == CON_HEDIT) + STATE(d) == CON_HEDIT || STATE(d) == CON_QEDIT) /** Defines if it is ok to send a message to ch. */ #define SENDOK(ch) (((ch)->desc || SCRIPT_CHECK((ch), MTRIG_ACT)) && \ diff --git a/src/zedit.c b/src/zedit.c index 3ef0b14..0cb1f74 100644 --- a/src/zedit.c +++ b/src/zedit.c @@ -39,7 +39,8 @@ ACMD(do_oasis_zedit) { int number = NOWHERE, save = 0, real_num; struct descriptor_data *d; - char *buf3; + char *stop; + char sbot[MAX_STRING_LENGTH]; char buf1[MAX_STRING_LENGTH]; char buf2[MAX_STRING_LENGTH]; @@ -48,7 +49,7 @@ ACMD(do_oasis_zedit) return; /* Parse any arguments. */ - buf3 = two_arguments(argument, buf1, buf2); + stop = one_argument(two_arguments(argument, buf1, buf2), sbot); /* If no argument was given, use the zone the builder is standing in. */ if (!*buf1) @@ -73,16 +74,16 @@ ACMD(do_oasis_zedit) return; } } else if (GET_LEVEL(ch) >= LVL_IMPL) { - if (str_cmp("new", buf1) || !buf3 || !*buf3) + if (str_cmp("new", buf1) || !stop || !*stop) send_to_char(ch, "Format: zedit new " "\r\n"); else { - char sbot[MAX_INPUT_LENGTH], stop[MAX_INPUT_LENGTH]; + if (atoi(stop) < 0 || atoi(sbot) < 0) { + send_to_char(ch, "Zones cannot contain negative vnums.\r\n"); + return; + } room_vnum bottom, top; - skip_spaces(&buf3); - two_arguments(buf3, sbot, stop); - number = atoidx(buf2); if (number < 0) number = NOWHERE; @@ -102,7 +103,7 @@ ACMD(do_oasis_zedit) } } - /* If a numeric argumentwas given, retrieve it. */ + /* If a numeric argument was given, retrieve it. */ if (number == NOWHERE) number = atoidx(buf1);