Appendix D. Commands Zone

%zone                                  commands
reset RESET_NOT

weather 1040

creators {"whistler","papi"}

notes
"This is the commands zone. Don't let any rooms point to this zone, or use any
objects from this zone without special permission. Do not slime objects from
this zone."

help
"This zone is not intended for players."
#define  CLAN_NAME   "$clan_name"
%dil

dilbegin stringlist shell (s:stringlist);
var
	ln:integer;
	imax:integer;
	i:integer;
	iVal:string;
	inc:integer;
	j:integer;
code
{
iMax:=length(s);
inc:=0;

while (inc < iMax)
	inc := inc *3+1;

inc :=inc/3;
while(inc > 0)
	{
	i:=inc;
	while (i < iMax)
		{
		iVal := s.[i];
		j:=i;
		while(j > (inc-1))
			{
			if(iVal < s.[j - inc])
				{
				s.[j] := s.[j - inc];
				}
			else
				break;
			j:=j-inc;
			}
		s.[j] := iVal;
		i:=i+1;
		}
	inc := inc /3;
	}

return (s);
}
dilend

dilbegin comm_dil(arg : string);
external
 stringlist shell (s:stringlist);
var
 newlist:stringlist;
	istart:integer;
  cmd : cmdptr;
  i : integer;
	cmdlist:stringlist;
	imax:integer;
	ln:integer;
	buff:string;
code
{
istart:=0;
   cmd := chead();
	while (cmd)
	{
	if ((cmd.level<=self.level) and
	(cmd.type!=TYPE_SOCIAL) and
	(cmd.type!=TYPE_SKILL))
	addstring (cmdlist,cmd.name);
	cmd := cmd.next;
	}

newlist :=shell(cmdlist);
i:=0;
sendtext ("The following commands are available:&n&n",self);
buff:="";
iMax:=length (newlist);
while (i<iMax)
	{
	if (i<iMax){
		buff :=buff+"&s5";
		ln:=length(newlist.[i]);
	ln:=15-ln;
	buff:=buff+newlist.[i]+"&&s"+itoa(ln);
	}
				 else
				 {
				  buff:=buff+"&n";
					break;
					}
	if (i+1<iMax){
		ln:=length(newlist.[i+1]);
	ln:=15-ln;
	buff:=buff+newlist.[i+1]+"&&s"+itoa(ln);
	}
				 else
				 {
				  buff:=buff+"&n";
					break;
					}
	if (i+2<iMax){
		ln:=length(newlist.[i+2]);
	ln:=15-ln;
	buff:=buff+newlist.[i+2]+"&&s"+itoa(ln);
				 }
				 else
				 {
				  buff:=buff+"&n";
					break;
					}
	if (i+3<iMax){
	buff:=buff+newlist.[i+3]+"&n";
				 }
				 else
				 {
				  buff:=buff+"&n";
					break;
					}
	i:=i+4;
	}
buff:=textformat(buff);
pagestring (buff,self);

   quit;
}
dilend


dilbegin soc_dil(arg : string);
external
 stringlist shell (s:stringlist);
var
 buff:string;
newlist:stringlist;
  cmd : cmdptr;
  i : integer;
	ln:integer;
	cmdlist:stringlist;
	imax:integer;
code
{
   cmd := chead();
	while (cmd)
	{
	if ((cmd.level<=self.level) and
	(cmd.type==TYPE_SOCIAL))
	addstring (cmdlist,cmd.name);
	cmd := cmd.next;
	}
sendtext ("The following socials are available:&n&n",self);

newlist :=shell(cmdlist);
i:=0;
buff:="";
iMax:=length (newlist);
while (i<iMax)
	{
	if (i<iMax){
		buff :=buff+"&s5";
		ln:=length(newlist.[i]);
	ln:=15-ln;
	buff:=buff+newlist.[i]+"&&s"+itoa(ln);
	}
				 else
				 {
				  buff:=buff+"&n";
					break;
					}
	if (i+1<iMax){
		ln:=length(newlist.[i+1]);
	ln:=15-ln;
	buff:=buff+newlist.[i+1]+"&&s"+itoa(ln);
	}
				 else
				 {
				  buff:=buff+"&n";
					break;
					}
	if (i+2<iMax){
		ln:=length(newlist.[i+2]);
	ln:=15-ln;
	buff:=buff+newlist.[i+2]+"&&s"+itoa(ln);
				 }
				 else
				 {
				  buff:=buff+"&n";
					break;
					}
	if (i+3<iMax){
	buff:=buff+newlist.[i+3]+"&n";
				 }
				 else
				 {
				  buff:=buff+"&n";
					break;
					}
	i:=i+4;
	}
buff:=textformat(buff);
pagestring (buff,self);

   quit;
}
dilend

dilbegin ski_dil(arg : string);
external
 stringlist shell (s:stringlist);
var
 buff:string;
newlist:stringlist;
  cmd : cmdptr;
  i : integer;
	ln:integer;
	cmdlist:stringlist;
	imax:integer;
code
{
   cmd := chead();
	while (cmd)
	{
	if ((cmd.level<=self.level) and
	(cmd.type==TYPE_SKILL))
	addstring (cmdlist,cmd.name);
	cmd := cmd.next;
	}

addstring (cmdlist,"dual wield");
addstring (cmdlist,"shield");
addstring(cmdlist,"climb");
addstring (cmdlist,"leadership");
sendtext ("The following skills are available:&n&n",self);

newlist :=shell(cmdlist);
i:=0;
buff:="";
iMax:=length (newlist);
while (i<iMax)
	{
	if (i<iMax){
		buff :=buff+"&s5";
		ln:=length(newlist.[i]);
	ln:=15-ln;
	buff:=buff+" "+newlist.[i]+" &&s"+itoa(ln);
	}
				 else
				 {
				  buff:=buff+"&n";
					break;
					}
	if (i+1<iMax){
		ln:=length(newlist.[i+1]);
	ln:=15-ln;
	buff:=buff+" "+newlist.[i+1]+" &&s"+itoa(ln);
	}
				 else
				 {
				  buff:=buff+"&n";
					break;
					}
	if (i+2<iMax){
	buff:=buff+" "+newlist.[i+2]+"&n";
				 }
				 else
				 {
				  buff:=buff+"&n";
					break;
					}
	i:=i+3;
	}
buff:=textformat(buff);
pagestring (buff,self);

   quit;
}
dilend

dilbegin wizhelp(arg : string);
external
 stringlist shell (s:stringlist);
var
 buff:string;
newlist:stringlist;
  cmd : cmdptr;
  i : integer;
	ln:integer;
	cmdlist:stringlist;
	imax:integer;
code
{
   cmd := chead();
	while (cmd)
	{
	if ((cmd.level<=self.level) and
	(cmd.level>=200) and
	(cmd.type!=TYPE_SOCIAL))
	addstring (cmdlist,cmd.name+"<"+itoa(cmd.level)+">");
	cmd := cmd.next;
	}
sendtext ("The following Admin commands are available:&n&n",self);

newlist :=shell(cmdlist);
i:=0;
buff:="";
iMax:=length (newlist);
while (i<iMax)
	{
	if (i<iMax){
		buff :=buff+"&s5";
		ln:=length(newlist.[i]);
	ln:=18-ln;
	buff:=buff+newlist.[i]+"&&s"+itoa(ln);
	}
				 else
				 {
				  buff:=buff+"&n";
					break;
					}
	if (i+1<iMax){
		ln:=length(newlist.[i+1]);
	ln:=18-ln;
	buff:=buff+newlist.[i+1]+"&&s"+itoa(ln);
	}
				 else
				 {
				  buff:=buff+"&n";
					break;
					}
	if (i+2<iMax){
		ln:=length(newlist.[i+2]);
	ln:=18-ln;
	buff:=buff+newlist.[i+2]+"&&s"+itoa(ln);
				 }
				 else
				 {
				  buff:=buff+"&n";
					break;
					}
	if (i+3<iMax){
	buff:=buff+newlist.[i+3]+"&n";
				 }
				 else
				 {
				  buff:=buff+"&n";
					break;
					}
	i:=i+4;
	}
buff:=textformat(buff);
pagestring (buff,self);

   quit;
}
dilend

dilbegin wizsoc(arg : string);
external
 stringlist shell (s:stringlist);
var
 buff:string;
newlist:stringlist;
  cmd : cmdptr;
  i : integer;
	ln:integer;
	cmdlist:stringlist;
	imax:integer;
code
{
   cmd := chead();
	while (cmd)
	{
	if ((cmd.level<=self.level) and
	(cmd.level>=200) and
	(cmd.type==TYPE_SOCIAL))
	addstring (cmdlist,cmd.name+"<"+itoa(cmd.level)+">");
	cmd := cmd.next;
	}

newlist :=shell(cmdlist);
i:=0;
sendtext ("The following Admin socials are available:&n&n",self);
buff:="";
iMax:=length (newlist);
while (i<iMax)
	{
	if (i<iMax){
		buff :=buff+"&s5";
		ln:=length(newlist.[i]);
	ln:=18-ln;
	buff:=buff+newlist.[i]+"&&s"+itoa(ln);
	}
				 else
				 {
				  buff:=buff+"&n";
					break;
					}
	if (i+1<iMax){
		ln:=length(newlist.[i+1]);
	ln:=18-ln;
	buff:=buff+newlist.[i+1]+"&&s"+itoa(ln);
	}
				 else
				 {
				  buff:=buff+"&n";
					break;
					}
	if (i+2<iMax){
		ln:=length(newlist.[i+2]);
	ln:=18-ln;
	buff:=buff+newlist.[i+2]+"&&s"+itoa(ln);
				 }
				 else
				 {
				  buff:=buff+"&n";
					break;
					}
	if (i+3<iMax){
	buff:=buff+newlist.[i+3]+"&n";
				 }
				 else
				 {
				  buff:=buff+"&n";
					break;
					}
	i:=i+4;
	}
buff:=textformat(buff);
pagestring (buff,self);

   quit;
}
dilend




dilbegin aware cmd_bugs(st : string);
var
   t : string;
   z : unitptr;
   i : integer;
code
{
if (self.type!=UNIT_ST_PC)
	return;
   sendtext("Enter your bug reports. You have approximately 4000 "+
            "characters to work with. Note that if you input only a "+
            "single word or nothing at all, it will abort.&n", self);
   beginedit(self);
   wait(SFB_EDIT, self == activator);
   t := argument;
   if (length(getwords(t)) < 2)
   {
      sendtext("Insufficient report. Exiting.&n", self);
      quit;
   }
   z := self.outside;
   while (z.type != UNIT_ST_ROOM)
      z := z.outside;
   t := z.nameidx+"@"+z.zoneidx+" ["+self.name+"] "+asctime(realtime)+
        argument+"&n&n";
   t := textformat(t);
   i := flog("bugs", t, "a");
   sendtext("Thank you. They will be corrected.&n", self);
   quit;
}
dilend


dilbegin aware cmd_ideas(st : string);
var
   t : string;
   z : unitptr;
   i : integer;
code
{
if (self.type!=UNIT_ST_PC)
	return;
   sendtext("Enter your ideas. You have approximately 4000 characters "+
            "to work with. Note that if you input only a single word or "+
            "nothing at all, it will abort.&n", self);
   beginedit(self);
   wait(SFB_EDIT, self == activator);
   t := argument;
   if (length(getwords(t)) < 2)
   {
      sendtext("Insufficient report. Exiting.&n", self);
      quit;
   }
   z := self.outside;
   while (z.type != UNIT_ST_ROOM)
      z := z.outside;
   t := z.nameidx+"@"+z.zoneidx+" ["+self.name+"] "+asctime(realtime)+
        argument+"&n&n";
   t := textformat(t);
   i := flog("ideas", t, "a");
   sendtext("Thank you for your comments.&n", self);
   quit;
}
dilend

dilbegin aware cmd_typos(st : string);
var
   t : string;
   z : unitptr;
   i : integer;
code
{
if (self.type!=UNIT_ST_PC)
	return;
   sendtext("Enter your typo reports. You have approximately 4000 "+
            "characters to work with. Note that if you input only a "+
            "single word or nothing at all, it will abort.&n", self);
   beginedit(self);
   wait(SFB_EDIT, self == activator);
   t := argument;
   if (length(getwords(t)) < 2)
   {
      sendtext("Insufficient report. Exiting.&n", self);
      quit;
   }
   z := self.outside;
   while (z.type != UNIT_ST_ROOM)
      z := z.outside;
   t := z.nameidx+"@"+z.zoneidx+" ["+self.name+"] "+asctime(realtime)+
        argument+"&n&n";
   t := textformat(t);
   i := flog("typos", t, "a");
   sendtext("Thank you. They will be corrected.&n", self);
   quit;
}
dilend

/*status used on Valhalla to show how it is done.*/
dilbegin cmd_stat(arg:string);
external
	path_update@guild_paths(u : unitptr);
	string racestring(i:integer);
	string wpn_rating (wpn:integer);
	string ski_rating (ski:integer);
	string sp_rating (sp:integer);

var
skilist:stringlist;
wpnlist:stringlist;
   total_hours  : integer;
   hours_played : integer;
   days_played  : integer;

   last_lev     : integer;
   gl1          : integer;
   gl2          : integer;
   gl3          : integer;

   data_list    : stringlist;

   guild1       : string;
   guild2       : string;
   guild3       : string;
   desc         : string;

   align_string : string;
   sex_string   : string;
   race_string  : string;
   wimpy_string : string;
   age_string   : string;

   guild_string : string;

   expd         : extraptr;


	ln1:string;
	ln2:string;
	temp:string;
	buff:string;
	maglist:stringlist;
	divlist:stringlist;
	realm:integer;
	waist:integer;
	waist1:integer;
	waist2:integer;
	waist3:integer;
	waist4:integer;
	waist5:integer;
	waist6:integer;
	i:integer;
	              ln:integer;
	              len:integer;
code
{
if (self.type!=UNIT_ST_PC)
	quit;
/*if (self.level>50)
	goto imm;*/

if (arg=="")
	goto start;
if (arg==left("weapons",length(arg)))
	goto wpn_stat;
if (arg==left("skills",length(arg)))
	goto ski_stat;
if (arg==left("spells",length(arg)))
	goto sp_stat;

:start:
if ("$morphed" in self.extra)
	goto morphed;

   expd := "$path" in self.quests;

   if (expd == null)
   {
      guild_string := "&c+rContact an administrator to set your " +
      "character up for Guild Paths.&cw&n";
      goto cont;
   }

if (self.vlevel <= atoi(expd.names.[7]))
	goto keep_on;

path_update@guild_paths(self);

:keep_on:
   expd := "$path" in self.quests;
   if (expd == null) quit;
   guild_string := "Your guild path is: " +
   expd.names.[1] + " / " + expd.names.[2] + " / " + expd.names.[3] +
   ".&nYour guild path levels are: " + expd.names.[4] + " / " +
   expd.names.[5] + " / " + expd.names.[6] + ".&n";

:cont:
total_hours := self.playtime / 3600;

hours_played := total_hours % 24;
if (hours_played < 0)
	hours_played := 0 - hours_played;

days_played := (total_hours - hours_played) / 24;
if (days_played < 0)
	days_played := 0 - days_played;

if (self.alignment < -349)
	align_string := "Evil";
else if (self.alignment > 349)
	align_string := "Good";
else
	align_string := "Neutral";

if (self.sex == SEX_MALE)
	sex_string := "male";
else if (self.sex == SEX_FEMALE)
	sex_string := "female";
else
	sex_string := "neuter";

race_string:=racestring(self.race);

if (isset(self.charflags, CHAR_WIMPY))
	wimpy_string := "wimpy";
else
	wimpy_string := "brave";

   age_string := "You are a " +
                 itoa((realtime - self.birth) / SECS_PER_MUD_YEAR) +
                 " year old " + sex_string +
                 " " + race_string + " at level " + itoa(self.level) + ".&n";

   act(self.name + " " + self.title + " (" + align_string +
       " alignment (" + itoa(self.alignment) + "))&n" +
       age_string +
       guild_string +
       "You have been playing for " + itoa(days_played) +
       " days and " + itoa(hours_played) + " hours.&n" +
       "Str " + itoa(self.abilities[ABIL_STR]) + ", " +
       "Dex " + itoa(self.abilities[ABIL_DEX]) + ", " +
       "Con " + itoa(self.abilities[ABIL_CON]) + ", " +
       "Cha " + itoa(self.abilities[ABIL_CHA]) + ", " +
       "Bra " + itoa(self.abilities[ABIL_BRA]) + ", " +
       "Mag " + itoa(self.abilities[ABIL_MAG]) + ", " +
       "Div " + itoa(self.abilities[ABIL_DIV]) + ", " +
       "Hit " + itoa(self.abilities[ABIL_HP]) + " (" +
       itoa(self.hp) + "/" + itoa(self.max_hp) + ")" +
       "&n" +
       "You have " + itoa(self.ability_points) + " ability, " +
       "and " + itoa(self.skill_points) + " skill practice points.&n" +
       "You are in " + wimpy_string + " mode.",
       A_ALWAYS, self, null, null, TO_CHAR);

   quit;



:morphed:

   if (self.alignment < -349) align_string := "Evil";
   else if (self.alignment > 349) align_string := "Good";
   else align_string := "Neutral";

   if (self.sex == SEX_MALE) sex_string := "male";
   else if (self.sex == SEX_FEMALE) sex_string := "female";
   else sex_string := "neuter";

race_string:=racestring(self.race);

if (isset(self.charflags, CHAR_WIMPY))
	wimpy_string := "wimpy";
else
	wimpy_string := "brave";

   age_string := "You are a " +
                 itoa((realtime - self.birth) / SECS_PER_MUD_YEAR) +
                 " year old " + sex_string +
                 " " + race_string + " at level " + itoa(self.level) + ".&n";

   act(self.name + " " + self.title + " (" + align_string +
       " alignment (" + itoa(self.alignment) + ")&n" +
       age_string +
       "Str " + itoa(self.abilities[ABIL_STR]) + ", " +
       "Dex " + itoa(self.abilities[ABIL_DEX]) + ", " +
       "Con " + itoa(self.abilities[ABIL_CON]) + ", " +
       "Cha " + itoa(self.abilities[ABIL_CHA]) + ", " +
       "Bra " + itoa(self.abilities[ABIL_BRA]) + ", " +
       "Mag " + itoa(self.abilities[ABIL_MAG]) + ", " +
       "Div " + itoa(self.abilities[ABIL_DIV]) +
       "&n" +
       "You are in " + wimpy_string + " mode.",
       A_ALWAYS, self, null, null, TO_CHAR);

   quit;
:imm:


:wpn_stat:

i:=7;
buff:="";
ln1:="";
ln2:="";
wpnlist:={""};
while (weapon_name(i)!="")
	{
	if (self.weapons[i]<=0)
		{
		i:=i+1;
		continue;
		}

		ln1:=wpn_rating(self.weapons[i]);
		temp:=weapon_name(i);
		ln1:=ln1+temp;
		addstring (wpnlist,ln1);
		i:=i+1;
		}

len:=length (wpnlist);
if (len<=0)
	{
	sendtext ("You are not skilled in any weapons.&n",self);
	quit;
	}

i:=0;
while (i<len)
	{
	if (not(i%2))
		{
		ln1:=wpnlist.[i];
		i:=i+1;
		}
	else
		{
		ln2:=wpnlist.[i]+"&n";
		ln:=length(ln1);
		if (ln<40)
			ln:=40-ln;

		if (ln>0)
			buff:=buff+textformat(ln1+" &&s"+itoa(ln)+" "+ln2);
		else
		buff:=buff+textformat(ln1+""+ln2);
		i:=i+1;
		}
	}

if (len%2)
	buff:=buff+textformat(ln1+"&n");

pagestring(buff,self);

quit;
:sp_stat:

i:=12;
realm:=0;
buff:="";
divlist:={""};
maglist:={""};
ln1:="";
ln2:="";
while (i<213)
	{
	if (self.spells[i]<=0)
		{
		i:=i+1;
		continue;
		}

	ln1:=sp_rating(self.spells[i]);
	temp:=spellinfo(i,realm,waist,waist1,waist2,waist3,waist4,waist5);
	ln1:=ln1+temp;
	if (realm==ABIL_MAG)
		addstring(maglist,ln1);
	else
		addstring(divlist,ln1);
	i:=i+1;
	}

len:=length(maglist);
i:=length(divlist);
if ((i==0) and (len==0))
	{
	sendtext("You're not skilled in any spells.&n",self);
	quit;
	}

if (len==0)
	goto div_sp;
i:=0;
sendtext ("Spells known through your magic essence mastery.&n&n",self);
while (i<len)
	{
	if (not(i%2))
		{
 log ("got 0");
		ln1:=maglist.[i];
		i:=i+1;
		}
	else
		{
		ln2:=maglist.[i];
		ln2:=ln2+"&n";
		ln:=length(ln1);
		if (ln<40)
			ln:=40-ln;

		if (ln>0)
			buff:=buff+textformat(ln1+" &&s"+itoa(ln)+" "+ln2);
		else
		buff:=buff+textformat(ln1+""+ln2);
		i:=i+1;
		}
	}

if (len%2)
	buff:=buff+textformat(ln1+"&n");

:div_sp:
len:=length(divlist);
if (len==0)
	goto end_sp;

buff:=buff+"&n Spells known through your divine channeling powers:&n&n";
i:=0;
while (i<len)
	{
	if (not(i%2))
		{
		ln1:=divlist.[i];
		i:=i+1;
		}
	else
		{
		ln2:=divlist.[i];
		ln2:=ln2+"&n";

		ln:=length(ln1);
		if (ln<40)
			ln:=40-ln;

		if (ln>0)
			buff:=buff+textformat(ln1+" &&s"+itoa(ln)+" "+ln2);
		else
		buff:=buff+textformat(ln1+""+ln2);
		i:=i+1;
		}
	}
if (len%2)
	buff:=buff+textformat(ln1+"&n");

:end_sp:

pagestring(buff,self);
quit;


:ski_stat:
i:=0;
buff:="";
ln1:="";
ln2:="";
skilist:={""};
while (skill_name(i)!="")
	{
	if (self.skills[i]<=0)
		{
		i:=i+1;
		continue;
		}

		ln1:=ski_rating(self.skills[i]);
		temp:=skill_name(i);
		ln1:=ln1+temp;
		addstring (skilist,ln1);
		i:=i+1;
		}
len:=length(skilist);
if (len==0)
	{
	sendtext ("You have no special skills.&n",self);
	quit;
	}

i:=0;
while (i<len)
	{
	if (not(i%2))
		{
		ln1:=skilist.[i];
		i:=i+1;
		}
	else
		{
		ln2:=skilist.[i]+"&n";
		ln:=length(ln1);
		if (ln<40)
			ln:=40-ln;

		if (ln>0)
			buff:=buff+textformat(ln1+" &&s"+itoa(ln)+" "+ln2);
		else
		buff:=buff+textformat(ln1+""+ln2);
		i:=i+1;
		}
	}

if (len%2)
	buff:=buff+textformat(ln1+"&n");


pagestring(buff,self);

:end:
   quit;
}
dilend

dilbegin string racestring (i:integer);
code
{

if (i == RACE_HUMAN)
	return("human");
else if (i == RACE_ELF)
	return("elf");
   else if (i == RACE_DWARF)
   	return("dwarf");
else if (i == RACE_HALFLING)
	return("halfling");
else if (i == RACE_GNOME)
	return("gnome");
else if (i == RACE_HALF_ORC)
	return("half-orc");
else if (i == RACE_HALF_OGRE)
   return("half-ogre");
else if (i == RACE_HALF_ELF)
	return("half-elf");
else if (i == RACE_BROWNIE)
	return("brownie");
else if (i == RACE_GROLL)
	return("groll");
else if (i == RACE_DARK_ELF)
	return("darkelf");
else if (i==RACE_GIANT)
	return("giant");
   else if (i == RACE_BIRD)
  return ("phoenix");
else if (i== RACE_SNAKE)
	return ("viper");
else if (i == RACE_VAMPIRE)
	return ("vampire");
else if (i == RACE_DRAGON_RED)
	return ("red dragon");
else if (i == RACE_ELEMENTAL_FROST)
	return ("ice elemental");
else if (i == RACE_LION)
	return("lion");
else if (i == RACE_SHADOW_DEVIL)
	return ("shadow demon");
else if (i == RACE_CAT)
	return ("black panther");
else if (i == RACE_DINOSAUR)
	return ("basilisk");

return ("Not A Race");
}
dilend

dilbegin string wpn_rating (wpn:integer);
code
{
if (wpn<10)
 return ("You're utterly hopeless with ");
else if (wpn<25)
	return ("You're impossible with ");
else if (wpn<40)
	return ("You're poor with ");
else  if (wpn<50)
	return ("You're good with ");
else if (wpn<70)
	return("You're skilled with ");
else if (wpn<90)
	return ("You're specialized with ");
else if (wpn < 100)
	return ("You're supreme with ");
else if (wpn<150)
	return ("You're expert with ");
else
	return ("You're godly with ");

}
dilend

dilbegin string ski_rating (ski:integer);
code
{
if (ski<10)
	return("You're utterly hopeless with ");
else if (ski<25)
  return("You're impossible with ");
else if (ski<40)
  return("You're poor with ");
else if (ski<50)
  return("You're good with");
else if (ski<70)
  return("You're skilled with");
else if (ski<90)
  return("You're specialized with");
else if (ski<100)
  return("You're supreme with ");
else if (ski<150)
  return("You're expert with ");
else
  return("You're godly with ");

}
dilend

dilbegin string sp_rating (sp:integer);
code
{
if (sp<=10)
	return ("You might remember ");
else if (sp<=25)
  return ("You can almost remember ");
else if (sp<=40)
  return ("You can remember ");
else if (sp<=50)
  return ("You have practiced ");
else if (sp<=70)
  return ("You have learned ");
else 	if (sp<=90)
  return ("You're master of ");
else if (sp<=100)
  return ("You're expert with ");
else
  return ("You're godly with ");

}dilend

dilbegin aware describe (arg:string);
var
	side:string;
oneword:stringlist;
	location:string;
	ln:integer;
	args:stringlist;
	temp:string;
	i:integer;
	x:extraptr;
code
{

if (self.type!=UNIT_ST_PC)
	quit;
if (self.position <POSITION_SLEEPING)
{
act ("Recover first and then you can describe your body parts.",
	A_ALWAYS,self,null,null,TO_CHAR);
quit;
}

args:=getwords(arg);
ln:=length(args);
if ((ln<1) or (ln>2))
	{
	sendtext ("No such location to describe.",self);
	quit;
	}
	else if (ln>1)
		goto two_word;

:one_word:
if ((arg==left("help",length(arg))) or
(arg==""))
goto hlp_dscr;
oneword:={"arms","butt","ears","eyes","face","feet","General","hair","hands",
					"head","legs","mouth","neck","nose","nostrils","teeth","toes","tounge"};

i:=0;
ln:=length(args.[0]);
temp:="ERROR";
while (i<18)
	{
	if (args.[0]==left(oneword.[i],ln))
		{
		temp:=oneword.[i];
		break;
		}
	i:=i+1;
	}

if (temp=="ERROR")
	{
	sendtext ("No such location to describe.",self);
	quit;
	}

goto describe;

:two_word:
oneword:={"arm","leg","foot","hand","eye","ear"};
temp:="ERROR";
ln:=length(args.[0]);
if (args.[0] == left("left",ln))
	side:="left";
else if (args.[0] == left("right",ln))
	side:="right";
else
	{
	sendtext ("No such location to describe.",self);
	quit;
	}

i:=0;
while (i<6)
	{
	if (args.[1]==left(oneword.[i],ln))
		{
		temp:=oneword.[i];
		break;
		}
	i:=i+1;
	}

if (temp=="ERROR")
	{
	sendtext ("No such location to describe.",self);
	quit;
	}

temp:=side+" "+temp;

:describe:
if (temp=="General")
	location:="";
else
	location:=temp;

x:=location in self.extra;
if (x!=null)
	if (location=="")
	sendtext("your Current description for your body is:  &n"+x.descr+"&n",self);
else
		sendtext("your Current description for your "+location+"is:  &n"+x.descr+"&n",self);


	if (location=="")
	sendtext ("Enter a text you would like others to see when they look at your body.&n",self);
else
	sendtext ("Enter a text you would like others to see when they look at your "+location+".&n",self);

	beginedit (self);
	wait(SFB_EDIT,self==activator) ;
temp:=textformat(argument);
oneword:={""};
subextra(self.extra,location);
addstring (oneword, location);
addextra (self.extra,oneword,temp);
sendtext ("Description added.&n",self);
quit;
:hlp_dscr:

sendtext ("&nCorrect usage of 'describe':&n&n",self);
sendtext ("describe <position>&n&n",self);
sendtext("<position> being one of the following:&n&n",self);
sendtext( "arms        butt        ears        eyes&n"+
					"face        feet        General     hair&n"+
					"hands	     head        left arm    left leg&n"+
					"left foot   left hand   left eye    left ear&n"+
					"legs        mouth       neck        nose&n"+
					"nostrils    right arm   right leg   right foot&n"+
					"right hand  right eye   right ear   teeth&n"+
					"toes        tounge&n&n",self);
sendtext ("Example:  &n&n",self);
sendtext ("describe left leg&n",self);
quit;
}
dilend

dilbegin apply_poison (pc:unitptr,pois:integer,amount:integer);
code
{

if ((pois>0) and (pc.level<200))
	{
	act("Oops, it tasted rather strange ?!!?",
	A_SOMEONE, pc, null, null, TO_CHAR);
	act("$1n chokes and utters some strange sounds.",
		A_HIDEINV, pc, null, null, TO_REST);

	 dilcopy("spl_poison@spells("+itoa(amount*pois)+")", pc);
	}


	return;
	}
	dilend

dilbegin integer dv(d_obj:unitptr,s:string);
var
	x:extraptr;
code
{
if (s=="thirst")
	{
	x:="$drink_thirst" in d_obj.extra;
	if (x==null)
		return (0);
	else if (x.descr=="")
		return (0);
	else
		return (atoi(x.descr));
	}
else if (s=="full")
	{
	x:="$drink_full" in d_obj.extra;
	if (x==null)
		return (0);
	else if (x.descr=="")
		return (0);
	else
		return (atoi(x.descr));
	}
else if (s=="drunk")
	{
	x:="$drink_drunk" in d_obj.extra;
	if (x==null)
		return (0);
	else if (x.descr=="")
		return (0);
	else
		return (atoi(x.descr));
	}

return (0);
}
dilend

dilbegin gain_cond(pc:unitptr,cond:string, i:integer);
var
	dr:integer;/*drunk*/
code
{
dr:=pc.drunk;

if (pc.type!=UNIT_ST_PC)
	return;
if ((cond=="thirst") and (pc.thirst>=48))
	return;
else if (cond=="thirst")
	{
	pc.thirst:=pc.thirst+i;
	if (pc.thirst>24)
		pc.thirst:=24;
	if (pc.thirst<-96)
			pc.thirst:=-96;
	if (pc.thirst>3)
		return;
	if (pc.thirst>-4)
		sendtext("You are thirsty.&n",pc);
	else if (pc.thirst>-8)
		sendtext("You are very thirsty.&n",pc);
	else if (pc.thirst>-12)
		sendtext("You are dehydrated.&n",pc);
	}
else if ((cond=="full") and (pc.full>=48))
	return;
else if (cond=="full")
	{
	pc.full:=pc.full+i;
	if (pc.full>24)
		pc.full:=24;
		if (pc.full<-96)
			pc.full:=-96;
	if (pc.full>3)
		return;
	if (pc.full>-4)
	sendtext("You are hungry.&n",pc);
	else if (pc.full>-8)
	sendtext("You are very hungry.&n",pc);
	else if (pc.full>-12)
	sendtext("You are starving.&n",pc);
	}
else if ((cond=="drunk") and (pc.drunk>=48))
	return;
else if (cond=="drunk")
	{
	pc.drunk:=pc.drunk+i;
	if ((pc.drunk<dr) and (pc.drunk==0))
		sendtext ("You sober up!&n",pc);
	if (pc.drunk>24)
		pc.drunk:=24;
		if (pc.drunk<0)
			pc.drunk:=0;/*you can't get any more sober than this*/
			if (pc.drunk>11)
				sendtext ("You are seeing double!&n",pc);
	else if (pc.drunk>7)
		sendtext("You are feeling very light headed.&n",pc);
	else if (pc.drunk>3)
		sendtext ("You are getting tipsy.",pc);
	}

return;
}
dilend

dilbegin sub_drink_info(d_obj:unitptr);
var
	x:extraptr;
code
{
	setweight(d_obj,d_obj.weight+(-(d_obj.value[0])));
	d_obj.value[0]:=0;
	d_obj.value[3]:=0;
	substring (d_obj.names,d_obj.names.[length (d_obj.names)-1]);
	subextra (d_obj.extra,"$drink_color");
	subextra (d_obj.extra,"$drink_thirst");
	subextra (d_obj.extra,"$drink_full");
	subextra (d_obj.extra,"$drink_drunk");
	return ;
	}
	dilend

dilbegin do_drink (arg:string);
external
	sub_drink_info (u:unitptr);
apply_poison (pc:unitptr,pois:integer,amount:integer);
	gain_cond(pc:unitptr,cond:string,i:integer);
	integer dv (d_obj:unitptr,s:string);
var
	d_obj:unitptr;
	amount:integer;
	i:integer;
	pois:integer;
code
{
if (arg=="")
	{
	sendtext("What do you want to drink?&n", self);
	quit;
	}

d_obj:=findunit(self,arg,FIND_UNIT_HERE,null);
if (d_obj==null)
	{
	act("You can't find it!", A_SOMEONE, self, null, null, TO_CHAR);
	quit;
	}

if ((d_obj.type!=UNIT_ST_OBJ) or (d_obj.objecttype!=ITEM_DRINKCON))
	{
	act("You can not drink from that.",
		A_SOMEONE, self, null, null, TO_CHAR);
	quit;
	}

if (d_obj.value[0]<-1)
	{
	act ("Drink Container Error report to an admin.",
	A_ALWAYS,self,null,null,TO_CHAR);
quit;
}

if (d_obj.value[0]==-1)
	amount:=rnd(3, 10);
else if (self.level>=200)
		amount:=10;
else
	amount:=rnd(3,10);

if (d_obj.value[0] <amount)
	amount:=d_obj.value[0];

if (amount < 0) /* Strange... Only value "0" should be negative*/
	   amount := 0;

if (d_obj.value[0]<=0)
	{
	act("The $2N is empty.",
		A_SOMEONE, self, d_obj, null, TO_CHAR);
	quit;
	}

if (self.level<200)
	{
	if (self.drunk>=24)
		{
		/* The pig is drunk */
		act("You simply fail to reach your mouth!",
			A_SOMEONE, self, null, null, TO_CHAR);
		 act("$1n tried to drink but missed $1s mouth!",
		 	A_HIDEINV, self, null, null, TO_REST);
		quit;
		}

	if (self.thirst>=24)
		{
		/* Stomach full */
		act("Your stomach can't contain anymore!",
			A_SOMEONE, self, null, null, TO_CHAR);
		quit;
		}
	}

if ((d_obj.value[0]>=0) and (amount >=d_obj.value[0]))
	amount:=d_obj.value[0];

act("$1n drinks $3t from $2n.",
	A_HIDEINV, self, d_obj,d_obj.names.[length(d_obj.names)-1], TO_REST);
act("You drink the $2t.",
	A_SOMEONE, self,d_obj.names.[length(d_obj.names)-1] , null, TO_CHAR);
i:=dv(d_obj,"drunk");
gain_cond(self, "drunk",((i*amount)/4));
i:=dv(d_obj,"full");
gain_cond(self, "full",((i*amount)/4));
i:=dv(d_obj,"thirst");
gain_cond(self, "thirst",((i*amount)/4));
pois:=d_obj.value[3];
apply_poison(self,pois,amount);
if (d_obj.capacity>0)
	{
	 /* empty the container, and no longer poison. */
	d_obj.value[0]:=d_obj.value[0]-amount;
	setweight(d_obj, d_obj.weight-amount); /* Subtract amount */
	if (d_obj.value[0]<=0)
		{
	sub_drink_info(d_obj);
	}
	}

if (self.drunk>10)
	act("You feel drunk.",
		A_ALWAYS, self, null, null, TO_CHAR);

if (self.thirst<15)
	act("You still feel thirsty.",
		A_ALWAYS, self, null, null, TO_CHAR);

if (self.full<15)
	act("You still feel hungry.",
		A_ALWAYS, self, null, null, TO_CHAR);
send_done ("drink",self,d_obj,null,pois,"",null);
quit;
}
dilend

dilbegin do_eat (arg:string);
external
apply_poison (pc:unitptr,pois:integer,amount:integer);
	gain_cond(pc:unitptr,cond:string,i:integer);
var
	food:unitptr;
	pois:integer;
	amount:integer;
code
{
if (arg=="")
	{
	sendtext("What do you want to eat?&n",self);
	quit;
	}

food:=findunit (self,arg,FIND_UNIT_HERE,null);
if (food==null)
	{
	act("You've got no such food.",
	A_SOMEONE, self, null, null, TO_CHAR);
	quit;
	}
else if ((food.type==UNIT_ST_OBJ) and (food.objecttype==ITEM_FOOD) and (self.level<200))
	{
	if ((self.type==UNIT_ST_PC) and (self.level<200) and (self.full>=24))
		{
		act("You are too full to eat more!",
			A_SOMEONE, self, null, null, TO_CHAR);
		quit;
		}
	if (food.value[0]<=0)
		{
		act("There is nothing left to eat.",
			A_SOMEONE, self, food, null, TO_CHAR);
		quit;
		}

		amount:=food.value[0];

	act("$1n eats $2n.",
	A_HIDEINV, self,   food, null, TO_REST);
	act("You eat $2n.",
		A_SOMEONE, self, food, null, TO_CHAR);

gain_cond(self, "full", amount);

pois:=food.value[3];
apply_poison(self,pois,amount);

	food.value[0]:=food.value[0]-amount;
	}
else if ((self.level<200) or (food.type==UNIT_ST_ROOM))
	{
	act("Your stomach refuses to eat that!?!",
		A_SOMEONE, self, null, null, TO_CHAR);
		quit;
		}
else
	{
	act("$1n eats $2n.",
		A_HIDEINV, self, food, null, TO_REST);
	act("You eat $2n.",
		A_HIDEINV, self, food, null, TO_CHAR);
	}

if (self.level<200)
	{

if (self.drunk>10)
	act("You feel drunk.",
		A_ALWAYS, self, null, null, TO_CHAR);

if (self.thirst<15)
	act("You still feel thirsty.",
		A_ALWAYS, self, null, null, TO_CHAR);

if (self.full<15)
	act("You still feel hungry.",
		A_ALWAYS, self, null, null, TO_CHAR);
		}
send_done ("eat",self,food,null,pois,"",null);
	destroy (food);
quit;
}
dilend

dilbegin do_sip(arg:string);
external
	sub_drink_info (u:unitptr);
apply_poison (pc:unitptr,pois:integer,amount:integer);
	gain_cond(pc:unitptr,cond:string,i:integer);
	integer dv (d_obj:unitptr,s:string);
var
i:integer;
pois:integer;
	d_obj:unitptr;
	amount:integer;
code
{
if (arg=="")
	act("What do you want to sip?",
		A_SOMEONE, self, null, null, TO_CHAR);
d_obj:=findunit(self,arg,FIND_UNIT_HERE,null);
if (d_obj==null)
	{
	act("You can't find such a thing.",
		A_SOMEONE, self, null, null, TO_CHAR);
	quit;
	}
else if ((d_obj.type!=UNIT_ST_OBJ) and (d_obj.objecttype!=ITEM_DRINKCON))
	{
	act("You can't sip from that.",
		A_SOMEONE, self, null, null, TO_CHAR);
	quit;
	}

amount:=1;
if (d_obj.value[0]<=0)
	{
	act("The $2N is empty.",
		A_SOMEONE, self, d_obj, null, TO_CHAR);
	quit;
	}

if (self.level<200)
	{
	if (self.drunk>=24)
		{
		/* The pig is drunk */
		act("You simply fail to reach your mouth!",
			A_SOMEONE, self, null, null, TO_CHAR);
		 act("$1n tried to sip but missed $1s mouth!",
		 	A_HIDEINV, self, null, null, TO_REST);
		quit;
		}

	if (self.thirst>=24)
		{
		/* Stomach full */
		act("Your stomach can't contain anymore!",
			A_SOMEONE, self, null, null, TO_CHAR);
		quit;
		}
	}

if ((d_obj.value[0]>=0) and (amount >=d_obj.value[0]))
	amount:=d_obj.value[0];

act("$1n sips $3t from $2n.",
	A_HIDEINV, self, d_obj,d_obj.names.[length(d_obj.names)-1], TO_REST);
act("You sip the $2t.",
	A_SOMEONE, self,d_obj.names.[length(d_obj.names)-1] , null, TO_CHAR);

i:=dv(d_obj,"drunk");
gain_cond(self, "drunk",(i*amount)/4);
i:=dv(d_obj,"full");
gain_cond(self, "full",(i*amount)/4);
i:=dv(d_obj,"thirst");
gain_cond(self, "thirst",(i*amount)/4);

pois:=d_obj.value[3];
apply_poison(self,pois,amount);

if (d_obj.capacity>0)
	{
	 /* empty the container, and no longer poison. */
	d_obj.value[0]:=d_obj.value[0]-amount;
	setweight(d_obj, d_obj.weight-amount); /* Subtract amount */
	if (d_obj.value[0]<=0)
		{

	sub_drink_info(d_obj);
	}
	}
if (self.drunk>10)
	act("You feel drunk.",
		A_ALWAYS, self, null, null, TO_CHAR);

if (self.thirst<15)
	act("You still feel thirsty.",
		A_ALWAYS, self, null, null, TO_CHAR);

if (self.full<15)
	act("You still feel hungry.",
		A_ALWAYS, self, null, null, TO_CHAR);
quit;
}
dilend

dilbegin do_taste(arg:string);
external
	sub_drink_info (u:unitptr);
apply_poison (pc:unitptr,pois:integer,amount:integer);
	gain_cond(pc:unitptr,cond:string,i:integer);
	integer dv (d_obj:unitptr,s:string);
var
pois:integer;
	food:unitptr;
	amount:integer;
	i:integer;
code
{
if (arg=="")
	{
	sendtext("What do you want to taste?&n",self);
	quit;
	}

food:=findunit (self,arg,FIND_UNIT_HERE,null);
if (food==null)
	{
	act("You've got no such food.",
	A_SOMEONE, self, null, null, TO_CHAR);
quit;
}

if (food.type!=UNIT_ST_OBJ)
	{
	act("You can't taste from that.",
		A_SOMEONE, self, null, null, TO_CHAR);
		quit;
		}

if ((food.objecttype!=ITEM_FOOD) and (food.objecttype!= ITEM_DRINKCON))
	{
	act("Taste that?!? Your stomach refuses!",
		A_SOMEONE, self, null, null, TO_CHAR);
	quit;
	}

	amount:=1;

	if (food.objecttype==ITEM_DRINKCON)
		{
		if (food.value[0]<=0)
			{
			act("The $2N is empty.",
				A_SOMEONE, self, food, null, TO_CHAR);
			quit;
			}

		if (self.level<200)
			{
			if (self.drunk>=24)
				{
				/* The pig is drunk */
				act("You simply fail to reach your mouth!",
					A_SOMEONE, self, null, null, TO_CHAR);
				act("$1n tried to sip but missed $1s mouth!",
					A_HIDEINV, self, null, null, TO_REST);
				quit;
			  }

			if (self.thirst>=24)
				{
				/* Stomach full */
				act("Your stomach can't contain anymore!",
					A_SOMEONE, self, null, null, TO_CHAR);
				quit;
				}
			}

		if ((food.value[0]>=0) and (amount >=food.value[0]))
			amount:=food.value[0];

		act("$1n tastes $3t from $2n.",
			A_HIDEINV, self, food,food.names.[length(food.names)-1], TO_REST);
		act("You sip the $2t.",
			A_SOMEONE, self,food.names.[length(food.names)-1] , null, TO_CHAR);

		i:=dv(food,"drunk");
		gain_cond(self, "drunk",(i*amount)/4);
		i:=dv(food,"full");
		gain_cond(self, "full",(i*amount)/4);
		i:=dv(food,"thirst");
		gain_cond(self, "thirst",(i*amount)/4);
		pois:=food.value[3];
apply_poison(self,pois,amount);
		if (food.capacity>0)
			{
			/* empty the container, and no longer poison. */
	food.value[0]:=food.value[0]-amount;
	setweight(food, food.weight-amount); /* Subtract amount */
	if (food.value[0]<=0)
		{			/* The last bit */
	setweight(food,food.weight+(-(food.value[0])));
	food.value[0]:=0;
		food.value[3]:=0;
		substring (food.names,food.names.[length(food.names)-1]);
		}
	}

	}
else/*food*/
	{
	if ((self.type==UNIT_ST_PC) and (self.level<200) and (self.full>=24))
		{
		act("You are too full to taste more!",
			A_SOMEONE, self, null, null, TO_CHAR);
		quit;
		}
	if (food.value[0]<=0)
		{
		act("There is nothing left to taste.",
			A_SOMEONE, self, food, null, TO_CHAR);
		quit;
		}

	if (amount> food.value[0])
		amount:=food.value[0];

	act("$1n tastes $2n.",
	A_HIDEINV, self, food, null, TO_REST);
	act("You taste $2n.",
		A_SOMEONE, self, food, null, TO_CHAR);

gain_cond(self, "full", amount);

pois:=food.value[3];
apply_poison(self,pois,amount);

	food.value[0]:=food.value[0]-amount;
	if (food.value[0]<=0)
		destroy (food);
else if ((self.level<200) or (food.type==UNIT_ST_ROOM))
	act("Your stomach refuses to taste that!?!",
		A_SOMEONE, self, null, null, TO_CHAR);
else
	{
	act("$1n tastes $2n.",
		A_HIDEINV, self, food, null, TO_REST);
	act("You taste $2n.",
		A_HIDEINV, self, food, null, TO_CHAR);
	destroy (food);
		quit;
	}
}


if (self.drunk>10)
	act("You feel drunk.",
		A_ALWAYS, self, null, null, TO_CHAR);

if (self.thirst<15)
	act("You still feel thirsty.",
		A_ALWAYS, self, null, null, TO_CHAR);

if (self.full<15)
	act("You still feel hungry.",
		A_ALWAYS, self, null, null, TO_CHAR);
quit;
}
dilend



dilbegin do_pour (arg:string);
external
	sub_drink_info (u:unitptr);
	integer dv (d_obj:unitptr,s:string);
var
	f_obj:unitptr;
	t_obj:unitptr;
	org:string;
	amount:integer;
	tx:extraptr;

	fx:extraptr;
	dx:extraptr;
	cx:extraptr;
code
{
if (arg=="")
	{
	act("What do you want to pour from?",
		A_SOMEONE, self, null, null, TO_CHAR);
		quit;
		}

f_obj:=findunit(self,arg,FIND_UNIT_HERE,null);
if (f_obj==null)
	{
	act("You can't find it!",
		A_SOMEONE, self, null, null, TO_CHAR);
	quit;
	}

if ((f_obj.type!=UNIT_ST_OBJ) or (f_obj.objecttype!=ITEM_DRINKCON))
	{
	act("You can not pour from that.",
		A_SOMEONE, self, null, null, TO_CHAR);
	quit;
	}

if (f_obj.value[0]<=0)
	{
	act("The $2N is empty.",
		A_SOMEONE, self, f_obj, null, TO_CHAR);
	quit;
	}

if (arg=="")
	{
	act("Where do you want it? Out or in what?",
		A_SOMEONE, self, null, null, TO_CHAR);
	quit;
	}
if (arg==" out")
	{
	if (f_obj.outside!=self)
		{
		act("You must carry it in order to empty it.",
			A_SOMEONE, self, null, null, TO_CHAR);
		quit;
		}

	if (f_obj.capacity==-1)
		{
		act("It is impossible to empty $2n.",
			A_SOMEONE, self, f_obj, null, TO_CHAR);
		quit;
		}

	act("$1n empties $2n.",
		A_HIDEINV, self, f_obj, null, TO_ROOM);
	act("You empty $2n.",
		A_SOMEONE, self, f_obj, null, TO_CHAR);

	sub_drink_info(f_obj);
send_done ("pour",self,f_obj,self.outside,0,"",null);
	quit;
	}

t_obj:=findunit(self,arg,FIND_UNIT_HERE,null);
if (t_obj==null)
	{
	act ("You can't find that to pour into.",
		A_ALWAYS,self,null,null,TO_CHAR);
	quit;
	}

if (t_obj==f_obj)
	{
	act("You can't pour it into itself!",
		A_SOMEONE, self, null, null, TO_CHAR);
	quit;
	}

if ((t_obj.type!=UNIT_ST_OBJ) and (t_obj.objecttype!=ITEM_DRINKCON))
	{
	act("You can't pour anything into that.",
		A_SOMEONE, self, null, null, TO_CHAR);
	quit;
	}

if ((t_obj.value[0]!=0) and
	(t_obj.names.[length(t_obj.names)-1]!=f_obj.names.[length(f_obj.names)-1]))
	{
	act("There is already another liquid in it!",
		A_SOMEONE, self,null, null,TO_CHAR);
	quit;
	}

if (t_obj.capacity<=t_obj.value[0])
	{
	act("There is no room for more.",
		A_SOMEONE, self, null, null, TO_CHAR);
	quit;
	}


act("You pour the $2t into $3n.",
	A_SOMEONE, self,f_obj.names.[length(f_obj.names)-1], t_obj,TO_CHAR);

if (t_obj.value[0]==0)
	{
	tx:="$drink_thirst" in f_obj.extra;
	if (tx==null)
		{
		:error:
		log ("Drink container error on "+f_obj.nameidx+"@"+f_obj.zoneidx);
		act ("Drink container error do to new container code replace your container.",
			A_ALWAYS, self,null,null,TO_CHAR);
		quit;
		}

	fx:="$drink_full" in f_obj.extra;
	if (fx==null)
		goto error;

	cx:="$drink_color" in f_obj.extra;
	if (cx==null)
		goto error;
	dx:="$drink_drunk" in f_obj.extra;
	if (dx==null)
		goto error;

	subextra (t_obj.extra,"$drink_color");
	subextra (t_obj.extra,"$drink_thirst");
	subextra (t_obj.extra,"$drink_full");
	subextra (t_obj.extra,"$drink_drunk");
	addextra (t_obj.extra,cx.names,cx.descr);
	addextra (t_obj.extra,tx.names,tx.descr);
	addextra (t_obj.extra,fx.names,fx.descr);
	addextra (t_obj.extra,dx.names,dx.descr);
	addstring (t_obj.names,f_obj.names.[length (f_obj.names)-1]);
	}


if (f_obj.value[0]==-1)
	{
	if (t_obj.capacity==0)
		amount:=0;
	else
		amount:=t_obj.capacity-t_obj.value[0];
	}
else if (t_obj.value[0]==-1)
	amount:=f_obj.value[0];
else

	{
	amount:=t_obj.capacity-t_obj.value[0];
	if (f_obj.value[0]<amount)
		amount:=f_obj.value[0];
	if (amount <0)
		amount:=0;
	}

 if (f_obj.value[0]>=0)
	{
	f_obj.value[0]:=f_obj.value[0]-amount;
	setweight (f_obj, f_obj.weight-amount);
	}

if (t_obj.value[0]>=0)
	{
	t_obj.value[0]:=t_obj.value[0]+amount;
	setweight (t_obj,t_obj.weight+amount);
	}

	 /* Then the poison boogie */
if (f_obj.value[3]>t_obj.value[3])
t_obj.value[3]:=rnd(f_obj.value[3],t_obj.value[3]);

if (f_obj.value[0]==0)
	{
	sub_drink_info(f_obj);
	}

send_done ("pour",self,f_obj,t_obj,0,"",null);
quit;
}
dilend


dilbegin no_shout (arg : string);

var
   pc       : unitptr;

   pcname   : string;
   time_str : string;
   type_str : string;

   i        : integer;
   ns_time  : integer;

code
{
   block;
   if (self.level < 200)
   {
      act("Arglebargle, glop-glyf!?!",
          A_ALWAYS, self, null, null, TO_CHAR);
      quit;
   }

   pcname := getword(arg);

   pc := findunit(self, pcname, FIND_UNIT_WORLD, null);

   if ((pc == null) or (pc.type != UNIT_ST_PC) or (pc.minv > self.level))
   {
      act("No such PC in the world.",
          A_ALWAYS, self, null, null, TO_CHAR);
      quit;
   }

   if (self.level <= pc.level)
   {
      act("I don't think $3e would appreciate that.",
          A_ALWAYS, self, null, pc, TO_CHAR);
      quit;
   }

   if (isset(pc.pcflags, PC_NOSHOUTING))
   {
      act("Noshouting removed from $3n.",
          A_ALWAYS, self, null, pc, TO_CHAR);
      act("Your sore throat suddenly clears up.",
          A_ALWAYS, pc, null, null, TO_CHAR);
      subextra(pc.quests, "$noshout");
      unset(pc.pcflags, PC_NOSHOUTING);
      i := dildestroy("no_shouted@commands", pc);
      log("NOSHOUT: " + self.name + " removed the noshout on " +
          pc.name + ".");
      quit;
   }

   time_str := getword(arg);
   type_str := getword(arg);

   /* Default noshout time is 30 real minutes */
   if (time_str == "")
   {
      ns_time := (PULSE_SEC * SECS_PER_REAL_HOUR) / 2;
      time_str := "30";
      type_str := "min";
      goto no_shout;
   }

   ns_time := atoi(time_str);

   if (not(ns_time))
   {
      act("Invalid time period.",
          A_ALWAYS, self, null, null, TO_CHAR);
      goto syntax;
   }

   if (type_str in "mins")
   {
      ns_time := ns_time * PULSE_SEC * SECS_PER_REAL_MIN;
      goto no_shout;
   }

   else if (type_str in "hours")
   {
      ns_time := ns_time * PULSE_SEC * SECS_PER_REAL_HOUR;
      goto no_shout;
   }

   else goto syntax;

:no_shout:

   set(pc.pcflags, PC_NOSHOUTING);
   act("Noshouting set on $3n.",
       A_ALWAYS, self, null, pc, TO_CHAR);
   act("You suddenly get a sore throat!",
       A_ALWAYS, pc, null, null, TO_CHAR);
   dilcopy("no_shouted@commands(" + itoa(ns_time) + ")", pc);
   addextra(pc.quests, {"$noshout"}, self.name + " " + asctime(realtime));
   log("NOSHOUT: " + self.name + " noshouted " + pc.name + " for " +
       time_str + " " + type_str + ".");

   quit;

:syntax:
      act("Syntax: 'Noshout player 1 hour' or 'Noshout player 25 min'." +
          "&nNote time is real time, not mud time.",
          A_ALWAYS, self, null, null, TO_CHAR);
      quit;
}
dilend /* revoke */

dilbegin recall aware no_shouted (ns_time : integer);

var
   ticks_so_far : integer;
   hours: integer;
   mins: integer;
   secs: integer;
   td: string;
   tl: string;

code
{
   ticks_so_far := 0;
   heartbeat := (PULSE_SEC * SECS_PER_REAL_MIN) / 3;
   interrupt (SFB_CMD, (command("noshouted") and (self == activator)), shou);

:re_tick:
   wait(SFB_TICK, TRUE);
   ticks_so_far := ticks_so_far + heartbeat;
   if (ticks_so_far >= ns_time) goto end;
   else goto re_tick;

:end:
   unset(self.pcflags, PC_NOSHOUTING);
   act("Your sore throat clears up.",
       A_ALWAYS, self, null, null, TO_CHAR);
   subextra(self.quests, "$noshout");
   log("NOSHOUT: " + self.name + "'s noshout has worn off.");
   quit;

:shou:
block;
hours := 0;mins := 0;td := "";tl := "";
secs := ticks_so_far / 4;

while (secs >= 3600) {
	secs := secs - 3600;
	hours := hours + 1;
	}
while (secs >= 60) {
	secs := secs - 60;
	mins := mins + 1;
	}

td := itoa(hours) + " hours, "+itoa(mins)+" minutes, "+itoa(secs)+
		" seconds";

hours := 0; mins := 0;
secs := ns_time / 4;

while (secs >= 3600) {
	secs := secs - 3600;
	hours := hours + 1;
	}
while (secs >= 60) {
	secs := secs - 60;
	mins := mins + 1;
	}

tl := itoa(hours) + " hours, "+itoa(mins)+" minutes, "+itoa(secs)+
		" seconds";

act ("You have "+td+" done off your noshout, out of "+tl+" to do.",
		A_ALWAYS,self,null,null,TO_CHAR);

goto re_tick;

}
dilend /* no_shouted */

dilbegin string exclaim_ask (s:string);
var
	punct:stringlist;
code
{
if ("!" in s)
	{
	if ("?" in s)
		goto d_punct;/*both ! and ?*/
	return ("exclaiming ");
	}
else if ("?" in s)
	return ("asking ");
else
	return ("");

:d_punct:
punct:=split(s,"!");
if (length (punct)==1)
	return ("exclaiming ");
else if ("?" in punct.[length(punct)-1])
	return ("asking ");
else
	return ("exclaiming ");
}
dilend


dilbegin reply (arg:string);
external
	string exclaim_ask(s:string);
var
sx:string;
  person:extraptr;
  pc:unitptr;
	punct:string;
  code
  {

if (arg=="")
  {
  act ("&[respond]Respond what?&[default]",A_ALWAYS,self,null,null,TO_CHAR);
  quit;
  }

person:="$reply" in self.quests;

if (person==null)
  {
  act ("&[respond]No one to respond to.&[default]",A_ALWAYS,self,null,null,TO_CHAR);
  quit;
  }

pc:=findunit (self,person.descr,FIND_UNIT_WORLD,null);
if (pc==null)
{
act ("&[respond]No one to respond to.&[default]",A_ALWAYS,self,null,null,TO_CHAR);
quit;
 }

:speak:

if (isset (self.pcflags, PC_NOTELLING))
	{
	act ("You have lost your telepathic ability.",
	A_ALWAYS,self,null,null,TO_CHAR);
	quit;
	}

punct:=exclaim_ask(arg);

if (visible(self,pc))
	sendtext("&[respond]You respond to "+pc.name+" "+punct+"'"+arg+"'&[default]&n", self);
else
	{
	if ((pc.sex==SEX_MALE) or (pc.sex==SEX_FEMALE))
		sx:="Someone";
	else
		sx:="Something";
	sendtext("&[respond]You respond to "+sx+" "+punct+"'"+arg+"'&[default]&n", self);
	}

if (visible (pc,self))
	sendtext("&[respond]"+self.name+" responds "+punct+"'"+arg+"'&[default]&n",pc);
else
	{
	if ((self.sex==SEX_MALE) or (self.sex==SEX_FEMALE))
		sx:="Someone";
	else
		sx:="Something";
	sendtext("&[respond]"+sx+" responds "+punct+"'"+arg+"'&[default]&n",pc);
	}

subextra (pc.quests,"$reply");
addextra (pc.quests,{"$reply"},self.name);
quit;

}
dilend



dilbegin who_dil ( arg: string );
var
 	buff:string;
	gld:string;
rc:string;
	ln:integer;
	u:unitptr;
	ply_list:stringlist;
	i:integer;
	temp:string;
	temps:string;
	tempp:string;
        path_guild : string;
	x:extraptr;
	ox:extraptr;
        gex : extraptr;

code
{
u:=ghead();
if (arg=="")
	{
	arg:="Players:";
	temp:="--------";
	temps:="player";
	tempp:="players";
	goto who_all;
	}
else if (arg in "newbie")
	{
	if ("New Player Helper" in self.quests)
		{
		arg:="Newbies:";
		temp:="--------";
		temps:="newbie";
		tempp:="newbies";
		goto who_newbie;
		}
	else
		{
		act ("Only the newbie council can check newbies on line.",
			A_ALWAYS,self,null,null,TO_CHAR);
		quit;
		}
	}
else if (arg in "guide")
	{
	arg:="Newbie Helpers:";
	temp:="---------------";
	temps:="helper";
	tempp:="helpers";
	goto who_guide;
	}
else if (arg in "builder")
	{
	arg:="Valhalla Builders:";
	temp:="------------------";
	temps:="builder";
	tempp:="builders";
	goto who_builder;
	}
else if (arg in "clan")
	{
	arg:="Clan Members:";
	temp:="-------------";
	temps:="member";
	tempp:="members";
	goto who_clan;
	}
else if (arg in "admin")
{
	arg:="Valhalla Admins:";
	temp:="----------------";
		temps:="admin";
		tempp:="admins";
	goto who_admin;
	}

arg:="Players:";
temp:="--------";
temps:="player";
tempp:="players";

:who_all:
while (u.type==UNIT_ST_PC)
{
if (visible(self,u))
	{
gex := "$path" in u.quests;
if (not(gex))
   gld := "Guildless";
else
   gld := gex.descr;

	if (u.level >= OVERSEER_LEVEL)
		gld:="Admin";
		else if (u.level>=CREATOR_LEVEL)
			gld:="Creator";
		else if (u.level>IMMORTAL_LEVEL)
			gld:="Immortal";

	buff:="&[who_name]"+u.name+"&[default] &[who_title]"+u.title+"&[default] &[who_guild]("+gld+"&[who_guild])&[default] ";
	if (u.minv>0)
		buff:=buff+"&[who_inv][ WIZINV "+itoa(u.minv)+" ]&[default] ";
		else if (isaff(u, ID_INVISIBILITY))
		buff:=buff+"&[who_inv][ INV ]&[who]";
		if ("valhalla builder" in u.quests)
			buff:=buff+" * Builder *&[default]";
	buff:=buff+" &n";
	addstring (ply_list,buff);
	}
u:=u.gnext;
}
goto p_who;
:who_newbie:
while (u.type==UNIT_ST_PC)
{
if ((visible(self,u)) and
(u.level <= 20))
	{
gex := "$path" in u.quests;
if (not(gex))
   gld := "Guildless";
else
   gld := gex.descr;
	if (u.level >= OVERSEER_LEVEL)
		gld:="Admin";
		else if (u.level>=CREATOR_LEVEL)
			gld:="Creator";
		else if (u.level>IMMORTAL_LEVEL)
			gld:="Immortal";

	buff:="&[who_name]"+u.name+"&[default] &[who_title]"+u.title+"&[default] &[who_guild]("+gld+"&[who_guild])&[default] ";
	if (u.minv>0)
		buff:=buff+"&[who_inv][ WIZINV "+itoa(u.minv)+" ]&[default] ";
		else if (isaff(u, ID_INVISIBILITY))
		buff:=buff+"&[who_inv][ INV ]&[who]";
		if ("valhalla builder" in u.quests)
			buff:=buff+" * Builder *&[default]";
	buff:=buff+" &n";
	addstring (ply_list,buff);
	}
u:=u.gnext;
}
goto p_who;
:who_admin:
while (u.type==UNIT_ST_PC)
{
if ((visible(self,u)) and
(u.level >= 253))
	{
gex := "$path" in u.quests;
if (not(gex))
   gld := "Guildless";
else
   gld := gex.descr;
	if (u.level >= OVERSEER_LEVEL)
		gld:="Admin";
		else if (u.level>=CREATOR_LEVEL)
			gld:="Creator";
		else if (u.level>IMMORTAL_LEVEL)
			gld:="Immortal";

	buff:="&[who_name]"+u.name+"&[default] &[who_title]"+u.title+"&[default] &[who_guild]("+gld+"&[who_guild])&[default] ";
	if (u.minv>0)
		buff:=buff+"&[who_inv][ WIZINV "+itoa(u.minv)+" ]&[default] ";
		else if (isaff(u, ID_INVISIBILITY))
		buff:=buff+"&[who_inv][ INV ]&[who]";
		if ("valhalla builder" in u.quests)
			buff:=buff+" * Builder *&[default]";
	buff:=buff+" &n";
	addstring (ply_list,buff);
	}
u:=u.gnext;
}
goto p_who;
:who_guide:
while (u.type==UNIT_ST_PC)
{
if ((visible(self,u)) and
("New Player Helper" in u.quests))
	{
gex := "$path" in u.quests;
if (not(gex))
   gld := "Guildless";
else
   gld := gex.descr;
	if (u.level >= OVERSEER_LEVEL)
		gld:="Admin";
		else if (u.level>=CREATOR_LEVEL)
			gld:="Creator";
		else if (u.level>IMMORTAL_LEVEL)
			gld:="Immortal";

	buff:="&[who_name]"+u.name+"&[default] &[who_title]"+u.title+"&[default] &[who_guild]("+gld+"&[who_guild])&[default] ";
	if (u.minv>0)
		buff:=buff+"&[who_inv][ WIZINV "+itoa(u.minv)+" ]&[default] ";
		else if (isaff(u, ID_INVISIBILITY))
		buff:=buff+"&[who_inv][ INV ]&[who]";
		if ("valhalla builder" in u.quests)
			buff:=buff+" * Builder *&[default]";
	buff:=buff+" &n";
	addstring (ply_list,buff);
	}
u:=u.gnext;
}
:who_builder:
while (u.type==UNIT_ST_PC)
{
if ((visible(self,u)) and
("valhalla builder" in u.quests))
	{
gex := "$path" in u.quests;
if (not(gex))
   gld := "Guildless";
else
   gld := gex.descr;
	if (u.level >= OVERSEER_LEVEL)
		gld:="Admin";
		else if (u.level>=CREATOR_LEVEL)
			gld:="Creator";
		else if (u.level>IMMORTAL_LEVEL)
			gld:="Immortal";

	buff:="&[who_name]"+u.name+"&[default] &[who_title]"+u.title+"&[default] &[who_guild]("+gld+"&[who_guild])&[default] ";
	if (u.minv>0)
		buff:=buff+"&[who_inv][ WIZINV "+itoa(u.minv)+" ]&[default] ";
		else if (isaff(u, ID_INVISIBILITY))
		buff:=buff+"&[who_inv][ INV ]&[who]";
		if ("valhalla builder" in u.quests)
			buff:=buff+" * Builder *&[default]";
	buff:=buff+" &n";
	addstring (ply_list,buff);
	}
u:=u.gnext;
}
:who_clan:
while (u.type==UNIT_ST_PC)
{
x:=CLAN_NAME in self.extra;
if (x==null)
	{
	u:=u.gnext;
	continue;
	}
ox:=CLAN_NAME in u.extra;
if (ox==null)
	{
	u:=u.gnext;
	continue;
	}
if (ox.descr!=x.descr)
	{
	u:=u.gnext;
	continue;
	}
if (visible(self,u))
	{
gex := "$path" in u.quests;
if (not(gex))
   gld := "Guildless";
else
   gld := gex.descr;
	if (u.level >= OVERSEER_LEVEL)
		gld:="Admin";
		else if (u.level>=CREATOR_LEVEL)
			gld:="Creator";
		else if (u.level>IMMORTAL_LEVEL)
			gld:="Immortal";

	buff:="&[who_name]"+u.name+"&[default] &[who_title]"+u.title+"&[default] &[who_guild]("+gld+"&[who_guild])&[default] ";
	if (u.minv>0)
		buff:=buff+"&[who_inv][ WIZINV "+itoa(u.minv)+" ]&[default] ";
		else if (isaff(u, ID_INVISIBILITY))
		buff:=buff+"&[who_inv][ INV ]&[who]";
		if ("valhalla builder" in u.quests)
			buff:=buff+" * Builder *&[default]";
	buff:=buff+" &n";
	addstring (ply_list,buff);
	}
u:=u.gnext;
}
:p_who:
buff:="";
ln:=length(ply_list);
buff:="&[who]"+arg+"&[default]&n";
buff:=buff+"&[who]"+temp+"&[default]&n";
if (ln<=0)
	buff:=buff+"None&n";
else
	{
i:=0;
while (i<ln)
	{
	buff:=buff+ply_list.[i];
	i:=i+1;
	}
}
if (ln==1)
	buff:=buff+"&[who]There is " +itoa(ln)+ " "+temps+" visible to you.&[default]";
else
	buff:=buff+"&[who]There are " +itoa(ln)+ " "+tempp+" visible to you.&[default]";;


pagestring(buff,self);
quit;
}
dilend


dilbegin string sizestring(cm : integer);
var
   ftn : integer;
   fts : string;
   inn : integer;
   ins : string;
code
{
   /* One inch equals 2,54 cm. There are 12 inches (30.48 cm) to a foot */
   ftn := cm / 30;
   inn := (10*(cm % 30))/25;
   if (ftn == 1)
     fts := "one foot";
   else if (ftn > 1)
     fts := itoa(ftn)+" feet";
   else
     fts := "";

   if (inn == 1)
     ins := "one inch";
   else if (inn > 1)
     ins := itoa(inn)+" inches";
   else
     ins := "";

   if (fts != "")
   {
      if (ins != "")
        fts := fts + " and ";
   }
   else
   {
      if (inn < 1)
	ins := "less than an inch";
   }

   return (fts + ins);
}
dilend
dilbegin string weightstring(p : integer);
var
   s : string;
code
{
   if (p == 1)
     s := "one pound";
   else if (p > 1)
     s := itoa(p)+" pounds";
   else
     s := "less than a pound";

   return (s);
}
dilend




dilbegin affect(arg:string);
var
	spl_aff:stringlist;
	i:integer;
	ln:integer;
code
{
   if (isaff(self, ID_BLESS))
	addstring(spl_aff,"Bless&n");
if (isaff(self, ID_DETECT_ALIGN))
	addstring(spl_aff,"Detect Alignment&n");
if (isaff(self, ID_DETECT_INVISIBLE))
	addstring(spl_aff,"Detect Invisibility&n");
if (isaff(self, ID_DETECT_MAGIC))
	addstring(spl_aff,"Detect Magic&n");
if (isaff(self, ID_DETECT_POISON))
	addstring(spl_aff,"Detect Poison&n");
if (isaff(self, ID_DETECT_UNDEAD))
	addstring(spl_aff,"Detect Undead&n");
if (isaff(self, ID_DETECT_CURSE))
	addstring(spl_aff,"Detect Curse&n");
if (isaff(self, ID_DETECT_LIFE))
	addstring(spl_aff,"Detect Life&n");
if (isaff(self, ID_INVISIBILITY))
	addstring(spl_aff,"Invisibility&n");
if (isaff(self, ID_HOLD))
	addstring(spl_aff,"Hold&n");
if (isaff(self, ID_MAGIC_LIGHT))
	addstring(spl_aff,"Magic Light&n");
if (isaff(self, ID_MAGIC_DARK))
	addstring(spl_aff,"Magic Dark&n");
if (isaff(self, ID_SPL_RAISE_MAG))
	addstring(spl_aff,"Raise Magic&n");
if (isaff(self, ID_SPL_RAISE_DIV))
	addstring(spl_aff,"Raise Divine&n");
if (isaff(self, ID_SPL_RAISE_STR))
	addstring(spl_aff,"Raise Strength&n");
if (isaff(self, ID_SPL_RAISE_DEX))
	addstring(spl_aff,"Raise Dexterity&n");
if (isaff(self, ID_SPL_RAISE_CON))
	addstring(spl_aff,"Raise Constitution&n");
if (isaff(self, ID_SPL_RAISE_CHA))
	addstring(spl_aff,"Raise Charisma&n");
if (isaff(self, ID_SPL_RAISE_BRA))
	addstring(spl_aff,"Raise Brain&n");
if (isaff(self, ID_SPL_RAISE_HPP))
	addstring(spl_aff,"Raise Hit Points&n");
if (isaff(self, ID_SPL_RAISE_DIVINE))
	addstring(spl_aff,"Raise Divine Sphere&n");
if (isaff(self, ID_SPL_RAISE_SUMMONING))
	addstring(spl_aff,"Raise Summoning Sphere&n");
if (isaff(self, ID_SPL_RAISE_MIND))
	addstring(spl_aff,"Raise Mind Sphere&n");
if (isaff(self, ID_SPL_RAISE_HEAT))
	addstring(spl_aff,"Raise Heat Sphere&n");
if (isaff(self, ID_SPL_RAISE_COLD))
	addstring(spl_aff,"Raise Cold Sphere&n");
if (isaff(self, ID_SPL_RAISE_CELL))
	addstring(spl_aff,"Raise Electricity Sphere&n");
if (isaff(self, ID_SPL_RAISE_INTERNAL))
	addstring(spl_aff,"Raise Poison Sphere&n");
if (isaff(self, ID_SPL_RAISE_EXTERNAL))
	addstring(spl_aff,"Raise Acid Sphere&n");
if (isaff(self, ID_POISON))
	addstring(spl_aff,"Poison&n");
if (isaff(self, ID_SPEED))
	addstring(spl_aff,"Magic Speed&n");
if (isaff(self, ID_LIFE_PROTECTION))
        addstring(spl_aff,"Life Protection&n");
if (isaff(self, ID_SANCTUARY))
        addstring(spl_aff,"Sanctuary&n");
if (isaff(self, ID_PROT_EVIL))
        addstring(spl_aff,"Protection from Evil&n");
if (isaff(self, ID_PROT_GOOD))
        addstring(spl_aff,"Protection from Good&n");
if (isaff(self, ID_BLIND_CHAR))
        addstring(spl_aff,"Blind&n");
if (isaff(self, ID_FEAR))
        addstring(spl_aff,"Fear&n");
if (isaff(self, ID_SLEEP))
        addstring(spl_aff,"Sleep&n");
if (isaff(self, ID_CURSE))
        addstring(spl_aff,"Curse&n");
if (isaff(self, ID_INSANITY))
        addstring(spl_aff,"Madness&n");
if (isaff(self, ID_SUSTAIN))
        addstring(spl_aff,"Sustained from Hunger&n");
if (isaff(self, ID_PLAGUE))
        addstring(spl_aff,"Plague&n");
if (isaff(self, ID_ENERGY_DRAIN))
        addstring(spl_aff,"Energy Drain&n");
if (isaff(self, ID_CONFUSION))
        addstring(spl_aff,"Confusion&n");
if (isaff(self, ID_NATURAL_ARMOUR))
        addstring(spl_aff,"Magical Natural Armor&n");

ln:=length (spl_aff);

if (ln<1)
	{
	act ("You are not affected by magic.",
		A_ALWAYS,self,null,null,TO_CHAR);
		goto hide_sneak	;
		}
i:=0;
act ("You are affected by:&n",
	A_ALWAYS,self,null,null,TO_CHAR);

while (i<ln)
	{
	sendtext (spl_aff.[i],self);
	i:=i+1;
	}

:hide_sneak:

if ((isset(self.charflags, CHAR_HIDE)) and (isset(self.charflags, CHAR_SNEAK))){
	sendtext ("&nYou are hiding and sneaking.&n",self);}
else if (isset(self.charflags, CHAR_HIDE)){
	sendtext ("&nYou are hiding.&n",self);}
else if (isset(self.charflags, CHAR_SNEAK)){
	sendtext ("&nYou are sneaking.&n",self);}
quit;
}
dilend


dilbegin report(arg:string);
var
u : unitptr;
code
{
if(self.type!=UNIT_ST_PC)
quit;

if(arg==""){
  act(self.name+" reports: "+itoa(self.hp)+"/"+itoa(self.max_hp)+
    " Hitpoints, "+itoa(self.endurance)+"/"+itoa(self.max_endurance)+
    " Endurance, "+itoa(self.mana)+"/"+itoa(self.max_mana)+" Mana",
    A_SOMEONE, self, null, null, TO_REST);
  act("You report: "+itoa(self.hp)+"/"+itoa(self.max_hp)+
    " Hitpoints, "+itoa(self.endurance)+"/"+itoa(self.max_endurance)+
    " Endurance, "+itoa(self.mana)+"/"+itoa(self.max_mana)+" Mana",
    A_ALWAYS, self, null, null, TO_CHAR);
}
else if(arg=="group") {
foreach (UNIT_ST_PC, u)
{
 if(u==self)
 {
  act("You report: "+itoa(self.hp)+"/"+itoa(self.max_hp)+
    " Hitpoints, "+itoa(self.endurance)+"/"+itoa(self.max_endurance)+
    " Endurance, "+itoa(self.mana)+"/"+itoa(self.max_mana)+" Mana"+
    " to the group.", A_ALWAYS, self, null, null, TO_CHAR);
 }
 else if(u.master==self)
 {
  act("$1n reports: "+itoa(self.hp)+"/"+itoa(self.max_hp)+
    " Hitpoints, "+itoa(self.endurance)+"/"+itoa(self.max_endurance)+
    " Endurance, "+itoa(self.mana)+"/"+itoa(self.max_mana)+" Mana"+
    " to the group.", A_SOMEONE, self, null, u, TO_VICT);
 }
 else if(u==self.master) {
  act("$1n reports: "+itoa(self.hp)+"/"+itoa(self.max_hp)+
    " Hitpoints, "+itoa(self.endurance)+"/"+itoa(self.max_endurance)+
    " Endurance, "+itoa(self.mana)+"/"+itoa(self.max_mana)+" Mana"+
    " to the group.", A_SOMEONE, self, null, u, TO_VICT);
 }
 else if(u.master==self.master)
 {
  act("$1n reports: "+itoa(self.hp)+"/"+itoa(self.max_hp)+
    " Hitpoints, "+itoa(self.endurance)+"/"+itoa(self.max_endurance)+
    " Endurance, "+itoa(self.mana)+"/"+itoa(self.max_mana)+" Mana"+
    " to the group.", A_SOMEONE, self, null, u, TO_VICT);
 }
}
}
else
{
 u:=findunit(self, arg, FIND_UNIT_SURRO, null);
 if(u==null)
 {
   act("That person is not here.", A_ALWAYS, self, null, null, TO_CHAR);
 }
 else
 {
  act("$1n reports: "+itoa(self.hp)+"/"+itoa(self.max_hp)+
    " Hitpoints, "+itoa(self.endurance)+"/"+itoa(self.max_endurance)+
    " Endurance, "+itoa(self.mana)+"/"+itoa(self.max_mana)+" Mana"+
    " to you.", A_SOMEONE, self, null, u, TO_VICT);
  act("You report: "+itoa(self.hp)+"/"+itoa(self.max_hp)+
    " Hitpoints, "+itoa(self.endurance)+"/"+itoa(self.max_endurance)+
    " Endurance, "+itoa(self.mana)+"/"+itoa(self.max_mana)+" Mana"+
    " to $3n.", A_ALWAYS, self, null, u, TO_CHAR);
 }
}
  quit;
}
dilend

dilbegin transfer(arg : string);
var
dest_s : unitptr;
dest_t : unitptr;
tgt    : unitptr;
str    : string;

code
{

 if(arg == "")
  {
   act("&n&c+wUsage &c+n: &cmtransfer &c+c<&ccperson&c+c>
        &cmtransfer &c+c<&ccperson&c+c> &c+c<&ccplace&c+c>
        &cmtransfer &c+c<&ccperson&c+c> <&ccroom&c+c@&cczone&c+c>
        &cmtransfer &c+c<&ccall&c+c> &cwUse with care!&[default]",
       A_ALWAYS, self, null, null, TO_CHAR);
   quit;
  }

  if((arg == "all") or (arg == "all now"))
  goto transall;

 tgt := findunit(self,arg,FIND_UNIT_GLOBAL,null);

 if((tgt == null) or (not(visible(self,tgt))))
  {
   act("No such person found.",
     A_ALWAYS, self, null, null, TO_CHAR);
   quit;
  }

 if(tgt == self)
  {
   act("DOH", A_ALWAYS, self, null, null, TO_CHAR);
   quit;
  }

 if(not(tgt.type & (UNIT_ST_PC|UNIT_ST_NPC)))
 {
  act("Transfer is for players and mobiles only!",
     A_ALWAYS, self, null, null, TO_CHAR);
  quit;
 }

 if(arg == "") /* lone transfer..ex. transfer domino */
 {
  dest_s := self.outside;
  dest_t := tgt.outside;

  if((("$NO_TRANS" in dest_s.extra) or ("NO_TRANS" in dest_t.extra)) and
      (self.level < 250))
  {
   act("Sorry, you are unable to transfer that person.",
      A_ALWAYS, self, null, null, TO_CHAR);
   quit;
  }

  if((isset(tgt.pcflags,PC_SPIRIT)) and (self.level < 250))
  {
   act("You are unable to transfer dead persons.",
      A_ALWAYS, self, null, null, TO_CHAR);
   quit;
  }

 act("Ok.", A_ALWAYS, self, null, null, TO_CHAR);
 act("$1n disappears in a mushroom cloud.",
       A_SOMEONE, tgt, null, null, TO_REST);
 act("$3n has transferred you!",
       A_SOMEONE, tgt, null, self, TO_CHAR);
 link(tgt,dest_s);
 exec("look", tgt);
 act("$1n appears in a puff of smoke.",
    A_SOMEONE, tgt, null, null, TO_REST);
 quit;
 }
 else if("@" in arg) /* transfer domino temple@udgaard */
 {
  dest_s := findroom(arg);
  if(dest_s == null)
  {
   act("No such room!", A_ALWAYS, self, null, null, TO_CHAR);
   quit;
  }
  dest_t := tgt.outside;

  if(("NO_TRANS" in dest_t.extra) and
      (self.level < 250))
  {
   act("Sorry, you are unable to transfer that person.",
      A_ALWAYS, self, null, null, TO_CHAR);
   quit;
  }

  if((isset(tgt.pcflags,PC_SPIRIT)) and (self.level < 250))
  {
   act("You are unable to transfer dead persons",
     A_ALWAYS, self, null, null, TO_CHAR);
   quit;
  }

  act("Ok.", A_ALWAYS, self, null, null, TO_CHAR);
  act("$1n disappears in a mushroom cloud.",
        A_SOMEONE, tgt, null, null, TO_REST);
  act("$3n has transferred you!",
        A_SOMEONE, tgt, null, self, TO_CHAR);
  link(tgt,dest_s);
  exec("look", tgt);
  act("$1n appears in a puff of smoke.",
     A_SOMEONE, tgt, null, null, TO_REST);
  quit;
 }
 else /* transfer domino boobar the giantslayer */
  {
   dest_s := findunit(self,arg, FIND_UNIT_WORLD, null);

   if(dest_s == null)
   {
    act("No such place to transfer $3n to!",
      A_ALWAYS, self, null, tgt, TO_CHAR);
    quit;
   }

 if(dest_s.type != UNIT_ST_ROOM)
  {
   while(dest_s.type != UNIT_ST_ROOM)
     dest_s := dest_s.outside;
  }

  dest_t := tgt.outside;

  if(("NO_TRANS" in dest_t.extra) and
      (self.level < 250))
  {
   act("Sorry, you are unable to transfer that person.",
      A_ALWAYS, self, null, null, TO_CHAR);
   quit;
  }

  if((isset(tgt.pcflags,PC_SPIRIT)) and (self.level < 250))
  {
   act("You are unable to transfer dead persons",
     A_ALWAYS, self, null, null, TO_CHAR);
   quit;
  }

  act("Ok.", A_ALWAYS, self, null, null, TO_CHAR);
  act("$1n disappears in a mushroom cloud.",
        A_SOMEONE, tgt, null, null, TO_REST);
  act("$3n has transferred you!",
        A_SOMEONE, tgt, null, self, TO_CHAR);
  link(tgt,dest_s);
  exec("look", tgt);
  act("$1n appears in a puff of smoke.",
     A_SOMEONE, tgt, null, null, TO_REST);
  quit;
 }

 :transall:

  if(arg != "all now")
  {
   act("You must type &cctransfer all now&[default].",
      A_ALWAYS, self, null, null, TO_CHAR);
   quit;
  }

  act("Ok.", A_ALWAYS, self, null, null, TO_CHAR);

 tgt := ghead();

 while(tgt.type == UNIT_ST_PC)
 {

  if((visible(self,tgt)) and (tgt != self))
  {

   act("$1n disappears in a mushroom cloud.",
       A_SOMEONE, tgt, null, null, TO_REST);
   act("$3n has transferred you!",
        A_SOMEONE, tgt, null, self, TO_CHAR);
   link(tgt, self.outside);
   exec("look", tgt);
   act("$1n appears in a puff of smoke.",
     A_SOMEONE, tgt, null, null, TO_REST);
  }

 tgt := tgt.gnext;
 }


quit;
}
dilend


dilbegin assist(arg : string);
var
   u : unitptr;
   s : string;
code
{
if(arg=="") {
  act("Assist who??",A_SOMEONE,self,null,null,TO_CHAR);
  quit; }
u:=findunit(self,arg,FIND_UNIT_SURRO,null);
secure(u,losthim);
if(u==null) {
  act("No such person by that name!.",A_SOMEONE,self,null,null,TO_CHAR);
  quit; }
if(u==self) {
  act("Assist yourself?  Your in pretty bad shape if your the only one who
can help you.",A_SOMEONE,self,null,null,TO_CHAR);
  quit; }
if(self.fighting) {
  act("No way! You are too busy fighting for your life!",
      A_ALWAYS,self,null,null,TO_CHAR);
  quit; }
if(u.fighting==null) {
  act("Assist $3n? $3e isn't fighting anything.",
      A_SOMEONE,self,null,u,TO_CHAR);
  quit; }
if((self.type==UNIT_ST_PC) and (u.fighting.type==UNIT_ST_PC)) {
  if(not(isset(u.fighting.pcflags,PC_PK_RELAXED))) {
    act("You cannot do this until $3n has signed the book of blood.",
        A_SOMEONE,self,null,u.fighting,TO_CHAR);
    quit; }
  if(not(isset(self.pcflags,PC_PK_RELAXED))) {
    act("You are not allowed to do this until you sign the book of blood.",
        A_ALWAYS,self,null,u.fighting,TO_CHAR);
    quit; } }
act("You bravely come to $3n's assistance.",
A_SOMEONE,self,null,u,TO_CHAR);
act("$1n bravely comes to your assistance.",
A_SOMEONE,self,null,u,TO_VICT);
act("$1n bravely comes to $3n's assistance.",
A_SOMEONE,self,null,u,TO_NOTVICT);
set_fighting(self,u.fighting);

:losthim:
quit;
}
dilend

/*Quaff dil
Made by Mesmer for the Realms Of The Past MUD
realms.pdt.net 4242
*/

dilbegin quaff_dil(arg : string);
var
potion : unitptr;
n      : integer;

code
{

 if(arg == "")
 {
 act("What do you want to quaff?",
     A_ALWAYS, self, null, null, TO_CHAR);
 quit;
 }

 potion := findunit(self,arg,FIND_UNIT_IN_ME,null);

 if(potion == null)
 {
 act("You do not have that item.",
    A_ALWAYS, self, null, null, TO_CHAR);
 quit;
 }

 if(potion.objecttype != ITEM_POTION)
 {
 act("You can only quaff potions.",
    A_ALWAYS, self, null, null, TO_CHAR);
 quit;
 }

 potion.spells[SPL_ALL] := potion.value[0];

 if(self.position == POSITION_FIGHTING) change_speed(self,PULSE_VIOLENCE*2);

 act("You quaff $2t which dissolves.",
      A_ALWAYS, self, potion.title, null, TO_CHAR);
 act("$1N quaffs $2t.",
      A_SOMEONE, self,potion.title, null, TO_REST);
 n := cast_spell(potion.value[1],self,potion,self,"");
 n := cast_spell(potion.value[2],self,potion,self,"");
 n := cast_spell(potion.value[3],self,potion,self,"");
 destroy(potion);
 quit;

}
dilend


dilbegin donate(arg:string);
var
	clan:integer;
d_rooms:stringlist;
room_idx:string;
room    :       unitptr;
item    :       unitptr;
num     :       integer;
i:integer;
here:unitptr;
x:extraptr;
amount:integer;
check:unitptr;
code
{
clan:=0;

:start:
d_rooms:={"udonate@midgaard","mdonate@midgaard","ndonate@nymgaard"};
room_idx:=self.outside.nameidx+"@"+self.outside.zoneidx;
if (room_idx in d_rooms)
  {
  act("You may not donate while in a donations room!",
    A_ALWAYS, self, null, null, TO_CHAR);
    quit;
  }

item := findunit(self, arg, FIND_UNIT_INVEN, null);
if (not(item.type == UNIT_ST_OBJ))
  {
  act("You do not have anything like that in your inventory.",
    A_ALWAYS, self, null, null, TO_CHAR);
    quit;
  }
  if ("midgaard" in arg)
  room := findroom("mdonate@midgaard");
  else if ("nymgaard" in arg)
  room := findroom("ndonate@nymgaard");
else if ("clan" in arg)
	{
	x:=CLAN_SYMBOLIC in self.extra;
	if (x==null)
		{
		act ("&[clan]You are not a member of a clan.",
			A_ALWAYS, self,null,null,TO_CHAR);
			quit;
			}
		room:=findsymbolic(x.descr);
		if (room==null)
		{
		act ("&[clan]Clan code error report to Admin.",
			A_ALWAYS,self,null,null,TO_CHAR);
		quit;
		}
if (item.objecttype==ITEM_CONTAINER)
	{
	if (item.inside!=null)
		{
	act ("&[clan]You can not donate a container that contains items, empty it and try again.",
    A_ALWAYS, self, null, null, TO_CHAR);
    quit;
		}
	}
		clan:=1;
amount:=0;
check:=room.inside;
while (check!=null)
	{
	if (check.minv!=253)
		amount:=amount+1;
	check:=check.next;
	}

	if (amount >=CLAN_MAX_DONATION)
		{
		act("&[clan]You can't donate your clan Chest is full.",
			A_ALWAYS,self,null,null,TO_CHAR);
			quit;
			}
	}
else
  room := findroom("udonate@udgaard");
if (clan!=1)
	{
	num := rnd(1, 200);
	if (num > 195)
	  {
	  if (item.cost >= 75000)
	    {
	    experience(+75, self);
	    act("You are rewarded 75 experience for your act.",
	      A_ALWAYS, self, null, null, TO_CHAR);
	    }else if (item.cost >= 50000)
	      {
	      experience(+35, self);
	      act("You are rewarded 35 experience for your act.",
	        A_ALWAYS, self, null, null, TO_CHAR);
	      }
	    }

	i:=0;
	here:=room.inside;
	while ((here!=null) and (i<5))
	  {
	  if (here.idx==item.idx)i:=i+1;
	  here:=here.next;
	  }

	  act("You donate $2n to those in need.",
	    A_ALWAYS, self, item, null, TO_CHAR);
	  act("$1n donates $2n to those in need.",
	    A_SOMEONE, self, item, null, TO_REST);

	  if (i<5)
	    {
	  item.cost := 0;
	  link(item, room);
	  act("A Glowing red portal appears hovering in the air, $2n"+
	    " emerges from it and drops to the floor.",
	    A_ALWAYS, room.inside, item, null, TO_ALL);
	    }
	    else
	     destroy (item);
			 }
		 else
		 	{
	  act("&[clan]You donate $2n to your clan.",
	    A_ALWAYS, self, item, null, TO_CHAR);
	  act("&[clan]$1n  donates $2n to $1s clan.",
	    A_SOMEONE, self, item, null, TO_REST);
	  link(item, room);
store (room,"d_c."+room.zoneidx,TRUE);
		}
  quit;
}
dilend

/* The cuff skill.

   The skill is implemented on the hand cuffs themselves.

*/

dilbegin cuff(arg : string);
code
{
   act("You seem to be missing a pair of hand cuffs.",
       A_ALWAYS, self, null, null, TO_CHAR);
   quit;
}
dilend


dilbegin evaluate(arg : string);

external
   string sizestring@commands(cm : integer);
   string weightstring@commands(cm : integer);

var
   u : unitptr;
   s : string;
   degrade : integer;
code
{
   if (arg == "")
   {
      act("What do you wish to evaluate?",
	  A_SOMEONE, self, null, null,TO_CHAR);
      quit;
   }

   u := findunit(self, arg, FIND_UNIT_HERE, null);

   if ((u == null) or not visible(self, u))
   {
      act("No such thing by that name!", A_SOMEONE, self, null, null,
TO_CHAR);
      quit;
   }

   if (u.type != UNIT_ST_OBJ)
   {
      act("You can't evaluate $3m.",
	  A_SOMEONE, self, null, u, TO_CHAR);
      quit;
   }

   s := weightstring@commands(u.weight);
   act("The $3N weighs "+s+".",
       A_SOMEONE, self, null, u, TO_CHAR);

   if ((u.manipulate & (MANIPULATE_WEAR_FINGER | MANIPULATE_WEAR_NECK  |
			MANIPULATE_WEAR_BODY   | MANIPULATE_WEAR_HEAD  |
			MANIPULATE_WEAR_LEGS   | MANIPULATE_WEAR_FEET  |
			MANIPULATE_WEAR_HANDS  | MANIPULATE_WEAR_ARMS  |
			MANIPULATE_WEAR_SHIELD | MANIPULATE_WEAR_ABOUT |
			MANIPULATE_WEAR_WAIST  | MANIPULATE_WEAR_WRIST |
			MANIPULATE_WIELD       | MANIPULATE_WEAR_EAR   |
			MANIPULATE_WEAR_BACK   | MANIPULATE_WEAR_CHEST |
			MANIPULATE_WEAR_ANKLE)) or
       (u.objecttype == ITEM_WEAPON))
   {
      s := sizestring@commands(u.height);
      act("$3e has been made to fit a person of "+s+".",
	  A_SOMEONE, self, null, u, TO_CHAR);
   }

   if ((u.max_hp > 0) and (u.hp > 0))
   {
      degrade := (100*u.hp) / u.max_hp;

      if (degrade >= 90)
	s := "in an excellent condition.";
      else if (degrade >= 75)
	s := "in a good condition.";
      else if (degrade >= 50)
	s := "worn.";
      else if (degrade >= 30)
	s := "in a poor condition";
      else if (degrade >= 10)
	s := "in a horrible condition.";
      else
	s := "nearly broken.";
   }
   else if (u.max_hp == -1)
     s := "in an excellent condition.";
   else
     s := "broken.";

   act("The $3N appears to be "+s,
       A_ALWAYS, self, null, u, TO_CHAR);

   if (u.objecttype == ITEM_ARMOR)
     on u.value[0] goto clothes,leather,leather,metal,metal;
   else if (u.objecttype == ITEM_SHIELD)
     goto metal;
   else if (u.objecttype == ITEM_WEAPON)
     goto metal;
   else if (u.objecttype == ITEM_WORN)
     goto clothes;
   else
   {
      if ((u.manipulate & (MANIPULATE_WEAR_FINGER | MANIPULATE_WEAR_NECK  |
			     MANIPULATE_WEAR_BODY   | MANIPULATE_WEAR_HEAD  |
			     MANIPULATE_WEAR_LEGS   | MANIPULATE_WEAR_FEET  |
			     MANIPULATE_WEAR_HANDS  | MANIPULATE_WEAR_ARMS  |
			     MANIPULATE_WEAR_SHIELD | MANIPULATE_WEAR_ABOUT |
			     MANIPULATE_WEAR_WAIST  | MANIPULATE_WEAR_WRIST |
			     MANIPULATE_WIELD       | MANIPULATE_WEAR_EAR   |
			     MANIPULATE_WEAR_BACK   | MANIPULATE_WEAR_CHEST |
			     MANIPULATE_WEAR_ANKLE)) == 0)
      {
         goto nextstep;
      }
      goto metal; /* What else can one do? */
   }
   goto nextstep;

   :clothes:
   act ("Refitting the size of it, requires tailoring skills.",
        A_ALWAYS,self,null, null,TO_CHAR);
   goto nextstep;

   :leather:
   act ("Refitting the size of it, requires leather working skills.",
        A_ALWAYS,self,null, null,TO_CHAR);
   goto nextstep;

   :metal:
   act ("Refitting the size of it, requires metal skills.",
        A_ALWAYS,self,null, null,TO_CHAR);
   goto nextstep;

   :nextstep:

   /* Eventually add

      Material Lore
      Appraisal
      Spell Lore
    */

   quit;
}
dilend

dilbegin ditch(arg : string);
var
   u : unitptr;
   s : string;
code
{
   if (arg == "")
   {
      act("They are not here.",
          A_SOMEONE, self, null, null,TO_CHAR);
      quit;
   }

   u := findunit(self, arg, FIND_UNIT_WORLD, null);
   secure(u,losthim);

   if ((u == null) or not visible(self, u))
   {
      act("No such person by that name!.",
       A_SOMEONE, self, null, null, TO_CHAR);
      quit;
   }
if (not (visible(self,u)))
   {
      act("No such person by that name!.",
       A_SOMEONE, self, null, null, TO_CHAR);
      quit;
   }
   if ((u.master == self) and  (u.type == UNIT_ST_NPC))
   {
      act("$1n tries to ditch $3n but fails miserably.",
	  A_SOMEONE, self, null, u, TO_NOTVICT);
      act("you can not ditched $3n.",
	  A_SOMEONE, self,null,u, TO_CHAR);
      quit;
   }
   if ((u.master == self) and  (u.type == UNIT_ST_PC))
   {
      act("$1n has ditched $3n.",
	  A_SOMEONE, self, null, u, TO_NOTVICT);
      act("$1n has ditched you.",
	  A_SOMEONE,self, null,u, TO_VICT);
      act("you have ditched $3n.",
	  A_SOMEONE, self,null,u, TO_CHAR);
      exec("follow self",u);
      quit;
   }
   else
   {
      act("$2n is not following you",
	  A_SOMEONE, self, u, null, TO_CHAR);
      quit;
   }

   :losthim:
   quit;
}
dilend
%rooms

hold_room
names {""}
title "In Stone"
descr

"You have been turned to stone. Time stands still for you."

flags {UNIT_FL_NO_WEATHER, UNIT_FL_NO_TELEPORT, UNIT_FL_SACRED}

minv 255

end /* hold_room */
                                   command_room
title "The Commands Room"
descr
"Token room."
movement SECT_INSIDE
flags {UNIT_FL_NO_WEATHER}
ALWAYS_LIGHT
end

%end