wizard.c
pdirt/drv/src/wizard.c · 27.7 KB
From the archive pDirt-1_tar.gz
Download the archive « Back to the archive contents
/*****************************************************************************
** WIZARD ROUTINES
*****************************************************************************/
#define WIZARD_C
#include "kernel.h"
#include "config.h"
#include <time.h>
#include <unistd.h>
#include "levels.h"
#ifdef VARGS
#include <stdarg.h>
#endif
#include "verbs.h"
#include "sendsys.h"
#include "pflags.h"
#include "sflags.h"
#include "lflags.h"
#include "mobile.h"
#include "cflags.h"
#include "objsys.h"
#include "wizard.h"
#include "rooms.h"
#include "parse.h"
#include "bprintf.h"
#include "uaf.h"
#include <stdlib.h>
#include "utils.h"
#include "mud.h"
#include "commands.h"
#include "log.h"
#include "fight.h"
#include "flags.h"
#include "clone.h"
#include "special.h"
#include "zones.h"
extern char *Oflags[];
A_COMMAND(saveallcom)
{ int lv;
send_msg(DEST_ALL, MODE_BRACKET|MODE_QUIET, LVL_APPREN, LVL_MAX, mynum,
NOBODY, "\001p%s\003 has SAVEALL'd", pname(mynum));
for (lv = 0; lv < max_players; lv++)
if (players[lv].iamon)
{
save_player(lv,False);
}
}
A_COMMAND(cfrcom)
{ char x[MAX_COM_LEN], y[MAX_COM_LEN];
getreinput(x);
sprintf(y, "&+w** &+wCALL FOR RESET &+wby &+w%s :&* %s\a\a\n", pname(mynum), x);
broad(y);
}
/* The SET command */
/* These properties require numbers: */
#define SET_BVALUE 0
#define SET_SIZE 1
#define SET_VIS 2
#define SET_DAMAGE 3
#define SET_ARMOR 4
#define SET_STATE 5
/* These require texts: */
#define SET_TEXT_MIN 5
#define SET_DESC0 6
#define SET_DESC1 7
#define SET_DESC2 8
#define SET_DESC3 9
#define SET_NAME 10
#define SET_ANAME 11
#define SET_TEXT_MAX 11
/* Properties */
static char *Props[] =
{"BaseValue", "Size", "Visibility", "Damage",
"Armor", "State", "Desc0", "Desc1",
"Desc2", "Desc3", "Name", "AltName",
TABLE_END
};
A_COMMAND(setcom)
{ int o, p, v; /* Object, Property, Value */
Boolean is_oflag;
if (!ptstflg (mynum, PFL_OBJECT))
{
erreval ();
return;
}
if (brkword () == -1 || (o = fobn (wordbuf)) == -1)
{
bprintf ("Set what??\n");
return;
}
if (brkword () == -1 || ((is_oflag = (p = tlookup (wordbuf, Props)) == -1)
&& (p = tlookup (wordbuf, Oflags)) == -1))
{
bprintf ("Set what property on the %s?\n", oname (o));
return;
}
if ((is_oflag || p <= SET_TEXT_MIN || p > SET_TEXT_MAX)
&& brkword () == -1)
{
bprintf ("Set the %s property to what ??\n",
is_oflag ? Oflags[p] : Props[p]);
return;
}
if (is_oflag)
{
if ((v = tlookup (wordbuf, OO)) == -1
&& (v = tlookup (wordbuf, TF)) == -1)
{
bprintf ("Value must be On or Off (or True/False).\n");
return;
}
if (v)
{
osetbit (o, p);
}
else
{
oclrbit (o, p);
}
}
else if (p <= SET_TEXT_MIN || p > SET_TEXT_MAX)
{
int limit = -1;
if (!isdigit (*wordbuf))
{
bprintf ("Value must be a number >= 0.\n");
return;
}
else
v = atoi (wordbuf);
switch (p)
{
case SET_BVALUE:
if (v > O_BVALUE_MAX ||
(v > obaseval (o) && v > 400
&& !ptstflg (mynum, PFL_FROB)))
limit = O_BVALUE_MAX;
else
osetbaseval (o, v);
break;
case SET_SIZE:
if (v > O_SIZE_MAX)
limit = O_SIZE_MAX;
else
osetsize (o, v);
break;
case SET_VIS:
if (v > O_VIS_MAX)
limit = O_VIS_MAX;
else
osetvis (o, v);
break;
case SET_DAMAGE:
if (v > O_DAM_MAX)
limit = O_DAM_MAX;
else
osetdamage (o, v);
break;
case SET_ARMOR:
if (v > O_ARMOR_MAX)
limit = O_ARMOR_MAX;
else
osetarmor (o, v);
break;
case SET_STATE:
if (v > omaxstate (o))
limit = omaxstate (o);
else
setobjstate (o, v);
break;
default:
bprintf ("Internal error\n");
mudlog ("Internal errror in setcom(): p = %d", p);
return;
}
if (limit > -1)
{
bprintf ("Sorry, value must be <= %d.\n", limit);
return;
}
}
else
{
char **q;
if (opermanent (o))
{
bprintf ("You can only change %s on non-permanent"
" (wiz-created) objects.\n", Props[p]);
return;
}
q = p == SET_DESC0 ? &olongt (o, 0)
: p == SET_DESC1 ? &olongt (o, 1)
: p == SET_DESC2 ? &olongt (o, 2)
: p == SET_DESC3 ? &olongt (o, 3)
: p == SET_NAME ? &oname (o)
: p == SET_ANAME ? &oaltname (o)
: NULL;
if (q == NULL)
{
bprintf ("Internal Error\n");
mudlog ("Internal error in setcom(), p = %d", p);
return;
}
if (strchr ((const char *)getreinput (wordbuf), '^') != NULL)
{
bprintf ("Illegal character(s) (^) in text.\n");
return;
}
if (p == SET_NAME || p == SET_ANAME)
{
char *s = wordbuf;
if (strlen (wordbuf) > ONAME_LEN)
{
bprintf ("Name too long. Max = %d chars.\n",
ONAME_LEN);
return;
}
while (*s != '\0' && isalpha (*s))
s++;
if (*s != '\0')
{
bprintf ("Name must only contain latters.\n");
return;
}
if (EMPTY (wordbuf))
{
if (p == SET_ANAME)
strcpy (wordbuf, "<null>");
else
{
bprintf ("Name is missing.\n");
return;
}
}
}
if (*q != NULL)
free (*q);
*q = COPY (wordbuf);
}
bprintf ("Ok.\n");
}
/* The SAVESET command.
*/
A_COMMAND(saveset)
{ SETIN_REC s;
if (cur_player->aliased || cur_player->polymorphed != -1)
{
bprintf ("Not while aliased.\n");
return;
}
strcpy (s.name, pname (mynum));
/*strcpy (s.prompt, cur_player->prompt);*/
strcpy (s.setin, cur_player->setin);
strcpy (s.setout, cur_player->setout);
strcpy (s.setmin, cur_player->setmin);
strcpy (s.setmout, cur_player->setmout);
strcpy (s.setvin, cur_player->setvin);
strcpy (s.setvout, cur_player->setvout);
strcpy (s.setqin, cur_player->setqin);
strcpy (s.setqout, cur_player->setqout);
strcpy (s.setsit, cur_player->setsit);
strcpy (s.setstand, cur_player->setstand);
strcpy (s.settrenter, cur_player->settrenter);
strcpy (s.settrvict, cur_player->settrvict);
strcpy (s.settrroom, cur_player->settrroom);
strcpy (s.setsleep, cur_player->setsleep);
strcpy (s.settrance, cur_player->settrance);
strcpy (s.setaway, cur_player->setaway);
s.spare2[0] = '\0';
s.spare3[0] = '\0';
putsetins (pname (mynum), &s);
bprintf ("&+w[&+wSaving &+wprompt&+w and &+wset*in/out&+w messages&+w]&*\n");
}
void exorcise_addition(int x);
A_COMMAND(exorcom)
{ int x, q;
if (!ptstflg (mynum, PFL_EXOR))
{
bprintf ("You couldn't exorcise your way out of a paper bag.\n");
return;
}
if (ltstflg(ploc(mynum),LFL_JAIL) && (plev(mynum) < LVL_DEMI) )
{ bprintf("You can't exorcise from here.\n");
return;
}
if (EMPTY (item1))
{
bprintf ("Exorcise who?\n");
return;
}
if ((x = pl1) == -1)
{
bprintf ("They aren't playing.\n");
return;
}
if (!do_okay (mynum, x, PFL_NOEXOR))
{
bprintf ("They don't want to be exorcised.\n");
return;
}
if (!can_manipulate(mynum,x))
{ bprintf("You can't focus on them.\n");
return;
}
#ifdef LOG_EXORCISE
mudlog ("EXORCISE: %s by %s", pname (x), pname(mynum));
#endif
bprintf("You have &+wEXORCISED&* the demon!\n");
send_msg (DEST_ALL, MODE_QUIET, pvis (x), LVL_MAX, x, NOBODY,
"%s has been kicked off.\n", pname (x));
send_msg(DEST_ALL, MODE_QUIET|MODE_BRACKET, Max(LVL_APPREN,pvis(x)),LVL_MAX,
x, NOBODY, "\001p%s\003 has been kicked off by \001p%s\003",
pname(x),pname(mynum));
if ((q = find_pretender (x)) >= 0)
{
sendf (q, "You have been kicked off!\n");
unalias (q);
unpolymorph (q);
}
if (x >= max_players)
{
dumpstuff (x, ploc (x));
setpfighting (x, -1);
if (!ppermanent (x))
{
destruct_mobile (x, NULL);
}
else
{
setpname (x, "");
destroy_mobile(x);
setpstr(x,-1);
}
}
else
{
p_crapup (x,"\t&+wYou have been kicked off!&*", CRAP_SAVE | CRAP_RETURN);
}
}
A_COMMAND(setstart)
{ PERSONA d;
int loc, p;
char buff[80];
char *who;
char *where;
int locid;
if (ltstflg(ploc(mynum),LFL_JAIL) && (plev(mynum) < LVL_ARCHWIZARD) )
{ bprintf("Uh oh.. you found a loop hole... Nah just kidding.\n");
return;
}
/* Parse the command, find *WHO*'s home we want to change and *WHERE*
* * to change it to.
*/
if (brkword () == -1)
{
who = pname (mynum);
where = NULL;
}
else if (getuaf (strcpy (buff, wordbuf), &d))
{
who = d.p_name;
where = (brkword () == -1) ? NULL : wordbuf;
if (!EQ (who, pname (mynum)))
{
if (!ptstflg (mynum, PFL_UAF))
{
bprintf ("You can only set your own start-location.\n");
return;
}
if (!do_okay_l (plev (mynum), d.p_level, False))
{
bprintf ("That is beyond your powers.\n");
return;
}
}
}
else if (brkword () == -1)
{
who = pname (mynum);
where = buff;
}
else
{
bprintf ("No such player: %s\n", buff);
return;
}
/* Got the arguments. If the operation is not 'erase home' (where=null),
* * see if the argument corresponds to a real room.
*/
if (where == NULL)
{
loc = 0;
}
else if ((loc = findroomnum (where)) == 0 || !exists (loc))
{
bprintf ("No such location.\n");
return;
}
locid=loc;
if (exists (loc))
{ locid = loc_id (loc);
/* Got the room number. Finally, set the home for the player. */
if (!checklevel(mynum, loc))
return;
}
if ((p = fpbns (who)) > -1)
{
setphome (p, locid);
}
else
{
strcpy(d.p_home,loc == 0 ? "" : showname(loc));
putuaf (&d);
}
bprintf ("Ok.\n");
}
void showlocation (int o)
{ int uc, gotroom;
uc = 1;
gotroom = 0;
while (!gotroom)
{
switch (ocarrf (o))
{
case IN_ROOM:
o = oloc (o);
gotroom = 1;
break;
case IN_CONTAINER:
bprintf (" &+w%cnside the %s&*", (uc ? 'I' : 'i'), oname (oloc (o)));
uc = 0;
o = oloc (o);
break;
case CARRIED_BY:
bprintf (" &+w%carried by %s&*", (uc ? 'C' : 'c'), pname (oloc (o)));
uc = 0;
o = ploc (oloc (o));
gotroom = 1;
break;
case WORN_BY:
bprintf (" &+w%corn by %s&*", (uc ? 'W' : 'w'), pname (oloc (o)));
uc = 0;
o = ploc (oloc (o));
gotroom = 1;
break;
case WIELDED_BY:
bprintf (" &+w%cielded by %s&*", (uc ? 'W' : 'w'), pname (oloc (o)));
uc = 0;
o = ploc (oloc (o));
gotroom = 1;
break;
case BOTH_BY:
bprintf (" &+w%corn and wielded by %s&*", (uc ? 'W' : 'w'), pname (oloc (o)));
uc = 0;
o = ploc (oloc (o));
gotroom = 1;
break;
default:
bprintf ("\n");
return;
}
}
bprintf (" &+w%cn &*", (uc ? 'I' : 'i'));
bprintf ("&+w%s&*\n", showname (o));
}
/* The SHOW command. */
A_COMMAND(showitem)
{ int x;
if (!ptstflg (mynum, PFL_STATS))
{
erreval ();
return;
}
if (EMPTY (item1))
{
bprintf ("Show what?\n");
return;
}
if ((x = fobn (item1)) == -1)
{
bprintf ("What's that?\n");
return;
}
if (!has_access_to(mynum,0,x))
{ bprintf("You can't inspect unexplored items.\n");
return;
}
_showitem(x);
}
void _showitem(int x)
{ int i;
OFLAGS *p;
bprintf ("\n&+wItem [&+w%d&+w]&+w:&+w %s&*", x, oname (x));
if (!EQ (oaltname (x), "<null>"))
bprintf (" &+w(%s)&*", oaltname (x));
bprintf ("\n&+wLocation: ");
showlocation (x);
if (olinked (x) > -1)
{
bprintf ("&+wLinked to:&* ");
if (olinked (x) >= numobs)
bprintf ("non-existant object! (%d)", olinked (x));
else
{
bprintf ("&+w%s&*", oname (olinked (x)));
if (olinked (olinked (x)) != x)
bprintf (" ERROR: Not linked back! (%d)\n",
olinked (olinked (x)));
else
showlocation (olinked (x));
}
}
bprintf ("&+wZone/Owner: &+w%s&*\n", zname (ozone (x)));
bprintf ("\n&+wState: &+w%d&*\t&+wMax State: &+w%d&*\n",
state (x), omaxstate (x));
bprintf ("&+wDamage: &+w%d&*\t&+wArmor Class: &+w%d&*\t\t&+wSize: &+w%d&*\n",
odamage (x), oarmor (x), osize (x));
bprintf ("&+wBase Value: &+w%-4d&*\t\t&+wCurrent Value: &+w%d&*\n",
obaseval (x), ovalue (x));
bprintf ("&+wSpecial Events: &+w%s.\n\n", obj_fun(x) != NULL ? "Yes" : "No");
bprintf ("&+wProperties:&+w ");
p = &(obits (x));
show_bits ((int *) p, sizeof (OFLAGS) / sizeof (int), Oflags);
bprintf ("\n&+wState: Description:&*\n");
for (i = 0; i < 4; i++)
bprintf ("&+w[%d] %s&*\n", i, olongt (x, i) == NULL ? "" : olongt (x, i));
}
/* Warnzap and puntzap - Dragorn */
A_COMMAND(warnzapcom)
{ int vic;
int phase;
if (brkword() == -1)
{
bprintf("Warn who?\n");
return;
}
else if (pl1 == -1)
{
bprintf("No one with that name playing.\n");
return;
}
else if (pname(mynum) == pname(pl1))
{
bprintf("What are you trying to do? Kill yourself?\n");
return;
}
else if (xplev(mynum) < xplev(pl1))
{
bprintf("You can't warn a higher immortal!\n");
return;
}
else if (pl1 > max_players -1)
{
bprintf("You can only warn players!\n");
return;
}
else
{
vic = pl1;
if (EMPTY(item2))
phase = 1;
else
phase = atoi(item2);
if (phase < 1 || phase > 4)
{ bprintf("Invalid warnzap level. Valid Levels: 1 through 4.\n");
return;
}
send_msg (ploc (vic), 0, pvis (vic), LVL_MAX, vic, NOBODY,
"&+wA lightning bolt strikes &+w%s&+w, driving %s to %s knees!\n",
pname(vic), him_or_her(vic), his_or_her(vic));
bprintf("&+wYou drive %s to %s knees with a lightning bolt!\n",pname(vic),his_or_her(vic));
setpstr(vic, 1);
/* Rainbow Spells Pts */
#ifdef setpspellpts
setpspellpts(vic, 1);
#endif
switch (phase) {
case 1:
sendf(vic, "&+w%s drives you to your knees with a lightning bolt, your body wracked\n"
"&+wwith pain. As you approach unconsiousness, a voice echos in your head.\n"
"&+w'&+wThis was but a warning.&+w' As you stumble to your feet you realize how\n"
"&+wlucky you are to have been spared.\n", pname(mynum));
mudlog("WARN: %s warned %s, &+wWarnlevel %d",pname(mynum), pname(vic), phase);
send_msg (DEST_ALL, MODE_BRACKET|MODE_QUIET, LVL_APPRENTICE, LVL_MAX, NOBODY, NOBODY,
"%s has been warned by %s, Warnlevel %d",
pname (vic), pname (mynum), phase);
break;
case 2:
sendf(vic, "&+w%s drives you to your knees with a lightning bolt, your body wracked\n"
"&+wwith pain. As you approach unconsiousness, you feel knowledge slipping\n"
"&+waway. %s's voice echos in your head. 'This was but a warning.'\n",
pname(mynum), pname(mynum));
setpscore(vic, (pscore(vic) - (pscore(vic) / 10)));
calib_player(vic);
mudlog("WARN: %s warned %s, &+wWarnlevel %d",pname(mynum), pname(vic), phase);
send_msg (DEST_ALL, MODE_BRACKET|MODE_QUIET, LVL_APPRENTICE, LVL_MAX, NOBODY, NOBODY,
"%s has been warned by %s, Warnlevel %d",
pname (vic), pname (mynum), phase);
break;
case 3:
sendf(vic, "&+w%s drives you to your knees with a lightning bolt, your body wracked\n"
"&+wwith pain. As you approach unconsiousness, you feel knowledge ripped\n"
"&+waway by an icy wind. %s's voice echos in your head. 'Do &+wnot&+w\n"
"&+wcontinue your actions.'\n",
pname(mynum), pname(mynum));
setpscore(vic, (pscore(vic) - (pscore(vic) / 10)));
calib_player(vic);
mudlog("WARN: %s warned %s, &+wWarnlevel %d",pname(mynum), pname(vic), phase);
send_msg (DEST_ALL, MODE_BRACKET|MODE_QUIET, LVL_APPRENTICE, LVL_MAX, NOBODY, NOBODY,
"%s has been warned by %s, Warnlevel %d",
pname (vic), pname (mynum), phase);
p_crapup (vic,"\t\tDo NOT continue your actions.", CRAP_SAVE | CRAP_RETURN);
break;
case 4:
sendf(vic, "&+w%s drives you to your knees with a lightning bolt, your body wracked\n"
"&+wwith pain. As you approach unconsiousness, you feel knowledge ripped\n"
"&+waway by an icy wind. %s's voice echos in your head. 'Do &+wnot&+w\n"
"&+wcontinue your actions. This is your &+wFINAL&+w warning.'\n",
pname(mynum), pname(mynum));
setpscore(vic, (pscore(vic) - (pscore(vic) / 2)));
calib_player(vic);
mudlog("WARN: %s warned %s, &+wWarnlevel %d",pname(mynum), pname(vic), phase);
send_msg (DEST_ALL, MODE_BRACKET|MODE_QUIET, LVL_APPRENTICE, LVL_MAX, NOBODY, NOBODY,
"%s has been warned by %s, Warnlevel %d",
pname (vic), pname (mynum), phase);
p_crapup (vic, "\t\tThis is your FINAL warning.", CRAP_SAVE | CRAP_RETURN);
break;
default:
bprintf("Invalid Warnzap Level. Valid Levels: 1 through 4.\n");
break;
} /* End switch */
}
}
A_COMMAND(puntzapcom)
{
int a=pl1,r_pl;
char *s;
s=NEW(char,100);
if (brkword() == -1)
{
bprintf("Puntzap who?\n");
return;
}
else if (pl1 == -1)
{
bprintf("No one with that name playing.\n");
return;
}
else if (pname(mynum) == pname(a))
{
bprintf("What are you trying to do? Fry yourself?\n");
return;
}
else if (xplev(mynum)<xplev(a))
{
bprintf("Your puny lightning bolt has no effect.\n");
sendf(pl1,"%s hits you with a puny lightning bolt that does no damage.\n",pname(mynum));
return;
}
else
{
r_pl = convroom(MY_RANDOM()%numloc);
if (brkword () != -1)
{
if ((r_pl = findroomnum (wordbuf)) == 0)
{
bprintf ("Unknown room\n");
return;
}
}
send_msg(ploc(a), 0, pvis(a), LVL_MAX, a, NOBODY,
"A lightning bolt slams into the ground next to %s and slams %s\ninto the sky!\n",pname(a), him_or_her(a));
send_msg(DEST_ALL,0,LVL_MIN,LVL_MAX,a,NOBODY,
"You hear a loud crash of thunder and a cry.\n"
"%s flies through the air leaving a trail of smoke behind %s.\n",pname(a), him_or_her(a));
send_msg(a,0,LVL_MIN,LVL_MAX,NOBODY,NOBODY,
"%s slams an immense bolt of lightning into the ground next to you, sending\n"
"you flying into the air, a trail of smoke behind you.\n"
"You land on the ground somewhere else, and frantically beat at the flames...\n",pname(mynum));
sendf(r_pl,"%s lands on the ground in front of you, smoking slightly.\n",
pname(a));
setploc(a,r_pl);
}
}
A_COMMAND(puntcom) /* written by Kender (kender@esu.edu) Winter, 1994 */
{ int save_mynum;
int temp_me = mynum;
int newloc=0;
int punter = mynum;
if (plev(mynum) < LVL_APPREN)
{
bprintf ("You stub your toe!\n");
return;
}
if (!ptstflg(mynum,PFL_MAYPUNT) )
{
bprintf ("You are not allowed to punt anymore.\n");
return;
}
if (brkword () == -1)
{
bprintf ("Who do you want to drop kick?\n");
return;
}
if (pl1 == -1)
{
bprintf ("No one with that name is playing.\n");
return;
}
if (ltstflg(ploc(mynum),LFL_JAIL) && (plev(mynum) < LVL_ARCHWIZARD) )
{ bprintf("You kick yourself for getting into jail.\n");
return;
}
if (brkword () != -1)
{
if ((newloc = findroomnum(wordbuf)) == 0)
{
bprintf ("Unknown player, object, or room\n");
return;
}
}
else newloc = convroom (MY_RANDOM()%numloc);
if (newloc == 0)
newloc = convroom(MY_RANDOM()%numloc);
if ((xplev(punter) < LVL_GOD) && ltstflg(newloc, LFL_PRIVATE))
if (count_players (newloc, LVL_MIN, LVL_MAX,
COUNT_PLAYERS | COUNT_MOBILES) > 1)
{
bprintf ("I'm sorry. There's a private conference in that location.\n");
return;
}
if (!checklevel(punter, newloc)) return;
if (!has_access_to(punter,newloc,-1))
{ bprintf("You can't punt someone to unknown grounds.\n");
return;
}
if (!has_access_to(pl1,newloc,-1))
newloc = get_rand_start();
if (xplev(punter) < LVL_DEMI && ploc(pl1) != ploc(punter))
{
bprintf ("Sorry, but it ain't here for you to drop kick!\n");
return;
}
if (xplev(pl1) > xplev(punter))
{
bprintf ("You kick %s with all your might, but stub your toe!\n",
pname(pl1));
send_msg (ploc(punter), 0, LVL_MIN, LVL_MAX, punter, pl1,
"%s slams %s foot into %s! %s does NOT look happy.\n",
pname(punter), his_or_her(punter), pname(pl1), pname(pl1));
sendf (pl1, "%s slams %s foot into your shin!\n",
pname(punter), his_or_her(punter));
return;
}
if (mob_fun(pl1) != NULL)
{ param_s.plx = punter;
param_s.pl = pl1;
param_s.misc= VERB_PUNT;
param_s.ret = 1;
mob_fun(pl1)(E_ONMISC);
if (param_s.ret == -1)
return;
/* fall through */
pl1 = param_s.pl;
punter = param_s.plx;
}
send_msg (DEST_ALL, MODE_QUIET|MODE_BRACKET, LVL_APPREN, LVL_MAX, punter, pl1,
"\001p%s\003 has just punted \001p%s\003",
pname(punter), pname(pl1));
bprintf ("You grab %s by the ears and deliver a thunderous kick with your "
"right foot!\n%s goes flying off into the air with a pitiful "
"'&+wWahoohoohoo&*'...\nYou hear a thunderous thud in the distance.\n",
pname(pl1), pname(pl1));
sendf (pl1, "With an evil grin, \001p%s\003 grabs you by the ears and "
"delivers\na thunderous kick! You feel yourself rising up into the "
"air.....\nYou land with a thunderous crash on the ground!"
"\n", pname(punter));
send_msg (ploc(punter), 0, LVL_MIN, LVL_MAX, punter, pl1,
"With an evil grin, \001p%s\003 grabs \001p%s\003 by the ears, "
"and\ndelivers a thunderous kick!\n", pname(punter), pname(pl1));
send_msg (DEST_ALL, MODE_QUIET|MODE_NODEAF,
LVL_MIN, LVL_MAX, punter, pl1,
"You hear a thunderous BOOT......\nYou hear a pitiful "
"'&+wWahoohoohoo&*' flying over your head...\nThe ground shakes "
"with a monstrous THUD in the distance.\n");
if (pl1 >= max_players)
setploc (pl1, newloc);
else {
save_mynum = punter;
setup_globals (pl1);
trapch (newloc);
setup_globals (save_mynum);
}
mudlog ("PUNT: %s punted %s to %s", pname(punter), pname(pl1), showname(ploc(pl1)));
send_msg (ploc(pl1), 0, LVL_MIN, LVL_MAX, pl1, NOBODY,
"You hear a yelp and a thud as \001p%s\003 comes flying in.\n",
pname(pl1));
setup_globals(temp_me);
}
A_COMMAND(asmortalcom)
{ Boolean has_quickwriter;
if (cur_player->defrob != NULL)
{
if (!is_start_loc(ploc(mynum)) && cur_player->defrob->real_level < LVL_ARCHWIZARD)
{ bprintf("Go to one of the starting places before becoming immortal again.\n");
return;
}
if (IN_GROUP(mynum))
{ bprintf("Leave your party before you become immortal.\n");
return;
}
if (gotanything(mynum))
{ bprintf("Pit all your stuff first.\n");
return;
}
if (pfighting(mynum) >= 0)
{ bprintf("Not while fighting.\n");
return;
}
if (!has_access_to(mynum,ploc(mynum),-1))
{ bprintf("Not while in the middle of a quest area!\n");
return;
}
bprintf("You mumble your secret spell, and you become immortal again.\n");
send_msg(ploc(mynum),MODE_NOBLIND|MODE_QUIET,LVL_MIN,LVL_MAX,mynum,NOBODY,
"\001p%s\003 assumes %s normal form.\n",pname(mynum),psex(mynum) ?
"her" : "his");
send_msg(DEST_ALL,MODE_QUIET|MODE_BRACKET,LVL_COUNSEL,LVL_MAX,mynum,NOBODY,
"\001p%s\003 has become immortal",pname(mynum));
#ifdef LOG_DEFROB
mudlog("DEFROB: %s has become immortal again.",pname(mynum));
#endif
setplev(mynum,cur_player->defrob->real_level);
pflags(mynum).b1 = cur_player->defrob->real_pflags.b1;
pflags(mynum).b2 = cur_player->defrob->real_pflags.b2;
pflags(mynum).b3 = cur_player->defrob->real_pflags.b3;
pmask(mynum).b1 = cur_player->defrob->real_mask.b1;
pmask(mynum).b2 = cur_player->defrob->real_mask.b2;
pmask(mynum).b3 = cur_player->defrob->real_mask.b3;
setpdam(mynum,cur_player->defrob->real_dam);
setparmor(mynum,cur_player->defrob->real_armor);
setpstr(mynum,pmaxstrength(plev(mynum)));
setpvis(mynum,cur_player->defrob->real_vis);
free(cur_player->defrob);
cur_player->defrob = NULL;
return;
}
if (plev(mynum) < LVL_APPREN)
{ erreval();
return;
}
if (!ptstflg(mynum,PFL_ASMORTAL))
{ bprintf("You are not allowed to run anymore.\n");
return;
}
if (gotanything(mynum))
{ bprintf("Remove all your stuff first.\n");
return;
}
cur_player->defrob = NEW(DEFROB,1);
if (cur_player->defrob == NULL)
{ mudlog("ERROR: Could not allocate memory for DEFROB");
bprintf("Asmortal has been temporarily disabled due to an error.\n");
return;
}
if (pfighting(mynum) >= 0)
{ bprintf("Not while fighting.\n");
return;
}
has_quickwriter = ptstflg(mynum,PFL_QUICKWRITER);
cur_player->defrob->real_level = plev(mynum);
cur_player->defrob->real_pflags.b1 = pflags(mynum).b1;
cur_player->defrob->real_pflags.b2 = pflags(mynum).b2;
cur_player->defrob->real_pflags.b3 = pflags(mynum).b3;
cur_player->defrob->real_mask.b1 = pmask(mynum).b1;
cur_player->defrob->real_mask.b2 = pmask(mynum).b2;
cur_player->defrob->real_mask.b3 = pmask(mynum).b3;
cur_player->defrob->real_vis = pvis(mynum);
cur_player->defrob->real_dam = pdam(mynum);
cur_player->defrob->real_armor = parmor(mynum);
setparmor(mynum,25);
setpdam(mynum,12);
setpvis(mynum,0);
bprintf("You cast your protecting spell and assume your mortal form.\n");
send_msg(ploc(mynum),MODE_NOBLIND|MODE_QUIET,LVL_MIN,LVL_MAX,mynum,NOBODY,
"\001p%s\003 assumes %s mortal form.\n",pname(mynum),psex(mynum) ?
"her" : "his");
send_msg(DEST_ALL,MODE_QUIET|MODE_BRACKET,LVL_COUNSEL,LVL_MAX,mynum,NOBODY,
"\001p%s\003 has become mortal",pname(mynum));
#ifdef LOG_DEFROB
mudlog("DEFROB: %s assumed the mortal form.",pname(mynum));
#endif
plev(mynum) = levelof(pscore(mynum),LVL_APPREN-1);
if (plev(mynum) >= LVL_APPREN)
setplev(mynum,LVL_APPREN-1);
setpstr(mynum,pmaxstrength(plev(mynum)));
set_xpflags(plev(mynum),&pflags(mynum),&pmask(mynum));
if (has_quickwriter)
psetflg(mynum,PFL_QUICKWRITER);
if (xplev(mynum) < LVL_ARCHWIZARD)
teletrap(get_rand_start());
calibme();
}
/*
* Routine to start or end tracing a player/mobile/object.
* Original code from dyrt 1.1c (Thrace?)
* modified by Twizzly July 1995
*/
A_COMMAND(tracecom)
{ int i;
if (!ptstflg (mynum, PFL_TRACE))
{ erreval ();
return;
}
if (cur_player->tr.trace_item != -1)
{
bprintf ("&+w[&+wTRACE&+w: Stopped tracing %s&+w]&*\n",
cur_player->tr.trace_class == 1 ?
oname (cur_player->tr.trace_item) :
pname (cur_player->tr.trace_item));
cur_player->tr.trace_item = -1;
if (brkword () == -1)
return;
}
else if (EMPTY (item1))
{
bprintf ("Trace what?\n");
return;
}
if ((i = fpbn (item1)) != -1)
{
if (!do_okay (mynum, i, PFL_NOTRACE))
{
bprintf ("They don't want to be traced.\n");
return;
}
cur_player->tr.trace_class = 2;
cur_player->tr.trace_item = i;
cur_player->tr.trace_loc = 0;
cur_player->tr.trace_carrf = IN_ROOM;
bprintf ("Ok.\n");
return;
}
if ((i = fobn (item1)) != -1)
{
cur_player->tr.trace_class = 1;
cur_player->tr.trace_item = i;
cur_player->tr.trace_loc = 0;
cur_player->tr.trace_carrf = IN_ROOM;
cur_player->tr.trace_oroom = roomobjin(i);
bprintf ("Ok\n");
return;
}
bprintf ("What's that?\n");
}