/*

filename    basis
password    release
changedby   Darg
EmailAdd    Mark Pringle darg@valhalla.com  
request     compile
version     2
END HEADER*/

#include

%zone                                  basis
reset RESET_NOT

weather 1040

creators {"Whistler","papi"}

notes
"This is the basis zone. Dont 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
"&hThis zone is not intended for players, unless you are in void or dead."
/*Colour test (blue background):&n&n
&bb
&cnBlack.&n
&crRed.&n
&cgGreen.&n
&cyYellow.&n
&cbBlue.&n
&cmMagenta.&n
&ccCyan.&n
&cwWhite.&n
&c+nBright Black.&n
&c+rBright Red.&n
&c+gBright Green.&n
&c+yBright Yellow.&n
&c+bBright Blue.&n
&c+mBright Magenta.&n
&c+cBright Cyan.&n
&c+wBright White.&n
&bn
"
*/

%dil


#define FIGHTER_BIT  1
#define HEALER_BIT   2
#define CONJURER_BIT 4
#define THIEF_BIT    8
dilbegin nanny_guild( arg : string );
var
  exdp   : extraptr;
  state  : integer;
  s      : string;
  s2     : string;
  picks  : integer;
code
{
  exdp  := "$nanny" in self.extra;
  state := atoi(exdp.descr);

  picks := FIGHTER_BIT + CONJURER_BIT + HEALER_BIT + THIEF_BIT;

  if (self.alignment < 350)
    unset(picks, HEALER_BIT);

  if (self.race == RACE_DWARF)
    unset(picks, CONJURER_BIT);
  else if (self.race == RACE_BROWNIE)
    unset(picks, FIGHTER_BIT);
  else if (self.race == RACE_GROLL)
  {
     unset(picks, THIEF_BIT);
     unset(picks, HEALER_BIT);
     unset(picks, CONJURER_BIT);
  }
  else if ((self.race == RACE_HALF_ORC) or
    (self.race == RACE_HALF_OGRE))
  {
     unset(picks, HEALER_BIT);
     unset(picks, CONJURER_BIT);
  }

  if (state == 0)
  {
     s := "&nChoose your guild:&n";

     if (isset(picks, FIGHTER_BIT))
s := s + "  &c+w1&cw) "+GUILD_UDG_FIGHTER+"&n";

     if (isset(picks, THIEF_BIT))
s := s + "  &c+w2&cw) "+GUILD_UDG_THIEF+"&n";

     if (isset(picks, HEALER_BIT))
s := s + "  &c+w3&cw) "+GUILD_UDG_CLERIC+"&n";

     if (isset(picks, CONJURER_BIT))
s := s + "  &c+w4&cw) "+GUILD_UDG_MAGE+"&n";

     s := s + "Please select a guild or Help: ";

     sendtext(s, self);

     exdp.descr := "1";
     return;
  }

  s := getword(arg);

  if ((s == "1") and isset(picks, FIGHTER_BIT))
  {
     sendtext("You are now a member of the "+
       GUILD_UDG_FIGHTER+" Guild.&n", self);
     self.guild := GUILD_UDG_FIGHTER;
  }
  else if ((s == "2") and isset(picks, THIEF_BIT))
  {
     sendtext("You are now a member of the "+
       GUILD_UDG_THIEF + " Guild.&n", self);
     self.guild := GUILD_UDG_THIEF;
  }
  else if ((s == "3") and isset(picks, HEALER_BIT))
  {
     sendtext("You are now a member of the "+
       GUILD_UDG_CLERIC + " Guild.&n", self);
     self.guild := GUILD_UDG_CLERIC;
  }
  else if ((s == "4") and isset(picks, CONJURER_BIT))
  {
     sendtext("You are now a member of the "+
       GUILD_UDG_MAGE + " Guild.&n", self);
     self.guild := GUILD_UDG_MAGE;
  }
  else
  {
     sendtext("No such guild available to you.&nPlease select one of the
guild numbers (1 - 4) or Help: ", self);
     return;
  }

  subextra(self.extra, "$nanny");
  return;
}
dilend
dilbegin login_modify(tgt : unitptr);
var
i : integer;
code
{
heartbeat := PULSE_SEC;


dilcopy ("got_mail@mail()",tgt);
dilcopy ("break_eq@basis()",tgt);
if (not(dilfind("pk_timer@basis",tgt)))
dilcopy ("pk_timer@basis()",tgt);

     i:=dildestroy("cmd_bugs@commands", tgt);
     i:=dildestroy("cmd_ideas@commands", tgt);
     i:=dildestroy("cmd_typos@commands", tgt);
 subextra (tgt.quests,"$newbie guide is helping");
return;
}
dilend

dilbegin aware link_dead();
var
       t:integer;
       x:extraptr;
       c:integer;
code
{
heartbeat := PULSE_SEC;

sendto ("linkdead",self);
t:=realtime;
x:="$PK_TIMER" in self.extra;
if (x==null)
       {
       act ("$1n leaves the world for another realm.", A_SOMEONE,self,null,null,TO_REST);
       destroy (self);
       }
:start:
c:=realtime-atoi(x.descr);

if (c>300)
       {
       act ("$1n leaves the world for another realm.", A_SOMEONE,self,null,null,TO_REST);
       destroy (self);
       }

       heartbeat:=PULSE_SEC*30;
wait (SFB_TICK,TRUE);
goto start;
}
dilend


dilbegin informer();
var
tgt : unitptr;
code
{
heartbeat := PULSE_SEC;

tgt := ghead();

while(tgt.type == UNIT_ST_PC)
{

if((isset(tgt.pcflags,PC_INFORM)) and (tgt != self))
{
       if(visible(tgt,self))
       {
       if(self.outside == tgt.outside)
        sendtext(self.name+" has arrived.&n", tgt);
         else
          sendtext(self.name+" has entered the world.&n", tgt);
       }
}

tgt := tgt.gnext;
}

return;
}
dilend


dilbegin aware on_connect();
external
       informer();
login_modify(tgt : unitptr);

var
 wizlvl : integer;
       i:integer;
err : integer;
motd : string;
welcome : string;
goodbye : string;
code
{
heartbeat := PULSE_SEC;

if(dilfind("do_quit@commands",self))
       i := dildestroy("do_quit@commands", self);

err := loadstr("motd",motd);

if(err > 0)
{
       motd := textformat(motd);
       sendtext(motd+"&n&n", self);

}

err := loadstr("welcome",welcome);
if(welcome)
       welcome := textformat(welcome);

if (self.level < 200)
{

login_modify(self);
dilcopy ("clan_delete@clans",self);
dilcopy ("clan_clear@clans",self);


if(err > 0)
       sendtext("&n"+welcome+"&n&n", self);
 informer();
 exec("look", self);
 quit;
}
gamestate(self, GS_MENU);

:wiz_menu:
sendtext("Welcome to Valhalla&n&n", self);
sendtext("1) Enter Valhalla&n", self);
sendtext("W) Change Wizinv level [&c+g"+itoa(self.minv)+"&[default]]&n",self);
sendtext("0) Exit Valhalla&n&n", self);
sendtext("Make your choice: ", self);
wait(SFB_CMD, TRUE);

if (command("1") )
{
 gamestate(self, GS_PLAY);
 if(err > 0)
       sendtext("&n"+welcome+"&n&n", self);
 informer();
 exec("look", self);
 quit;
} else if (command("0") ) {
 err := loadstr("goodbye",goodbye);
 if(err > 0)
 {
 goodbye := textformat(goodbye);
 sendtext(goodbye, self);
 }
 destroy(self);
 quit;
} else if (command("w") ) {
 sendtext("Enter new WizInv Level: ", self);
 wait(SFB_CMD, TRUE);
 wizlvl := atoi(cmdstr);
 if (wizlvl > self.level)
   wizlvl := self.level;
 self.minv := wizlvl;
} else {
 sendtext("Invalid Selection&n&n", self);
 goto wiz_menu;
}

}
dilend


dilbegin aware pk_timer();
code
{
heartbeat:=PULSE_SEC*3;
:start:
wait (SFB_COM,activator==self);
if (self.fighting.type==UNIT_ST_PC)
{
subextra(self.extra,"$PK_TIMER");
addextra (self.extra,{"$PK_TIMER"},itoa(realtime));
}
goto start;
}
dilend

dilbegin break_eq ();
var
item:unitptr;
code
{
if (self.level >=200) quit;
   item := self.inside;
     while(item)
   {
  if ((item.hp<-1) and (item.type==ITEM_TRASH))
   {
  item.manipulate:=0;
  item.manipulate:=MANIPULATE_TAKE;
  }
   if ((item.hp<-1) and (item.objecttype!=ITEM_TRASH) and (item.zoneidx!="treasure"))
    {
 if (item.equip==0)
  {
 act ("Your $2N falls off.",A_ALWAYS,self,item,null,TO_CHAR);
 act ("$1n's $2N falls off.",A_ALWAYS, self,item,null,TO_REST);
 }

 addextra (item.extra,item.names,"Whatever this was it looks like broken garbage now.");
 item.title:=item.title+"Broken";
  item.objecttype := ITEM_TRASH;
 unequip (item);
 }
    item := item.next;
   }

quit;
}
dilend


/* nanny_guild */

dilbegin nanny_alignment( arg : string );
var
  exdp   : extraptr;
  state  : integer;
  s      : string;
  cat    : integer;
code
{
  exdp  := "$nanny" in self.extra;
  state := atoi(exdp.descr);
/*
  if ((self.race == RACE_HALFLING) or (self.race == RACE_ELF) or
      (self.race == RACE_HALF_ELF) or (self.race == RACE_BROWNIE))
*/
  if ((self.guild == "Udgaard Healer") or
      (self.guild == "Nymgaard Ranger"))
    cat := 1; /* Good and Neutral */

  else if (self.guild == "Midgaard Paladin")
    cat := 2;
/*
  else if ((self.race == RACE_GROLL) or (self.race == RACE_HALF_ORC) or
    (self.race == RACE_HALF_OGRE))
    cat := 2; /* Evil or Neutral */

/*  else if (self.race == RACE_DARK_ELF)
  {
     self.alignment := -1000;
     goto done;
  } */

  else if (self.guild == "Necromancer")
    cat := 3;

  else
    cat := 4; /* Player's choice */

  if (state == 0)
  {
     if (cat == 1)
sendtext("&nPlease choose your personality:&n"+
  "  &c+w1&cw) A saint             (Good)&n"+
  "  &c+w2&cw) Who cares?          (Neutral)&n"+
  "Please select 1, 2 or Help: ", self);
     else if (cat == 2)
       sendtext("&nPlease choose your personality (Only 1 choice):&n"+
                "  &c+w1&cw) A saint             (Good)&n"+
                "Please select 1 or Help: ", self);
     else if (cat == 3)
sendtext("&nPlease choose your personality (Only 1 choice):&n"+
  "  &c+w3&cw) The devil's brother (Evil)&n"+
  "Please select 3 or Help: ", self);
     else
sendtext("&nPlease choose your personality:&n"+
  "  &c+w1&cw) A saint             (Good)&n"+
  "  &c+w2&cw) Who cares?          (Neutral)&n"+
  "  &c+w3&cw) The devil's brother (Evil)&n"+
  "Please select 1, 2, 3 or Help: ", self);

     exdp.descr := "1";
     return;
  }

  s := getword(arg);

  if ((s == "1") and (cat != 3))
  {
     sendtext("You are now a saint.&n&n", self);
     self.alignment := 850;
  }
  else if ((s == "2") and ((cat != 2) and (cat != 3)))
  {
     sendtext("Who cares about it anyway?&n&n", self);
     self.alignment := 0;
  }
  else if ((s == "3") and ((cat != 1) and (cat !=2)))
  {
     sendtext("So be it...&n&n", self);
     self.alignment := -850;
  }
  else
  {
     if (cat == 1)
sendtext("No such personality, please select 1, 2 "+
  "or Help: ", self);
     else if (cat == 2)
sendtext("No such personality, please select 1 "+
  "or Help: ", self);
     else if (cat == 3)
       sendtext("No such personality, please select 3 " +
                "or Help: ", self);
     else
sendtext("No such personality, please select 1, 2, 3 "+
  "or Help: ", self);
     return;
  }

  :done:

  subextra(self.extra, "$nanny");
  return;
}
dilend

dilbegin playerinit();

var
  expd : extraptr;

code
{
  heartbeat := 4;

  pause;
  exec("pray odin", self);
  exec("wear all", self);
  exec("claim dictionary", self);
  if (self.race==RACE_HUMAN)
  {
     self.abilities[ABIL_STR] := 4;
     self.abilities[ABIL_CON] := 4;
     self.abilities[ABIL_HP ] := 4;
     self.abilities[ABIL_DEX] := 4;
     self.abilities[ABIL_BRA] := 4;
     self.abilities[ABIL_CHA] := 4;
     self.abilities[ABIL_DIV] := 4;
     self.abilities[ABIL_MAG] := 4;
  }
  else if (self.race==RACE_DWARF)
  {
     self.abilities[ABIL_STR] := 6;
     self.abilities[ABIL_CON] := 2;
     self.abilities[ABIL_HP ] := 6;
     self.abilities[ABIL_DEX] := 2;
     self.abilities[ABIL_BRA] := 4;
     self.abilities[ABIL_CHA] := 2;
     self.abilities[ABIL_DIV] := 4;
     self.abilities[ABIL_MAG] := 2;
  }
  else if (self.race==RACE_ELF)
  {
     self.abilities[ABIL_STR] := 4;
     self.abilities[ABIL_CON] := 4;
     self.abilities[ABIL_HP ] := 4;
     self.abilities[ABIL_DEX] := 4;
     self.abilities[ABIL_BRA] := 4;
     self.abilities[ABIL_CHA] := 6;
     self.abilities[ABIL_DIV] := 6;
     self.abilities[ABIL_MAG] := 4;
  }
  else if (self.race==RACE_HALFLING)
  {
     self.abilities[ABIL_STR] := 4;
     self.abilities[ABIL_CON] := 6;
     self.abilities[ABIL_HP ] := 4;
     self.abilities[ABIL_DEX] := 6;
     self.abilities[ABIL_BRA] := 4;
     self.abilities[ABIL_CHA] := 2;
     self.abilities[ABIL_DIV] := 4;
     self.abilities[ABIL_MAG] := 2;
  }
  else if (self.race==RACE_GNOME)
  {
     self.abilities[ABIL_STR] := 4;
     self.abilities[ABIL_CON] := 4;
     self.abilities[ABIL_HP ] := 4;
     self.abilities[ABIL_DEX] := 4;
     self.abilities[ABIL_BRA] := 6;
     self.abilities[ABIL_CHA] := 4;
     self.abilities[ABIL_DIV] := 4;
     self.abilities[ABIL_MAG] := 4;
  }
  else if (self.race==RACE_HALF_OGRE)
  {
     self.abilities[ABIL_STR] := 6;
     self.abilities[ABIL_CON] := 6;
     self.abilities[ABIL_HP ] := 6;
     self.abilities[ABIL_DEX] := 2;
     self.abilities[ABIL_BRA] := 2;
     self.abilities[ABIL_CHA] := 2;
     self.abilities[ABIL_DIV] := 4;
     self.abilities[ABIL_MAG] := 2;
  }
  else if (self.race==RACE_HALF_ORC)
  {
     self.abilities[ABIL_STR] := 4;
     self.abilities[ABIL_CON] := 4;
     self.abilities[ABIL_HP ] := 4;
     self.abilities[ABIL_DEX] := 4;
     self.abilities[ABIL_BRA] := 2;
     self.abilities[ABIL_CHA] := 2;
     self.abilities[ABIL_DIV] := 4;
     self.abilities[ABIL_MAG] := 2;
  }
  else if (self.race==RACE_BROWNIE)
  {
     self.abilities[ABIL_STR] := 2;
     self.abilities[ABIL_CON] := 4;
     self.abilities[ABIL_HP ] := 4;
     self.abilities[ABIL_DEX] := 4;
     self.abilities[ABIL_BRA] := 6;
     self.abilities[ABIL_CHA] := 4;
     self.abilities[ABIL_DIV] := 2;
     self.abilities[ABIL_MAG] := 6;
  }
  else if (self.race==RACE_HALF_ELF)
  {
     self.abilities[ABIL_STR] := 4;
     self.abilities[ABIL_DEX] := 4;
     self.abilities[ABIL_CON] := 4;
     self.abilities[ABIL_MAG] := 4;
     self.abilities[ABIL_DIV] := 4;
     self.abilities[ABIL_CHA] := 4;
     self.abilities[ABIL_BRA] := 4;
     self.abilities[ABIL_HP ] := 4;
  }
  else if (self.race==RACE_GROLL)
  {
     self.abilities[ABIL_STR] := 6;
     self.abilities[ABIL_DEX] := 2;
     self.abilities[ABIL_CON] := 8;
     self.abilities[ABIL_MAG] := 2;
     self.abilities[ABIL_DIV] := 2;
     self.abilities[ABIL_CHA] := 2;
     self.abilities[ABIL_BRA] := 2;
     self.abilities[ABIL_HP ] := 8;
  }
  else if (self.race==RACE_DARK_ELF)
  {
     self.abilities[ABIL_STR] := 4;
     self.abilities[ABIL_DEX] := 4;
     self.abilities[ABIL_CON] := 4;
     self.abilities[ABIL_MAG] := 6;
     self.abilities[ABIL_DIV] := 2;
     self.abilities[ABIL_CHA] := 4;
     self.abilities[ABIL_BRA] := 6;
     self.abilities[ABIL_HP ] := 4;
  }

  if (self.guild == GUILD_UDG_FIGHTER)
  {
     self.abilities[ABIL_STR] :=self.abilities[ABIL_STR]+2;
     self.abilities[ABIL_DEX] :=self.abilities[ABIL_DEX]+0;
     self.abilities[ABIL_CON] :=self.abilities[ABIL_CON]+2;
     self.abilities[ABIL_HP] :=self.abilities[ABIL_HP]+2;
     self.abilities[ABIL_DIV] :=self.abilities[ABIL_DIV]-2;
     self.abilities[ABIL_MAG] :=self.abilities[ABIL_MAG]-2;
     self.abilities[ABIL_CHA] :=self.abilities[ABIL_CHA]+0;
     self.abilities[ABIL_BRA] :=self.abilities[ABIL_BRA]-2;

     self.weapons[WPN_AXE_HAM] :=  5;
     self.weapons[WPN_UNARMED] :=  5;
     self.weapons[WPN_SWORD]   :=  5;

     self.weapons[WPN_FIST]        :=  5;
     self.weapons[WPN_HAND_AXE]  :=  5;
     self.weapons[WPN_DAGGER]  :=  5;
     self.weapons[WPN_BROAD_SWORD] :=  5;

     exec("alias kd kill deer", self);
     exec("alias kb kill badger", self);
     exec("alias kf kill fox", self);
     exec("alias kr kill rabbit", self);
     exec("alias ks kill skunk", self);
  }
  else if (self.guild == GUILD_UDG_THIEF)
  {
     self.abilities[ABIL_STR] :=self.abilities[ABIL_STR]+0;
     self.abilities[ABIL_DEX] :=self.abilities[ABIL_DEX]+4;
     self.abilities[ABIL_CON] :=self.abilities[ABIL_CON]+0;
     self.abilities[ABIL_HP] :=self.abilities[ABIL_HP]+0;
     self.abilities[ABIL_DIV] :=self.abilities[ABIL_DIV]-2;
     self.abilities[ABIL_MAG] :=self.abilities[ABIL_MAG]-0;
     self.abilities[ABIL_CHA] :=self.abilities[ABIL_CHA]+0;
     self.abilities[ABIL_BRA] :=self.abilities[ABIL_BRA]-2;

     self.skills[SKI_SHIELD] := 5;
     self.skills[SKI_SEARCH] := 5;
     self.skills[SKI_HIDE]   := 5;
     self.skills[SKI_SNEAK]  := 5;
     self.skills[SKI_SKIN]  := 5;

     self.weapons[WPN_FIST]         :=  5;
     self.weapons[WPN_UNARMED]      :=  5;
     self.weapons[WPN_SWORD]        :=  5;
     self.weapons[WPN_SHORT_SWORD]  :=  5;
     self.weapons[WPN_DAGGER]       :=  5;

     exec("alias kd kill deer", self);
     exec("alias kb kill badger", self);
     exec("alias kf kill fox", self);
     exec("alias kr kill rabbit", self);
     exec("alias ks kill skunk", self);
  }
  else if (self.guild == GUILD_UDG_CLERIC)
  {
     self.abilities[ABIL_STR] :=self.abilities[ABIL_STR]+0;
     self.abilities[ABIL_DEX] :=self.abilities[ABIL_DEX]+0;
     self.abilities[ABIL_CON] :=self.abilities[ABIL_CON]+0;
     self.abilities[ABIL_HP] :=self.abilities[ABIL_HP]+0;
     self.abilities[ABIL_DIV] :=self.abilities[ABIL_DIV]+2;
     self.abilities[ABIL_MAG] :=self.abilities[ABIL_MAG]-2;
     self.abilities[ABIL_CHA] :=self.abilities[ABIL_CHA]+2;
     self.abilities[ABIL_BRA] :=self.abilities[ABIL_BRA]+0;

     self.weapons[WPN_CLUB_MACE]     :=  5;
     self.weapons[WPN_MACE]          :=  5;

     self.spells[SPL_DIVINE]         :=  5;
     self.spells[SPL_MIND]           :=  5;

     self.spells[SPL_CURE_WOUNDS_1]  :=  5;
     self.spells[SPL_CAUSE_WOUNDS_1] :=  5;

     self.skills[SKI_FIRST_AID]      :=  5;
     self.skills[SKI_SKIN]  := 5;

     exec("alias cu cast cure light wounds $", self);
     exec("alias ca cast cause light wounds $", self);
     exec("alias kk kill $; ca $", self);

     exec("alias kd kk deer", self);
     exec("alias kb kk badger", self);
     exec("alias kf kk fox", self);
     exec("alias kr kk rabbit", self);
     exec("alias ks kk skunk", self);
  }
  else if (self.guild == GUILD_UDG_MAGE)
  {
     self.abilities[ABIL_STR] :=self.abilities[ABIL_STR]-2;
     self.abilities[ABIL_DEX] :=self.abilities[ABIL_DEX]+2;
     self.abilities[ABIL_CON] :=self.abilities[ABIL_CON]-2;
     self.abilities[ABIL_HP] :=self.abilities[ABIL_HP]-2;
     self.abilities[ABIL_MAG] :=self.abilities[ABIL_MAG]+2;
     self.abilities[ABIL_DIV] :=self.abilities[ABIL_DIV]-2;
     self.abilities[ABIL_CHA] :=self.abilities[ABIL_CHA]+2;
     self.abilities[ABIL_BRA] :=self.abilities[ABIL_BRA]+2;

     self.weapons[WPN_SWORD]         :=  5;
     self.weapons[WPN_DAGGER]        :=  5;

     self.skills[SKI_SCROLL_USE]    :=  5;
     self.skills[SKI_WAND_USE]      :=  5;
     self.skills[SKI_SKIN]  := 5;

     self.spells[SPL_DETECTION]     :=  5;
     self.spells[SPL_DET_INVISIBLE] :=  5;

     self.spells[SPL_DETECTION]     :=  5;
     self.spells[SPL_DET_MAGIC]     :=  5;

     self.spells[SPL_SUMMONING]     :=  5;
     self.spells[SPL_ENERGY_BOLT]   :=  5;

     exec("alias eb cast energy bolt $", self);
     exec("alias kk kill $; eb $", self);

     exec("alias kd kk deer", self);
     exec("alias kb kk badger", self);
     exec("alias kf kk fox", self);
     exec("alias kr kk rabbit", self);
     exec("alias ks kk skunk", self);
  }
 
  if (self.abilities[ABIL_STR] < 2) self.abilities[ABIL_STR] := 2;
  if (self.abilities[ABIL_DEX] < 2) self.abilities[ABIL_DEX] := 2;
  if (self.abilities[ABIL_CON] < 2) self.abilities[ABIL_CON] := 2;
  if (self.abilities[ABIL_CHA] < 2) self.abilities[ABIL_CHA] := 2;
  if (self.abilities[ABIL_BRA] < 2) self.abilities[ABIL_BRA] := 2;
  if (self.abilities[ABIL_MAG] < 2) self.abilities[ABIL_MAG] := 2;
  if (self.abilities[ABIL_DIV] < 2) self.abilities[ABIL_DIV] := 2;
  if (self.abilities[ABIL_HP] < 2) self.abilities[ABIL_HP] := 2;

  self.hometown := "temple@udgaard";

  self.skills[SKI_FLEE]        := 50;
  self.skills[SKI_CONSIDER]    := 50;
     self.skills[SKI_SKIN]  := 5;
  self.skills[SKI_DIAGNOSTICS] := 50;

  if (self.outside != findroom(self.hometown))
  {
     act("$1n is taken away to start a new life.",
  A_HIDEINV, self, null, null, TO_ROOM);
     link(self, findroom(self.hometown));
     act("$1n appears from thin air.", A_HIDEINV, self, null, null, TO_ROOM);
  }

  act("&h", A_ALWAYS, self, null, null, TO_CHAR);

  exec("look", self);

  act("&c+rYou are a guest here until you save yourself.&cw&n&nIf you need
" +
      "to get to your guild, use the guild medallion in your " +
      "inventory. If you lose it, pray to the statue of Odin for another.&n",
      A_ALWAYS, self, null, null, TO_CHAR);
  subextra(self.quests, "$guild");

  quit;
}
dilend

dilbegin nanny_race( arg : string );
var
  exdp   : extraptr;
  state  : integer;
  s      : string;
code
{
  exdp  := "$nanny" in self.extra;
  state := atoi(exdp.descr);

  if (state == 0)
  {
     sendtext("&nPlease choose your race:&n"
+"  &c+w1&cw) Human&cw            &c+w 7&cw) Dark-Elf (hard)&n"
+"  &c+w2&cw) Dwarf&cw            &c+w 8&cw) Brownie&n"
+"  &c+w3&cw) Halfling&cw         &c+w 9&cw) Groll&n"
+"  &c+w4&cw) Gnome&cw            &c+w10&cw) Half-Orc&n"
+"  &c+w5&cw) Elf&cw              &c+w11&cw) Half-Ogre&n"
+"  &c+w6&cw) Half-elf&n"
+"Please select 1 - 11 or Help: ", self);

     exdp.descr := "1";
     return;
  }

  s := getword(arg);

  if (s == "1")
  {
     sendtext("You are now a human.&n", self);
     self.race := RACE_HUMAN;
  }
  else if (s == "2")
  {
     sendtext("You are now a dwarf.&n", self);
     self.race := RACE_DWARF;
  }
  else if (s == "3")
  {
     sendtext("You are now a halfling.&n", self);
     self.race := RACE_HALFLING;
  }
  else if (s == "4")
  {
     sendtext("You are now a gnome.&n", self);
     self.race := RACE_GNOME;
  }
  else if (s == "5")
  {
     sendtext("You are now an elf.&n", self);
     self.race := RACE_ELF;
  }
  else if (s == "6")
  {
     sendtext("You are now a half-elf.&n", self);
     self.race := RACE_HALF_ELF;
  }
  else if (s == "7")
  {
     sendtext("You are now a dark-elf.&n", self);
     self.race := RACE_DARK_ELF;
  }
  else if (s == "8")
  {
     sendtext("You are now a Brownie.&n", self);
     self.race := RACE_BROWNIE;
  }
  else if (s == "9")
  {
     sendtext("You are now a Groll.&n", self);
     self.race := RACE_GROLL;
  }
  else if (s == "10")
  {
     sendtext("You are now a half-orc.&n", self);
     self.race := RACE_HALF_ORC;
  }
  else if (s == "11")
  {
     sendtext("You are now a half-ogre.&n", self);
     self.race := RACE_HALF_OGRE;
  }
  else
  {
     sendtext("Please choose 1 - 11 or Help: ", self);
     return;
  }

  substring(exdp.names, "login races");
  addstring(exdp.names, "login guilds");
  exdp.descr := "0";
  return;
}
dilend


dilbegin nanny_sex( arg : string );
var
  exdp   : extraptr;
  state  : integer;
  s      : string;
code
{
  exdp  := "$nanny" in self.extra;
  state := atoi(exdp.descr);

  if (state == 0)
  {
     sendtext("&nPlease choose your gender:&n"+
  "  &c+w1&cw) Male&n"+
  "  &c+w2&cw) Female&n"+
  "Please select 1, 2 or Help: ", self);
     exdp.descr := "1";
     return;
  }

  s := getword(arg);

  if (s == "1")
  {
     sendtext("You are now a male.&n", self);
     self.sex := SEX_MALE;
  }
  else if (s == "2")
  {
     sendtext("You are now a female.&n", self);
     self.sex := SEX_FEMALE;
  }
  else
  {
     sendtext("Please choose 1, 2 or Help: ", self);
     return;
  }

  substring(exdp.names, "genders");
  addstring(exdp.names, "login races");
  exdp.descr := "0";
  return;
}
dilend


dilbegin nanny_maiden( arg : string );
var
  exdp   : extraptr;
  texdp  : extraptr;
  state  : integer;
  s      : string;
code
{
  exdp  := "$nanny" in self.extra;
  state := atoi(exdp.descr);

  if (state == 0)
  {
     sendtext("&nPlease enter your mother's maiden name (Help): ", self);
     exdp.descr := "1";
  }
  else if (state == 1)
  {
     texdp := "$maiden" in self.info;
     if (not texdp)
     {
 addextra(self.info, {"$maiden"}, arg);
 texdp := "$maiden" in self.info;
     }
     sendtext("&nIs '&c+w"+texdp.descr+"&cw' correct (Y/N/H)? ", self);
     exdp.descr := "2";
  }
  else if (state == 2)
  {
     s := " " + getword(arg);

     if (" y" in s)
     {
 substring(exdp.names, "maiden name");
 addstring(exdp.names, "personal email");
 exdp.descr := "0";
     }
     else if (" n" in s)
     {
 subextra(self.info, "$maiden");
 exdp.descr := "0";
 nanny_maiden("");
     }
     else
sendtext("&nPlease anwser Yes or No : ", self);
  }
  return;
}
dilend


dilbegin nanny_email( arg : string );
var
  exdp   : extraptr;
  texdp  : extraptr;
  state  : integer;
  s      : string;
code
{
  exdp  := "$nanny" in self.extra;
  state := atoi(exdp.descr);

  if (state == 0)
  {
     sendtext("&nYou have the option of supplying your email now: ", self);
     exdp.descr := "1";
  }
  else if (state == 1)
  {
     texdp := "$email" in self.info;
     if (not texdp)
     {
 addextra(self.info, {"$email"}, arg);
 texdp := "$email" in self.info;
     }
     sendtext("&nIs '&c+w"+texdp.descr+"&cw' correct (Y/N/H)? ", self);
     exdp.descr := "2";
  }
  else if (state == 2)
  {
     s := " " + getword(arg);

     if (" y" in s)
     {
 :done:
 substring(exdp.names, "personal email");
 addstring(exdp.names, "genders");
 exdp.descr := "0";
     }
     else if (" n" in s)
     {
 subextra(self.info, "$email");
 exdp.descr := "0";
 nanny_email("");
     }
     else
sendtext("&nPlease anwser Yes or No : ", self);
  }
  return;
}
dilend

/* Special notice: When "help" is chosen by the user, the "$nanny" extra
  description's description field is subtracted one, effectively putting
  the user at the state just before help was requested. */

dilbegin nanny( arg : string );
external
  nanny_maiden( arg : string );
  nanny_email( arg : string );
  nanny_sex( arg : string );
  nanny_race( arg : string );
  nanny_guild( arg : string );
  nanny_alignment( arg : string );

var
  exdp   : extraptr;

code
{
  exdp := "$nanny" in self.extra;
  if (not exdp)
  {
     addextra(self.extra, {"$nanny", "maiden name"}, "0");
     exdp := "$nanny" in self.extra;
  }


  if ("maiden name" in exdp.names)
    nanny_maiden( arg );

  if ("personal email" in exdp.names)
    nanny_email( arg );

  if ("genders" in exdp.names)
    nanny_sex( arg );

  if ("login races" in exdp.names)
    nanny_race( arg );

  if ("login guilds" in exdp.names)
    nanny_guild( arg );

  if ("personality" in exdp.names)
    nanny_alignment( arg );

  quit;
}
dilend

/* Put in here all actions that need to be considered */
/* by players in Valhalla                             */
dilbegin dead_only(msg : string);
code
{
  :start:
  wait(SFB_CMD, activator.type == UNIT_ST_PC);
  if (activator.level >= ADMINISTRATOR_LEVEL)
    goto start;

  if (not isset(activator.pcflags, PC_SPIRIT))
  {
     act(msg, A_ALWAYS, activator, null, null, TO_CHAR);
     act("$1n vanishes in a flash of light!",
  A_HIDEINV, activator, null, null, TO_ROOM);

     link(activator, findroom(activator.hometown));

     act("$1n materializes.", A_HIDEINV, activator, null, null, TO_ROOM);
     block;
     goto start;
  }

  if (command("cast"))
  {
     act("Your powers do not work in the spirit world!",
  A_ALWAYS, activator, null, null, TO_CHAR);
     block;
  }
  else if (command("kill") or command("hit") or command("kick") or
    command("bash") or command("backstab") or
    command("trip") or command ("disarm"))
  {
     act("Return to the mortal world, then you can die again.",
  A_ALWAYS, activator, null, null, TO_CHAR);
     block;
  }
  else if (command("steal") or command("filch") or
command("pickpocket"))
  {
  act ("You grasp but notice your body is not solid enough to steal.",
  A_ALWAYS, activator, null, null, TO_CHAR);
     block;
  }
  goto start;
}
dilend

dilbegin magic(u1 : unitptr);
var
  i : integer;
code
{
  heartbeat := PULSE_SEC * 3;

  :loop:
  i  := rnd(SPL_GROUP_MAX, SPL_TREE_MAX);
  link(self, u1.outside);
  self.hp   := self.max_hp;
  self.mana := 100;
  cast_spell(i, self, self, u1);
  self.mana := 100;
  cast_spell(i, self, self, self);
  self.mana := 100;
  u1 := null;
  cast_spell(i, self, self, u1);
  return;
}
dilend


dilbegin doom(u1 : unitptr);
code
{
  heartbeat := PULSE_SEC * 5;

  :loop:
  link(self, u1.outside);
  secure(u1, done);
  exec("hit "+u1.name, self);

  while (self.fighting)
  {
     pause;
     exec("hit "+u1.name, self);
     self.hp   := self.max_hp;
     self.mana := 80;
  }

  :done:
  return;
}
dilend

%rooms

                                  ocean_void

title "The Great Ocean"
descr
"   You drifting helplessly around in the great ocean."
movement SECT_WATER_SAIL
flags {UNIT_FL_NO_WEATHER}
light 5
end


                                      void

names "void"
title "The Void"
descr
"   You are floating helplessly around in nothing. This is a very peculiar
feeling, as everything around you is nothing, not even darkness."
flags {UNIT_FL_NO_WEATHER}
light 5
end


                                  destroy_room
title "Destroy Room"
descr
"This room is used for storing units between each event that are supposed
to be extracted."
flags {UNIT_FL_NO_WEATHER, UNIT_FL_NO_TELEPORT}
light 5

end


                                  deathseq_room

title "The Death Sequence Room"
descr
"   This is the Death Sequence Room. All players that are dead and
being shown the death sequence are placed in this room."
flags {UNIT_FL_NO_TELEPORT, UNIT_FL_NO_WEATHER}
dilcopy dead_only@basis("You should not have been here, you are sent home.");
/* dilcopy morph_corpse@basis(); */
light -2  /* Always dark for players... */
end

                                    timeout

title "The Timeout Room"
descr
"   All players which are idle, are stored in this room."
flags {UNIT_FL_NO_TELEPORT, UNIT_FL_NO_WEATHER}
light 5
dilcopy dead_only@basis("You should not have been here, you are sent home.");
end


                                    entry1
/* This is where all wierd rooms meet. */

title "The Astral Plane"
descr
"   You are floating around in colours of all kinds. Below you, a bright
light is shining through a shimmering blue circle.  A tiny circle of light
opens
to the east."

flags {UNIT_FL_NO_MOB, UNIT_FL_NO_WEATHER, UNIT_FL_NO_TELEPORT}
movement SECT_INSIDE
dilcopy dead_only@basis("You should not have been here, you are sent home.");
light 5
east to throne_room;
end


                                  throne_room
names {"valhalla"}
title "The Castle of Valhalla"
descr
"   You are inside the great dining hall of the Valhalla castle. Warriors
fallen in battle and others equally worthy are brought here by the Valkyries.
An exit leads up to the throne hall and down to a portion of hell.  To the
west
there might or might not be something."
flags {UNIT_FL_NO_TELEPORT, UNIT_FL_NO_WEATHER}
dilcopy dead_only@basis("You should not have been here, you are sent home.");
light 5
up to heaven_entry;
down to hell_entry;
west to entry1;
end


                                  heaven_entry
title "The Throne Hall"
descr
"   You are inside the great throne hall of Odin. The ceiling is made of
the purest silver and in the far end of the hall is the throne of Odin,
said to let anyone sitting in it, view the entire world. The dining hall
is down."
flags {UNIT_FL_NO_TELEPORT, UNIT_FL_NO_WEATHER}
dilcopy dead_only@basis("You should not have been here, you are sent home.");
light 5
down to throne_room;
extra {"ceiling", "silver"}
"It is pure silver."
extra {"throne"}
"The throne is very large and awe inspiring, you dare not approach it."
end


                                   hell_entry
title "Burning in Hel"
descr "The walls around flame bright red.  Nothing could live here for very
long not that you are worried your dead!  Evil deeds must have got you to this
place nothing good could stay here without destroying its soul.  Hot and
taunting
flames dance around pools of black liquids that look as if they ahve no
bottom.  A more pleasant dining room is up from here."
flags {UNIT_FL_NO_TELEPORT, UNIT_FL_NO_WEATHER}
dilcopy dead_only@basis("You should not have been here, you are sent home.");
light 5
up to throne_room;

end


%objects

colour_object
names {"colour object", "colour", "object"}
title "&cwa &c+rc&c+yo&c+gl&c+bo&c+mu&c+cr&cw object"
descr "A colourful object lies on the ground here."

extra {}
"&cwThis object is for adding colour titles and names to objects, and colour
titles, names and guild-names to players (only gods can have colour
guild-names). With it, you can also execute any command (except wiz commands)
in colour. &c+rPlease use restraint in your colour schemes - we wish to avoid
gawdy titles/names&cw. The syntax for its use is as follows (please note that
for the new kernel which allows colour everything, we MUST add a &&p
every time we add a foreground colour code and we can only change the colour
once per string [joining substrings doesn't bypass this unfortunately]. So if
you want to rename an object with multiple colours, close it with &&cw for
the moment]. A &&q is used to reset the
background colour code - this is very important):
&l

  To add a colour title to an object:

                     ctitle objectname title
                 eg: ctitle enforcer &&c+bMy &&c+ggreen &&c+raxe&&cw

  To add a colour name (this should be done as little as possible because
  weapons may disrupt fight sequence colours) to an object:

                     cname objectname newname
                 eg: cname enforcer &&c+ggreen &&c+raxe&&cw

  To give a player a colour title or guild-name, the procedure is identical
  to giving (except only gods can have non-guild guild-names)
  an object a colour title, except use the person's name instead of the
  objectname.

  (&c+rThis feature is disabled until further notice due to formatting
   problems in room looks &cw) - &c+gEirinn clarej@tcd.ie&cw.

  To execute a command in colour, do the following:

                     carg command arguments
                 eg: carg shout &&c+rRed Shout!&&cw

  Only level 240+ gods may use the colour object for naming and titling
  because its facilities are variants of the set command. The object
  may however be used by 235+ gods to execute normal commands (eg shout,
  tell, etc), but not wiz commands.

  For level 242+ gods, it is possible to colour broadcast. To use this
  capability, do the following:

                     cb &&c+rValhalla will be rebooting in 2 minutes.&&cw

  This would broadcast the message 'Valhalla will be rebooting in 2 minutes'
  in bright red.

  The command cech works like echo except it accepts colour codes.
  The command cmes works like message except it accepts colour codes.

  Don't forget about &&p and &&q. &c+cFor a full list of colour
  codes take a look at control.txt in the Builder's library -
  http:\\valhalla.com&cw"

dilcopy colour_title@basis();
dilcopy colour_arg@basis();
dilcopy colour_bc@basis();

manipulate {MANIPULATE_TAKE,MANIPULATE_HOLD}

weight 1
type ITEM_OTHER

end /* colour_object */




dust_bones
names {"pile of dust","dust","pile"}
title "a pile of dust"
descr "A pile of dust and bones lies here."
MATERIAL_EARTH("Ordinary dust")

manipulate {MANIPULATE_TAKE,MANIPULATE_ENTER}
extra{}
"It looks like the remains of a zombie."
weight 50
CONTAINER_DEF(10)
dilcopy blowaway@function (600,"A sudden wind scatters a pile of dust and
bones.");
end


                               porkchop
names {"pork chop", "pork", "chop"}
title "a delicious pork chop"
descr "A delicious pork chop has been left here."
manipulate {MANIPULATE_TAKE}
FOOD_DEF(36, 0)
weight 6
cost 10 IRON_PIECE
special SFUN_BLOW_AWAY time PULSE_SEC*120 bits SFB_RANTIME
"$1n returns to its origins."
end

                              mug_beer

names {"mug of tuborg", "tuborg", "mug", "beer"}
title "a mug of Tuborg"
descr "A mug of Tuborg has been dropped here."
extra {}
"Your mouth begins to water as you look at the cool and refreshing
mug of Green Tuborg. You feel an urge to drink it as soon as
possible and at the same time you are convinced that it will bring
you new energy."
manipulate {MANIPULATE_TAKE}
LIQ_DEF("brown", 1,1,1,5,2,3,0)
cost 7 IRON_PIECE
dilbegin tuborg();
external
sub_drink_info@commands(d:unitptr);
var
 u : unitptr;
code
{
 :start:
 wait(SFB_CMD, ( (command("drink")) or
                (command("sip")) or
         (command("taste")) ) );
u := activator;
secure (u,start);
if (findunit (activator,argument,FIND_UNIT_INVEN|FIND_UNIT_SURRO,null)!=self)
goto start;
if ( command("sip") or command("taste") )
{
  block;
  act("$1n tastes $2n enjoying every drop.", A_HIDEINV, u, self, null,
       TO_ROOM);
   act("The taste of the $2N is nothing less than divine.", A_HIDEINV, u, self,
     null, TO_CHAR);
  goto start;
  }

 if ( u.thirst >20 )
 {
   block;
  act("Your not thirsty.", A_HIDEINV, u, null, null, TO_CHAR);
    goto start;
 }
block;
  act ("You drink $2n and it makes you feel more energetic!", A_HIDEINV, u, self,
      null, TO_CHAR);
  act ("$1n drinks $2n and looks more energetic!", A_HIDEINV, u, self,
      null, TO_ROOM);

 u.thirst := u.thirst + 10;
 u.full := u.full + 10;
 if (u.thirst > 24)
 {
   u.thirst := 24;
 }

 if (u.full > 24)
 {
   u.full := 24;
 }
 u.endurance := u.endurance+50;
 if (u.endurance > u.max_endurance)
 {
   u.endurance := u.max_endurance;
 }
 sub_drink_info@commands(self);
 quit;
}
dilend
end


                                 slime

names {"green slime", "slime", "blob"}
title "a blob of green slime"
descr "A disgusting blob of green slime has been left here."
extra {}
"As you examine the blob closer you get the eeire feeling that it
resembeles an item you once used to possess - sort of a slimy
deja-vu."
manipulate {MANIPULATE_TAKE, MANIPULATE_HOLD, MANIPULATE_ENTER}
CONTAINER_DEF(1)
weight 1
special SFUN_BLOW_AWAY "The green slime seeps into the ground."
time WAIT_SEC*120 bits SFB_RANTIME
end


                                    head
names {"head"}
title "a bloody head"
descr "The decapitated head of %s is here."
type ITEM_TRASH
manipulate {MANIPULATE_TAKE}
weight 1
end


                                    corpse
names {"corpse"}
title "a corpse"
descr "The corpse of %s is here."
type ITEM_TRASH
manipulate {MANIPULATE_TAKE, MANIPULATE_ENTER}
/* Rest of values are inserted at runtime */
dilbegin bob_code ();
var
 arg:string;
 pc:unitptr;
 pars:string;
 item:unitptr;
 ex_ptr:extraptr;
 splstr:string;
 splno:integer;
code
{
heartbeat:=PULSE_SEC*3;
if (self.value[2]!=1) quit;
interrupt (SFB_PRE,((command ("cast")) and
(target==self)),bl_animate);

:start:
unsecure(pc);
unsecure(item);
interrupt (SFB_CMD, command("get") or command("take"), get_shit);

wait (SFB_CMD, command("get") or command("take"));
:get_shit:

if (isset(self.flags,UNIT_FL_BURIED))
goto start;
pc:=activator;
secure (pc,start);

arg:=argument;

pars:=getword(argument);
while ((pars!="") and (pars!="from"))
 {
 pars:=getword (argument);
 }

if (pars=="") goto start;

item:=findunit (pc,argument, FIND_UNIT_SURRO,null);
if ( item ==null)
 goto start;
secure (item,start);

if (item!=self) goto start;

if ((pc.type==UNIT_ST_NPC) and
(pc.master))
{
block;
goto start;
}

if ((("corpse of "+pc.name) == item.name)) goto start;

block;

act ("You can't loot a player corpse.", A_ALWAYS,pc,null,null,TO_CHAR);
goto start;

:bl_animate:
if (self!=target) goto start;
splstr:= getword(argument);
splno:= atoi(splstr);
if (splno==81)
{
power:=-1;
 block;
 act ("Making a Zombie from a fellow players corpse is forbiden.",
 A_ALWAYS,activator,null,null,TO_CHAR);
 goto start;
 }

}
dilend


dilbegin report_corpse ();
var
act_str:string;
empty:string;
code
{
if (self.value[2]!=1) quit;
if (self.value[3]>20) quit;
:start:
wait (SFB_MSG,argument=="report");
if (self.outside.type==UNIT_ST_PC)
act_str:=self.outside.name;
else
act_str:=self.outside.title;

if (self.inside==null)
empty:="[Empty]";
else
empty:="[Not Empty]";
act ("$3N in "+act_str+" "+empty,
A_ALWAYS,activator,null, self,TO_CHAR);
goto start;
}
dilend

end

                               iron_piece
MONEY(IRON_PIECE, 0)
/* Rest of values are inserted at runtime */
end

                               copper_piece
MONEY(COPPER_PIECE, 0)
/* Rest of values are inserted at runtime */
end

                               silver_piece
MONEY(SILVER_PIECE, 0)
/* Rest of values are inserted at runtime */
end

                               gold_piece
MONEY(GOLD_PIECE, 0)
/* Rest of values are inserted at runtime */
end

                               platinum_piece
MONEY(PLATINUM_PIECE, 0)
/* Rest of values are inserted at runtime */
end

                                      letter
names {"letter", "paper"}
title "a letter"
descr
"A letter has been left here on the ground."
type ITEM_NOTE
weight 1
manipulate MANIPULATE_TAKE
end

                                   death_seq
names {"death sequence"}
title "Death Sequence"
descr
"A death sequence has carelessly been left here."
type ITEM_TRASH
flags {UNIT_FL_NO_TELEPORT}
minv 254

/* This object is transferred to players when they die */
dilbegin noaction();
code
{
  :loop:
  wait(SFB_CMD, activator == self.outside);

  if (activator.level < IMMORTAL_LEVEL)
  {
     act("You are dead, don't move!",
         A_ALWAYS, self.outside, null, null, TO_CHAR);
     block;
  }

  goto loop;
}
dilend


dilbegin recall death_obj();
var
  i : integer;
code
{
  on_activation(self.outside.type != UNIT_ST_PC, abort);

  if ("$ARENA" in self.outside.quests)
    goto abort;

  self.outside.hp  := self.outside.max_hp;

  if (self.outside.level <= START_LEVEL + 5)
    i := 2;
  else if (self.outside.level <= 25)
    i := 4;
  else
    i := 6;

  addaff(self.outside, ID_VALHALLA, i, WAIT_SEC*30,
  0, 0, 0, TIF_NONE, TIF_NONE, TIF_VALHALLA_RET,
  APF_NONE);

  on_activation(not isaff(self.outside, ID_VALHALLA), abort);

  heartbeat := PULSE_SEC * 3;
  sendto ("remove kill prottection",self.outside);
dilcopy ("no_kill@function",self.outside);

  pause;

  act("There is complete silence, you are floating in utter darkness.",
      A_ALWAYS, self.outside, null, null, TO_CHAR);
  pause;

  act("Through the darkness you see a white light in the distance.",
      A_ALWAYS, self.outside, null, null, TO_CHAR);
  pause;

  act("The light grows larger and more intense, it seems to resemble a "+
      "warrior flying through the darkness.",
      A_ALWAYS, self.outside, null, null, TO_CHAR);
  pause;

  act("The warrior takes your soul, and at that very instant you can see
the"+
      " world around you. You are in the arms of a beautiful Valkyrie, she "+
      "begins to fly towards the stars.",
      A_ALWAYS, self.outside, null, null, TO_CHAR);
  pause;

  act("The world is rapidly disappearing below you, as the Valkyrie rides "+
      "towards the stars at an amazing speed.",
      A_ALWAYS, self.outside, null, null, TO_CHAR);
  pause;
if (self.outside.alignment>249)
{
  act("After a short ride she sets your spirit down inside Valhalla. You "+
      "slowly regain a more material form.",
      A_ALWAYS, self.outside, null, null, TO_CHAR);
  act("$1n enters the castle of Valhalla.",
      A_ALWAYS, self.outside, null, null, TO_ROOM);
  link(self.outside, findsymbolic("heaven_entry@basis"));
 }
else if (self.outside.alignment<-249)
{
  act("After a short ride she throws you down into the pits of hell.  You "+
      "slowly regain a more material form instantly feeling the heat.",
      A_ALWAYS, self.outside, null, null, TO_CHAR);
  act("$1n enters the pits of hell.",
      A_ALWAYS, self.outside, null, null, TO_ROOM);
  link(self.outside, findsymbolic("hell_entry@basis"));
 }
else
{
  act("After a short ride she sets your spirit lets your spirit drift into
the
  astral planes."+
  "You slowly regain your senses.",
      A_ALWAYS, self.outside, null, null, TO_CHAR);
  act("$1n floats into the astral planes.",
      A_ALWAYS, self.outside, null, null, TO_ROOM);
  link(self.outside, findsymbolic("entry1@basis"));
 }

  self.outside.position := POSITION_RESTING;

  :abort:
  destroy(self);
}
dilend

end

                                    scythe

/* The ultimate weapon for the ultimate godess of death - Hel */
names {"scythe of death", "scythe"}
title "a scythe"
descr
"A great black scythe has been left here."
extra {}
"There are seven runes engraved into the blade of the scythe."
extra {"runes"}
"Each rune is very complex, and glow in a different colour."
manipulate {MANIPULATE_TAKE, MANIPULATE_WIELD}
WEAPON_DEF(WPN_SCYTHE, +25, +25)
dilcopy level_restrict@function(51,0,0,"");
end


   dictionary
names {"dictionary"}
title "a dictionary"
descr
"Someone has carelessly dropped their dictionary here."
extra {}
"On the first page of the dictionary there is a small inscription."
extra {"inscription", "first page"}
"The inscription says in ancient letters written in a shaky hand:

 You will probably get a lot more information if you type 'help alias'
                                             Kind regards, Gnort."
manipulate {MANIPULATE_TAKE, MANIPULATE_HOLD}
type ITEM_OTHER
cost 4 COPPER_PIECE
special SFUN_DICTIONARY
end

/* ============ A D M I N I S T R A T O R    O B J E C T S ============= */


                 admin_slime
names {"slime object", "slime", "object"}
title "a slime object"
descr
"Someone has carelessly dropped a blob of horrible green slime here."
extra {}
"&lThis object contains the much feared slime command:

  slime (add | remove | list)

And all such units will be slimed from then on (including reset of zones,
players entering the game, etc.). Do not slime this object!

Example: slime add cloud_land/concluder"
manipulate {MANIPULATE_TAKE, MANIPULATE_HOLD}
type ITEM_OTHER
special SFUN_SLIME_ADM
end


   admin_ball
names {"crystal ball", "ball"}
title "a crystal ball"
descr
"Someone has dropped a crystal ball here."
extra {}
"&lUsage: use crystal ball

       Will find the top 10 items of type with
       maximum values of value[].

       Example: use ball 5 1
         Will find the 10 weapons with the maximum quality."

manipulate {MANIPULATE_TAKE, MANIPULATE_HOLD}
type ITEM_OTHER
special SFUN_CRYSTAL_BALL
end

/* ===================================================================== */


   log_obj
names {"log object","log","object"}
title "a log object"
descr
"Someone has dropped a few pages of the log here."
extra {}
"It's really not that easy to read.  Maybe the command `log help' will
give you more information."
manipulate {MANIPULATE_TAKE, MANIPULATE_HOLD}
type ITEM_OTHER
special SFUN_LOG_OBJECT time WAIT_SEC*3
end

   rod_error
names {"rod of error", "rod"}
title "a rod of error cancellation"
descr "A rod has carelessly been left here."
extra {}
"When this objects is held and used with the 'use rod' command all errors
in the zone will be cleared."
manipulate {MANIPULATE_TAKE, MANIPULATE_HOLD}
type ITEM_OTHER
special SFUN_ERROR_ERASE
end

   rod_info
names {"rod of info", "rod"}
title "a rod of user information cancellation"
descr "A rod has carelessly been left here."
extra {}
"When this objects is held and used with the 'wave rod' command all
information given by the players in a given zone is erased. USE ONLY
WHEN ALL USER INFO HAS BEEN READ AND CORRECTED."
manipulate {MANIPULATE_TAKE, MANIPULATE_HOLD}
type ITEM_OTHER
special SFUN_INFO_ERASE
end



%mobiles

                          zombie

names {"zombie"}
title "the zombie"
descr "A mindless zombie is roaming around here."
extra {} "Disgusting!"
M_ZOMBIE_AVG
level 4
exp 0
end

    odin

/* God of death */
names {"odin"}
title "Odin"
descr
"Odin the almighty is sitting here in his throne."
M_NORSE_ODIN
level 199
height 190
weight 190
default POSITION_SITTING
position POSITION_SITTING

extra {}
"Beneath wild long grey hair and beard you see black calm eyes looking
back at you."

dilbegin accuse_detect();
var
 u : unitptr;
 ou : unitptr;
code
{
  heartbeat := PULSE_SEC * 10;

  :loop:
  wait(SFB_TICK, TRUE);
  u := findrndunit(self, FIND_UNIT_SURRO, UNIT_ST_PC);
  if (u and (u != ou))
  {
     if (isaff(u, ID_WITNESS))
     {
        exec("tell "+u.name+" I see you have been the victim of a "+
             "horrible crime, if you wish to accuse anyone, I can help you.",
             self);
        ou := u;
        secure(ou, loop);
        goto loop;
     }
  }
  goto loop;
}
dilend

special SFUN_ACCUSE
end


                                heidruns

names {"heidruns", "goat"}
title "Heidruns the goat"
descr "Heidruns the magical goat is standing here."
race RACE_GOAT
attack WPN_CRUSH
sex SEX_FEMALE
extra {}
"Heidruns is a nice magical goat that anyone would appreciate at home!
Obviously she is not a normal goat since famous Tuborg beer flows from
her udder (use 'milk goat' to get a mug of Tuborg)."

dilbegin goat();
var
  u : unitptr;
code
{
  wait(SFB_CMD, command("milk"));

  if (self #= findunit(activator, argument, FIND_UNIT_SURRO, null))
  {
     if (findunit(activator, "mug", FIND_UNIT_INVEN, null))
     {
 act("You already have a mug of beer.",
     A_SOMEONE, activator, self, null, TO_CHAR);
     }
     else
     {
 act("You grab a mug and milk $2n.",
     A_SOMEONE, activator, self, null, TO_CHAR);
 act("$1n milks $2n.",
     A_SOMEONE, activator, self, null, TO_ROOM);
 u := load("mug_beer@basis");
 link(u, activator);
     }
  }
  else
  {
     act("You can only milk Heidruns the goat.",
  A_SOMEONE, activator, self, null, TO_CHAR);
  }
  block;
}
dilend

end

                                saerimner

names {"saerimner", "pig"}
title "Saerimner the pig"
descr "Saerimner the magical pig is standing here."

extra {}
"Saerimner is a nice little magical pig. He doesn't mind at all when
you cut porkchops from his fat little body. In fact, he regenerates
his flesh as fast as you can cut it away! (Use 'cut pig' to get food)."

sex SEX_MALE
attack WPN_BITE
race RACE_PIG

dilbegin pig();
var
  u : unitptr;
code
{
  wait(SFB_CMD, command("cut"));

  if (self #= findunit(activator, argument, FIND_UNIT_SURRO, null))
  {
     if (findunit(activator, "pork chop", FIND_UNIT_INVEN, null))
     {
 act("You have already got a pork chop, eat it first.",
     A_SOMEONE, activator, self, null, TO_CHAR);
     }
     else
     {
 act("You cut a pork chop from $2n.",
     A_SOMEONE, activator, self, null, TO_CHAR);
 act("$2n giggles as $1n cuts a pork chop from his little fat body.",
     A_SOMEONE, activator, self, null, TO_ROOM);
 u := load("porkchop@basis");
 link(u, activator);
     }
  }
  else
  {
     act("You can only cut in Saerimner the pig.",
  A_SOMEONE, activator, self, null, TO_CHAR);
  }
  block;
}
dilend
end

%mobiles

                                     recep_daemon

names {"reception daemon", "daemon"}
title "the daemon"
descr "The dreaded reception daemon is standing here."
extra {}
"You have heard tales of this daemon before. It is a dreaded creature which
silently during the night erases all your inventory!"
romflags {CHAR_DETECT_INVISIBLE}

M_DEMON_GREATER(SEX_NEUTRAL)

end


                                  chaos_daemon

/* Daemon to make random events */
names {"chaos daemon", "daemon"}
title "the daemon"
descr "The dreaded Chaos daemon is standing here."
extra {}
"You have heard tales of this daemon before. It is a dreaded creature which
causes chaos in the world. Good and bad things simply happen only because of
the mere existence of this small creature."

romflags {CHAR_DETECT_INVISIBLE}

M_DEMON_GREATER(SEX_NEUTRAL)

end

                                      hel
/* Godess of Hell */
names {"hel"}
title "Hel"
descr "Hel the grim reaper is here."
extra {} "Dressed in black."
romflags {CHAR_DETECT_INVISIBLE}
ATTACK_DEFENSE(+500, +500)

M_NORSE_HELA

special SFUN_COMBAT_MAGIC "cast acidball"
special SFUN_MERCENARY_HIRE


dilbegin appocalypse();
external
  magic@basis(u1 : unitptr);
  doom@basis (u1 : unitptr);
var
 u1 : unitptr;
code
{
  wait(SFB_CMD, command("doom") and (activator.level >= 254));
  block;

  heartbeat := PULSE_SEC * 5;

  :loop:
  u1 := findrndunit(self, FIND_UNIT_WORLD, UNIT_ST_NPC);
  if ((u1.idx == self.idx) or (u1 == null))
  {
     pause;
     goto loop;
  }


  if (rnd(0,1))
    magic@basis(u1);
  else if (rnd(0,1))
    doom@basis(u1);
  pause;
  goto loop;
}
dilend


end

/* Reset is only performed at boot time */

%reset

load odin into heaven_entry max 1

{
  equip scythe position WEAR_WIELD
}
load recep_daemon into hell_entry max 1
load chaos_daemon into hell_entry max 1

load saerimner into throne_room
load heidruns into throne_room

%end