/******************************************************************************
** Project : pDirt (Aber IV MUD Deamon)
** Module : Pets.c
** Author : Peter Eussen (Marty)
** Description: An attempt for a personalised, yet standard Pets system.
** Version : 0.0
** Date : August 1996
**
** These are just some functions that can be called from the user special
** event function in Players.c. It currently holds 2 non-completed pets:
** a demon and an elf. I guess you will be able to figure out how they work,
** it's pretty straightforward.
*****************************************************************************/
#include "Pets.h"
/******************************************************************************
** The demon pet.
** Currently the only pet in the system. Commands are:
** demon greet <plx>
** demon hug <plx>
** demon scare <plx>
*******************************************************************************/
void demon_pet(char *name,int event, Boolean he, int *mob)
{ static char *demon_tab[] =
{ "greet", "hug", "scare",
TABLE_END
};
if (event == E_ONTIMER)
return;
switch (event) {
case E_ONINIT:
if (plev(param_s.plx) > LVL_DEMI)
sendf(param_s.plx,"Loading User Code....\n");
if (randperc() < 75)
{
sendf(param_s.plx,"%s comes in and sits on your shoulder.\n",name);
send_msg(ploc(param_s.plx),MODE_NOBLIND,pvis(param_s.plx),LVL_MAX,param_s.plx,NOBODY,
"%s comes in and sits on \001p%s\003's shoulder.\n",
name,pname(param_s.plx));
}
else
sendf(param_s.plx,"%s feels a bit cranky today, and decides to stay at the Pet Store.\n",name);
break;
case E_USER:
if (strncasecmp(param_s.buf,"demon",strlen(param_s.buf)) == 0)
{ int demon_cmd;
param_s.ret = 0;
if (brkword() != -1)
{ demon_cmd = tlookup(wordbuf,demon_tab);
if (demon_cmd >= 0)
{ int plx = -1;
if (brkword() != -1)
plx = fpbns(wordbuf);
switch(demon_cmd) {
case 0: if (plx < 0 || plx > numchars)
{ sendf(param_s.plx,"%s doesn't know them.\n",name);
}
else
{ sendf(param_s.plx,"%s flies off to greet %s.\n",name,
pname(plx));
send_msg(ploc(param_s.plx),MODE_NOBLIND,pvis(param_s.plx),LVL_MAX,param_s.plx,NOBODY,
"%s flies off to greet someone.\n",name);
if (ploc(param_s.plx) == ploc(plx))
{ send_msg(ploc(plx),MODE_NOBLIND,LVL_MIN,LVL_MAX,plx,NOBODY,
"%s flies towards %s and starts playing with %s hair joyfully.\n",
name,pname(plx),his_or_her(plx));
sendf(plx,"%s rushes towards you in a blinding joy, and plays with your hair.\n"
"while playing %s says: &+W'%s is happy to see you'&*\n",
name,he ? "he" : "shes", pname(param_s.plx));
send_msg(ploc(param_s.plx),MODE_NOBLIND,pvis(param_s.plx),LVL_MAX,param_s.plx,NOBODY,
"%s flies back to \001p%s\003.\n",name,pname(param_s.plx));
}
else
{ send_msg(ploc(plx),MODE_NOBLIND,LVL_MIN,LVL_MAX,plx,NOBODY,
"%s comes in and plays with \001p%s\003 %s hear, making it a complete mess.\n",
name,pname(plx),his_or_her(plx));
sendf(plx,"%s flies straight towards you in a blinding joy, and plays with your hair.\n"
"while playing %s says: &+W'%s is happy to see you'&*\n",
name,he ? "he" : "she", pname(param_s.plx));
send_msg(ploc(param_s.plx),MODE_NOBLIND,pvis(param_s.plx),LVL_MAX,NOBODY,NOBODY,
"%s comes back from a succesfull mission.\n",name);
}
}
break;
case 1: if (plx < 0 || plx > numchars)
bprintf("%s doesn't know them.\n",name);
else
{ if (ploc(plx) == ploc(param_s.plx))
{ bprintf("%s hugs %s closely.\n",name,pname(plx));
sendf(plx,"%s hugs you closely.\n",name);
send_msg(ploc(plx),MODE_NOBLIND,Max(pvis(mynum),pvis(plx)), LVL_MAX, plx, mynum,
"%s hugs %s closely.\n",name,pname(plx));
}
else
{ bprintf("You send %s out to hug %s.\n",name,pname(plx));
send_msg(ploc(param_s.plx),MODE_NOBLIND,LVL_MIN,LVL_MAX,param_s.plx,NOBODY,
"\001p%s\003 sends %s demon out on a mission.\n",pname(mynum),
his_or_her(param_s.plx));
send_msg(ploc(plx),MODE_NOBLIND,LVL_MIN,LVL_MAX,plx,NOBODY,
"%s the demon comes in flying towards \001p%s\003.\n",
name,pname(plx));
sendf(plx,"%s comes flying in and hugs you closely.\n",name);
send_msg(ploc(plx),MODE_NOBLIND,LVL_MIN,LVL_MAX,NOBODY,NOBODY,
"%s flies back to %s owner.\n",name, he ? "his" : "her");
send_msg(ploc(param_s.plx),MODE_NOBLIND,LVL_MIN,LVL_MAX,param_s.plx,NOBODY,
"%s returns from a succesfull mission.\n");
}
}
break;
case 2: sendf(param_s.plx,"Demon scare command.\n");
break;
default: sendf(param_s.plx,"%s looks baffeled.\n",pname(param_s.plx));
break;
}
return;
}
}
sendf(param_s.plx, "%s wonders what you are up to next.\n",name);
send_msg(ploc(param_s.plx),MODE_NOBLIND,pvis(param_s.plx),LVL_MAX,param_s.plx,NOBODY,
"%s wonders what %s is up to next.\n",
name,pname(param_s.plx));
}
break;
default: break;
}
}
void elf_pet(char *name,int event, Boolean he, int *mob)
{ static char *elf_cmds[] =
{ "greet", "tickle", "hate",
TABLE_END
};
switch (event) {
case E_ONINIT:
sendf(param_s.plx,"%s comes in and hides in one of your pockets.\n",name);
send_msg(ploc(param_s.plx),MODE_NOBLIND,pvis(param_s.plx),LVL_MAX,param_s.plx,NOBODY,
"%s comes flying in and hides in \001p%s\003's pocket.\n",name,
pname(param_s.plx));
break;
case E_USER:
if (strncasecmp(param_s.buf,name,strlen(param_s.buf)) == 0)
{ if (brkword() != -1)
{ int verb = tlookup(wordbuf,elf_cmds);
int plx = -1;
if (verb > 0)
{ if (brkword() != -1)
plx = fpbns(wordbuf);
switch(verb) {
case 0: sendf(param_s.plx,"Greet com\n");break;
case 1: sendf(param_s.plx,"Tickle com\n");break;
case 2:
if (plx < 0 || plx > numchars)
{ sendf(param_s.plx,"%s looks everywhere but %s can't find them.\n",
name, he ? "he" : "she");
}
else
{ sendf(param_s.plx,"%s is going to teach %s a lesson!\n",name,pname(plx));
if (ploc(param_s.plx) != ploc(plx))
{ sendf(ploc(param_s.plx),"%s flies away to teach %s a lesson %s won't forget.\n",
name, pname(plx),he_or_she(plx) );
send_msg(ploc(plx),MODE_NOBLIND,pvis(plx),LVL_MAX,plx,NOBODY,
"%s comes flying in and flies towards %s.\n",name,
pname(plx));
sendf(plx,"%s flies towards YOU!\n",name);
}
send_msg(ploc(plx),MODE_NOBLIND,LVL_MIN,LVL_MAX,plx,NOBODY,
"%s sells \001p%s\003 a solid blow to the chin.\n",name,
pname(plx));
sendf(ploc(plx),"%s shouts &+W'TAKE THAT YOU.... YOU MEANY!'&*\n",name);
setpstr(plx,pstr(plx) /2);
sendf(plx,"%s sells you a solid blow to the chin!\n"
"You faint and fall to the ground.\n",name);
if (plx < max_players)
{ setpsitting(plx,2);
send_msg(ploc(plx),MODE_NOBLIND,LVL_MIN,LVL_MAX,plx,NOBODY,
"\001p%s\003 falls to the ground.\n%s says &+W'Whimp!'&*\n",
pname(plx),name);
}
}
break;
default:
sendf(param_s.plx,"%s doesn't know what you mean.\n",name);
break;
}
}
else
sendf(param_s.plx,"%s doesn't know what you mean.\n",name);
}
else
{ sendf(param_s.plx,"You take a look at your sweet little elf.\n");
send_msg(ploc(param_s.plx),MODE_NOBLIND,pvis(param_s.plx),LVL_MAX,param_s.plx,NOBODY,
"%s takes a look at %s little elf.\n",
pname(param_s.plx), his_or_her(param_s.plx));
}
param_s.ret = 0;
}
break;
default: break;
}
}