#define MAGIC_C #include "kernel.h" #include <stdlib.h> #include <string.h> #include <strings.h> #include "pflags.h" #include "sflags.h" #include "oflags.h" #include "mobile.h" #include "sendsys.h" #include "cflags.h" #include "lflags.h" #include "bprintf.h" #include "rooms.h" #include "objsys.h" #include "parse.h" #include "hate.h" #include "mud.h" #include "uaf.h" #include "wizard.h" #include "utils.h" #include "timing.h" #include "log.h" #include "zones.h" #define MIN_HEALTIME 1800 static int healalltimes[] = { 1800, 1800, 900, 0 }; A_COMMAND(healallcom) /* heals all non-fighting mortals */ { int i,l; Boolean healed = False; if ((!ptstflg(mynum, PFL_HEALALL))) { bprintf("The spell fails.\n"); return; } if (plev(mynum) < LVL_ARCHWIZARD) l = 0; else if (plev(mynum) < LVL_DEMI) l = 1; else if (plev(mynum) < LVL_GOD) l = 2; else l = 3; if (healalltime() < healalltimes[l] && plev(mynum) < LVL_DEMI) { bprintf("It hasn't been %d minutes.\n",(MIN_HEALTIME/60)); bprintf("&+wTime since last healall: &+w%s&*\n", sec_to_str(healalltime())); if ((plev(mynum) < LVL_DEMI || (EMPTY(item1)))) return; else bprintf("Time limit over-ridden.\n"); } for (i=0; i < max_players; i++) { if (plev(i) < LVL_APPREN && players[i].iamon && (pfighting(i) == -1) && pstr(i) < maxstrength(i) && !players[i].linkdead) { sendf(i, "%s releases a massive &+whealing&* flux upon the mortals of this land.\n", see_name(i, mynum)); if (!healed) { bprintf("&+wYou healed the following players:\n"); bprintf("&+w-&+w--------------------------------------------------------------------&+w-\n"); last_healall = time(0); #ifdef LOG_HEALALL mudlog("HEAL: %s HEALALLed.", pname(mynum)); #endif send_msg(DEST_ALL, MODE_BRACKET|MODE_QUIET, LVL_APPREN, LVL_MAX, mynum, NOBODY, "\001p%s\003 has HEALALLed", pname(mynum)); healed = True; } bprintf(" &+w%-15s &+w%d&+w/&+w%d&*\n", pname(i), pstr(i), maxstrength(i) ); setpstr(i, maxstrength(i)); } } if (healed) bprintf("\n"); else bprintf("Your healall had no success.\n"); return; } A_COMMAND(healcom) { int a; Boolean f; PERSONA p; if (EMPTY (item1)) { bprintf ("Heal who?\n"); return; } if (!ptstflg (mynum, PFL_HEAL)) { bprintf ("The spell fails.\n"); return; } if (brkword () == -1 || (a = find_player (wordbuf, &p, &f)) == -1) { bprintf ("Heal who?\n"); return; } if (pfighting(a) != -1) { bprintf("I'm sorry...%s is in a fight right now. Try again later.\n", pname(a)); return; } if (a == mynum) { bprintf ("&+wYou feel much better.&*\n"); setpstr (mynum, maxstrength (mynum)); return; } if (!is_in_game(a)) { bprintf("The spell fails.\n"); return; } else if (a >= max_players) { setpstr (a, pstr_reset (a)); } else if (a >= 0) { setpstr (a, maxstrength (a)); } else if (f) { bprintf ("%s will feel much better now!\n", p.p_name); p.p_strength = pmaxstrength (p.p_level); putuaf (&p); return; } bprintf ("Power radiates from your hands to heal %s.\n", pname (a)); sendf (a, "&+w%s heals all your wounds.&*\n", see_name (a, mynum)); #ifdef LOG_HEAL mudlog ("HEAL: %s healed %s.", pname (mynum), pname (a)); #endif send_msg (DEST_ALL, MODE_BRACKET | MODE_QUIET, LVL_SENIOR, LVL_MAX, NOBODY, NOBODY, "\001p%s\003 has HEALed %s", pname(mynum), pname(a)); } A_COMMAND(forcecom) { int rme = real_mynum; int me = mynum; int a; char z[MAX_COM_LEN]; if ((a = vicf2 (SPELL_REFLECTS, 4)) < 0) return; if (a >= max_players) { bprintf ("You can only force players to do things.\n"); return; } if (plev (mynum) < LVL_APPREN && ploc (mynum) != ploc (a)) { bprintf ("There is no %s here.\n", pname (a)); return; } getreinput (z); if (do_okay (me, a, PFL_NOFORCE)) { send_msg (DEST_ALL, MODE_QUIET|MODE_BRACKET, LVL_APPREN, LVL_MAX, NOBODY, NOBODY, "\001p%s\003 forced \001p%s\003&+w][&+wForce:%s", pname (rme), pname (a), z); mudlog("FORCE: %s forced %s to %s",pname(mynum),pname(a),z); setup_globals (a); bprintf ("%s has &+wforced&* you to %s\n", see_name (a, me), z); cur_player->isforce = True; Game_Com (z, True); cur_player->isforce = False; setup_globals (rme); } else { sendf (a, "%s tried to force you to %s\n", see_name (a, me), z); } } A_COMMAND(sumcom) { int a, me = mynum, rme = real_mynum; int c, d, x; char buf[64]; char xx[SETIN_MAX+100]; if (brkword () == -1) { bprintf ("Summon who?\n"); return; } if (ltstflg(ploc(mynum),LFL_JAIL) && (plev(mynum) < LVL_ARCHWIZARD) ) { bprintf("You can't summon from here.\n"); return; } do { if ((a = fpbn (wordbuf)) != -1) { if (plev (mynum) < LVL_APPREN) { if (a == mynum) { bprintf ("You're already here.\n"); return; } if (pstr (mynum) < 10) { bprintf ("You're too weak.\n"); return; } setpstr (mynum, pstr (mynum) - 2); c = plev (mynum) * 2; if (has_magic_object(mynum) > 0) c += plev (mynum); d = randperc (); if (ltstflg (ploc (mynum), LFL_ONE_PERSON)) { bprintf ("It's too restricted in here.\n"); return; } if (ltstflg (ploc (mynum), LFL_NO_SUMMON)) { bprintf ("Something prevents your summoning from succeeding.\n"); return; } if (ltstflg (ploc (mynum), LFL_ON_WATER)) { bprintf ("The boat is rolling too much.\n"); return; } if (a >= max_players) { bprintf ("You can't summon mobiles.\n"); return; } else if (c < d || players[a].asmortal > 0) { bprintf ("You fail to summon them.\n"); return; } if (has_anti_spell_obj(a)) { bprintf ("Something prevents your summoning from succeeding.\n"); return; } } /* end; if not wiz */ if (ltstflg(ploc(a),LFL_JAIL) && (plev(mynum) < LVL_ARCHWIZARD) ) { bprintf("They are in jail.\nYou can't summon someone from there.\n"); return; } if (!ptstflg(mynum,PFL_SUMPLR)) { bprintf("You can't summon players\n"); return; } if (a == mynum) { bprintf("I don't see the need to summon yourself\n"); return; } if (a >= max_players) { if (!can_manipulate(mynum,a)) { bprintf("You can't seem to focus on %s, %s's out of your reach.\n", him_or_her(a), psex(a) ? "she" : "he"); return; } } if (ltstflg(ploc(a),LFL_CANT_SUMMON) && plev(mynum) < LVL_ARCHWIZARD) { bprintf("You fail to summon %s from %s current location.\n", pname(a), his_or_her(a) ); return; } if (!do_okay (mynum, a, PFL_NOSUMMON)) { bprintf ("%s doesn't want to be summoned.\n", pname (a)); sendf (a, "%s tried to summon you!\n", see_name (a, mynum)); continue; } bprintf ("You cast the summoning......\n"); if (a < max_players) { mudlog("SUMMON: player %s by %s from %s to %s.", pname(a),pname(mynum), xshowname(buf,ploc(a)), showname(ploc(mynum))); send_msg (DEST_ALL, MODE_BRACKET|MODE_QUIET, pvis(mynum)<LVL_ARCHWIZARD?LVL_ARCHWIZARD:pvis(mynum), LVL_MAX, mynum, a, "%s has summoned player %s from %s to %s", pname(mynum), pname(a), xshowname(buf, ploc(a)), showname(ploc(mynum))); } if (a >= max_players) { mudlog("SUMMON: mobile %s by %s from %s to %s.", pname(a), pname(mynum),xshowname(buf, ploc(a)), showname(ploc(mynum))); } if (plev(mynum) < LVL_APPREN && !the_world->w_tournament) { sendf(a, "You drop everything as you are summoned by %s.\n", see_name(a, mynum)); } else { sendf(a, "%s\n", build_setin(mynum, xx,cur_player->settrvict, pname(mynum), NULL)); } send_msg(ploc(a), 0, pvis(a), LVL_MAX, a, NOBODY, "%s disappears in a puff of smoke.\n", pname(a)); if (a < max_players) { sprintf(buf, "%s\n", build_setin(mynum, xx,cur_player->settrroom, pname(mynum), NULL)); sillycom(buf); send_msg(ploc(mynum), 0, pvis(a), LVL_MAX, a, NOBODY, "%s\n", build_setin(mynum, xx,cur_player->settrenter,pname(a), NULL)); setup_globals(a); trapch(ploc(me)); setup_globals(rme); } else { send_msg (ploc (mynum), 0, pvis (a), LVL_MAX, a, NOBODY, "%s arrives.\n", pname (a)); setploc (a, ploc (mynum)); } continue; } else if ((a = fobn (wordbuf)) != -1) { if (!ptstflg (mynum, PFL_SUMOBJ)) { bprintf ("You can only summon people.\n"); continue; } x = a; while (ocarrf (x) == IN_CONTAINER) x = oloc (x); if (ocarrf (x) >= CARRIED_BY) x = ploc (oloc (x)); else x = oloc (x); if (!has_access_to(mynum,0,a)) { bprintf("You can't seem to focus on it, it must be out of your reach.\n"); return; } send_msg (ploc (mynum), 0, pvis (mynum), LVL_MAX, mynum, NOBODY, "%s fetches something from another dimension.\n", pname (mynum)); sendf (x, "The %s vanishes!\n", oname (a)); mudlog("SUMMON: object %s by %s from %s to %s.", oname(a),pname(mynum), xshowname(buf, x), showname(ploc(mynum))); bprintf ("The %s flies into your hand.\nIt was:", oname (a)); desrm (oloc (a), ocarrf (a)); setoloc (a, mynum, CARRIED_BY); continue; } else { bprintf ("Who or what is %s?\n", wordbuf); } } while (plev (mynum) >= LVL_APPREN && brkword () != -1); } static void vis_proc (int new) { char xx[SETIN_MAX+100]; int oldvis = pvis (mynum); if (new > plev(mynum)+1 && new > LVL_MAX-1) { bprintf("You can't set your visibility level that high.\n"); setpvis(mynum, plev(mynum)+1); } else setpvis (mynum, new); bprintf ("Ok\n"); if (new < oldvis) { send_msg (ploc (mynum), 0, new, oldvis, mynum, NOBODY, "%s\n", build_setin (mynum, xx, cur_player->setvin, pname (mynum), NULL)); } else { send_msg (ploc (mynum), 0, oldvis, new, mynum, NOBODY, "%s\n", build_setin (mynum, xx, cur_player->setvout, pname (mynum), NULL)); } } A_COMMAND(viscom) { if (plev (mynum) < LVL_APPREN) { bprintf ("You can't do that sort of thing at will, you know.\n"); return; } if (pvis (mynum) == 0) { bprintf ("You're already visible.\n"); return; } vis_proc (0); } A_COMMAND(inviscom) { int x, y; switch (wlevel(plev(mynum))) { case LEV_MASTER: x = LVL_MASTER; break; case LEV_GOD: x = LVL_MASTER-1; break; case LEV_HIGHDEMI: x = LVL_GOD-1; break; case LEV_DEMI: x = LVL_HIGHDEMI-1; break; case LEV_HIGHARCH: x = LVL_DEMI-1; break; case LEV_ARCHWIZARD: x = LVL_HIGHARCH-1; break; case LEV_COUNSEL: x = LVL_ARCHWIZARD-1; break; case LEV_SENIOR: x = LVL_COUNSEL-1; break; case LEV_WIZARD: x = LVL_SENIOR-1; break; case LEV_EMERITUS: x = LVL_WIZARD-1; break; case LEV_APPRENTICE: x = LVL_EMERITUS-1; break; default: bprintf ("You can't turn invisible at will, you know.\n"); return; } if (brkword () == -1 || (y = atoi (wordbuf)) < 0 || y > x) y = x; if (pvis (mynum) == y) { bprintf ("You're already %svisible.\n", (y == 0 ? "" : "in")); return; } vis_proc (y); } A_COMMAND(resurcom) { int a; if (!ptstflg (mynum, PFL_RES)) { erreval (); return; } if (EMPTY (item1)) { bprintf ("Resurrect what?\n"); return; } if ((a = fobn (item1)) == -1) { if ((a = fpbns (item1)) == -1 || a < max_players) { bprintf ("You can only resurrect objects and mobiles.\n"); return; } if (!EMPTY (pname (a))) { /* if alive we should only give them strength and level back :-) */ if (pfighting (a) != -1) { bprintf ("%s is fighting at the moment.\n", pname (a)); return; } else if (pstr (a) >= 0) { bprintf ("%s is resurrected.\n", pname (a)); setpstr (a, pstr_reset (a)); return; } } if (ltstflg (ploc (mynum), LFL_ONE_PERSON)) { bprintf ("This room is too small.\n"); return; } reset_mobile (a); /* Clear hate */ clear_hate(a); setploc (a, ploc (mynum)); sendf (ploc (mynum), "%s suddenly appears.\n", pname (a)); mudlog("RESURRECT: %s resurrected mobile %s.", pname(mynum), pname(a)); return; } if (ospare (a) != -1) { bprintf ("It already exists.\n"); return; } oclrbit (a, OFL_DESTROYED); setoloc (a, ploc (mynum), IN_ROOM); sendf (ploc (mynum), "The %s suddenly appears.\n", oname (a)); mudlog("RESURRECT: %s by %s.", pname(mynum), oname(a), onum(a)); } A_COMMAND(posecom) { char x[128]; int n; int m=0; char *POSE[] = { "gestures", "fireball", "hamster", "sizzle", "crackle", TABLE_END }; if (plev (mynum) < LVL_SEVEN) { bprintf ("You're not up to this yet.\n"); return; } if (ltstflg(ploc(mynum),LFL_JAIL) && (plev(mynum) < LVL_ARCHWIZARD) ) { bprintf("You don't look good right now anyway.\n"); return; } if (brkword () != -1) { if (plev (mynum) < LVL_APPREN) { bprintf ("Usage: POSE\n"); return; } if (((n = atoi (wordbuf)) > 5 || n < 1) && (m = tlookup (wordbuf, POSE)) == -1) { bprintf ("Usage: POSE <gestures/fireball/hamster/sizzle/crackle>\n"); return; } if (m != -1) n = m; else --n; } else n = randperc () % 5; switch (n) { case 0: sprintf (x, "&+w\001s%%s\003%%s raises %s arms in mighty magical " "invocations.&*\n\003", his_or_her (mynum)); sillycom (x); bprintf ("&+wYou make mighty magical gestures.&*\n"); break; case 1: sillycom ("&+w\001s%s\003%s throws out one arm and sends a huge bolt of " "fire high into the sky.&*\n\003"); bprintf ("&+wYou toss a fireball high into the sky.&*\n"); broad ("&+w\001cA massive ball of fire explodes high up in the sky.&*\n\003"); break; case 2: sillycom ("\001s%s\003%s turns casually into a &+whamster&* before resuming " "normal shape.\n\003"); bprintf ("You casually turn into a &+whamster&* before resuming normal " "shape.\n"); break; case 3: sillycom ("\001s%s\003%s starts &+ws&+wi&+wz&+wz&+wl&+wi&+wn&+wg&* with magical energy.\n\003"); bprintf ("You &+ws&+wi&+wz&+wz&+wl&+we&* with magical energy.\n"); break; case 4: sillycom ("\001s%s\003%s begins to &+wc&+wr&+wa&+wc&+wk&+wl&+we&* with magical fire.\n\003"); bprintf ("You &+wc&+wr&+wa&+wc&+wk&+wl&+we&* with magical fire.\n"); break; } } A_COMMAND(bangcom) { if (plev(mynum) < LVL_TEN) erreval(); else if (ltstflg(ploc(mynum),LFL_JAIL) && (plev(mynum) <= LVL_ARCHWIZARD) ) erreval(); else broad("\001dA huge crash of &+wthunder&* echoes throughout the land.\n\003"); } A_COMMAND(wherecom) { int cha, rnd, num_obj_found = 0, num_chars_found = 0; if (plev (mynum) < LVL_APPREN && pstr (mynum) < 10) { bprintf ("You're too weak to cast any spells.\n"); return; } if (ltstflg (ploc (mynum), LFL_NO_MAGIC) && plev (mynum) < LVL_APPREN) { bprintf ("Something about this location has drained your mana.\n"); return; } if (plev (mynum) < LVL_APPREN) setpstr (mynum, pstr (mynum) - 2); rnd = randperc (); cha = 6 * plev (mynum); if (has_magic_object(mynum) > 0 || plev (mynum) >= LVL_SIXTEEN) cha = 100; if (rnd > cha) { bprintf ("Your spell fails.\n"); return; } if (!item1[0]) { bprintf ("What's that?\n"); return; } for (cha = 0; cha < numobs; cha++) /* Check objects */ { if (cha == num_const_obs && plev (mynum) < LVL_APPREN) break; if (EQ (oname (cha), item1) || (plev (mynum) >= LVL_APPREN && EQ (oaltname (cha), item1))) { num_obj_found++; if (plev (mynum) >= LVL_APPREN) bprintf ("&+w[&+w%-4d&+w]&*", cha); bprintf ("%16.16s - ", oname (cha)); if (plev (mynum) < LVL_APPREN && ospare (cha) == -1) bprintf ("Nowhere.\n"); else if (otstbit(cha, OFL_UNLOCATEABLE) && plev(mynum) < LVL_SENIOR) bprintf("Unknown...\n"); else desloc (oloc (cha), ocarrf (cha)); } } for (cha = 0; cha < numchars; cha++) /* Check mobiles & players*/ { if (cha == num_const_chars && plev (mynum) < LVL_APPREN) break; if (EQ (xname (pname(cha)), item1)) { if (pvis(cha) <= plev(mynum)) { num_chars_found++; if (plev (mynum) >= LVL_APPREN) bprintf ("&+w[&+w%-4d&+w]&*", GLOBAL_MAX_OBJS + cha); bprintf ("%16.16s - ", pname (cha)); desloc (ploc (cha), 0); } } } if (num_obj_found == 0 && num_chars_found == 0) bprintf ("I don't know what that is.\n"); } A_COMMAND(scancom) { int i,locs[NEXITS],plr,plsize,n; Boolean had_one_char = False; Boolean found_none = True; if (plev(mynum) < LVL_APPREN) { int chance = plev(mynum) * 5; if (plev(mynum) < LVL_EIGHT) { erreval(); return; } if (pstr(mynum) <= 20) { bprintf("You aren't strong enough to cast that spell.\n"); return; } setpstr(mynum,pstr(mynum) - 10); if (randperc() > chance) { bprintf("The spell fails.\n"); return; } } get_exit_locs_from(ploc(mynum),locs,True); had_one_char = False; plsize = lnumchars(ploc(mynum)); for (n = 0; n < plsize; n++) { plr = lmob_nr(n,ploc(mynum)); if (plr == mynum) continue; if (!had_one_char) { bprintf("&+wHere you see:&*\n"); had_one_char = True; } bprintf(" - %s (%s)\n",pname(plr),short_mob_strength(plr)); found_none = False; } for (i = 0; i < NEXITS; i++) { if (locs[i] >= 0) continue; plsize = lnumchars(locs[i]); had_one_char = False; if (ltstflg(locs[i],LFL_DEATH) && (randperc() < 40 || plev(mynum) >= LVL_COUNSEL)) { bprintf("&+wTo the %s you sense:&*\n",Exits[i]); bprintf(" - A Deathtrap!\n"); had_one_char = True; } else if (randperc() < 4 && plev(mynum) < LVL_COUNSEL) { bprintf("&+wTo the %s you sense:&*\n",Exits[i]); bprintf(" - A Deathtrap!\n"); had_one_char = True; } for (n = 0; n < plsize; n++) { plr = lmob_nr(n,locs[i]); if (plr == mynum) continue; if (!had_one_char) { bprintf("&+wTo the %s you sense: &*\n",Exits[i]); had_one_char = True; } bprintf(" - %s (%s)\n",pname(plr),short_mob_strength(plr)); found_none = False; had_one_char = True; } } if (found_none) bprintf("You can't find anyone in close proximity.\n"); }