commands.c
pdirt/drv/src/commands.c · 56.6 KB
From the archive pDirt-1_tar.gz
Download the archive « Back to the archive contents
/*****************************************************************************
** Standard commands
*****************************************************************************/
#define COMMANDS_C
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#ifdef RS6000
#include <strings.h>
#endif
#include "kernel.h"
#include "oflags.h"
#include "pflags.h"
#include "lflags.h"
#include "cflags.h"
#include "quests.h"
#include "sflags.h"
#include "sendsys.h"
#include "commands.h"
#include "rooms.h"
#include "mudtypes.h"
#include "mobile.h"
#include "parse.h"
#include "rooms.h"
#include "objsys.h"
#include "bprintf.h"
#include "mud.h"
#include "clone.h"
#include "log.h"
#include "cmd_handlers.h"
#include "quest.h"
#include "main.h"
#include "special.h"
#include "verbs.h"
#include "questpoints.h"
#include "zones.h"
#ifndef R_OK
#define R_OK 4
#endif
extern char *WizLevels[];
extern char *MLevels[];
extern char *FLevels[];
/* iDIRT pager system */
A_COMMAND(setpager)
{ int new;
if (brkword()==-1) {
bprintf("&+w[&+wPager lines &+w= &+w%d&+w]\n",ppager(mynum));
return;
}
new = atoi(wordbuf);
if (new > 200) {
bprintf ("Do you really need the pager set that high?\n");
return;
}
if (new < 5) {
bprintf("Do you really need the pager set that low?\n");
return;
}
setppager(mynum,new);
if (new) {
bprintf("&+w[&+wPager lines &+w= &+w%d&+w]&*\n",new);
} else {
bprintf("&+w[&+wPager &+w= &+wOff&+w]&*\n");
}
}
PUBLIC A_COMMAND(showemail)
{ PERSONA d;
int b;
if (brkword () == -1 || strlen(wordbuf) > PNAME_LEN)
{ bprintf("Get whose email address?\n");
return;
}
if ((b = fpbns (wordbuf)) != -1 && seeplayer (b))
{ if (b < max_players)
player2pers (&d, NULL, b);
else
{ bprintf("Mobiles do not have email addresses, Silly.\n");
return;
}
}
else if (!getuaf (wordbuf, &d))
{ bprintf ("Who's that?\n");
return;
}
if (b >= max_players)
{ bprintf("Mobiles do not have email addresses, Silly.\n");
return;
}
if (tst_doublebit(&d.p_sflags,SFL_NOFINGER) && plev(mynum) < LVL_ARCHWIZARD)
bprintf("Sorry, %s doesn't want it to be made public.\n",d.p_name);
else
bprintf("&+w%s's email address is:&+w %s&*\n", d.p_name, d.p_email);
}
/** Rope code, by Rhadamanthus (7/1/95) **/
A_COMMAND(untiecom)
{
int o/*, ob*/;
if((o = ob1) == -1 || state(o) != 0)
{
bprintf("There's no rope here.\n");
return;
}
if (obj_fun(o) != NULL)
{ param_s.plx = mynum;
param_s.ob = o;
param_s.loc = ploc(mynum);
param_s.ret = 1;
obj_fun(o)(E_ONUNTIE);
if (param_s.ret != 1)
return;
}
bprintf("There's no rope here.\n");
}
A_COMMAND(tiecom)
{
int o;
if (ob1 == -1 || onum(ob1) == -1 || ob1 > numobs)
{ bprintf("Tie what?\n");
return;
}
if(!is_rope((o = onum(ob1))))
{
bprintf("You can't tie that!\n");
return;
}
param_s.plx = mynum;
param_s.ob = o;
param_s.loc = ploc(mynum);
param_s.ret = 1;
param_s.misc = ob1;
if (rom_fun(ploc(mynum)) != NULL)
{ rom_fun(ploc(mynum))(E_ONTIE);
if (param_s.ret != 1)
return;
}
if (obj_fun(onum(o)) != NULL)
{ param_s.ob = o;
obj_fun(onum(o))(E_ONTIE);
if (param_s.ret != 1)
return;
}
bprintf("You have nothing to tie it to.\n");
}
A_COMMAND(throwcom)
{
if (!iscarrby(ob1, mynum))
{
bprintf("You don't have it.\n");
return;
}
if (ob1 == -1 && ob2 == -1)
{ bprintf("Throw what?\n");
return;
}
if (ob1 == -1 && ob2 >= 0)
ob1 = ob2;
if (obj_fun(onum(ob1)) != NULL)
{ param_s.plx = mynum;
param_s.ob = ob1;
param_s.loc = ploc(mynum);
param_s.ret = 1;
obj_fun(onum(ob1))(E_ONTHROW);
if (param_s.ret != 1)
return;
}
bprintf ("You can't throw that!\n");
}
A_COMMAND(lookcom)
{
int a;
if (psitting(mynum) > 1)
{ bprintf("You can't keep your eyes open long enough to get a clear picture.\n");
return;
}
if (brkword() == -1)
{
lookin(ploc(mynum), SHOW_LONG);
}
else
{
if (EQ(wordbuf, "at"))
{
strcpy(item1, item2);
ob1 = ob2;
examcom();
}
else if (!EQ(wordbuf, "in") && !EQ(wordbuf, "into") && !EQ(wordbuf,"on"))
{
bprintf("I don't understand. Are you trying to LOOK, LOOK AT, or LOOK IN something?\n");
}
else if (EMPTY(item2))
{
bprintf("In what?\n");
}
else if ((a = ob2) == -1)
{
bprintf("What?\n");
}
else if (!otstbit(a, OFL_CONTAINER))
{
bprintf("That isn't a container.\n");
}
else if (otstbit(a, OFL_OPENABLE) && state(a) != 0)
{
bprintf("It's closed.\n");
}
else
{ if (obj_fun(a) != NULL)
{ param_s.plx = mynum;
param_s.ob = a;
param_s.loc = ploc(mynum);
obj_fun(a)(E_ONLOOK);
if (param_s.ret != 1)
return;
}
bprintf ("The %s contains:\n", oname (a));
aobjsat (a, IN_CONTAINER, 8);
}
}
}
A_COMMAND(blowcom)
{ int a;
if ((a = ohereandget ()) == -1)
return;
if (obj_fun(onum(a)) != NULL)
{ param_s.plx = mynum;
param_s.ob = a;
param_s.loc = ploc(a);
param_s.pl = -1;
param_s.misc = VERB_BLOW;
param_s.ret = 1;
obj_fun(onum(a))(E_ONMISC);
if (param_s.ret != 1)
return;
}
bprintf ("You can't blow that.\n");
}
A_COMMAND(beepcom)
{ int vic;
if (brkword () == -1)
{
bprintf ("Beep who?\n");
return;
}
if (ltstflg(ploc(mynum),LFL_JAIL) && (plev(mynum) < LVL_ARCHWIZARD) )
{ bprintf("I think you need to cool off a bit first.\n");
return;
}
if ((vic = pl1) == -1)
{
bprintf ("There is no one with that name.\n");
return;
}
if (vic == mynum)
{
bprintf ("You are funny.\n");
return;
}
/* no beep to BUSY, DEAF, DUMB, or people in SOUNDPROOF rooms */
if ((ststflg (vic, SFL_BUSY) || ststflg (vic, SFL_DEAF) ||
ststflg (vic, SFL_DUMB) ||
ltstflg (ploc (vic), LFL_SOUNDPROOF)) && plev(mynum) < LVL_ADVISOR)
{
bprintf ("Your spell fizzles and dies...\n");
return;
}
sendf (vic, "%s is &+w&#d&#e&#s&#p&#e&#r&#a&#t&#e&#l&#y&* trying to get your attention.\n",
see_player (vic, mynum) ? pname (mynum) : "Someone");
bprintf ("You send %s annoying &+wbeeps&*.\n", psex (vic) ? "her" : "him");
}
A_COMMAND(homecom)
{ int l;
l = find_loc_by_id(phome(mynum));
if (phome (mynum) == 0 || !exists (phome(mynum)))
{
bprintf ("You are but without a home, my friend.\n");
return;
}
if (ltstflg (ploc(mynum),LFL_JAIL) && (plev(mynum) < LVL_ARCHWIZARD))
{ bprintf("Until you are let out, this IS your home.\n");
return;
}
if (ltstflg (phome(mynum), LFL_PRIVATE))
{
if (plev (mynum) < LVL_GOD)
if (count_players (phome(mynum), LVL_MIN, LVL_MAX, COUNT_PLAYERS) > 1)
{
bprintf ("Your home seems to be full at the moment.\n");
return;
}
}
bprintf ("You suddenly feel homesick... and click your heels three times.\n");
teletrap (phome(mynum));
return;
}
A_COMMAND(comparecom)
{
if (EMPTY(item1) || EMPTY(item2))
{
bprintf ("You must specify two items to compare.\n");
return;
}
if (!iscarrby(ob1, mynum))
{
bprintf ("You don't have a %s.\n", item1);
return;
}
if (!iscarrby(ob2, mynum))
{
bprintf ("You don't have a %s.\n", item2);
return;
}
if ((oarmor(ob1) < 1 && odamage(ob1) < 1) ||
(oarmor(ob2) < 1 && odamage(ob2) < 1))
{
bprintf("The gods save you points by telling you that either %s or %s is "
"neither\narmor nor weapon.\n", oname(ob1), oname(ob2));
return;
}
if (pscore(mynum) < 2500)
{
bprintf ("You don't have enough score to compare objects.\nYou need"
"2500 to use this command.\n");
return;
}
else
{ setpscore (mynum, pscore (mynum) - 500);
bprintf("You offer your 500 score sacrifice in hopes of answered"
" prayers.\n");
bprintf("After a few moments you hear their reply and jot it down.\n");
bprintf("Your notes look like this...\n\n");
if (oarmor(ob1) != oarmor(ob2))
{ bprintf("Better Armor == ");
if (oarmor(ob1) > oarmor(ob2))
bprintf("&+w%s&*\n", oname(ob1));
else
bprintf("&+w%s&*\n", oname(ob2));
} else
bprintf("&+wBoth same armor value.&*\n");
if (odamage(ob1) != odamage(ob2))
{
bprintf("Better Damage == ");
if (odamage(ob1) > odamage(ob2))
bprintf("&+w%s&*\n", oname(ob1));
else
bprintf("&+w%s&*\n", oname(ob2));
}
else
bprintf("&+wBoth same damage value.&*\n");
}
}
A_COMMAND(trancecom)
{ if (psitting(mynum) == 3)
{ bprintf("You are already in trance.\n");
return;
}
if (pfighting(mynum) >= 0)
{ bprintf("You don;t have enough time to fall into trance.\n");
return;
}
if (ltstflg(ploc(mynum),LFL_IN_WATER))
{ bprintf("You'd surely drown in here.\n");
return;
}
if (ptstflg(mynum,PFL_CANTRANCE))
{
bprintf("You practice some Tai-Chi exercises and fall into a deep trance.\n");
send_msg(ploc(mynum),0,pvis(mynum),LVL_MAX,mynum,NOBODY,
"%s practice some Tai-Chi exercises and falls into a deep trance.\n",
pname(mynum) );
setpsitting(mynum,3);
if (rom_fun(ploc(mynum)) != NULL)
{ param_s.plx = mynum;
param_s.loc = ploc(mynum);
param_s.ret = 1;
rom_fun(ploc(mynum))(E_ONREST);
if (param_s.ret != 1)
return;
}
}
else
{ bprintf("You try as hard as you can to fall into a trance but you fail.\n");
return;
}
}
A_COMMAND(sitcom)
{
if (psitting (mynum)==1)
{
bprintf ("You're already sitting.\n");
return;
}
else if (pfighting (mynum) >= 0)
{
bprintf ("You want to sit down while fighting? Do you have a death "
"wish or something?\n");
return;
}
if (rom_fun(ploc(mynum)) != NULL)
{ param_s.plx = mynum;
param_s.pl = -1;
param_s.ob = -1;
param_s.ret = 1;
param_s.misc= VERB_SIT;
param_s.loc = ploc(mynum);
rom_fun(ploc(mynum))(E_ONMISC);
if (param_s.ret != 1)
return;
}
if (ob1 != -1)
{ if (obj_fun(ob1) != NULL)
{ param_s.plx = mynum;
param_s.ob = ob1;
param_s.pl = -1;
param_s.loc = ploc(mynum);
param_s.ret = 1;
param_s.misc= VERB_SIT;
obj_fun(ob1)(E_ONMISC);
if (param_s.ret != 1)
return;
}
}
else if (ltstflg(ploc(mynum),LFL_IN_WATER) )
{
bprintf("Somehow you doubt that resting underwater won't help that much.\n");
}
else
{
bprintf ("You assume the lotus position.\n");
send_msg (ploc (mynum), 0, pvis (mynum), LVL_MAX, mynum, NOBODY,
"%s sits down.\n", pname (mynum));
setpsitting (mynum, 1);
}
}
A_COMMAND(standstart)
{ standcom(mynum);
}
void standcom (int player)
{
if (!psitting (player))
{
sendf (player, "You're already standing.\n");
return;
}
else
{
sendf (player, "You clamber to your feet.\n");
send_msg (ploc (player), 0, pvis (player), LVL_MAX, player, NOBODY,
"%s clambers to %s feet.\n", pname (player), his_or_her (player));
setpsitting (player, 0);
}
}
A_COMMAND(sleepcom)
{
if (ltstflg(ploc(mynum),LFL_IN_WATER) )
{
bprintf("I don't think it is wise to sleep underwater.\n");
return;
}
else if (pfighting(mynum)>=0)
{
bprintf("Sleep while fighting? Are you crazy??.\n");
return;
}
else if (psitting(mynum) == 2)
{ bprintf("You're already asleep.\n");
return;
}
else
{
bprintf("You roll out your sleeping bag and fall asleep.\n");
send_msg(ploc(mynum),0,pvis(mynum),LVL_MAX,mynum,NOBODY,
"%s decides %s needs a nap, and falls asleep.\n", pname(mynum),
psex(mynum) ? "she" : "he" );
setpsitting(mynum,2);
if (rom_fun(ploc(mynum)) != NULL)
{ param_s.plx = mynum;
param_s.loc = ploc(mynum);
param_s.ret = 1;
rom_fun(ploc(mynum))(E_ONREST);
if (param_s.ret != 1)
return;
}
}
}
A_COMMAND(ticklecom)
{ int a;
if (ob1 != -1)
{ if (obj_fun(ob1) != NULL)
{ param_s.plx = mynum;
param_s.pl = -1;
param_s.misc= VERB_TICKLE;
param_s.ret = 1;
obj_fun(ob1)(E_ONMISC);
if (param_s.ret != 1)
return;
}
}
if ((a = vichere ()) < 0)
return;
if (a == mynum)
{
bprintf ("You tickle yourself.\n");
return;
}
sillytp (a, "tickles you.");
bprintf ("You tickle %s.\n", him_or_her (a));
}
A_COMMAND(diagnosecom)
{ int plx=pfighting (mynum);
if (pfighting(mynum) < 0)
{
bprintf ("You aren't fighting anyone!\n");
return;
}
else
{ show_mob_strength(plx);
setpstr(mynum,pstr(mynum) - 2);
}
}
A_COMMAND(cleancom)
{ if (ob1 == -1)
{ bprintf("Clean what?\n");
}
else
{ if (obj_fun(ob1) != NULL)
{ param_s.plx = mynum;
param_s.ob = ob1;
param_s.ret = 1;
param_s.loc = ploc(mynum);
param_s.misc= VERB_CLEAN;
obj_fun(ob1)(E_ONMISC);
if (param_s.ret != 1)
return;
}
bprintf("Although cleaning it would be appropriate, you doubt if it would do any\n"
"good at all.\n");
}
}
A_COMMAND(meltcom)
{
if (p_ohanyflag(mynum,OFL_LIT) < 0 && p_ohanyflag(mynum,OFL_MAGICLIT) < 0)
{ bprintf("You don't have a flame or another source of warmth to melt anything.\n");
return;
}
param_s.plx = mynum;
param_s.pl = -1;
param_s.loc = ploc(mynum);
param_s.ret = 1;
param_s.ob = -1;
param_s.misc= VERB_MELT;
if (ob1 != -1)
{ param_s.ob = ob1;
if (obj_fun(ob1) != NULL)
{ obj_fun(ob1)(E_ONMISC);
if (param_s.ret != 1)
return;
}
bprintf("You can't melt that.\n");
}
else if (rom_fun(ploc(mynum)) != NULL)
{ rom_fun(ploc(mynum))(E_ONMISC);
if (param_s.ret != 1)
return;
}
bprintf("There's nothing you can melt here.\n");
}
A_COMMAND(digcom)
{ int i,ob;
if (rom_fun(ploc(mynum)) != NULL)
{ param_s.plx = mynum;
param_s.ob = ob1;
param_s.loc = ploc(mynum);
param_s.ret = 1;
rom_fun(ploc(mynum))(E_ONDIG);
if (param_s.ret != 1)
return;
}
for (i = 0; i < lnumobs(ploc(mynum)); i++)
{ ob = lobj_nr(i,ploc(mynum));
if (obj_fun(ob) != NULL)
{ param_s.plx = mynum;
param_s.ob = ob1;
param_s.loc = ploc(mynum);
param_s.ret = 1;
param_s.misc= ob;
obj_fun(ob)(E_ONDIG);
if (param_s.ret != 1)
return;
}
}
bprintf ("You find nothing.\n");
return;
}
A_COMMAND(playcom)
{ if (ob1 > -1)
{ if (obj_fun(ob1) != NULL)
{ param_s.ret = 1;
param_s.plx = mynum;
param_s.ob = ob1;
param_s.misc= VERB_PLAY;
obj_fun(ob1)(E_ONMISC);
if (param_s.ret != 1)
return;
}
bprintf("You can't figure out how to play it\n");
}
}
A_COMMAND(scorecom)
{
static char *t[] =
{
"%s near death&*",
"%s near death&*",
"%s mortally wounded&*",
"%s seriously wounded&*",
" some wounds, but %s still fairly strong&*",
" minor cuts and abrasions&*",
" minor cuts and abrasions&*",
"feel a bit dazed&*",
"%s in better than average condition&*",
"%s in exceptional health&*",
"%s in exceptional health&*"
};
static char *dr[] =
{ "completely sober",
"almost sober",
"a bit tipsy",
"tipsy",
"very tipsy",
"drunk",
"very drunk",
"extremely drunk",
"near puking"
};
int p,d=0;
int plx = mynum;
int togo = 0;
if (plev(plx) >= LVL_APPREN && brkword() != -1 && (plx = fpbn (wordbuf)) < 0)
{
bprintf ("Hmm...%s seems to be hiding...\n", wordbuf);
}
else if (plx >= max_players)
{
if (plx != mynum && can_manipulate(mynum,plx))
{ bprintf("You don't seem able to size them up.\n");
return;
}
if (plx == mynum)
{
bprintf ("Your ");
}
else
{
bprintf ("%s's ", pname (plx));
}
bprintf ("strength is &+w%d&*.\n", pstr (plx));
}
else
{
p = (int) (pstr (plx) * 10 / maxstrength (plx));
if (p > 10)
p = 10;
d = (int) (pdrunk(plx) / 4);
if (d > 8)
d = 8;
togo = levels[plev(plx)+1] - pscore(plx);
if (plx == mynum)
{
bprintf("&+wYour strength is &+w%d&+L/&+w%d\n", pstr(plx), maxstrength(plx));
bprintf("&+wYou scored &+w%d &+wpoints.\n", pscore(plx));
if (plev(plx) < LVL_APPREN)
{ if (pwimpy(plx) > 0)
bprintf("&+wYour wimpy level is &+w%d&*\n",pwimpy(plx));
bprintf("&+wYour level is &+w%d", plev(plx));
if (togo > 0)
bprintf("&+w, you need &+w%d &*points and &+w%d&* questpoints to level.\n",
levels[plev(plx)+1] - pscore(plx),qp_for_level(plev(plx)+1)-qpoints(plx));
else if (plev(plx) < LVL_APPREN)
bprintf("&+w, you only need &+w%d&* questpoints to level.\n",qp_for_level(plev(plx) +1));
bprintf("&+wYou have accumulated a total of &+w%d&+w/&+w%d&+w questpoints (required %d).\n",qpoints(plx),QP_total,QP_required);
if (plev(mynum) == LVL_SIXTEEN)
bprintf("&+wTo become immortal you will need at least &+w%d&+w questpoints.\n",QP_required);
}
else
bprintf("&+wYou have accumulated a total of &+w%d&+w/&+w%d&+w questpoints.\n",qpoints(plx),QP_total);
bprintf("&+wThe value of your possessions is &+w%d.&+w\n",
value_class(findclass("all"), plx, True));
bprintf ("You &*");
if (p >= 4 && p <= 6)
bprintf ("have");
bprintf (t[p], "are");
bprintf("&+w and %s&*.\n",dr[d]);
}
else
{
bprintf("&+L[&+w%s&+L]&*\n\n", make_title(ptitle(plx), pname(plx)));
bprintf("&+wStrength:&+w\t%d&+L/&+w%d&*\n", pstr(plx), maxstrength(plx));
bprintf("&+wScore:&*\t\t%d\n", pscore(plx));
if (plev(plx) < LVL_APPREN)
{ if (pwimpy(plx) > 0)
bprintf("&+wWimpy:&*\t\t%d\n", pwimpy(plx));
bprintf("&+wLevel:&*\t\t%d\n", plev(plx));
bprintf("&+wDrunk level:&*\t%d\n",pdrunk(plx));
if (togo > 0)
bprintf("&+wPoints to next level:&*\t%d\n",
levels[plev(plx)+1] - pscore(plx));
else
bprintf("&+w%s only needs questpoints to level.\n",pname(plx));
}
bprintf("&+w%s has a total of: &+w%d&+w/&+w%d&+w questpoints.\n",pname(plx),qpoints(plx),QP_total);
bprintf("\n");
bprintf ("%s ", pname (plx));
if (p >= 4 && p <= 6)
bprintf ("has ");
bprintf (t[p], "is");
bprintf("\nThe value of %s's possessions is %d.\n", pname(plx),
value_class(findclass("all"), plx, True));
}
}
}
A_COMMAND(meditatecom)
{
if (rom_fun(ploc(mynum)) != NULL)
{ param_s.plx = mynum;
param_s.loc = ploc(mynum);
param_s.ret = 1;
param_s.misc= VERB_MEDITATE;
rom_fun(ploc(mynum))(E_ONMISC);
if (param_s.ret != 1)
return;
}
bprintf ("You &+wmeditate&* quietly in the corner.\n");
}
A_COMMAND(ringcom)
{ if (ob1 > -1)
{ if (obj_fun(ob1) != NULL)
{ param_s.plx = mynum;
param_s.ob = ob1;
param_s.ret = 1;
param_s.misc= VERB_RING;
obj_fun(ob1)(E_ONMISC);
if (param_s.ret != 1)
return;
bprintf("You can't ring that.\n");
}
} else bprintf("Ring what?\n");
}
Boolean find_stuff (int s, int o, char *t)
{
if (odamage (s) == 0)
{
osetdamage (s, 1);
bprintf (t);
create (o);
setoloc (o, ploc (mynum), IN_ROOM);
return True;
}
return False;
}
A_COMMAND(examcom)
{
int a;
FILE *x;
char ch;
char *t;
char text[80];
if (!item1[0])
{
bprintf ("Examine what?\n");
return;
}
if (psitting(mynum) > 1)
{ bprintf("&+wO&+wo&+wo&+wo&+wh&+w.&+w. &+Ll&+wo&+wo&+wk &+wa&+wt&+w "
"t&+wh&+wo&+ws&+we &+wp&+wr&+we&+wt&+wt&+wy &+wc&+wo&+wl&+wo&+wr&+ws&+w!\n");
/* I just love colors - M :P */
return;
}
if ((a = fpbn (item1)) != -1 && ploc (a) == ploc (mynum))
{ /*220692 */
if (pstr (a) < 0)
{
bprintf ("You see the worm-infested corpse of %s.\n", pname (a));
return;
}
if (a >= max_players && (t = pexam (a)) != NULL)
{
bprintf ("%s\n", t);
show_mob_strength(a);
}
else
{
if (a != mynum)
{
sendf (a, "%s examines you closely.\n", pname (mynum));
}
sprintf (text, "%s/%s", DESC_DIR, pname (a));
if ((x = fopen (text, "r")) == NULL)
{ /*ACCESS! */
bprintf ("A typical, run of the mill %s.\n", pname (a));
} else
{ fclose (x);
bprintf ("\001f%s\003", text);
}
show_mob_strength(a);
}
if (mob_fun(a) != NULL)
{ param_s.plx = mynum;
param_s.pl = a;
param_s.ob = -1;
param_s.loc = ploc(mynum);
param_s.ret = 1;
mob_fun(a)(E_ONEXAMINE);
}
return;
}
if ((a = ob1) == -1)
{
bprintf ("You see nothing special.\n");
return;
}
if (isa_board (a))
{
lat_board (a);
return;
}
send_msg (ploc (mynum), 0, pvis (mynum), LVL_MAX, mynum, NOBODY,
"%s examines the %s closely.\n", pname (mynum), oname (a));
/* Special events */
if (obj_fun(onum(a)) != NULL)
{ param_s.ret = 1;
param_s.plx = mynum;
param_s.ob = a;
obj_fun(onum(a))(E_ONEXAMINE);
if (param_s.ret != 1)
return ;
}
/* End of special events */
if (oexam_text (a) != NULL)
{
bprintf ("%s", oexam_text (a));
}
else if (oexamine (a) != 0 && (x = fopen (OBJECTS, "r")) != NULL)
{
fseek (x, oexamine (a), 0);
while ((ch = fgetc (x)) != '^')
bprintf ("%c", ch);
fclose (x);
}
else
{
bprintf ("You see nothing special.\n");
return;
}
}
void incom (Boolean inv)
{
int x, y;
char st[MAX_COM_LEN];
if (!ptstflg (mynum, PFL_GOTO))
{
/* Mortals who doesn't have goto will assume that in = inventory... */
/* Thus hiding the fact that there IS a command called in... */
/* Must fix it so that at this should only be the case when IN is used */
/* and not when AT is used */
/* old: erreval(); */
if (inv)
inventory ();
else
bprintf ("You must be high.\n");
return;
}
if (ltstflg(ploc(mynum),LFL_JAIL) && (plev(mynum) < LVL_ARCHWIZARD) )
{ bprintf("You aren't authorized for that room.\n");
return;
}
if (ltstflg(ploc(mynum),LFL_JAIL) && (plev(mynum) < LVL_DEMI) )
{ bprintf("This is where you are AT, Jail you are IN... deal with it!\n");
return;
}
if ((x = getroomnum ()) == 0 || !exists (x))
{
bprintf ("Unknown Player Or Room\n");
return;
}
if (!checklevel(mynum, x)) return;
if (!has_access_to(mynum,x,-1))
{ bprintf("You're vision is too blurred to make out any details.\n");
return;
}
getreinput (st);
if (EQ (st, "!"))
{
bprintf ("What exactly do you want to do?\n");
return;
}
y = ploc (mynum);
setploc (mynum, x);
Game_Com (st, False);
setploc (mynum, y);
}
/* Hit the reset-stone. */
void sys_reset (void)
{
int i;
for (i = 0; i < max_players; i++)
{ if (!is_in_game(i) || plev(i) >= LVL_APPREN || i == mynum)
continue;
bprintf("Checking %s\n",pname(i));
if (plast_cmd(i) > (global_clock - RESET_IDLE) && ploc(i) != ploc(mynum))
{ bprintf("Some players haven't been idle long enough to be ignored.\n",pname(i));
return;
}
if (ploc (i) != ploc (mynum))
{ bprintf ("There are other players on who are not at this location,"
" so it won't work.\n");
return;
}
}
if (last_reset < global_clock && global_clock < last_reset + RESET_TIME)
{
bprintf ("Sorry, A reset can only take place once every %d minutes.\n",
(RESET_TIME/60));
return;
}
resetcom (0);
}
/* The RESET command. */
void resetcom (int flags)
{ register int i;
extern CALENDAR calendar;
if ((flags & RES_TEST) != 0 && !ptstflg (mynum, PFL_RESET))
{ erreval ();
return;
}
if (ltstflg(ploc(mynum),LFL_JAIL) && (plev(mynum) < LVL_ARCHWIZARD) )
{ bprintf("You can't reset from here!\n");
return;
}
if (brkword () != -1 && plev (mynum) >= LVL_APPREN)
{ int zone, r_locs, r_mobs, r_objs, nlocs, nmobs, nobjs, d_locs, d_mobs, d_objs,i;
char *q = NULL;
if ((zone = get_zone_by_name (wordbuf)) == -1)
{
bprintf ("No such zone: %s\n", wordbuf);
return;
}
i = 0;
while (zonetab[i] <= zone && zonetab[i] != -1 && q == NULL)
{ if (zonetab[i] == zone)
{ questsdone[zonetab[i+1]] = False;
q = Quests[zonetab[i+1]];
}
i+=2;
}
nlocs = znumloc (zone);
nobjs = znumobs (zone);
nmobs = znumchars (zone);
reset_zone (zone, &global_clock, &d_locs, &d_mobs, &d_objs,
&r_locs, &r_mobs, &r_objs);
if (!ztemporary (zone))
{
#ifdef LOG_RESET
mudlog ("RESET: (zone %s) by %s", zname (zone), pname (mynum));
#endif
init_zone(zone);
bprintf ("&+wZone %s: Reset Completed.&*\n", zname (zone));
if (q != NULL)
bprintf ("&+wQuest %s reset.\n",q);
bprintf ("\n%3d (from %d) "
"Room(s) were successfully reset.\n",
r_locs, nlocs - d_locs);
bprintf ("%3d (from %d) "
"Object(s) were successfully reset.\n",
r_objs, nobjs - d_objs);
bprintf ("%3d (from %d) "
"Mobile(s) were successfully reset.\n",
r_mobs, nmobs - d_mobs);
}
else
{
#ifdef LOG_RESET
mudlog ("RESET: (tempzone %s) by %s", zname (zone), pname (mynum));
#endif
bprintf ("Zone %s:\n\n"
"%d Room(s) destroyed.\n"
"%d Objects(s) destroyed.\n"
"%d Mobiles(s) destroyed.\n",
zname (zone),
nlocs, nobjs, nmobs);
}
}
else
{
if (the_world->w_delayed == 1)
{ sendf(DEST_ALL, "Delayed Reboot Activated.\n");
mudlog("REBOOT: DELAYED REBOOT Activated");
numreboots++;
sysreboot(False,False);
the_world->w_delayed = 0;
return;
}
last_reset = global_clock;
broad ("&+wReformatting the world.... Prepare for Action.&*\n");
#ifdef LOG_RESET
mudlog ("RESET: (all zones) by %s", pname (mynum));
#endif
calendar.daytime = 0;
for (i = 0; i <= LAST_QUEST; i++)
questsdone[i] = False;
for (i = 0; i < numzon; i++)
{ reset_zone (i, &global_clock,
NULL, NULL, NULL, NULL, NULL, NULL);
}
for (i = 0; i < max_players; i++)
{ setpwpn(i,-1);
}
init_all();
broad ("&+wReformat succeeded, Go for it!&*\n");
the_world->w_start_loc = 0; /* Remove no-run flag */
numresets++;
}
}
A_COMMAND(praycom)
{
if (rom_fun(ploc(mynum)) != NULL)
{ param_s.plx = mynum;
param_s.misc = VERB_PRAY;
param_s.ret = 1;
rom_fun(ploc(mynum))(E_ONMISC);
if (param_s.ret != 1)
return;
}
if (ob1 > 0 && ob1 < numobs)
{ if (obj_fun(ob1) != NULL)
{ param_s.plx = mynum;
param_s.ob = ob1;
param_s.ret = 1;
param_s.misc = VERB_PRAY;
obj_fun(ob1)(E_ONMISC);
if (param_s.misc != 1)
return;
}
}
bprintf("You fall down and grovel in the dirt.\n");
sillycom ("\001s%s\003%s falls down and grovels in the dirt.\n\003");
}
/* Brian Preble -- shows current set*in/set*out settings.
* (Improved by Alf. Extended to include other players setins by Nicknack.)
*/
A_COMMAND(reviewcom)
{ char xx[SETIN_MAX + 100];
SETIN_REC s;
PERSONA p;
int x;
Boolean me = False;
PLAYER_REC *v = NULL;
char *in_ms, *out_ms, *min_ms, *mout_ms;
char *vin_ms, *vout_ms, *qin_ms, *qout_ms;
char *pro;
char *name;
char *sit_ms, *stand_ms, *sleep_ms, *trance_ms;
char *trenter_ms, *trvict_ms, *trroom_ms;
char *away_ms;
if (brkword () == -1 || EQ (wordbuf, pname (mynum)))
{
me = True;
v = cur_player;
x = mynum;
}
else if ((x = fpbns (wordbuf)) >= 0 && x < max_players &&
plev (x) >= LVL_APPREN)
{
v = players + x;
}
else if (!getuaf (wordbuf, &p) || p.p_level < LVL_APPREN)
{
bprintf ("I know no wizard with the name '%s'.\n", wordbuf);
return;
}
else if (!getsetins (wordbuf, &s))
{
bprintf ("%s has no non-standard travel-messages.\n", p.p_name);
return;
}
if (v != NULL)
{
in_ms = v->setin;
out_ms = v->setout;
min_ms = v->setmin;
mout_ms = v->setmout;
vin_ms = v->setvin;
vout_ms = v->setvout;
qin_ms = v->setqin;
qout_ms = v->setqout;
pro = v->prompt;
sit_ms = v->setsit;
stand_ms = v->setstand;
trenter_ms = v->settrenter;
trvict_ms = v->settrvict;
trroom_ms = v->settrroom;
sleep_ms = v->setsleep;
trance_ms = v->settrance;
away_ms = v->setaway;
name = pname (x);
}
else
{
in_ms = s.setin;
out_ms = s.setout;
min_ms = s.setmin;
mout_ms = s.setmout;
vin_ms = s.setvin;
vout_ms = s.setvout;
qin_ms = s.setqin;
qout_ms = s.setqout;
pro = s.prompt;
sit_ms = s.setsit;
stand_ms = s.setstand;
trenter_ms = s.settrenter;
trvict_ms = s.settrvict;
trroom_ms = s.settrroom;
name = p.p_name;
sleep_ms = s.setsleep;
trance_ms = s.settrance;
away_ms = s.setaway;
}
bprintf ("&+wCurrent travel messages&*");
if (!me)
bprintf (" &+wfor %s&*", name);
bprintf (":\n&+w-------------------------------------------------------&*\n");
bprintf ("&+wSETIN &+w:&* %s\n", build_setin (x, xx, in_ms, name, NULL));
bprintf ("&+wSETOUT &+w:&* %s\n", build_setin (x, xx, out_ms, name, "<dir>"));
bprintf ("&+wSETMIN &+w:&* %s\n", build_setin (x, xx, min_ms, name, NULL));
bprintf ("&+wSETMOUT &+w:&* %s\n", build_setin (x, xx, mout_ms, name, NULL));
bprintf ("&+wSETVIN &+w:&* %s\n", build_setin (x, xx, vin_ms, name, NULL));
bprintf ("&+wSETVOUT &+w:&* %s\n", build_setin (x, xx, vout_ms, name, NULL));
bprintf ("&+wSETQIN &+w:&* %s\n", build_setin (x, xx, qin_ms, name, NULL));
bprintf ("&+wSETQOUT &+w:&* %s\n", build_setin (x, xx, qout_ms, name, NULL));
bprintf ("&+wSETSIT &+w:&* %s\n", build_setin (x, xx, sit_ms, name, NULL));
bprintf ("&+wSETSTAND &+w:&* %s\n", build_setin (x, xx, stand_ms, name, NULL));
bprintf ("&+wSETSLEEP &+w:&* %s\n", build_setin (x, xx, sleep_ms, name, NULL));
bprintf ("&+wSETTRANCE &+w:&* %s\n", build_setin (x, xx, trance_ms, name, NULL) );
bprintf ("&+wSETTRENTER &+w:&* %s\n", build_setin (x, xx, trenter_ms, "<player>", NULL));
bprintf ("&+wSETTRVICT &+w:&* %s\n", build_setin (x, xx, trvict_ms, name, NULL));
bprintf ("&+wSETTRROOM &+w:&* %s&+w\n", build_setin (x, xx, trroom_ms, name, NULL));
bprintf ("&+wSETAWAY &+w:&* %s&+w\n", build_setin (x, xx, away_ms, name, NULL));
if (!me)
bprintf ("&+wPROMPT &+w:&* %s&+w\n", pro);
bprintf ("&+w--------------------------------------------------------&*\n");
}
A_COMMAND(pncom)
{
int plx = real_mynum;
char *p;
if (((brkword () == -1 || (plx = fpbn (wordbuf)) == -1 ||
plx >= max_players || plx != mynum) && plev (mynum) < LVL_APPREN))
{
plx = real_mynum;
}
if (plx == real_mynum)
{
bprintf ("&+wCurrent pronouns are:&*\n");
}
else
{
bprintf ("&+wCurrent pronouns for %s are:&*\n", pname (plx));
}
bprintf ("Me : %s\n", pname (plx));
bprintf ("It : %s\n", (p = players[plx].wd_it) == NULL ? "<none>" : p);
bprintf ("Him : %s\n", (p = players[plx].wd_him) == NULL ? "<none>" : p);
bprintf ("Her : %s\n", (p = players[plx].wd_her) == NULL ? "<none>" : p);
bprintf ("Them : %s\n", (p = players[plx].wd_them) == NULL ? "<none>" : p);
}
static void do_pretend (int plx)
{
int p;
if ((p = cur_player->pretend) >= 0)
{
/* We are someone else, unalias him */
sclrflg (p, SFL_OCCUPIED);
mynum = real_mynum;
cur_player->pretend = -1;
}
if (plx < 0)
{
/* Back to ourselves */
if (p < 0)
return; /* we already are ourselves */
strcpy (cur_player->setin, cur_player->o_setin);
strcpy (cur_player->setout, cur_player->o_setout);
}
else if (!has_access_to(mynum,ploc(plx),-1))
{ bprintf("You can't alias %s.\n",him_or_her(plx));
}
else
{
/* We will pretend to be plx from now */
mynum = plx;
cur_player->pretend = plx;
ssetflg (plx, SFL_OCCUPIED);
if (p < 0)
{
strcpy (cur_player->o_setin, cur_player->setin);
strcpy (cur_player->o_setout, cur_player->setout);
}
if (plx >= max_players)
{
strcpy (cur_player->setin, "%n has arrived.");
strcpy (cur_player->setout, "%n has gone %d.");
}
else
{
strcpy (cur_player->setin, players[plx].setin);
strcpy (cur_player->setout, players[plx].setout);
}
}
}
int find_pretender (int plx)
{
int p;
if (plx == -1)
return -1;
if (ststflg (plx, SFL_OCCUPIED))
{
for (p = 0; p < max_players; p++)
{
if (players[p].pretend == plx && is_in_game (p))
{
return p;
}
}
}
return -1;
}
A_COMMAND(aliascom)
{
if (pl1 == -1)
{
if (ptstflg (mynum, PFL_ALIAS) || ptstflg (mynum, PFL_ALIASP))
{
bprintf ("Who?\n");
}
else
{
erreval ();
}
return;
}
if (cur_player->polymorphed >= 0)
{
bprintf ("A mysterious force stops you.\n");
return;
}
if (pl1 == mynum)
{ bprintf("You would have to explain that sometime..\n");
return;
}
if (ststflg (pl1, SFL_OCCUPIED))
{
bprintf ("Already occupied!\n");
return;
}
if (pl1 < max_players)
{
if (!ptstflg (mynum, PFL_ALIASP))
{
bprintf ("You can't become another player!\n");
return;
}
if (!do_okay (mynum, pl1, PFL_NOALIAS))
{
if (players[pl1].defrob != NULL && plev (mynum) <= LVL_APPREN)
bprintf ("Already occupied!\n");
else
bprintf ("They don't want to be aliased!\n");
return;
}
}
else if (!ptstflg (mynum, PFL_ALIAS))
{
bprintf ("You can't become a mobile!\n");
return;
}
#ifdef LOG_ALIAS
mudlog("ALIAS: %s aliased %s",pname(real_mynum), pname(pl1));
#endif
send_msg(DEST_ALL,MODE_QUIET|MODE_BRACKET,Max(plev(mynum),LVL_ARCHWIZARD),LVL_MAX,
mynum,NOBODY,"%s has aliased to %s",pname(mynum),pname(pl1));
do_pretend (pl1);
cur_player->aliased = True;
cur_player->aliasto = pl1;
bprintf ("Aliased to %s.\n", pname (pl1));
}
void polymorph (int plx, int turns)
{
/* Polymorph to PLX for TURNS turns. */
if (plx < 0 || turns < 0)
{
unpolymorph (real_mynum);
return;
}
do_pretend (plx);
cur_player->polymorphed = turns;
bprintf ("You pass out.....\n..... and wake up.\n");
}
void unalias (int pl)
{
int me = real_mynum;
setup_globals (pl);
if (cur_player->aliased)
{
do_pretend (-1);
cur_player->aliased = False;
cur_player->aliasto = -1;
bprintf ("&+wBack to good old %s....&*\n", pname (mynum));
}
setup_globals (me);
}
PUBLIC void unpolymorph (int pl)
{
int me = real_mynum;
setup_globals (pl);
if (cur_player->polymorphed >= 0)
{
do_pretend (-1);
cur_player->polymorphed = -1;
setpfighting (mynum, -1);
bprintf ("Suddenly you awake... were you dreaming or what?\n");
}
setup_globals (me);
}
PUBLIC A_COMMAND(rollcom)
{ int a;
if ((a = ohereandget ()) == -1)
return;
if (obj_fun(a) != NULL)
{ param_s.plx = mynum;
param_s.ob = a;
param_s.loc = ploc(mynum);
param_s.pl = -1;
param_s.misc= -1;
param_s.ret = 1;
obj_fun(a)(E_ONPUSH);
if (param_s.ret != 1)
return;
}
/* Try push on for size */
if (otstbit (a, OFL_PUSHABLE))
{ setobjstate (a, 0);
oplong (a);
return;
}
if (otstbit (a, OFL_PUSHTOGGLE))
{ setobjstate (a, 1 - state (a));
oplong (a);
return;
}
bprintf ("You can't roll that.\n");
}
PUBLIC A_COMMAND(emptycom)
{ int a, b;
if ((a = ohereandget ()) == -1)
return;
if (otstbit (a, OFL_LOCKABLE) && state (a) == 2 && !ohany (1 << OFL_KEY))
{
bprintf ("The %s is locked, and you have no key.\n", oname (a));
return;
}
else if ((otstbit (a, OFL_OPENABLE) || otstbit (a, OFL_LOCKABLE))
&& state (a) > 0)
{
bprintf ("You open the %s.\n", oname (a));
setobjstate (a, 0);
}
for (b = ofirst_obj (a); b != SET_END; b = onext_obj (a))
{
if (iscontin (b, a))
{
setoloc (b, mynum, CARRIED_BY);
bprintf ("You empty the %s from the %s.\n", oname (b), oname (a));
dropobj(b);
}
}
}
PUBLIC A_COMMAND(treasurecom)
{ int a, c, tc = 0;
char b[40], d[40];
for (a = 0; a < numobs; a++)
{
if (!oflannel (a) && !otstbit (a, OFL_DESTROYED) && ocarrf (a) == IN_ROOM)
{
tc++;
c = findzone (oloc (a), b);
sprintf (d, "%s%d", b, c);
bprintf ("%-13s%-13s", oname (a), d);
if (tc % 3 == 0)
bprintf ("\n");
if (tc % 18 == 17)
pbfr ();
}
}
bprintf ("\nApproximately %d treasures remain.\n", tc);
}
/* The LEVELS command. Display the number of points required to reach each
* new level together with the corresponding male and female titles.
*/
PUBLIC A_COMMAND(levelscom)
{
int i;
bprintf ("&+wLevel Points QP &+wMale Female&*\n");
bprintf ("&+w===== ====== == ==== ======\n");
for (i = 1; i <= LVL_APPREN; i++)
{
bprintf ("&+w%-5d&* &+w%6d&* &+w%2d&* &*the %-17s the %-20s&*\n",
i, levels[i], qp_for_level(i),MLevels[i], FLevels[i]);
}
bprintf ("\n");
}
PUBLIC A_COMMAND(scorepromptcom)
{ Boolean wants_str = False;
Boolean wants_score = False;
Boolean wants_qp = False;
Boolean wants_armor = False;
Boolean wants_damage = False;
if (brkword() == -1)
{ bprintf("Usage: scoreprompt [full/medium/small/off] or see HELP SCOREPROMPT\n");
return;
}
if (strcasecmp(wordbuf,"full") == 0)
{ strcpy(cur_player->prompt,"&+w[%h&+w/&+w%H&+w][%a&+w][%d&+w]&+w> &*");
return;
}
if (strcasecmp(wordbuf,"medium") == 0)
{ strcpy(cur_player->prompt,"&+w[%h&+w/&+w%H&+w][&+w%s&+w]&+w> &*");
return;
}
if (strcasecmp(wordbuf,"small") == 0)
{ strcpy(cur_player->prompt,"&+w[%h&+w/&+w%H&+w]&+w> &*");
return;
}
if (strcasecmp(wordbuf,"off") == 0)
{ strcpy(cur_player->prompt,DEFAULT_PROMPT);
return;
}
do
{ if (strncasecmp(wordbuf,"strength",strlen(wordbuf)) == 0)
wants_str = True;
else if (strncasecmp(wordbuf,"score",strlen(wordbuf)) == 0)
wants_score = True;
else if (strncasecmp(wordbuf,"quests",strlen(wordbuf)) == 0)
wants_qp = True;
else if (strncasecmp(wordbuf,"armor",strlen(wordbuf)) == 0)
wants_armor = True;
else if (strncasecmp(wordbuf,"damage",strlen(wordbuf)) == 0)
wants_damage = True;
else
{ bprintf("I do not understand the option you gave: %s\n",wordbuf);
return;
}
} while (brkword() != -1);
cur_player->prompt[0] = '\0';
if (wants_str)
strcat(cur_player->prompt,"&+w[%h&+w/&+w%H&+w]");
if (wants_score)
strcat(cur_player->prompt,"&+w[&+w%s&+w]");
if (wants_qp)
strcat(cur_player->prompt,"&+w[&+w%q&+w/&+w%Q&+w]");
if (wants_armor)
strcat(cur_player->prompt,"&+w[%a&+w]");
if (wants_damage)
strcat(cur_player->prompt,"&+w[%d&+w]");
strcat(cur_player->prompt,"&+w> &*");
strcpy(cur_player->cprompt,cur_player->prompt);
}
PUBLIC A_COMMAND(promptcom)
{ char buff[MAX_COM_LEN];
int i;
Boolean has_str = False;
Boolean has_maxstr = False;
Boolean has_score = False;
Boolean has_qppl = False;
Boolean has_qp = False;
Boolean has_dam = False;
Boolean has_arm = False;
Boolean has_error = False;
getreinput (buff);
if (strlen(buff) <= 0)
{ strcpy(cur_player->prompt,DEFAULT_PROMPT);
return;
}
if (strlen (buff) > PROMPT_LEN)
{ bprintf ("Max. prompt length is %d.\n", PROMPT_LEN);
return;
}
for (i=0; i < strlen(buff) && !has_error; i++)
{ if (buff[i] == '%')
switch (buff[i+1]) {
case 'A':
case 'a':
has_error = has_arm;
has_arm = True;
break;
case 'd':
case 'D':
has_error = has_dam;
has_dam = True;
break;
case 'Q':
has_error = has_qppl;
has_qppl = True;
break;
case 'q':
has_error = has_qp;
has_qp = True;
break;
case 's':
case 'S':
has_error = has_score;
has_score = True;
break;
case 'H':
has_error = has_maxstr;
has_maxstr = True;
break;
case 'h':
has_error = has_str;
has_str = True;
break;
default:
if (buff[i+1] != '\0')
bprintf("Wrong argument to prompt %%%c isnt valid.\n",buff[i+1]);
else
bprintf("It is not allowed to end a prompt with a %% sign.\n");
return;
}
}
if (has_error)
{ bprintf("You can only have one occurance of each statistic in your prompt.\n");
return;
}
strcpy (cur_player->prompt, buff);
strcpy(cur_player->cprompt,cur_player->prompt);
bprintf ("Ok\n");
}
PUBLIC A_COMMAND(kooshcom)
{
if (ob1 < 0)
{ erreval();
return;
}
if (obj_fun(onum(ob1)) != NULL)
{ param_s.misc = VERB_KOOSH;
param_s.ret = 1;
obj_fun(onum(ob1))(E_ONMISC);
if (param_s.ret != 1)
return;
}
bprintf("You don't have the koosh ball.\n");
}
PUBLIC A_COMMAND(nodcom)
{
if (pl1 < 0 || ploc(pl1) != ploc(mynum))
{ bprintf("You nod solemnly.\n");
sillycom("\001s%s\002%s nods solemnly.\n\003");
}
else
{ sillytp(pl1,"nods to you in agreement.");
bprintf("You nod to %s in agreement.\n",pname(pl1));
send_msg(ploc(mynum),MODE_NOBLIND,LVL_MIN,LVL_MAX,pl1,mynum,
"\001p%s\003 nods to \001p%s\003 in agreement.\n",
pname(mynum),pname(pl1));
}
}
PUBLIC A_COMMAND(flowercom)
{
int a = pl1;
if (a < 0 || pvis(a) > plev(mynum))
{ bprintf("Who is that?\n");
return;
}
if (a == mynum)
{ bprintf("Cute..\n");
return;
}
sillytp (a, "sends you flowers.\n\n"
" &+w(*)&*\n"
" &+w*&* &+w |&* &+w*&*\n"
"&+w \\|/ \\|/ \\|/&*\n"
"&+w-----------------------&*\n");
bprintf ("You send %s flowers.\n", him_or_her (a));
}
PUBLIC A_COMMAND(rosecom)
{
int a = pl1;
if (a < 0 || pvis(a) > plev(mynum))
{ bprintf("Who is that?\n");
return;
}
if (a == mynum)
{ bprintf("Cute..\n");
return;
}
if (a < max_players)
{ if (players[a].linkdead)
{ bprintf("They are absent at the moment, please try later.\n");
return;
}
sillytp (a, "sends you a beautiful rose.\n"
"&+w _____ &*\n"
"&+w / ___ \\ &*\n"
"&+w / / _ \\ \\ &*\n"
"&+w /( /( /(_)\\ )\\ )\\ &*\n"
"&+w ( \\ \\ ___ / / ) &*\n"
"&+w ( \\ _____ / ) &*\n"
"&+w /( )\\ &*\n"
"&+w| \\ / | &*\n"
"&+w| \\ _______ / | &*\n"
"&+w \\ / &+w\\ /&+w \\ / &*\n"
"&+w \\/ &+w| |&+w \\/ &*\n"
"&+w | |/ &*\n"
"&+w | | &*\n"
"&+w \\| | &*\n");
}
bprintf ("You send %s a beautiful rose.\n", pname(a));
}
PUBLIC A_COMMAND(lscom)
{
bprintf("Since you seem to like UNIX so much:\n\n"
"-rw-rw-rw- 1 satan hell 6666666666 Jun 6 66:66 Lucifer.c\n"
"drw-rw-rw- 1 satan hell 1024 Jun 6 66:66 HELL\n"
"-rwxr-xr-x 1 satan hell 666 Jun 6 66:66 &+wStartHell&*\n");
}
PUBLIC A_COMMAND(petcom)
{
int a;
if ((a = vichere ()) < 0)
return;
if (a == mynum)
{
bprintf ("No petting yourself in public, please.\n");
return;
}
if (mob_fun(a) != NULL)
{ param_s.plx = mynum;
param_s.ob = -1;
param_s.pl = a;
param_s.loc = ploc(mynum);
param_s.ret = 1;
param_s.misc= VERB_PAT;
mob_fun(a)(E_ONMISC);
if (param_s.ret != 1)
return;
}
sillytp (a, "pats you on the head.");
bprintf ("You pat %s on the head.\n", him_or_her (a));
}
A_COMMAND(cutcom)
{ if (brkword() == -1)
{ bprintf("Cut what?\n");
return;
}
if (ob1 == -1)
{ bprintf("Cut what?\n");
return;
}
if (obj_fun(onum(ob1)) != NULL)
{ param_s.plx = mynum;
param_s.ob = ob1;
param_s.loc = oloc(mynum);
param_s.ret = 1;
param_s.misc = VERB_CUT;
obj_fun(onum(ob1))(E_ONMISC);
if (param_s.ret != 1)
return;
}
bprintf("You can't cut that.\n");
}
PUBLIC A_COMMAND(wavecom)
{ int a;
if (pfighting (mynum) >= 0)
{
bprintf ("What are you trying to do? Make 'em die laughing?\n");
return;
}
if (EMPTY (item1))
{
sillycom ("\001s%s\002%s waves happily.\n\003");
bprintf ("You wave happily.\n");
return;
}
if ((a = ob1) < 0)
{ if (pl1 == mynum)
{ bprintf("You silly!\n");
return;
}
else if (pl1 == -1)
{ bprintf("Wave to who?\n");
return;
}
else
{ send_msg(ploc(mynum),MODE_NOBLIND,LVL_MIN,LVL_MAX,mynum,a,
"\001p%s\003 waves to \001p%s\003.\n",pname(mynum),pname(a));
bprintf("You wave to %s.\n",pname(a));
sillytp(a,"waves to you.");
}
return;
}
/* Special events */
if (obj_fun(onum(a)) != NULL)
{ param_s.plx = mynum;
param_s.ob = a;
param_s.loc = ploc(mynum);
param_s.pl = -1;
param_s.to = -1;
param_s.ret = 1;
param_s.misc = VERB_WAVE;
obj_fun(onum(a))(E_ONMISC);
if (param_s.ret != 1)
return;
}
bprintf ("Nothing happens.\n");
}
PUBLIC A_COMMAND(lightcom)
{ int a;
if (pl1 == mynum && plev(mynum) >= LVL_APPREN)
{
ssetflg(mynum, SFL_GLOWING);
bprintf("You &+wlight&* yourself!\n");
return;
}
if ((a = ohereandget ()) == -1)
return;
if (!p_ohanyflag(mynum,OFL_LIT) && !p_ohanyflag(mynum,OFL_MAGICLIT))
/* if (ohany(1<<OFL_LIT))*/
{
bprintf ("You have nothing to light things from.\n");
return;
}
if (obj_fun(onum(a)) != NULL)
{ param_s.plx = mynum;
param_s.loc = oloc(a);
param_s.ob = a;
param_s.ret = 1;
obj_fun(onum(a))(E_ONLIGHT);
if (param_s.ret != 1)
return;
}
if (!otstbit (a, OFL_LIGHTABLE))
bprintf ("You can\'t light that!\n");
else if (otstbit (a, OFL_LIT))
bprintf ("It\'s already lit.\n");
else
{
setobjstate (a, 0);
osetbit (a, OFL_LIT);
bprintf ("Ok\n");
}
}
PUBLIC A_COMMAND(extinguishcom)
{ int a;
if (pl1 == mynum && plev(mynum) >= LVL_APPREN)
{
sclrflg(mynum, SFL_GLOWING);
bprintf("You put yourself out before you accidently set a mortal alight!\n");
return;
}
if ((a = ohereandget ()) == -1)
return;
if (otstbit(a, OFL_MAGICLIT))
bprintf ("You can't find the source of the light.\n");
else if (!otstbit (a, OFL_LIT))
bprintf ("It\'s not lit!\n");
else if (!otstbit (a, OFL_EXTINGUISH))
bprintf ("You can\'t extinguish that!\n");
else
{
setobjstate (a, 1);
oclrbit (a, OFL_LIT);
bprintf ("Ok\n");
}
}
PUBLIC A_COMMAND(pushcom)
{ int x;
if (brkword () == -1)
{
bprintf ("Push what?\n");
return;
}
if ((x = fobna (wordbuf)) == -1)
{
bprintf ("That is not here.\n");
return;
}
/* Here used to stand a Very long list of exceptions... */
if (obj_fun(onum(x)) != NULL) /* For cloned objects , and non-cloned*/
{ param_s.plx = mynum;
param_s.loc = ploc(mynum);
param_s.ob = x;
param_s.ret = 1;
obj_fun(onum(x))(E_ONPUSH);
if (param_s.ret != 1)
return;
}
if (otstbit (x, OFL_PUSHABLE))
{ setobjstate (x, 0);
oplong (x);
return;
}
if (otstbit (x, OFL_PUSHTOGGLE))
{ int n = state(x) -1;
if (n < 0)
n = omaxstate(x);
setobjstate (x, n /*1 - state (x)*/);
oplong (x);
return;
}
bprintf ("Nothing happens.\n");
}
PUBLIC A_COMMAND(followcom)
{ int i;
if (cur_player->i_follow >= 0)
{
bprintf ("Stopped following \001P%s\003.\n", pname (cur_player->i_follow));
sendf(cur_player->i_follow,"%s stopped following you.\n",pname(mynum));
cur_player->i_follow = -1;
return;
}
if (pfighting (mynum) != -1)
{
bprintf ("Not in a fight!\n");
return;
}
if (EMPTY (item1) || pl1 == -1)
{
bprintf ("Who?\n");
return;
}
if (ploc (pl1) != ploc (mynum) && pvis(mynum) >= pvis(pl1) )
{
bprintf ("They aren't here.\n");
return;
}
if (mynum == pl1)
{
bprintf ("You run round in circles!\n");
return;
}
i = pl1;
if ((i != -1) && (i < max_players))
{
i = players[i].i_follow;
if (i == mynum)
{
bprintf("You chase each other in circles!\n");
return;
}
}
sendf (pl1, "%s is following you.\n", see_name (pl1, mynum));
cur_player->i_follow = pl1;
bprintf ("Ok\n");
}
PUBLIC A_COMMAND(losecom)
{
if (cur_player->i_follow == -1)
{
bprintf ("You aren't following anyone.\n");
return;
}
cur_player->i_follow = -1;
bprintf ("Ok\n");
}
/**************************************************************************
* The BULLETIN command
***************************************************************************/
PRIVATE void bull3 (char *cont)
{
bprintf ("\001f%s\003", BULLETIN3);
get_command (NULL);
}
PRIVATE void bull2 (char *cont)
{
bprintf ("\001f%s\003", BULLETIN2);
if (plev (mynum) < LVL_ARCHWIZARD)
get_command (NULL);
else
{
bprintf (pwait);
replace_input_handler (bull3);
}
}
PUBLIC void bulletincom (void)
{
bprintf ("\001f%s\003", BULLETIN1);
if (plev (mynum) < LVL_APPREN)
return;
bprintf (pwait);
replace_input_handler (bull2);
}
void boot_reset ()
{ register int i;
extern CALENDAR calendar;
calendar.daytime = 0;
global_clock = time (0);
for (i = 0; i < numzon; i++)
reset_zone (i, &global_clock, NULL, NULL, NULL, NULL, NULL, NULL);
for (i = 0; i <= LAST_QUEST; i++)
questsdone[i] = False;
/* Initialise special events */
setfunctions();
init_all();
mudlog ("SYSTEM: RELOADing the Deamon");
last_reset = time (0);
}
PUBLIC A_COMMAND(timeoutcom)
{
int x;
char name[80];
if (!ptstflg (mynum, PFL_TIMEOUT))
{
bprintf ("You can't do that now.\n");
return;
}
if (EMPTY (item1))
{
bprintf ("Timeout who?\n");
return;
}
if ((x = pl1) == -1)
{
bprintf ("No such player or mobile on the game.\n");
return;
}
if (x >= max_players)
{ /* mobile */
dumpstuff (x, ploc (x));
setpfighting (x, -1);
if (!ppermanent (x))
{
sprintf (name, "non-permanent mobile %s", pname (x));
destruct_mobile (x, NULL);
}
else
{
sprintf (name, "permanent mobile %s", pname (x));
setpname (x, "");
}
}
else if (wlevel (plev (mynum)) < wlevel (plev (x)))
{
bprintf ("You can't time out %s.\n", pname (x));
}
else if (ptstflg(x,PFL_NOTIMEOUT) && plev(mynum) <= plev(x))
{
bprintf("%s refuses to be timed out.\n",pname(x));
return;
}
else
{ /* player */
int y = real_mynum;
setup_globals (x);
sprintf (name, "player %s", pname (x));
crapup ("\tYou have timed out.", CRAP_SAVE | CRAP_RETURN);
setup_globals (y);
}
#ifdef LOG_TOUT
mudlog ("TOUT: %s touted %s", pname (mynum), name);
#endif
send_msg (DEST_ALL, MODE_QUIET | MODE_BRACKET,Max(pvis(x),LVL_ARCHWIZARD), LVL_MAX, x, mynum,
"%s timed out %s", pname (mynum), name);
return;
}
/****************************************************************************
* Config command by Marty
* Show a players sflags in a nice orderly way
****************************************************************************/
PUBLIC A_COMMAND(config)
{ int plx=mynum;
if (cur_player->aliased || cur_player->polymorphed >= 0)
{ bprintf("Not while aliased.\n");
return;
}
if (plev(mynum) >=LVL_APPREN)
{ if (brkword()!= -1)
{ plx = pl1;
if (plx < 0 || plx >= max_players || !players[plx].iamon)
{ bprintf("Unknown player, or player is a mobile.\n");
return;
}
}
}
bprintf("&+w[&+wConfiguration for player %-12s&+w]-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-&*\n",pname(plx));
bprintf("&+wColor &+w= &+w%s &+w(COLOR) ",ststflg(plx,SFL_COLOR) ? "On " : "Off");
bprintf("&+wAutoexit &+w= &+w%s &+w(AUTOEXIT)\n",ststflg(plx,SFL_AUTOEXIT) ? "On " : "Off");
bprintf("&+wCompact &+w= &+w%s &+w(COMPACT) ",ststflg(plx,SFL_COMPACT) ? "On " : "Off");
bprintf("&+wShouts &+w= &+w%s &+w(NOSHOUT)\n",ststflg(plx,SFL_NOSHOUT) ? "Off" : "On ");
bprintf("&+wBeeps &+w= &+w%s &+w(NOBEEP) ",ststflg(plx,SFL_NOBEEP) ? "Off" : "On ");
bprintf("&+wBrief mode &+w= &+w%s &+w(BRIEF)\n",ststflg(plx,SFL_BRIEF) ? "On " : "Off");
bprintf("&+wQuiet mode &+w= &+w%s &+w(QUIET) ",ststflg(plx,SFL_QUIET) ? "On " : "Off");
bprintf("&+wSayBack &+w= &+w%s &+w(SAYBACK)\n",ststflg(plx,SFL_SAYBACK) ? "On ": "Off");
bprintf("&+wBusy mode &+w= &+w%s &+w(BUSY) ",ststflg(plx,SFL_BUSY) ? "On ": "Off");
bprintf("&+wGossips &+w= &+w%s &+w(NOGOSSIP)\n",ststflg(plx,SFL_NO_GOSSIP) ? "Off" : "On ");
bprintf("&+wChat channel&+w= &+w%s &+w(NOCHAT) ",ststflg(plx,SFL_NO_CHAT) ? "Off" : "On ");
bprintf("&+wAway &+w= &+w%s &+w(AWAY)\n",ststflg(plx,SFL_AWAY) ? "On ": "Off");
bprintf("&+wBattles &+w= &+w%s &+w(NOBATTLE) ",ststflg(plx,SFL_NOBATTLE) ? "Off": "On ");
bprintf("&+wInventories &+w= &+w%s &+w(NOINVEN)\n",ststflg(plx,SFL_NOINVEN) ? "Off" : "On ");
bprintf("&+wPager length&+w= &+w%.3d &+w(SETPAGER) ",ppager(plx));
bprintf("&+wKeyboardLock&+w= &+w%s &+w(KLOCK)\n",(ststflg(plx,SFL_KLOCKED))? "On " : "Off");
bprintf("&+wShort Exits &+w= &+w%s &+w(SHORTEXIT) ",ststflg(plx,SFL_SHORTEXIT) ? "On " : "Off");
bprintf("&+wPrivateEmail&+w= &+w%s &+w(NOFINGER)\n",ststflg(plx,SFL_NOFINGER) ? "On ": "Off");
bprintf("&+wPuff Msgs &+w= &+w%s &+w(NOPUFF) ",ststflg(plx,SFL_NOPUFF) ? "Off" : "On ");
bprintf("&+wWeather &+w= &+w%s &+w(NOWEATHER)\n",ststflg(plx,SFL_NOWEATHER) ? "Off" : "On ");
bprintf("&+wAutoeat &+w= &+w%s &+w(AUTOEAT) ",ststflg(plx,SFL_AUTOEAT) ? "On " : "Off");
bprintf("&+wOld Login &+w= &+w%s &+w(OLDLOGIN)\n",ststflg(plx,SFL_OLDLOGIN) ? "On" : "Off");
/* Now only the Wizard+ sflags */
if (plev(plx) >= LVL_APPREN)
{
bprintf("\n&+wAloof &+w= &+w%s &+w(ALOOF) ",ststflg(plx,SFL_ALOOF) ? "On " : "Off");
bprintf("&+wGlowing &+w= &+w%s &+w(LIGHT)\n",ststflg(plx,SFL_GLOWING) ? "On ": "Off");
bprintf("&+wWiz channel &+w= &+w%s &+w(NOWIZ) ",ststflg(plx,SFL_NO_WIZ) ? "Off": "On ");
bprintf("&+wSlain msg &+w= &+w%s &+w(NOSLAIN)\n",ststflg(plx,SFL_NOSLAIN) ? "Off" : "On ");
bprintf("&+wNo Comms &+w= &+w%s &+w(NOCOMM) ",ststflg(plx,SFL_NOCOMM) ? "On " : "Off");
bprintf("&+wInterMUD &+w= &+w%s &+w(INOGOSSIP)\n",ststflg(plx,SFL_I_NOGOSSIP) ? "Off" : "On ");
if (ptstflg(plx,PFL_MAYCODE))
bprintf("&+wCoding &+w= &+w%s &+w(CODING)\n",ststflg(plx,SFL_CODING) ? "On ": "Off");
}
bprintf("&+w%s&*\n",MIXLINE);
}
A_COMMAND(klockstart)
{ klockcom(NULL);
}
/* Key board lock */
PUBLIC void klockcom (char *passwd)
{ char pass[sizeof(cur_player->passwd)];
if (passwd == NULL)
{ ssetflg(mynum,SFL_KLOCKED);
bprintf("\001C\003");
bflush();
bprintf("Locking the keyboard with login password\n");
bprintf("\377\373\001\001Enter password: ");
strcpy(cur_player->cprompt,cur_player->prompt);
strcpy(cur_player->prompt,"\377\373\001\001Enter Password: ");
cur_player->no_echo = True;
replace_input_handler(klockcom);
return;
} else
{
my_crypt(pass,passwd,sizeof(pass));
if (strcmp(pass,cur_player->passwd) == 0)
{ bprintf("\377\374\001\001\nPassword correct, Keyboard unlocked.\n");
replace_input_handler(get_command);
cur_player->no_echo = False;
sclrflg(mynum,SFL_KLOCKED);
sclrflg(mynum,SFL_DISTRACTED);
strcpy(cur_player->prompt,cur_player->cprompt);
bprintf("%s",cur_player->prompt);
return;
}
else
{ bprintf("\377\373\001\001 Wrong password\nEnter password: ");
return;
}
}
}