spec_proc.c

src/spec_proc.c · 191.9 KB

From the archive DaleMUD.3.0.tar.gz

Download the archive   « Back to the archive contents

#include <stdio.h>
#include <string.h>
#include <ctype.h>

#include "protos.h"

#define INQ_SHOUT 1
#define INQ_LOOSE 0

#define SWORD_ANCIENTS 25000
/*
 *  list of room #s
 */
#define Elf_Home     1414
#define Bakery       3009
#define Dump         3030
#define Ivory_Gate    1499

/*   external vars  */

extern struct room_data *world;
extern struct char_data *character_list;
extern struct descriptor_data *descriptor_list;
extern struct index_data *obj_index;
extern struct time_info_data time_info;
extern struct index_data *mob_index;
extern struct weather_data weather_info;
        extern int top_of_world;
        extern struct int_app_type int_app[26];
extern int RacialMax[][MAX_CLASS];

extern struct title_type titles[MAX_CLASS][ABS_MAX_LVL];
extern struct spell_info_type spell_info[];
extern char *dirs[]; 



/* Data declarations */

struct social_type {
  char *cmd;
  int next_line;
};

/*
  Brian:  I moved all your stuff to spec_procs2.c

*/



/*************************************/
/* predicates for find_path function */

int is_target_room_p(int room, void *tgt_room)
{
  return room == (int)tgt_room;
}

int named_object_on_ground(int room, void *c_data)
{
  char  *name = c_data;
  return 0!=get_obj_in_list(name, real_roomp(room)->contents);
}

/* predicates for find_path function */
/*************************************/



/* ********************************************************************
*  Special procedures for rooms                                       *
******************************************************************** */

char *how_good(int percent)
{
  static char buf[256];
  
  if (percent == 0)
    strcpy(buf, " (not learned)");
  else if (percent <= 10)
    strcpy(buf, " (awful)");
  else if (percent <= 20)
    strcpy(buf, " (bad)");
  else if (percent <= 40)
    strcpy(buf, " (poor)");
  else if (percent <= 55)
    strcpy(buf, " (average)");
  else if (percent <= 70)
    strcpy(buf, " (fair)");
  else if (percent <= 80)
    strcpy(buf, " (good)");
  else if (percent <= 85)
    strcpy(buf, " (very good)");
  else
    strcpy(buf, " (Superb)");
  
  return (buf);
}

int GainLevel(struct char_data *ch, int class)
{

  if (GET_EXP(ch)>=
     titles[class][GET_LEVEL(ch, class)+1].exp) {
     if (GET_LEVEL(ch, class) < RacialMax[GET_RACE(ch)][class]) {

       send_to_char("You raise a level!\n\r", ch);
       advance_level(ch, class);
       set_title(ch);
       return(TRUE);
     }  else {
       send_to_char("You are unable to advance further in this class\n\r", ch);     
     }
  } else {
     send_to_char("You haven't got enough experience!\n\r",ch);
  }
  return(FALSE);
}

struct char_data *FindMobInRoomWithFunction(int room, int (*func)())
{
  struct char_data *temp_char, *targ;

  targ = 0;

  if (room > NOWHERE) {
    for (temp_char = real_roomp(room)->people; (!targ) && (temp_char); 
       temp_char = temp_char->next_in_room)
       if (IS_MOB(temp_char))
         if (mob_index[temp_char->nr].func == func)
           targ = temp_char;

  } else {
    return(0);
  }

  return(targ);

}

int MageGuildMaster(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type) 
{
  int number, i, percent;
  char buf[MAX_INPUT_LENGTH];
  struct char_data *guildmaster;
  extern char *spells[];
  extern struct spell_info_type spell_info[MAX_SPL_LIST];

  if (!ch->skills) return(FALSE);

  if (IS_IMMORTAL(ch))
    return(FALSE);

  if (check_soundproof(ch)) return(FALSE);  
  if(type == PULSE_COMMAND)
     guildmaster = mob;
  else
     guildmaster = ch;

  guildmaster = FindMobInRoomWithFunction(ch->in_room, MageGuildMaster); 

  if (!guildmaster) return(FALSE);

  if ((cmd != 164) && (cmd != 170) && (cmd != 243) && (cmd != 72))
      return(FALSE);

  if (IS_NPC(ch)) 
  {
    act("$N tells you 'What do i look like, an animal trainer?'", FALSE,
        ch, 0, guildmaster, TO_CHAR);
    return(FALSE);
  }

  for (;*arg == ' '; arg++);

  if (HasClass(ch, CLASS_MAGIC_USER) || HasClass(ch,CLASS_SORCERER))  {
     if (cmd == 243)  { 
     if (HasClass(ch,CLASS_MAGIC_USER)) {
       if (GET_LEVEL(ch,MAGE_LEVEL_IND) < GetMaxLevel(guildmaster)-10) { 
     if (GET_EXP(ch)<
         titles[MAGE_LEVEL_IND][GET_LEVEL(ch, MAGE_LEVEL_IND)+1].exp) {
          send_to_char("You are not yet ready to gain\n\r", ch);
          return(FALSE);
         } else {
          GainLevel(ch,MAGE_LEVEL_IND);
          return(TRUE);
         }
       } else {
          send_to_char("I cannot train you.. You must find another.\n\r",ch);
        }
     } else 
       if (HasClass(ch,CLASS_SORCERER)) {
       if (GET_LEVEL(ch,SORCERER_LEVEL_IND) < GetMaxLevel(guildmaster)-10) { 
     if (GET_EXP(ch)<
         titles[SORCERER_LEVEL_IND][GET_LEVEL(ch, SORCERER_LEVEL_IND)+1].exp) {
          send_to_char("You are not yet ready to gain\n\r", ch);
          return(FALSE);
         } else {
          GainLevel(ch,SORCERER_LEVEL_IND);
          return(TRUE);
         }
       } else {
          send_to_char("I cannot train you.. You must find another.\n\r",ch);
        }

       }
       
       return(TRUE);       
     }


     if (!*arg) {
      sprintf(buf,"You have got %d practice sessions left.\n\r", 
              ch->specials.spells_to_learn);
      send_to_char(buf, ch);
      send_to_char("You can practise any of these spells:\n\r", ch);
      for(i=0; *spells[i] != '\n'; i++) 
        if (HasClass(ch,CLASS_MAGIC_USER)) {
        if (spell_info[i+1].spell_pointer &&
            (spell_info[i+1].min_level_magic<=
             GET_LEVEL(ch,MAGE_LEVEL_IND)) &&
            (spell_info[i+1].min_level_magic <=
             GetMaxLevel(guildmaster)-10)) {

            sprintf(buf,"[%d] %s %s \n\r",
                    spell_info[i+1].min_level_magic,
                    spells[i],how_good(ch->skills[i+1].learned));
          send_to_char(buf, ch);
        }
        } else
        if (HasClass(ch,CLASS_SORCERER))
        if (spell_info[i+1].spell_pointer &&
            (spell_info[i+1].min_level_magic<=
             GET_LEVEL(ch,SORCERER_LEVEL_IND)) &&
            (spell_info[i+1].min_level_magic <=
             GetMaxLevel(guildmaster)-10)) {
            sprintf(buf,"[%d] %s %s \n\r",
                    spell_info[i+1].min_level_magic,
                    spells[i],how_good(ch->skills[i+1].learned));
          send_to_char(buf, ch);
        }

      return(TRUE);

    }
    
    for (;isspace(*arg);arg++);
    number = old_search_block(arg,0,strlen(arg),spells,FALSE);
    if(number == -1) {
      send_to_char("You do not know of this spell...\n\r", ch);
      return(TRUE);
    }

    if (HasClass(ch,CLASS_MAGIC_USER)) 
     if (GET_LEVEL(ch,MAGE_LEVEL_IND) < spell_info[number].min_level_magic) {
      send_to_char("You do not know of this spell...\n\r", ch);
      return(TRUE);
    }

    if (HasClass(ch,CLASS_SORCERER))
    if (GET_LEVEL(ch,SORCERER_LEVEL_IND) < spell_info[number].min_level_magic) {
      send_to_char("You do not know of this spell...\n\r", ch);
      return(TRUE);
    }

    if (GetMaxLevel(guildmaster)-10 < spell_info[number].min_level_magic) {
      do_say(guildmaster, "I don't know of this spell.", 0);
      return(TRUE);
    }
    if (ch->specials.spells_to_learn <= 0) {
      send_to_char("You do not seem to be able to practice now.\n\r", ch);
      return(TRUE);
    }
    
    if (ch->skills[number].learned >= 60) {
      send_to_char("You must use this skill to get any better.  I cannot train you further.\n\r", ch);
      return(TRUE);
    }
    
    send_to_char("You Practice for a while...\n\r", ch);
    ch->specials.spells_to_learn--;

if (!IS_SET(ch->skills[number].flags, SKILL_KNOWN)) {
     SET_BIT(ch->skills[number].flags, SKILL_KNOWN);
     SET_BIT(ch->skills[number].flags, SKILL_KNOWN_MAGE);     
     SET_BIT(ch->skills[number].flags, SKILL_KNOWN_SORCERER);
    }
    percent = ch->skills[number].learned+int_app[GET_RINT(ch)].learn;
    ch->skills[number].learned = MIN(95, percent);
    
    if (ch->skills[number].learned >= 95) {
      send_to_char("You are now learned in this area.\n\r", ch);
      return(TRUE);

    }
  } else {
    send_to_char("Oh.. i bet you think you're a magic user?\n\r", ch);
    return(FALSE);
  }

}

int ClericGuildMaster(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type) 
{

  int number, i, percent;
  char buf[MAX_INPUT_LENGTH];
  struct char_data *guildmaster;
  extern char *spells[];
  extern struct spell_info_type spell_info[MAX_SPL_LIST];

  if (!ch->skills) return(FALSE);

  if (check_soundproof(ch)) return(FALSE);

  if (IS_IMMORTAL(ch))
    return(FALSE);

  guildmaster = FindMobInRoomWithFunction(ch->in_room, ClericGuildMaster);

  if (!guildmaster) return(FALSE);

  if ((cmd != 164) && (cmd != 170) && (cmd != 243) && (cmd != 72))
      return(FALSE);

  if (IS_NPC(ch)) {
    act("$N tells you 'What do i look like, an animal trainer?'", FALSE,
        ch, 0, guildmaster, TO_CHAR);
    return(FALSE);
  }

  for (;*arg == ' '; arg++);

  if (HasClass(ch, CLASS_CLERIC)) {
#ifdef QUEST_GAIN
     if (cmd == 243 || cmd == 72) /*gain or give */ 
#else
        if (cmd == 243) /*gain */
#endif     
     {  
       if (GET_LEVEL(ch,CLERIC_LEVEL_IND) < GetMaxLevel(guildmaster)-10) 
       { 
#ifdef QUEST_GAIN
         MakeQuest(ch, guildmaster, CLERIC_LEVEL_IND, arg, cmd);
#else
     if (GET_EXP(ch)<
         titles[CLERIC_LEVEL_IND][GET_LEVEL(ch, CLERIC_LEVEL_IND)+1].exp) 
         {
          send_to_char("You are not yet ready to gain.\n\r", ch);
          return(FALSE);
         } else
         {
          GainLevel(ch,CLERIC_LEVEL_IND);
          return(TRUE);
         }
#endif
        } else {
          send_to_char("I cannot train you.. You must find another.\n\r",ch);
        }
        return(TRUE); 
     }


    if (!*arg) {
      sprintf(buf,"You have got %d practice sessions left.\n\r", 
              ch->specials.spells_to_learn);
      send_to_char(buf, ch);
      send_to_char("You can practise any of these spells:\n\r", ch);
      for(i=0; *spells[i] != '\n'; i++)
        if (spell_info[i+1].spell_pointer &&
           (spell_info[i+1].min_level_cleric <= 
            GET_LEVEL(ch,CLERIC_LEVEL_IND)) &&
            (spell_info[i+1].min_level_cleric <=
             GetMaxLevel(guildmaster)-10)) {
          sprintf(buf,"[%d] %s %s \n\r",
                  spell_info[i+1].min_level_cleric,spells[i],
                  how_good(ch->skills[i+1].learned));
          send_to_char(buf, ch);  
        }
      return(TRUE);
    }
    for (;isspace(*arg);arg++);
    number = old_search_block(arg,0,strlen(arg),spells,FALSE);
    if(number == -1) {
      send_to_char("You do not know of this spell...\n\r", ch);
      return(TRUE);
    }
    if (GET_LEVEL(ch,CLERIC_LEVEL_IND) < spell_info[number].min_level_cleric) {
      send_to_char("You do not know of this spell...\n\r", ch);
      return(TRUE);
    }
    if (GetMaxLevel(guildmaster)-10 < spell_info[number].min_level_cleric) {
      do_say(guildmaster, "I don't know of this spell.", 0);
      return(TRUE);
    }
    if (ch->specials.spells_to_learn <= 0) {
      send_to_char("You do not seem to be able to practice now.\n\r", ch);
      return(TRUE);
    }
    if (ch->skills[number].learned >= 45) {
      send_to_char("You must use this spell to get any better.  I cannot train you further.\n\r", ch);
      return(TRUE);
    }
    send_to_char("You Practice for a while...\n\r", ch);
    ch->specials.spells_to_learn--;
    
if (!IS_SET(ch->skills[number].flags, SKILL_KNOWN)) {
     SET_BIT(ch->skills[number].flags, SKILL_KNOWN);
     SET_BIT(ch->skills[number].flags, SKILL_KNOWN_CLERIC);     
    }
    
    percent = ch->skills[number].learned+int_app[GET_RINT(ch)].learn;
    ch->skills[number].learned = MIN(95, percent);
    
    if (ch->skills[number].learned >= 95) {
      send_to_char("You are now learned in this area.\n\r", ch);
      return(TRUE);
    }
  } else {
    send_to_char("What do you think you are, a cleric??\n\r", ch);
    return(FALSE);
  }

}

int ThiefGuildMaster(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type) 
{
  char buf[256];
  struct char_data *guildmaster;
  static char *n_skills[] = {
    "sneak",     /* 1 */
    "hide",
    "steal",
    "backstab",
    "pick",      /* 5 */
    "spy",     
    "retreat", 
    "find trap",
    "disarm trap",
    "\n",
  };
  int percent=0, number=0;
  int sk_num;

  if (!AWAKE(ch))
    return(FALSE);  

  if (!cmd) 
  {
    if (ch->specials.fighting) 
    {
      return(fighter(ch, cmd, arg, ch, 0));
    }
    return(FALSE);
  }

  if (!ch->skills) return(FALSE);

  if (check_soundproof(ch)) return(FALSE);

  guildmaster = FindMobInRoomWithFunction(ch->in_room, ThiefGuildMaster);  
  
  for(; *arg==' '; arg++); /* ditch spaces */
  if ((cmd==164)||(cmd==170)||cmd==243) 
  {
  if (!HasClass(ch, CLASS_THIEF)) {
    send_to_char("The ThiefGuildmaster says 'Get out of here!'\n\r",ch);
    return(TRUE);
    }
  if (IS_NPC(ch)) 
  {
    act("$N tells you 'What do i look like, an animal trainer?'", FALSE,
        ch, 0, guildmaster, TO_CHAR);
    return(FALSE);
  }
    
    if (cmd==243)
     {
   if (GET_LEVEL(ch,THIEF_LEVEL_IND) > GetMaxLevel(guildmaster)-10) 
      {
       send_to_char("You must learn from another, I can no longer train you.\n\r",ch);
       return(TRUE);
      }
      
  if (GET_EXP(ch)<
    titles[THIEF_LEVEL_IND][GET_LEVEL(ch, THIEF_LEVEL_IND)+1].exp)
    
         {
          send_to_char("You are not yet ready to gain.\n\r", ch);
          return(FALSE);
         } else
         {
          GainLevel(ch,THIEF_LEVEL_IND);
          return(TRUE);
         }
     } /* end gain */

  
    if (!arg || (strlen(arg) == 0)) 
    {
      sprintf(buf,"You have got %d practice sessions left.\n\r", 
              ch->specials.spells_to_learn);
      send_to_char(buf,ch);           

      sprintf(buf," sneak           :  %s\n\r",how_good(ch->skills[SKILL_SNEAK].learned));
      send_to_char(buf,ch);
      sprintf(buf," hide            :  %s\n\r",how_good(ch->skills[SKILL_HIDE].learned));
      send_to_char(buf,ch);
      sprintf(buf," steal           :  %s\n\r",how_good(ch->skills[SKILL_STEAL].learned));
      send_to_char(buf,ch);
      sprintf(buf," backstab        :  %s\n\r",how_good(ch->skills[SKILL_BACKSTAB].learned));
      send_to_char(buf,ch);
      sprintf(buf," pick            :  %s\n\r",how_good(ch->skills[SKILL_PICK_LOCK].learned));
      send_to_char(buf,ch);
      sprintf(buf," spy             :  %s\n\r",how_good(ch->skills[SKILL_SPY].learned));
      send_to_char(buf,ch);
      sprintf(buf," retreat         :  %s\n\r",how_good(ch->skills[SKILL_RETREAT].learned));
      send_to_char(buf,ch);
      sprintf(buf," find trap       :  %s\n\r",how_good(ch->skills[SKILL_FIND_TRAP].learned));
      send_to_char(buf,ch);
      sprintf(buf," disarm trap     :  %s\n\r",how_good(ch->skills[SKILL_REMOVE_TRAP].learned));
      send_to_char(buf,ch);

      return(TRUE);
    } else 
    {
      number = old_search_block(arg,0,strlen(arg),n_skills,FALSE);
      send_to_char ("The Thief Guildmaster says ",ch);
          
      if (number == -1) {
        send_to_char("'I do not know of this skill.'\n\r", ch);
        return(TRUE);
      }

      switch(number) {
      case 0:
      case 1:
        sk_num = SKILL_SNEAK;
        break;
      case 2:
        sk_num = SKILL_HIDE;
        break;
      case 3:
        sk_num = SKILL_STEAL;
        break;
      case 4:
        sk_num = SKILL_BACKSTAB;
        break;
      case 5:
        sk_num = SKILL_PICK_LOCK;
        break;
      case 6:
        sk_num = SKILL_SPY;
        break;
      case 7:
        sk_num = SKILL_RETREAT;
        break;
      case 8:
        sk_num = SKILL_FIND_TRAP;
        break;
      case 9:
        sk_num = SKILL_REMOVE_TRAP;
        break;

      default:
        sprintf(buf, "Strangeness in Thief Guildmaster (%d)", number);
        log(buf);
        send_to_char("'Ack!  I feel sick!'\n\r", ch);
        return(TRUE);
      } /* end switch */
    
      if (ch->skills[sk_num].learned > 45) 
      {
        send_to_char("'You must learn from practice and experience now.'\n\r", ch);
        return(TRUE);
      }

    if (ch->specials.spells_to_learn <= 0) 
    {
      send_to_char 
        ("'You must first use the knowledge you already have.'\n\r",ch);
      return(FALSE);
    }
    
    send_to_char("'This is how you do it...'\n\r",ch);
    ch->specials.spells_to_learn--;

if (!IS_SET(ch->skills[sk_num].flags, SKILL_KNOWN)) {
     SET_BIT(ch->skills[sk_num].flags, SKILL_KNOWN);
     SET_BIT(ch->skills[sk_num].flags, SKILL_KNOWN_THIEF);     
    }
    
    percent = ch->skills[sk_num].learned +
      int_app[GET_INT(ch)].learn;
    ch->skills[sk_num].learned = MIN(95, percent);
    
    if (ch->skills[sk_num].learned >= 95) 
    {
      send_to_char("'You are now a master of this art.'\n\r", ch);
      return(TRUE);        
    }
        
  }
 } else {
    return(FALSE);
   }
}


#if 0

int WarriorGuildMaster(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type) 
{

  int number, i, percent;
  char buf[MAX_INPUT_LENGTH];
  struct char_data *guildmaster;

  static char *w_skills[] = {
    "kick",  /* No. 50 */
    "bash",
    "rescue",
    "\n"
    };

  if (!ch->skills) return(FALSE);


  if (IS_IMMORTAL(ch))
    return(FALSE);

  if (check_soundproof(ch)) return(FALSE);

  guildmaster = FindMobInRoomWithFunction(ch->in_room, WarriorGuildMaster);

  if (!guildmaster) return(FALSE);

  if ((cmd != 164) && (cmd != 170) && (cmd != 243) && (cmd != 72))
      return(FALSE);

  if (IS_NPC(ch)) {
    act("$N tells you 'What do i look like, an animal trainer?'", FALSE,
        ch, 0, guildmaster, TO_CHAR);
    return(FALSE);
  }

  for (;*arg == ' '; arg++);

  if (HasClass(ch, CLASS_WARRIOR)) {

#ifdef QUEST_GAIN
     if (cmd == 243 || cmd == 72)   /* gain or give */
#else
        if (cmd == 243)
#endif
      {     
       if (GET_LEVEL(ch,WARRIOR_LEVEL_IND) < GetMaxLevel(guildmaster)-10) 
       { 
#ifdef QUEST_GAIN
         MakeQuest(ch, guildmaster, WARRIOR_LEVEL_IND, arg, cmd);
#else
     if (GET_EXP(ch)<
         titles[WARRIOR_LEVEL_IND][GET_LEVEL(ch, WARRIOR_LEVEL_IND)+1].exp) 
         {
          send_to_char("You are not yet ready to gain.\n\r", ch);
          return(FALSE);
         } else
         {
          GainLevel(ch,WARRIOR_LEVEL_IND);
          return(TRUE);
         }
#endif

        } else {
          send_to_char("I cannot train you.. You must find another.\n\r",ch);
        }
        return(TRUE); 
     }

    if (!*arg) {
      sprintf(buf,"You have got %d practice sessions left.\n\r", 
              ch->specials.spells_to_learn);
      send_to_char(buf, ch);
      send_to_char("You can practise any of these skills:\n\r", ch);
      for(i=0; *w_skills[i] != '\n';i++) {
        send_to_char(w_skills[i], ch);
        send_to_char(how_good(ch->skills[i+SKILL_KICK].learned), ch);
        send_to_char("\n\r", ch);
      }
      return(TRUE);
    }
    for (;isspace(*arg);arg++);
    number = search_block(arg, w_skills, FALSE);
    if(number == -1) {
      send_to_char("You do not have ability to practise this skill!\n\r", ch);
      return(TRUE);
    }
    if (ch->specials.spells_to_learn <= 0) {
      send_to_char("You do not seem to be able to practice now.\n\r", ch);
      return(TRUE);
    }
    if (ch->skills[number+SKILL_KICK].learned >= 45) {
      send_to_char("I have taught you all that I can.  Now you must use your skills.\n\r", ch);
      return(TRUE);
    }
    send_to_char("You Practice for a while...\n\r", ch);
    ch->specials.spells_to_learn--;
    
    SET_BIT(ch->skills[number+SKILL_KICK].flags, SKILL_KNOWN);
    percent = ch->skills[number+SKILL_KICK].learned +
      int_app[GET_RINT(ch)].learn;
    ch->skills[number+SKILL_KICK].learned = MIN(90, percent);
    
    if (ch->skills[number+SKILL_KICK].learned >= 90) {
      send_to_char("You are now learned in this area.\n\r", ch);
      return(TRUE);
    }
  } else {
    send_to_char("Oh.. i bet you think you're a fighter??\n\r", ch);
    return(FALSE);
  }
}

#endif

int WarriorGuildMaster(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type) 
{
  char buf[256];
  struct char_data *guildmaster;
  static char *n_skills[] = {
    "kick",     /* 1 */
    "bash",
    "rescue",
    "skin",
    "bellow",
    "\n",
  };
  int percent=0, number=0;
  int sk_num;

  if (!AWAKE(ch))
    return(FALSE);  

  if (!cmd) 
  {
    if (ch->specials.fighting) 
    {
      return(fighter(ch, cmd, arg, ch, 0));
    }
    return(FALSE);
  }

  if (!ch->skills) return(FALSE);

  if (check_soundproof(ch)) return(FALSE);

  guildmaster = FindMobInRoomWithFunction(ch->in_room, WarriorGuildMaster);  
  
  for(; *arg==' '; arg++); /* ditch spaces */
  if ((cmd==164)||(cmd==170)||cmd==243) 
  {
  if (!HasClass(ch, CLASS_WARRIOR)) {
    send_to_char("The Warrior Guildmaster says 'Get out of here!'\n\r",ch);
    return(TRUE);
    }
  if (IS_NPC(ch)) 
  {
    act("$N tells you 'What do i look like, an animal trainer?'", FALSE,
        ch, 0, guildmaster, TO_CHAR);
    return(FALSE);
  }
    
    if (cmd==243)
     {
   if (GET_LEVEL(ch,WARRIOR_LEVEL_IND) > GetMaxLevel(guildmaster)-10) 
      {
       send_to_char("You must learn from another, I can no longer train you.\n\r",ch);
       return(TRUE);
      }
      
  if (GET_EXP(ch)<
    titles[WARRIOR_LEVEL_IND][GET_LEVEL(ch, WARRIOR_LEVEL_IND)+1].exp)
    
         {
          send_to_char("You are not yet ready to gain.\n\r", ch);
          return(FALSE);
         } else
         {
          GainLevel(ch,WARRIOR_LEVEL_IND);
          return(TRUE);
         }
     } /* end gain */

  
    if (!arg || (strlen(arg) == 0)) 
    {
      sprintf(buf,"You have got %d practice sessions left.\n\r", 
              ch->specials.spells_to_learn);
      send_to_char(buf,ch);           

      sprintf(buf," kick          :  %s\n\r",how_good(ch->skills[SKILL_KICK].learned));
      send_to_char(buf,ch);
      sprintf(buf," bash          :  %s\n\r",how_good(ch->skills[SKILL_BASH].learned));
      send_to_char(buf,ch);
      sprintf(buf," rescue        :  %s\n\r",how_good(ch->skills[SKILL_RESCUE].learned));
      send_to_char(buf,ch);
      sprintf(buf," skin          :  %s\n\r",how_good(ch->skills[SKILL_TAN].learned));
      send_to_char(buf,ch);
      sprintf(buf," bellow        :  %s\n\r",how_good(ch->skills[SKILL_BELLOW].learned));
      send_to_char(buf,ch);
      return(TRUE);
    } else 
    {
      number = old_search_block(arg,0,strlen(arg),n_skills,FALSE);
      send_to_char ("The Warrior Guildmaster says ",ch);
          
      if (number == -1) {
        send_to_char("'I do not know of this skill.'\n\r", ch);
        return(TRUE);
      }

      switch(number) {
      case 0:
      case 1:
        sk_num = SKILL_KICK;
        break;
      case 2:
        sk_num = SKILL_BASH;
        break;
      case 3:
        sk_num = SKILL_RESCUE;
        break;
      case 4:
        sk_num = SKILL_TAN;
        break;
      case 5:
        sk_num = SKILL_BELLOW;
        break;

      default:
        sprintf(buf, "Strangeness in Warrior Guildmaster (%d)", number);
        log(buf);
        send_to_char("'Ack!  I feel sick!'\n\r", ch);
        return(TRUE);
      } /* end switch */
    
      if (ch->skills[sk_num].learned > 45) 
      {
        send_to_char("'You must learn from practice and experience now.'\n\r", ch);
        return(TRUE);
      }

    if (ch->specials.spells_to_learn <= 0) 
    {
      send_to_char 
        ("'You must first use the knowledge you already have.'\n\r",ch);
      return(FALSE);
    }
    
    send_to_char("'This is how you do it...'\n\r",ch);
    ch->specials.spells_to_learn--;

if (!IS_SET(ch->skills[sk_num].flags, SKILL_KNOWN)) {
     SET_BIT(ch->skills[sk_num].flags, SKILL_KNOWN);
     SET_BIT(ch->skills[sk_num].flags, SKILL_KNOWN_WARRIOR);     
    }

    percent = ch->skills[sk_num].learned +
      int_app[GET_INT(ch)].learn;
    ch->skills[sk_num].learned = MIN(95, percent);
    
    if (ch->skills[sk_num].learned >= 95) 
    {
      send_to_char("'You are now a master of this art.'\n\r", ch);
      return(TRUE);        
    }
        
  }
 } else {
    return(FALSE);
   }
}


int dump(struct char_data *ch, int cmd, char *arg, struct room_data *rp, int type) 
{
  struct obj_data *k;
  char buf[100];
  struct char_data *tmp_char;
  int value=0;
  
  void do_drop(struct char_data *ch, char *argument, int cmd);
  char *fname(char *namelist);
  
  for(k = real_roomp(ch->in_room)->contents; k ; k = real_roomp(ch->in_room)->contents)    {
      sprintf(buf, "The %s vanish in a puff of smoke.\n\r" ,fname(k->name));
      for(tmp_char = real_roomp(ch->in_room)->people; tmp_char;
          tmp_char = tmp_char->next_in_room)
        if (CAN_SEE_OBJ(tmp_char, k))
          send_to_char(buf,tmp_char);
      extract_obj(k);
    }
  
  if(cmd!=60) return(FALSE);
  
  do_drop(ch, arg, cmd);
  
  value = 0;
  
  for(k = real_roomp(ch->in_room)->contents; k ; 
      k = real_roomp(ch->in_room)->contents)    {
      sprintf(buf, "The %s vanish in a puff of smoke.\n\r",fname(k->name));
      for(tmp_char = real_roomp(ch->in_room)->people; tmp_char;
          tmp_char = tmp_char->next_in_room)
        if (CAN_SEE_OBJ(tmp_char, k))
          send_to_char(buf,tmp_char);
      value+=(MIN(1000,MAX(k->obj_flags.cost/4,1)));
      /*
        value += MAX(1, MIN(50, k->obj_flags.cost/10));
        */
      extract_obj(k);
    }
  
  if (value)    {
    act("You are awarded for outstanding performance.", 
        FALSE, ch, 0, 0, TO_CHAR);
    act("$n has been awarded for being a good citizen.", 
        TRUE, ch, 0,0, TO_ROOM);
    
    if (GetMaxLevel(ch) < 3)
      gain_exp(ch, MIN(100,value));
    else
      GET_GOLD(ch) += value;
  }
}

int mayor(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  static char open_path[] =
    "W3a3003b33000c111d0d111Oe333333Oe22c222112212111a1S.";
  
  static char close_path[] =
    "W3a3003b33000c111d0d111CE333333CE22c222112212111a1S.";
  
  static char *path;
  static int index;
  static bool move = FALSE;
  
  void do_move(struct char_data *ch, char *argument, int cmd);
  void do_open(struct char_data *ch, char *argument, int cmd);
  void do_lock(struct char_data *ch, char *argument, int cmd);
  void do_unlock(struct char_data *ch, char *argument, int cmd);
  void do_close(struct char_data *ch, char *argument, int cmd);
  

  if(type == EVENT_WINTER) {
    GET_POS(ch) = POSITION_STANDING;
    do_shout(ch, "Aieee!   The rats!  The rats are coming!  Aieeee!",0);
    return(TRUE);
  }

  
  if (!move) {
    if (time_info.hours == 6) {
      move = TRUE;
      path = open_path;
      index = 0;
    } else if (time_info.hours == 20) {
      move = TRUE;
      path = close_path;
      index = 0;
    }
  }
  
  if (cmd || !move || (GET_POS(ch) < POSITION_SLEEPING) ||
      (GET_POS(ch) == POSITION_FIGHTING)) {
    if (!ch->specials.fighting) return(FALSE);
    return(fighter(ch, cmd, arg, mob, type));
  }
  
  switch (path[index]) {
  case '0' :
  case '1' :
  case '2' :
  case '3' :
    do_move(ch,"",path[index]-'0'+1);
    break;
    
  case 'W' :
    GET_POS(ch) = POSITION_STANDING;
    act("$n awakens and groans loudly.",FALSE,ch,0,0,TO_ROOM);
    break;
    
  case 'S' :
    GET_POS(ch) = POSITION_SLEEPING;
    act("$n lies down and instantly falls asleep.",FALSE,ch,0,0,TO_ROOM);
    break;
    
  case 'a' :
    if (check_soundproof(ch)) return(FALSE);
    act("$n says 'Hello Honey!'",FALSE,ch,0,0,TO_ROOM);
    act("$n smirks.",FALSE,ch,0,0,TO_ROOM);
    break;
    
  case 'b' :
    if (check_soundproof(ch)) return(FALSE);
    act("$n says 'What a view! I must get something done about that dump!'",
        FALSE,ch,0,0,TO_ROOM);
    break;
    
  case 'c' :
    if (check_soundproof(ch)) return(FALSE);
    act("$n says 'Vandals! Youngsters nowadays have no respect for anything!'",
        FALSE,ch,0,0,TO_ROOM);
    break;
    
  case 'd' :
    if (check_soundproof(ch)) return(FALSE);
    act("$n says 'Good day, citizens!'", FALSE, ch, 0,0,TO_ROOM);
    break;
    
  case 'e' :
    if (check_soundproof(ch)) return(FALSE);
    act("$n says 'I hereby declare the bazaar open!'",FALSE,ch,0,0,TO_ROOM);
    break;
    
  case 'E' :
    if (check_soundproof(ch)) return(FALSE);
    act("$n says 'I hereby declare Midgaard closed!'",FALSE,ch,0,0,TO_ROOM);
    break;
    
  case 'O' :
    do_unlock(ch, "gate", 0);
    do_open(ch, "gate", 0);
    break;
    
  case 'C' :
    do_close(ch, "gate", 0);
    do_lock(ch, "gate", 0);
    break;
    
  case '.' :
    move = FALSE;
    break;
    
  }
  
  index++;
  return FALSE;
}

#define ACT_OVER_21 1
#define ACT_SNICKER 2

struct pub_beers {
  int   container;
  int   contains;
  int   howman; 
  int   actflag;
};

struct pub_beers sold_here[] = {
  {3903, 3902, 6, 1 },
  {3905, 3904, 6, 1 },
  {3907, 3906, 6, 1 },
  {3909, 3908, 6, 3 },
  {3911, 3910, 6, 3 },
  {3913, 3912, 6, 3 },
  {3914, 0, 0, 1 },
  {3930, 0, 0, 0 },
  {3931, 0, 0, 0 },
  {3932, 0, 0, 0 },
  {3102, 0, 0, 0 },
  {-1}
};
  

int andy_wilcox(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)

{
  /* things you MUST change if you install this on another mud:
     THE_PUB, room number of the Pub where he will sell beer.
     sold_here, object numbers of the containers and the
     corresponding beer that they will contain.  If you don't
     have multi-buy code, change the #if 1 to #if 0.
     */
#define THE_PUB 3940
  static int    open=1; /* 0 closed;  1 open;  2 last call */
  char argm[100], newarg[100], buf[MAX_STRING_LENGTH];
  struct obj_data *temp1, *temp2;
  struct char_data *temp_char;
  struct char_data *andy;
  int num, i, cost;
  extern struct pub_beers sold_here[];
  struct pub_beers *scan;


  andy = 0;

  if (check_soundproof(ch)) return(FALSE);
  
  for (temp_char = real_roomp(ch->in_room)->people; (!andy) && (temp_char) ; 
       temp_char = temp_char->next_in_room)
    if (IS_MOB(temp_char))
      if (mob_index[temp_char->nr].func == andy_wilcox)
        andy = temp_char;
  
  if (open==0 && time_info.hours == 11) {
    open = 1;
    do_unlock(andy, "door", 0);
    do_open(andy, "door", 0);
    act("$n says 'We're open for lunch, come on in.'", FALSE, andy, 0,0, TO_ROOM);
  }
  if (open==1 && time_info.hours == 1) {
    open = 2;
    act("$n says 'Last call, guys and gals.'", FALSE, andy, 0,0, TO_ROOM);
  }
  if (open==2 && time_info.hours == 2) {
    open = 0;
    act("$n says 'We're closing for the night.\n  Thanks for coming, all, and come again!'", FALSE, andy, 0,0, TO_ROOM);
    do_close(andy, "door", 0);
    do_lock(andy, "door", 0);
  }
  
  switch (cmd) {
  case 25:      /* kill */
  case 70:      /* hit */
  case 157:     /* bash */
  case 159:     /* kick */
    only_argument(arg, argm);
    
    if (andy == ch)
      return TRUE;
    if (andy == get_char_room(argm, ch->in_room))
      {
        int     hitsleft;
        act("$n says 'Get this, $N wants to kill me', and\n falls down laughing.", FALSE, andy, 0, ch, TO_ROOM);
        hitsleft = dice(2,6) + 6;
        if (hitsleft < GET_HIT(ch) && GetMaxLevel(ch) <= MAX_MORT) {
          act("$n beats the shit out of $N.", FALSE, andy, 0, ch, TO_NOTVICT);
          act("$n beats the shit out of you.  OUCH!", FALSE, andy, 0, ch, TO_VICT);
          GET_HIT(ch) = hitsleft;
        } else {
          act("$n grabs $N in a vicious sleeper hold.", FALSE, andy, 0, ch, TO_NOTVICT);
          act("$n puts you in a vicious sleeper hold.", FALSE, andy, 0, ch, TO_VICT);
        }
        GET_POS(ch) = POSITION_SLEEPING;
      }
    else
      {
        do_action(andy, ch->player.name, 130 /* slap */);
        act("$n says 'Hey guys, I run a quiet pub.  Take it outside.'",
            FALSE, andy, 0, 0, TO_ROOM);
      }
    return TRUE;
    break;
    
  case 156:     /* steal */
    if (andy == ch)
      return TRUE;
    do_action(andy, ch->player.name, 130 /* slap */);
    act("$n tells you 'Who the hell do you think you are?'",
        FALSE, andy, 0, ch, TO_VICT);
    do_action(andy, ch->player.name, 116 /* glare */);
    return TRUE;
    break;
    
  case 84:
  case 207:
  case 172:     /* cast, recite, use */
    if (andy == ch)
      return TRUE;
    do_action(andy, ch->player.name, 94 /* poke */);
    act("$n tells you 'Hey, no funny stuff.'.", FALSE, andy, 0, ch, TO_VICT);
    return TRUE;
    break;
    
  case 56: /* buy */
    if (ch->in_room != THE_PUB) {
      act("$n tells you 'Hey man, I'm on my own time, but stop by the Pub some time.'", FALSE, andy, 0, ch, TO_VICT);
      return TRUE;
    }
    if (open==0) {
      act("$n tells you 'Sorry, we're closed, come back for lunch.'",
          FALSE, andy, 0, ch, TO_VICT);
      return TRUE;
    }
    only_argument(arg, argm);
    if (!(*argm)) {
      act("$n tells you 'Sure, what do you want to buy?'",
          FALSE, andy, 0, ch, TO_VICT);
      return TRUE;
    }
    
#if 1
    /* multiple buy code */
    if ((num = getabunch(argm,newarg))!=NULL) {
      strcpy(argm,newarg);
    }
    if (num == 0) num = 1;
#endif
    
    if(!( temp1 = get_obj_in_list_vis(ch,argm,andy->carrying)))      {
        act("$n tells you 'Sorry, but I don't sell that.'", FALSE, andy, 0, ch, TO_VICT);
        return TRUE;
      }
    for (scan = sold_here; scan->container>=0; scan++) {
      if (scan->container == obj_index[temp1->item_number].virtual)
        break;
    }
    if (scan->container<0)      {
        act("$n tells you 'Sorry, that's not for sale.'", FALSE, andy, 0, ch, TO_VICT);
        return TRUE;
      }
    
    if (scan->actflag&ACT_OVER_21 && GET_AGE(ch)<21 ) {
      if (IS_IMMORTAL(ch) || HasClass(ch, CLASS_THIEF)) {
        act("$N manages to slip a fake ID past $n.",
            FALSE, andy, 0, ch, TO_NOTVICT);
      } else if ( !IS_NPC(ch) ) {
        act("$n tells you 'Sorry, I could lose my license if I served you alcohol.'", FALSE, andy, 0, ch, TO_VICT);
        act("$n cards $N and $N is BUSTED.", FALSE, andy, 0, ch, TO_NOTVICT);
        return TRUE;
      }
    }
    
    temp2 = read_object(scan->contains, VIRTUAL);
    cost = ( temp2 ? (scan->howman * temp2->obj_flags.cost) : 0 )
      + temp1->obj_flags.cost;
    cost *= 9;
    cost /=10;
    cost++;
    if (temp2)
      extract_obj(temp2);
    
    for (; num>0; num--)
      {
        if (GET_GOLD(ch) < cost) {
          act("$n tells you 'Sorry, man, no bar tabs.'",
              FALSE, andy, 0, ch, TO_VICT);
          return TRUE;
        }
        temp1 = read_object(temp1->item_number, REAL);
        for (i=0; i<scan->howman; i++) {
          temp2 = read_object(scan->contains, VIRTUAL);
          obj_to_obj(temp2, temp1);
        }
        obj_to_char(temp1, ch);
        GET_GOLD(ch) -= cost;
        act("$N buys a $p from $n", FALSE, andy, temp1, ch, TO_NOTVICT);
        if (scan->actflag&ACT_SNICKER) {
          act("$n snickers softly.", FALSE, andy, NULL, ch, TO_ROOM);
        } else {
          act((scan->actflag&ACT_OVER_21) ?
              "$n tells you 'Drink in good health' and gives you $p" :
              "$n tells you 'Enjoy' and gives you $p",
              FALSE, andy, temp1, ch, TO_VICT);
        }
      }
    return TRUE;
    break;
    
  case 59: /* list */
    act("$n says 'We have", FALSE, andy, NULL, ch, TO_VICT);
    for (scan = sold_here; scan->container>=0; scan++) {
      temp1 = read_object(scan->container, VIRTUAL);
      temp2 = scan->contains ? read_object(scan->contains, VIRTUAL) : NULL;
      cost = (temp2 ? (scan->howman * temp2->obj_flags.cost) : 0 )
        + temp1->obj_flags.cost;
      cost *= 9;
      cost /=10;
      cost++;
      sprintf(buf,"%s for %d gold coins.\n\r", temp1->short_description, cost);
      send_to_char(buf, ch);
      extract_obj(temp1);
      if (temp2)
        extract_obj(temp2);
    }
    return TRUE;
    break;
  }
  
  return FALSE;
}


struct char_data *find_mobile_here_with_spec_proc(int (*fcn)(), int rnumber)
{
  struct char_data      *temp_char;

  for (temp_char = real_roomp(rnumber)->people; temp_char ; 
       temp_char = temp_char->next_in_room)
    if (IS_MOB(temp_char) &&
        mob_index[temp_char->nr].func == fcn)
      return temp_char;
  return NULL;
}

int eric_johnson(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)

{
  /* if more than one eric johnson exists in a game, it will
     get confused because of the state variables */
#define E_HACKING       0
#define E_SLEEPING      1
#define E_SHORT_BEER_RUN 2
#define E_LONG_BEER_RUN 3
#define E_STOCK_FRIDGE  4
#define E_SKYDIVING     5
#define Erics_Lair      3941
#define DanjerKitchen   3904
#define DanjerLiving    3901
#define DanjerPorch     3900
  static int    fighting=0, state=E_HACKING;
  struct obj_data *temp1;
  struct char_data      *eric, *temp_char;
  char  buf[100];

  eric = 0;

  if (check_soundproof(ch)) return(FALSE);

  eric = find_mobile_here_with_spec_proc(eric_johnson, ch->in_room);
  for (temp_char = real_roomp(ch->in_room)->people; (!eric) && (temp_char) ; 
       temp_char = temp_char->next_in_room)
    if (IS_MOB(temp_char))
      if (mob_index[temp_char->nr].func == eric_johnson)
        eric = temp_char;

  if (ch==eric) {

    if (cmd!=0)
      return FALSE; /* prevent recursion when eric wants to move */

    if (!fighting && ch->specials.fighting) {
      act("$n says 'What the fuck?'", FALSE, eric, 0, 0, TO_ROOM);
      fighting=1;
    }
    if (fighting && !ch->specials.fighting) {
      act("$n says 'I wonder what their problem was.'", FALSE, eric, 0, 0, TO_ROOM);
      fighting=0;
    }
    if (fighting) {
      struct char_data  *target = eric->specials.fighting;
      act("$n yells for help.", FALSE, eric, 0, 0, TO_ROOM);
      act("$n throws some nasty judo on $N.", FALSE, eric, 0, target, TO_NOTVICT);
      act("$n throws some nasty judo on you.", FALSE, eric, 0, target, TO_VICT);
      damage(eric, target, dice(2,4), TYPE_HIT);
      if (!saves_spell(target, SAVING_SPELL)) {
        struct affected_type af;
        af.type = SPELL_SLEEP;
        af.duration = 2;
        af.modifier = 0;
        af.location = APPLY_NONE;
        af.bitvector = AFF_SLEEP;
        affect_join(target, &af, FALSE, FALSE);
        if (target->specials.fighting)
          stop_fighting(target);
        if (eric->specials.fighting)
          stop_fighting(eric);
        act("$N is out cold.", FALSE, eric, 0, target, TO_NOTVICT);
        act("You are out cold.", FALSE, eric, 0, target, TO_VICT);
        GET_POS(target) = POSITION_SLEEPING;
        RemHated(eric, target);
        RemHated(target, eric);
      }
      return FALSE;
    }

    switch(state) {
    case E_HACKING:
      if (GET_POS(eric)==POSITION_SLEEPING) {
        do_wake(eric, "", -1);
        return TRUE;
      }
      break;
    case E_SLEEPING:
      if (GET_POS(eric)!=POSITION_SLEEPING) {
        act("$n says 'Go away, I'm sleeping'", FALSE, eric, 0,0, TO_ROOM);
        do_sleep(eric, "", -1);
        return TRUE;
      }
      break;
    default:
      if (GET_POS(eric)==POSITION_SLEEPING) {
        do_wake(eric, "", -1);
        return TRUE;
      } else if (GET_POS(eric)!=POSITION_STANDING) {
        do_stand(eric, "", -1);
        return TRUE;
      }
      break;
    }

    switch(state) {
      char      *s;
    case E_SLEEPING:
      if (time_info.hours>9 && time_info.hours<12) {
        do_wake(eric, "", -1);
        act("$n says 'Ahh, that was a good night's sleep'", FALSE, eric,
            0,0, TO_ROOM);
        state = E_HACKING;
        return TRUE;
      }
      return TRUE;
      break;
    case E_HACKING:
      if (eric->in_room != Erics_Lair) {
        /* he's not in his lair, get him there. */
        int     dir;
        if (eric->in_room == DanjerLiving) {
          do_close(eric, "front",0);
          do_lock(eric, "front",0);
        }
        dir = choose_exit_global(eric->in_room, Erics_Lair, -100);
        if (dir<0)
          {
            if (eric->in_room == DanjerPorch) {
              do_unlock(eric, "front",0);
              do_open(eric, "front",0);
              return TRUE;
            }
            dir = choose_exit_global(eric->in_room, DanjerPorch, -100);
          }
        if (dir<0) {
          if (dice(1,2)==1)
            act("$n says 'Shit, I'm totally lost.", FALSE, eric, 0,0,TO_ROOM);
          else
            act("$n says 'Can you show me the way back to the DanjerHaus?'",
                FALSE, eric, 0,0, TO_ROOM);
        } else
          go_direction(eric, dir);
        
      } else {
        if (time_info.hours>22 || time_info.hours<3) {
          state = E_SLEEPING;
          do_sleep(eric, 0, -1);
          return TRUE;
        }

        do_sit(eric, "", -1);
        if (3==dice(1,5)) {
          /* he's in his lair, do lair things */
          switch (dice(1,5)) {
          case 1:
            s = "$n looks at you, then resumes hacking";
            break;
          case 2:
            s = "$n swears at the terminal and resumes hacking";
            break;
          case 3:
            s = "$n looks around and says 'Where's Big Guy?'";
            break;
          case 4:
            s = "$n says 'Dude, RS/6000s suck.'";
            break;
          case 5:
            temp1 = get_obj_in_list_vis(eric, "beer", eric->carrying);
            if (temp1==NULL ||
                temp1->obj_flags.type_flag != ITEM_DRINKCON ||
                temp1->obj_flags.value[1] <= 0) {
              s = "$n says 'Damn, out of beer'";
              do_stand(eric, "", -1);
              state = E_SHORT_BEER_RUN;
            } else {
              do_drink(eric, "beer", -1 /* irrelevant */);
              s = "$n licks his lips";
            }
            break;
          }
          act(s, FALSE, eric, 0, 0, TO_ROOM);
        }
      }
      break;
    case E_SHORT_BEER_RUN:
      if (eric->in_room != DanjerKitchen) {
        int     dir;
        dir = choose_exit_global(eric->in_room, DanjerKitchen, -100);
        if (dir<0) {
          if (dice(1,3)!=1)
            act("$n says 'Dammit, where's the beer?",
                FALSE, eric, 0,0,TO_ROOM);
          else
            act("$n says 'Christ, who stole my kitchen?'",
                FALSE, eric, 0,0, TO_ROOM);
        } else {
          go_direction(eric, dir);
        }
      } else {
        /* we're in the kitchen, find beer */
        temp1 = get_obj_in_list_vis(eric, "fridge",
                                    real_roomp(eric->in_room)->contents);
        if (temp1==NULL) {
          act("$n says 'Alright, who stole my refrigerator!'", FALSE, eric,
              0, 0, TO_ROOM);
        } else if (IS_SET(temp1->obj_flags.value[1], CONT_CLOSED)) {
          do_drop(eric, "bottle", -1 /* irrelevant */);
          do_open(eric, "fridge", -1 /* irrelevant */);
        } else if (NULL == (temp1 = get_obj_in_list_vis(eric, "sixpack",
                                                        eric->carrying))) {
          strcpy(buf, "get sixpack fridge");
          command_interpreter(eric, buf);
          if (NULL == get_obj_in_list_vis(eric, "sixpack",
                                          eric->carrying)) {
            act("$n says 'Aw, man.  Someone's been drinking all the beer.",
                FALSE, eric, 0, 0, TO_ROOM);
            do_close(eric, "fridge", -1 /* irrelevant */);
            state = E_LONG_BEER_RUN;
          }
        } else if (NULL == (temp1 = get_obj_in_list_vis(eric, "beer",
                                                        eric->carrying))) {
          strcpy(buf, "get beer sixpack");
          command_interpreter(eric, buf);
          if (NULL == get_obj_in_list_vis(eric, "beer",
                                          eric->carrying)) {
            act("$n says 'Well, that one's finished...'", FALSE, eric,
                0, 0, TO_ROOM);
            do_drop(eric, "sixpack", -1 /* irrelevant */);
          }
        } else {
          strcpy(buf, "put sixpack fridge");
          command_interpreter(eric, buf);
          do_close(eric, "fridge", -1 /* irrelevant */);
          state = E_HACKING;
        }
      }
      break;
    case E_LONG_BEER_RUN:
      {
        static struct char_data *andy = 0;
        int     dir;
        static char     **scan,*shopping_list[] =
          { "guinness", "harp", "sierra", "2.harp", NULL };
        
        for (temp_char = character_list; temp_char; temp_char = temp_char->next)
          if (IS_MOB(temp_char))
            if (mob_index[temp_char->nr].func == andy_wilcox)
              andy = temp_char;
        
        if (eric->in_room != andy->in_room) {
          if (eric->in_room == DanjerPorch) {
            do_close(eric, "front",0);
            do_lock(eric, "front",0); /* this takes no time */
          } else if (eric->in_room == DanjerLiving) {
              do_unlock(eric, "front",0);
              do_open(eric, "front",0);
            return TRUE; /* this takes one turn */
            }
          dir = choose_exit_global(eric->in_room, andy->in_room, -100);
          if (dir<0) {
            dir = choose_exit_global(eric->in_room, DanjerLiving, -100);
          }
          if (dir<0) {
            act("$n says 'Aw, man.  Where am I going to get more beer?",
                FALSE, eric, 0,0, TO_ROOM);
            state = E_HACKING;
          } else
            go_direction(eric, dir);
        } else {
          for (scan = shopping_list; *scan; scan++) {
            if (NULL == get_obj_in_list_vis(eric, *scan,
                                            eric->carrying)) {
              char      *s;
              s = (scan[0][1] == '.') ? scan[0]+2 : scan[0];
              sprintf(buf, "buy %s", s);
              command_interpreter(eric, buf);
              if (NULL == get_obj_in_list_vis(eric, *scan,
                                              eric->carrying)) {
                act("$n says 'ARGH, where's my deadbeat roommate with the rent.'", FALSE, eric, 0,0, TO_ROOM);
                act("$n says 'I need beer money.'", FALSE, eric, 0,0, TO_ROOM);
                state = (scan==shopping_list) ? E_HACKING : E_STOCK_FRIDGE;
                return TRUE;
              }
              break;
            }
          }
          if (*scan==NULL || 1 == dice(1,4)) {
            act("$n says 'Catch you later, dude.'", FALSE, eric, 0,0, TO_ROOM);
            state = E_STOCK_FRIDGE;
          }
        }
      }
      break;
    case E_STOCK_FRIDGE:
      if (eric->in_room != DanjerKitchen) {
        int     dir;
        if (eric->in_room == DanjerLiving) {
          do_close(eric, "front",0);
          do_lock(eric, "front",0);
        }
        dir = choose_exit_global(eric->in_room, DanjerKitchen, -100);
        if (dir<0) {
          if (eric->in_room == DanjerPorch) {
            do_unlock(eric, "front",0);
            do_open(eric, "front",0);
            return TRUE;
          }
          dir = choose_exit_global(eric->in_room, DanjerPorch, -100);
        }
        if (dir<0) {
          if (dice(1,3)!=1)
            act("$n says 'Dammit, where's the fridge?",
                FALSE, eric, 0,0,TO_ROOM);
          else
            act("$n says 'Christ, who stole my kitchen?'",
                FALSE, eric, 0,0, TO_ROOM);
        } else {
          go_direction(eric, dir);
        }
      } else {
        /* we're in the kitchen, find beer */
        temp1 = get_obj_in_list_vis(eric, "fridge",
                                    real_roomp(eric->in_room)->contents);
        if (temp1==NULL) {
          act("$n says 'Alright, who stole my refrigerator!'", FALSE, eric,
              0, 0, TO_ROOM);
        } else if (IS_SET(temp1->obj_flags.value[1], CONT_CLOSED)) {
          do_open(eric, "fridge", -1 /* irrelevant */);
        } else if (NULL == (temp1 = get_obj_in_list_vis(eric, "beer",
                                                        eric->carrying))) {
          strcpy(buf, "get beer sixpack");
          command_interpreter(eric, buf);
          if (NULL == get_obj_in_list_vis(eric, "beer",
                                          eric->carrying)) {
            act("$n says 'What the hell, I just bought this?!'", FALSE, eric,
                0, 0, TO_ROOM);
            do_drop(eric, "sixpack", -1 /* irrelevant */);
            if (NULL == get_obj_in_list_vis(eric, "sixpack", eric->carrying))
              state = E_HACKING;
          }
        } else {
          strcpy(buf, "put all.sixpack fridge");
          command_interpreter(eric, buf);
          do_close(eric, "fridge", -1 /* irrelevant */);
          state = E_HACKING;
        }
      }
      break;
    }
  }

  return FALSE;
}

/* *******************************************************************
*  General special procedures for mobiles                            *
******************************************************************** */

/* SOCIAL GENERAL PROCEDURES

If first letter of the command is '!' this will mean that the following
command will be executed immediately.

"G",n      : Sets next line to n
"g",n      : Sets next line relative to n, fx. line+=n
"m<dir>",n : move to <dir>, <dir> is 0,1,2,3,4 or 5
"w",n      : Wake up and set standing (if possible)
"c<txt>",n : Look for a person named <txt> in the room
"o<txt>",n : Look for an object named <txt> in the room
"r<int>",n : Test if the npc in room number <int>?
"s",n      : Go to sleep, return false if can't go sleep
"e<txt>",n : echo <txt> to the room, can use $o/$p/$N depending on
             contents of the **thing
"E<txt>",n : Send <txt> to person pointed to by thing
"B<txt>",n : Send <txt> to room, except to thing
"?<num>",n : <num> in [1..99]. A random chance of <num>% success rate.
             Will as usual advance one line upon sucess, and change
             relative n lines upon failure.
"O<txt>",n : Open <txt> if in sight.
"C<txt>",n : Close <txt> if in sight.
"L<txt>",n : Lock <txt> if in sight.
"U<txt>",n : Unlock <txt> if in sight.    */

/* Execute a social command.                                        */
void exec_social(struct char_data *npc, char *cmd, int next_line,
                 int *cur_line, void **thing)
{
  bool ok;

  void do_move(struct char_data *ch, char *argument, int cmd);
  void do_open(struct char_data *ch, char *argument, int cmd);
  void do_lock(struct char_data *ch, char *argument, int cmd);
  void do_unlock(struct char_data *ch, char *argument, int cmd);
  void do_close(struct char_data *ch, char *argument, int cmd);

  if (GET_POS(npc) == POSITION_FIGHTING)
    return;

  ok = TRUE;

  switch (*cmd) {

    case 'G' :
      *cur_line = next_line;
      return;

    case 'g' :
      *cur_line += next_line;
      return;

    case 'e' :
      act(cmd+1, FALSE, npc, *thing, *thing, TO_ROOM);
      break;

    case 'E' :
      act(cmd+1, FALSE, npc, 0, *thing, TO_VICT);
      break;

    case 'B' :
      act(cmd+1, FALSE, npc, 0, *thing, TO_NOTVICT);
      break;

    case 'm' :
      do_move(npc, "", *(cmd+1)-'0'+1);
      break;

    case 'w' :
      if (GET_POS(npc) != POSITION_SLEEPING)
        ok = FALSE;
      else
        GET_POS(npc) = POSITION_STANDING;
      break;

    case 's' :
      if (GET_POS(npc) <= POSITION_SLEEPING)
        ok = FALSE;
      else
        GET_POS(npc) = POSITION_SLEEPING;
      break;

    case 'c' :  /* Find char in room */
      *thing = get_char_room_vis(npc, cmd+1);
      ok = (*thing != 0);
      break;

    case 'o' : /* Find object in room */
      *thing = get_obj_in_list_vis(npc, cmd+1, real_roomp(npc->in_room)->contents);
      ok = (*thing != 0);
      break;

    case 'r' : /* Test if in a certain room */
      ok = (npc->in_room == atoi(cmd+1));
      break;

    case 'O' : /* Open something */
      do_open(npc, cmd+1, 0);
      break;

    case 'C' : /* Close something */
      do_close(npc, cmd+1, 0);
      break;

    case 'L' : /* Lock something  */
      do_lock(npc, cmd+1, 0);
      break;

    case 'U' : /* UnLock something  */
      do_unlock(npc, cmd+1, 0);
      break;

    case '?' : /* Test a random number */
      if (atoi(cmd+1) <= number(1,100))
        ok = FALSE;
      break;

    default:
      break;
  }  /* End Switch */

  if (ok)
    (*cur_line)++;
  else
    (*cur_line) += next_line;
}



void npc_steal(struct char_data *ch,struct char_data *victim)
{
  int gold;
  
  if(IS_NPC(victim)) return;
  if(GetMaxLevel(victim)>MAX_MORT) return;

  if (AWAKE(victim) && (number(0,GetMaxLevel(ch)) == 0)) {
    act("You discover that $n has $s hands in your wallet.",FALSE,ch,0,victim,TO_VICT);
    act("$n tries to steal gold from $N.",TRUE, ch, 0, victim, TO_NOTVICT);
  } else {
    /* Steal some gold coins */
    gold = (int) ((GET_GOLD(victim)*number(1,10))/100);
    if (gold > 0) {
      GET_GOLD(ch) += gold;
      GET_GOLD(victim) -= gold;
    }
  }
}


int snake(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  void cast_poison( byte level, struct char_data *ch, char *arg, int type,
                   struct char_data *tar_ch, struct obj_data *tar_obj );
  
  if (cmd || !AWAKE(ch))
    return(FALSE);

  if(GET_POS(ch)!=POSITION_FIGHTING) return FALSE;
  
  if (ch->specials.fighting && 
      (ch->specials.fighting->in_room == ch->in_room)) {
    act("$n poisons $N!", 1, ch, 0, ch->specials.fighting, TO_NOTVICT);
    act("$n poisons you!", 1, ch, 0, ch->specials.fighting, TO_VICT);
    cast_poison( GetMaxLevel(ch), ch, "", SPELL_TYPE_SPELL,
                ch->specials.fighting, 0);
    return TRUE;
  }
  return FALSE;
}





int PaladinGuildGuard( struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  
  if (!AWAKE(ch))
    return(FALSE);
  
  if (!cmd) {
    if (ch->specials.fighting) {
      fighter(ch, cmd, arg, mob, type);
    } 
  } else if (cmd >= 1 && cmd <= 6) {
    if ((cmd == 2) || (cmd == 1)  || (cmd == 4)) return(FALSE);  
    if (!HasClass(ch, CLASS_PALADIN)) {
      send_to_char
        ("The guard shakes his head, and blocks your way.\n\r", ch);
      act("The guard shakes his head, and blocks $n's way.", 
          TRUE, ch, 0, 0, TO_ROOM);
      return(TRUE);
    }
  }
  return(FALSE);
}

#if 0

int GameGuard( struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  
  if (!cmd) {
    if (ch->specials.fighting) {
      fighter(ch, cmd, arg,mob,type);
    } 
  } 
  
  if (cmd == 4) {  /* West is field */
    if ((IS_AFFECTED(ch,AFF_TEAM_GREY)) ||
        (IS_AFFECTED(ch,AFF_TEAM_AMBER))){
      send_to_char
        ("The guard wishes you good luck on the field.\n\r", ch);
      return(FALSE);
    } else {
      send_to_char
        ("The guard shakes his head, and blocks your way.\n\r", ch);
      act("The guard shakes his head, and blocks $n's way.", 
          TRUE, ch, 0, 0, TO_ROOM);
      send_to_char
        ("The guard says 'Your not a player! You can't enter the field!'.\n\r", ch);
      return(TRUE);
    }    
    return(FALSE);
  } else return(FALSE);
}

int GreyParamedic(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int types)
{
  struct char_data *vict, *most_hurt;
  
  if (!cmd) {
    if (ch->specials.fighting) {
      return(cleric(ch, 0, "", mob, types));
    } else {
      if (GET_POS(ch) == POSITION_STANDING) {
        
        /* Find a dude to do good things upon ! */
        
        most_hurt = real_roomp(ch->in_room)->people;
        for (vict = real_roomp(ch->in_room)->people; vict;
             vict = vict->next_in_room ) {
          if (((float)GET_HIT(vict)/(float)hit_limit(vict) <
               (float)GET_HIT(most_hurt)/(float)hit_limit(most_hurt))
              && (CAN_SEE(ch, vict)))
            most_hurt = vict;
        }
        if (!most_hurt) return(FALSE); /* nobody here */
        if (IS_AFFECTED(most_hurt,AFF_TEAM_GREY)) {
          
          if ((float)GET_HIT(most_hurt)/(float)hit_limit(most_hurt) >
              0.66) {
            if (number(0,5)==0) {
              act("$n shrugs helplessly.", 1, ch, 0, 0, TO_ROOM);
            }
            return TRUE;        /* not hurt enough */
          }
          
          if (!check_soundproof(ch)) {
            if(number(0,4)==0) {
              if (most_hurt != ch) {
                act("$n looks at $N.", 1, ch, 0, most_hurt, TO_NOTVICT);
                act("$n looks at you.", 1, ch, 0, most_hurt, TO_VICT);
              }

              if (check_nomagic(ch, 0, 0))
                return(TRUE);

              act("$n utters the words 'judicandus dies'.",
                  1, ch, 0, 0, TO_ROOM);
              cast_cure_light(GetMaxLevel(ch), ch, "", 
                              SPELL_TYPE_SPELL, most_hurt, 0);
              return(TRUE);
            }
          }
        } else { /* Other Team? */
          if (IS_AFFECTED(most_hurt,AFF_TEAM_AMBER)) {

              if (check_nomagic(ch, 0, 0))
                return(TRUE);

              act("$n utters the words 'die punk'.", 
                  1, ch, 0, 0, TO_ROOM);
              cast_cause_light(GetMaxLevel(ch), ch, "", 
                              SPELL_TYPE_SPELL, most_hurt, 0);
              return(TRUE); 
          } else return(FALSE);
        }
      } else {/* I'm asleep or sitting */
        return(FALSE);
      }
    }
  }
  return(FALSE);
}

int AmberParamedic(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  struct char_data *vict, *most_hurt;
  
  if (!cmd) {
    if (ch->specials.fighting) {
      return(cleric(ch, 0, "",mob,type));
    } else {
      if (GET_POS(ch) == POSITION_STANDING) {
        
        /* Find a dude to do good things upon ! */
        
        most_hurt = real_roomp(ch->in_room)->people;
        for (vict = real_roomp(ch->in_room)->people; vict;
             vict = vict->next_in_room ) {
          if (((float)GET_HIT(vict)/(float)hit_limit(vict) <
               (float)GET_HIT(most_hurt)/(float)hit_limit(most_hurt))
              && (CAN_SEE(ch, vict)))
            most_hurt = vict;
        }
        if (!most_hurt) return(FALSE); /* nobody here */
        if (IS_AFFECTED(most_hurt,AFF_TEAM_AMBER)) {
          
          if ((float)GET_HIT(most_hurt)/(float)hit_limit(most_hurt) >
              0.66) {
            if (number(0,5)==0) {
              act("$n shrugs helplessly.", 1, ch, 0, 0, TO_ROOM);
            }
            return TRUE;        /* not hurt enough */
          }
          
          if (!check_soundproof(ch)) {
            if(number(0,4)==0) {
              if (most_hurt != ch) {
                act("$n looks at $N.", 1, ch, 0, most_hurt, TO_NOTVICT);
                act("$n looks at you.", 1, ch, 0, most_hurt, TO_VICT);
              }   

              if (check_nomagic(ch, 0, 0))
                return(TRUE);

              act("$n utters the words 'judicandus dies'.", 
                  1, ch, 0, 0, TO_ROOM);
              cast_cure_light(GetMaxLevel(ch), ch, "", 
                              SPELL_TYPE_SPELL, most_hurt, 0);
              return(TRUE);
            }
          }
        } else { /* Other Team? */
          if (IS_AFFECTED(most_hurt,AFF_TEAM_GREY)) {

              if (check_nomagic(ch, 0, 0))
                return(TRUE);

              act("$n utters the words 'die punk'.", 
                  1, ch, 0, 0, TO_ROOM);
              cast_cause_light(GetMaxLevel(ch), ch, "", 
                              SPELL_TYPE_SPELL, most_hurt, 0);
              return(TRUE); 
          } else return(FALSE);
        }
      } else {/* I'm asleep or sitting */
        return(FALSE);
      }
    }
  }
  return(FALSE);
}
#endif


int blink( struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  if (cmd || !AWAKE(ch))
    return(FALSE);

  
  if (GET_HIT(ch) < (int)GET_MAX_HIT(ch) / 3) {
    act("$n blinks.",TRUE,ch,0,0,TO_ROOM);
    cast_teleport( 12, ch, "", SPELL_TYPE_SPELL, ch, 0);
    return(TRUE);
  } else {
    return(FALSE);
  } 
}



int MidgaardCitizen(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  if (cmd || !AWAKE(ch))
    return(FALSE);
  
  if (ch->specials.fighting) {
    fighter(ch, cmd, arg,mob,type);
    
    if (check_soundproof(ch)) return(FALSE);
    
    if (number(0,18) == 0) {
      do_shout(ch, "Guards! Help me! Please!", 0);
    } else {
      act("$n shouts 'Guards!  Help me! Please!'", TRUE, ch, 0, 0, TO_ROOM);
    }
    
    if (ch->specials.fighting)
      CallForGuard(ch, ch->specials.fighting, 3, MIDGAARD);
    
    return(TRUE);
    
  } else {
    return(FALSE);
  }
}

int ghoul(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  struct char_data *tar;
  
  void cast_paralyze( byte level, struct char_data *ch, char *arg, int type,
                     struct char_data *tar_ch, struct obj_data *tar_obj );
  
  if (cmd || !AWAKE(ch))
    return(FALSE);
  
  tar = ch->specials.fighting;
  
  if (tar && (tar->in_room == ch->in_room)) {
    if (!affected_by_spell(tar, SPELL_PROTECT_FROM_EVIL) && 
        (!IS_AFFECTED(tar, AFF_SANCTUARY))) {
      if (HitOrMiss(ch, tar, CalcThaco(ch))) {
        act("$n touches $N!", 1, ch, 0, tar, TO_NOTVICT);
        act("$n touches you!", 1, ch, 0, tar, TO_VICT);
        if (!IS_AFFECTED(tar, AFF_PARALYSIS)) {
          cast_paralyze( GetMaxLevel(ch), ch, "", SPELL_TYPE_SPELL,tar, 0);
          return TRUE;
        }
      }
    }
  }
    return FALSE;
}

int CarrionCrawler(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  struct char_data *tar;
  int i;
  
  void cast_paralyze( byte level, struct char_data *ch, char *arg, int type,
                     struct char_data *tar_ch, struct obj_data *tar_obj );
  
  if (cmd || !AWAKE(ch))
    return(FALSE);

  for (i=0;i<8;i++) {
    if ((tar = FindAHatee(ch)) == NULL) 
        tar = FindVictim(ch);
    
    if (tar && (tar->in_room == ch->in_room)) {
      if (HitOrMiss(ch, tar, CalcThaco(ch))) {
        act("$n touches $N!", 1, ch, 0, tar, TO_NOTVICT);
        act("$n touches you!", 1, ch, 0, tar, TO_VICT);
        if (!IS_AFFECTED(tar, AFF_PARALYSIS)) {
          cast_paralyze( GetMaxLevel(ch), ch, "", SPELL_TYPE_SPELL,tar, 0);
          return TRUE;
        }
      }
    }
  }
  return FALSE;
}

int WizardGuard(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  struct char_data *tch, *evil;
  int max_evil;
  
  if (cmd || !AWAKE(ch))
    return (FALSE);
  
  if (ch->specials.fighting) {
    fighter(ch, cmd, arg,mob,type);
    CallForGuard(ch, ch->specials.fighting, 9, MIDGAARD);
  }     
  max_evil = 1000;
  evil = 0;
  
  for (tch=real_roomp(ch->in_room)->people; tch; tch = tch->next_in_room) {
    if (tch->specials.fighting) {
      if ((GET_ALIGNMENT(tch) < max_evil) &&
          (IS_NPC(tch) || IS_NPC(tch->specials.fighting))) {
        max_evil = GET_ALIGNMENT(tch);
        evil = tch;
      }
    }
  }
  
  if (evil && (GET_ALIGNMENT(evil->specials.fighting) >= 0) &&
      !check_peaceful(ch, "")) {
    if (!check_soundproof(ch)) {
       act("$n screams 'DEATH!!!!!!!!'", 
           FALSE, ch, 0, 0, TO_ROOM);
    }
    hit(ch, evil, TYPE_UNDEFINED);
    return(TRUE);
  }
  return(FALSE);
}



int vampire(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  void cast_energy_drain(byte level,struct char_data *ch, char *arg,int type,
                         struct char_data *tar_ch,struct obj_data *tar_obj);
  
  if (cmd || !AWAKE(ch))
    return(FALSE);
  
  if (ch->specials.fighting && 
      (ch->specials.fighting->in_room == ch->in_room)) {
    act("$n touches $N!", 1, ch, 0, ch->specials.fighting, TO_NOTVICT);
    act("$n touches you!", 1, ch, 0, ch->specials.fighting, TO_VICT);
    cast_energy_drain( GetMaxLevel(ch), ch, "", SPELL_TYPE_SPELL,
                      ch->specials.fighting, 0);
    if (ch->specials.fighting && 
        (ch->specials.fighting->in_room == ch->in_room)) {
      cast_energy_drain( GetMaxLevel(ch), ch, "", SPELL_TYPE_SPELL,
                        ch->specials.fighting, 0);
    }
    return TRUE;
  }
  return FALSE;
}

int wraith(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  void cast_energy_drain( byte level, struct char_data *ch, char *arg, int type,          struct char_data *tar_ch, struct obj_data *tar_obj );
  
  if (cmd || !AWAKE(ch))
    return(FALSE);

  
  if (ch->specials.fighting && 
      (ch->specials.fighting->in_room == ch->in_room)) {
    act("$n touches $N!", 1, ch, 0, ch->specials.fighting, TO_NOTVICT);
    act("$n touches you!", 1, ch, 0, ch->specials.fighting, TO_VICT);
    cast_energy_drain( GetMaxLevel(ch), ch, "", SPELL_TYPE_SPELL,
                      ch->specials.fighting, 0);
    return TRUE;
  }
  return FALSE;
}


int shadow(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{       
  
  void cast_chill_touch( byte level, struct char_data *ch, char *arg, int type,
                        struct char_data *tar_ch, struct obj_data *tar_obj );
  void cast_weakness( byte level, struct char_data *ch, char *arg, int type,
                     struct char_data *tar_ch, struct obj_data *tar_obj );
  
  if (cmd || !AWAKE(ch))
    return(FALSE);
  
  if (ch->specials.fighting && 
      (ch->specials.fighting->in_room == ch->in_room)) {
    act("$n touches $N!", 1, ch, 0, ch->specials.fighting, TO_NOTVICT);
    act("$n touches you!", 1, ch, 0, ch->specials.fighting, TO_VICT);
    cast_chill_touch( GetMaxLevel(ch), ch, "", SPELL_TYPE_SPELL,
                     ch->specials.fighting, 0);
    if (ch->specials.fighting)
      cast_weakness( GetMaxLevel(ch), ch, "", SPELL_TYPE_SPELL,
                    ch->specials.fighting, 0);
    return TRUE;
  }
  return FALSE;
}



int geyser(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  
  void cast_geyser( byte level, struct char_data *ch, char *arg, int type,
                   struct char_data *tar_ch, struct obj_data *tar_obj );
  
  if (cmd || !AWAKE(ch))
    return(FALSE);
  
  if (number(0,3)==0) {
    act("You erupt.", 1, ch, 0, 0, TO_CHAR);
    cast_geyser( GetMaxLevel(ch), ch, "", SPELL_TYPE_SPELL, 0, 0);
    send_to_zone("The volcano rumbles slightly.\n\r", ch);
    return(TRUE);
  }
  
}


int green_slime(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  struct char_data *cons;
  
  void cast_green_slime( byte level, struct char_data *ch, char *arg, int type,
                        struct char_data *tar_ch, struct obj_data *tar_obj );
  
  if (cmd || !AWAKE(ch))
    return(FALSE);
  
  for (cons = real_roomp(ch->in_room)->people; cons; cons = cons->next_in_room )
    if((!IS_NPC(cons)) && (GetMaxLevel(cons)<LOW_IMMORTAL))
      cast_green_slime( GetMaxLevel(ch), ch, "", SPELL_TYPE_SPELL, cons, 0);
  
  
}


int DracoLich(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
}
int Drow(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
}
int Leader(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
}


int thief(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  struct char_data *cons;

  if (cmd || !AWAKE(ch))
    return(FALSE);

  if(GET_POS(ch)!=POSITION_STANDING)return FALSE;

  for(cons = real_roomp(ch->in_room)->people; cons; cons = cons->next_in_room )
    if((!IS_NPC(cons)) && (GetMaxLevel(cons)<LOW_IMMORTAL) && (number(1,5)==1))
        npc_steal(ch,cons); 

  return(FALSE);
}





/* ********************************************************************
*  Special procedures for mobiles                                      *
******************************************************************** */

int guild_guard(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  
  if (!cmd) {
     if (ch->specials.fighting) {
       return(fighter(ch, cmd, arg,mob,type));
     }
  } else {
   
     switch(ch->in_room) {
     case 3017:
        return(CheckForBlockedMove(
               ch, cmd, arg, 3017, 2, CLASS_MAGIC_USER|CLASS_SORCERER));
        break;
     case 3004:
        return(CheckForBlockedMove(ch, cmd, arg, 3004, 0, CLASS_CLERIC));
        break;
     case 3027:
        return(CheckForBlockedMove(ch, cmd, arg, 3027, 1, CLASS_THIEF));
        break;
     case 3021:
        return(CheckForBlockedMove(ch, cmd, arg, 3021, 1, CLASS_WARRIOR));
        break;
    }
  }
  
  return FALSE;
  
}




int Inquisitor(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  if (cmd || !AWAKE(ch))
    return(FALSE);

  if (ch->specials.fighting) {
    return(fighter(ch, cmd, arg,mob,type));
  }

  switch(ch->generic) {
  case INQ_SHOUT:
    if (!check_soundproof(ch))
    do_shout(ch, "NOONE expects the Spanish Inquisition!", 0);
    ch->generic = 0;
    break;
  default:
    break;
  }
}

int puff(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  struct char_data *i, *tmp_ch;
  char buf[80];
  
  void do_say(struct char_data *ch, char *argument, int cmd);
  void do_emote(struct char_data *ch, char *argument, int cmd);
  void do_shout(struct char_data *ch, char *argument, int cmd);

  if(type == EVENT_DWARVES_STRIKE) {
    do_shout(ch, "Ack! Of all the stupid things! Those damned dwarves are on strike again!", 0);
    return(TRUE);
  }

  if(type == EVENT_END_STRIKE) {
    do_shout(ch, "Gee, about time those dwarves stopped striking!", 0);
    return(TRUE);
  }

  if(type == EVENT_DEATH) {
    do_shout(ch, "Ack! I've been killed! Have some God Load me again!!!", 0);
    return(TRUE);
  }

  if(type == EVENT_SPRING) {
    do_shout(ch, "Ahhh, spring is in the air.", 0);
    return(TRUE);
  }

  if (cmd)
    return(0);

  if (ch->generic == 1) {
    do_shout(ch, "When will we get there?", 0);
    ch->generic = 0;
  }


  if (check_soundproof(ch)) return(FALSE);
    
  switch (number(0, 250))
    {
    case 0:
      sprintf(buf,"Anyone know where I am at?\n");
      do_say(ch, buf, 0);
      return(1);
    case 1:
      do_say(ch, "How'd all those fish get up here?", 0);
      return(1);
    case 2:
      do_say(ch, "I'm a very female dragon.", 0);
      return(1);
    case 3:
      do_say(ch, "Haven't I seen you at the Temple?", 0);
      return(1);
    case 4:
      do_shout(ch, "Bring out your dead, bring out your dead!", 0);
      return(1);
    case 5:
      do_emote(ch, "gropes you.", 0);
      return(1);
    case 6:
      do_emote(ch, "gives you a long and passionate kiss.  It seems to last forever.", 0);
      return(1);
    case 7:
      {
        for (i = character_list; i; i = i->next) {
          if (!IS_NPC(i)) {
            if (number(0,5)==0) {
              if (!strcmp(GET_NAME(i),"Celestian")) {
                do_shout(ch,"Celestian, come ravish me now!",0);
              } else if (!strcmp(GET_NAME(i), "Fiona")) {
                do_shout(ch,"I'm Puff the PMS dragon!",0);
              } else if (!strcmp(GET_NAME(i), "Stranger")) {
                do_shout(ch, "People are strange, when they're with Stranger!",0);
              } else if (!strcmp(GET_NAME(i), "God")) {
                do_shout(ch, "God!  Theres only room for one smartass robot on this mud!",0);
              } else if (GET_SEX(i)==SEX_MALE) {
                sprintf(buf,"Hey, %s, how about some MUDSex?",GET_NAME(i));
                do_say(ch,buf,0);
              } else {
                sprintf(buf,"I'm much prettier than %s, don't you think?",GET_NAME(i));
                do_say(ch,buf,0);
              }
            }
          }
          break;
        }
      }
      return(1);
    case 8:
      do_say(ch, "Celestian is my hero!", 0);
      return(1);
    case 9:
      do_say(ch, "So, wanna neck?", 0);
      return(1);
    case 10:
      {
        tmp_ch = (struct char_data *)FindAnyVictim(ch);
        if (!IS_NPC(ch)) {
          sprintf(buf, "Party on, %s", GET_NAME(tmp_ch)); 
          do_say(ch, buf, 0);
          return(1);
        } else {
          return(0);
        }
      }
    case 11:
      if (!number(0,30))
        do_shout(ch, "NOT!!!", 0);
      return(1);
    case 12:
      do_say(ch, "Bad news.  Termites.", 0);
      return(1);
    case 13:
      for (i = character_list; i; i = i->next) {
        if (!IS_NPC(i)) {
          if (number(0,30)==0) {
            sprintf(buf, "%s shout I love Celestian!",GET_NAME(i));
            do_force(ch, buf, 0);
            sprintf(buf, "%s bounce", GET_NAME(i));
            do_force(ch, buf, 0);
            do_restore(ch, GET_NAME(i), 0);
            return(TRUE);
          }
        }
      }
      return(1);
    case 14:
      do_say(ch, "I'll be back.", 0);
      return(1);
    case 15:
      do_say(ch, "Aren't wombat's so cute?", 0);
      return(1);
    case 16:
      do_emote(ch, "fondly fondles you.", 0);
      return(1);
    case 17:
      do_emote(ch, "winks at you.", 0);
      return(1);
    case 18:
      do_say(ch, "This mud is too silly!", 0);
      return(1);
    case 19:
      do_say(ch, "If the Mayor is in a room alone, ", 0);
      do_say(ch, "Does he say 'Good morning citizens.'?",0);
      return(0);
    case 20:
      for (i = character_list; i; i = i->next) {
        if (!IS_NPC(i)) {
          if (number(0,30)==0) {
            sprintf(buf, "Top of the morning to you %s!", GET_NAME(i));
            do_shout(ch, buf, 0);
            return(TRUE);
          }
        }
      }
      break;
    case 21:
      for (i = real_roomp(ch->in_room)->people; i; i= i->next_in_room) {
        if (!IS_NPC(i)) {
          if (number(0,3)==0) {
            sprintf(buf, "Pardon me, %s, but are those bugle boy jeans you are wearing?", GET_NAME(i));
            do_say(ch, buf, 0);
            return(TRUE);
          }
        }
      }
      break;
    case 22:
      for (i = real_roomp(ch->in_room)->people; i; i= i->next_in_room) {
        if (!IS_NPC(i)) {
          if (number(0,3)==0) {
            sprintf(buf, "Pardon me, %s, but do you have any Grey Poupon?", GET_NAME(i));
            do_say(ch, buf, 0);
            return(TRUE);
          }
        }
      }
      break;
    case 23:
      if (number(0,80)==0) {
        do_shout(ch, "Where are we going?", 0);
        ch->generic = 1;
      }
      break;
    case 24:
      do_say(ch, "Blackstaff is a wimp!", 0);
      return(TRUE);
      break;
    case 25:
      do_say(ch, "Better be nice or I will user spellfire on you!", 0);
      return(TRUE);
      break;
    case 26:
      if (number(0,100)==0)
        do_shout(ch, "What is the greatest joy?", 0);
      break;
    case 27:
      do_say(ch, "Have you see Elminster? Gads he is slow...", 0);
      return(TRUE);
    case 28:
      if (number(0,50))
        do_shout(ch, "SAVE!  I'm running out of cute things to say!", 0);
        do_force(ch, "all save", 0);
      return(TRUE);
    case 29:
      do_say(ch, "I hear Strahd is a really mean vampire.", 0);
      return(TRUE);
    case 30:
      do_say(ch, "I heard there was a sword that would kill frost giants.", 0);
      return(TRUE);
    case 31:
      do_say(ch, "Hear about the sword that kills Red Dragons?", 0);
      return(TRUE);
    case 32:
      if (number(0,100)==0) {
        do_shout(ch, "Help yourself and help a newbie!", 0);
        return(TRUE);
      }
      break;
    case 33:
      if (number(0,100)==0) {
        /* do_shout(ch, "Kill all other dragons!", 0); */
        return(TRUE);
      }
      break;
    case 34:
      if (number(0,50)==0) {
        for (i = character_list; i; i=i->next) {
          if (mob_index[i->nr].func == Inquisitor) {
             do_shout(ch, "I wasn't expecting the Spanish Inquisition!", 0);
             i->generic = INQ_SHOUT;
             return(TRUE);
           }
        }
        return(TRUE);
      }
      break;
    case 35:
      do_say(ch, "Are you crazy, is that your problem?", 0);
      return(TRUE);
    case 36:
      for (i = real_roomp(ch->in_room)->people; i; i=i->next_in_room) {
        if (!IS_NPC(i)) {
          if (number(0,3)==0) {
            sprintf(buf, "%s, do you think I'm going bald?",GET_NAME(i));
            do_say(ch, buf, 0);
            return(TRUE);
          }
        }
      }
      break;
    case 37:
      do_say(ch, "This is your brain.", 0);
      do_say(ch, "This is MUD.", 0);
      do_say(ch, "This is your brain on MUD.", 0);
      do_say(ch, "Any questions?", 0);
      return(TRUE);
    case 38:
      for (i = character_list; i; i=i->next) 
      {
        if (!IS_NPC(i)) 
        {
          if (number(0,20) == 0) 
          {
            if (i->in_room != NOWHERE) 
            {
              sprintf(buf, "%s save", GET_NAME(i));
              do_force(ch, buf, 0);
              return(TRUE);
            }
          }
        }
      }
      return(TRUE);
    case 39:
      do_say(ch, "I'm Puff the Magic Dragon, who the hell are you?", 0);
      return(TRUE);
    case 40:
      do_say(ch, "Attention all planets of the Solar Federation!", 0);
      do_say(ch, "We have assumed control.", 0);
      return(TRUE);
    case 41:
      if (number(0,50)==0) {
        do_shout(ch, "We need more explorers!", 0);
        return(TRUE);
      }
      break;
    case 42:
      if (number(0,50)==0) {
        do_shout(ch, "Pray to Celestian, he might be in a good mood!", 0);
        return(TRUE);
      }
      break;
    case 43:
      do_say(ch, "Pardon me boys, is this the road to Great Cthulhu?", 0);
      return(TRUE);
    case 44:
      do_say(ch, "May the Force be with you... Always.", 0);
      return(TRUE);
    case 45:
      do_say(ch, "Eddies in the space time continuum.", 0);
      return(TRUE);
    case 46:
      do_say(ch, "Quick!  Reverse the polarity of the neutron flow!", 0);
      return(TRUE);
    case 47:
      if (number(0,50) == 0) {
        do_shout(ch, "Someone pray to Blackmouth, he is lonely.", 
                 0);
        return(TRUE);
      }
      break;
    case 48:
      do_say(ch, "Shh...  I'm beta testing.  I need complete silence!", 0);
      return(TRUE);
    case 49:
      do_say(ch, "Do you have any more of that Plutonium Nyborg!", 0);
      return(TRUE);
    case 50:
      do_say(ch, "I'm the real implementor, you know.", 0);
      return(TRUE);
    case 51:
      do_emote(ch, "moshes into you almost causing you to fall.", 0);
      return(TRUE);
    case 52:
      if (!number(0,30))
        do_shout(ch, "Everybody pray to Ator!", 0);
      return(TRUE);
    case 53:
      do_say(ch, "You know I always liked you the best don't you?", 0);
      do_emote(ch, "winks seductively at you.", 0);
      return(TRUE);
    case 54:
      if (!number(0,30))
        do_shout(ch, "Ack! Who prayed to Wert!", 0);      
      return(TRUE);

    default:
      return(0);
    }
}

int regenerator( struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{

  if (cmd) return(FALSE);

  if (GET_HIT(ch) < GET_MAX_HIT(ch)) {
    GET_HIT(ch) += 9;
    GET_HIT(ch) = MIN(GET_HIT(ch), GET_MAX_HIT(ch));

    act("$n regenerates.", TRUE, ch, 0, 0, TO_ROOM);
    return(TRUE);
  }
}

int replicant( struct char_data *ch, int cmd, char *arg, struct char_data *mob1, int type)
{
  struct char_data *mob;

  if (cmd) return FALSE;

  if (GET_HIT(ch) < GET_MAX_HIT(ch)) {
    act("Drops of $n's blood hit the ground, and spring up into another one!",
        TRUE, ch, 0, 0, TO_ROOM);
    mob = read_mobile(ch->nr, REAL);
    char_to_room(mob, ch->in_room);
    act("Two undamaged opponents face you now.", TRUE, ch, 0, 0, TO_ROOM);
    GET_HIT(ch) = GET_MAX_HIT(ch);
  }

   return FALSE;

}

#define TYT_NONE 0
#define TYT_CIT  1
#define TYT_WHAT 2
#define TYT_TELL 3
#define TYT_HIT  4
        
int Tytan(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  struct char_data *vict;

  if (cmd || !AWAKE(ch))
    return(FALSE);

  if (ch->specials.fighting) {
    return(magic_user(ch, cmd, arg, mob, type));
  } else {
    switch(ch->generic) {
    case TYT_NONE:
      if (vict = FindVictim(ch)) {
        ch->generic = TYT_CIT;
        SetHunting(ch, vict);
      }
      break;
    case TYT_CIT:
      if (ch->specials.hunting) {
        if (IS_SET(ch->specials.act, ACT_AGGRESSIVE)) {
          REMOVE_BIT(ch->specials.act, ACT_AGGRESSIVE);
        }
        if (ch->in_room == ch->specials.hunting->in_room) {
          act("Where is the Citadel?", TRUE, ch, 0, 0, TO_ROOM);
          ch->generic = TYT_WHAT;
        }
      } else {
        ch->generic = TYT_NONE;
      }
      break;
    case TYT_WHAT:
      if (ch->specials.hunting) {
        if (ch->in_room == ch->specials.hunting->in_room) {
          act("What must we do?", TRUE, ch, 0, 0, TO_ROOM);
          ch->generic = TYT_TELL;
        }
      } else {
        ch->generic = TYT_NONE;
      }
      break;
    case TYT_TELL:
      if (ch->specials.hunting) {
        if (ch->in_room == ch->specials.hunting->in_room) {
          act("Tell Us!  Command Us!", TRUE, ch, 0, 0, TO_ROOM);
          ch->generic = TYT_HIT;
        }
      } else {
        ch->generic = TYT_NONE;
      }
      break;
    case TYT_HIT:
      if (ch->specials.hunting) {
        if (ch->in_room == ch->specials.hunting->in_room) {
          if (!check_peaceful(ch, "The Tytan screams in anger")) {
            hit(ch, ch->specials.hunting, TYPE_UNDEFINED);
            if (!IS_SET(ch->specials.act, ACT_AGGRESSIVE)) {
              SET_BIT(ch->specials.act, ACT_AGGRESSIVE);
            }
            ch->generic = TYT_NONE;
          } else {
            ch->generic = TYT_CIT;
          }
        }
      } else {
        ch->generic = TYT_NONE;
      }
      break;
    default:
      ch->generic = TYT_NONE;
    }
  }
  return(FALSE);
}

int AbbarachDragon(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{

  struct char_data *targ;

  if (cmd || !AWAKE(ch))
    return(FALSE);
  
  if (!ch->specials.fighting) {
     targ = (struct char_data *)FindAnyVictim(ch);
     if (targ && !check_peaceful(ch, "")) {
        hit(ch, targ, TYPE_UNDEFINED);
        act("You have now payed the price of crossing.", 
         TRUE, ch, 0, 0, TO_ROOM);
        return(TRUE);
     }
   } else {
     return(BreathWeapon(ch, cmd, arg,mob,type));
   }
}


int fido(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  
  register struct obj_data *i, *temp, *next_obj, *next_r_obj;
  register struct char_data *v, *next;
  register struct room_data *rp;
  char found = FALSE;
  
  if (cmd || !AWAKE(ch))
    return(FALSE);

  if ((rp = real_roomp(ch->in_room)) == 0)
    return(FALSE);
    
  for (v = rp->people; (v && (!found)); v = next) {
    next = v->next_in_room;
    if ((IS_NPC(v)) && (mob_index[v->nr].virtual == 100) &&
        CAN_SEE(ch, v)) {  /* is a zombie */
      if (v->specials.fighting)
        stop_fighting(v);
      make_corpse(v,NULL);
      extract_char(v);
      found = TRUE;
    } 
  }
  
  
  for (i = real_roomp(ch->in_room)->contents; i; i = next_r_obj) {
    next_r_obj = i->next_content;
    if (GET_ITEM_TYPE(i)==ITEM_CONTAINER && i->obj_flags.value[3]) {
      act("$n savagely devours a corpse.", FALSE, ch, 0, 0, TO_ROOM);
      for(temp = i->contains; temp; temp=next_obj)      {
        next_obj = temp->next_content;
        obj_from_obj(temp);
        obj_to_room(temp,ch->in_room);
      }
      extract_obj(i);
      return(TRUE);
    }
  }
  return(FALSE);
}



int janitor(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  struct obj_data *i;
  
  if (cmd || !AWAKE(ch))
    return(FALSE);
  
  for (i = real_roomp(ch->in_room)->contents; i; i = i->next_content) {
    if (IS_SET(i->obj_flags.wear_flags, ITEM_TAKE) && 
        ((i->obj_flags.type_flag == ITEM_DRINKCON) ||
         (i->obj_flags.cost <= 10))) {
      act("$n picks up some trash.", FALSE, ch, 0, 0, TO_ROOM);
      
      obj_from_room(i);
      obj_to_char(i, ch);
      return(TRUE);
    }
  }
  return(FALSE);
}

int tormentor(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{

  if (!cmd) return(FALSE);

  if (IS_IMMORTAL(ch)) return(FALSE);

  if (!IS_PC(ch)) return(FALSE);

  return(TRUE);

}

int RustMonster(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  struct char_data *vict;
  struct obj_data *t_item;
  int t_pos;

  if (cmd || !AWAKE(ch))
    return(FALSE);
  
/*
**   find a victim
*/
  if (ch->specials.fighting) {
    vict = ch->specials.fighting;
  } else {
    vict = FindVictim(ch);
    if (!vict) {
      return(FALSE);
    }
  }

/*
**   choose an item of armor or a weapon that is metal
**  since metal isn't defined, we'll just use armor and weapons   
*/

   /*
   **  choose a weapon first, then if no weapon, choose a shield,
   **  if no shield, choose breast plate, then leg plate, sleeves,
   **  helm
   */

  if (vict->equipment[WIELD]) {
    t_item = vict->equipment[WIELD];
    t_pos = WIELD;
  } else if (vict->equipment[WEAR_SHIELD]) { 
    t_item = vict->equipment[WEAR_SHIELD];
    t_pos = WEAR_SHIELD;
  } else if (vict->equipment[WEAR_BODY]) {
    t_item = vict->equipment[WEAR_BODY];
    t_pos = WEAR_BODY;
  } else if (vict->equipment[WEAR_LEGS]) {
    t_item = vict->equipment[WEAR_LEGS];
    t_pos = WEAR_LEGS;
  } else if (vict->equipment[WEAR_ARMS]) {
    t_item = vict->equipment[WEAR_ARMS];
    t_pos = WEAR_ARMS;
  } else if (vict->equipment[WEAR_HEAD]) {
    t_item = vict->equipment[WEAR_HEAD];
    t_pos = WEAR_HEAD;
  } else {
    return(FALSE);
  }

/*
**  item makes save (or not)
*/
    if (DamageOneItem(vict, ACID_DAMAGE, t_item)) {
      t_item = unequip_char(vict, t_pos);
      if (t_item) {
/*
**  if it doesn't make save, falls into a pile of scraps
*/
        MakeScrap(vict,NULL, t_item);
      }
    }

  return(FALSE);

}

int temple_labrynth_liar(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  void do_say(struct char_data *ch, char *argument, int cmd);
  
  if (cmd || !AWAKE(ch))
    return(0);

  if (check_soundproof(ch)) return(FALSE);
  
  switch (number(0, 15)) {
    case 0:
      do_say(ch, "I'd go west if I were you.", 0);
      return(1);
    case 1:
      do_say(ch, "I heard that Vile is a cute babe.", 0);
      return(1);
    case 2:
      do_say(ch, "Going east will avoid the beast!", 0);
      return(1);
    case 4:
      do_say(ch, "North is the way to go.", 0);
      return(1);
    case 6:
      do_say(ch, "Dont dilly dally go south.", 0);
      return(1);
    case 8:
      do_say(ch, "Great treasure lies ahead", 0);
      return(1);
    case 10:
      do_say(ch, "I wouldn't kill the sentry if I were more than level 9. No way!", 0);
      return(1);
    case 12:
      do_say(ch, "I am a very clever liar.", 0);
      return(1);
    case 14:
      do_say(ch, "Loki is a really great guy!", 0);
      do_say(ch, "Well.... maybe not...", 0);
      return(1);
    default:
      do_say(ch, "Then again I could be wrong!", 0);
      return(1);
    }
}

int temple_labrynth_sentry(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  struct char_data *tch;
  int counter;
  
  void cast_fireball( byte level, struct char_data *ch, char *arg, int type,
                     struct char_data *victim, struct obj_data *tar_obj );
  void do_say(struct char_data *ch, char *argument, int cmd);
  
  if(cmd || !AWAKE(ch)) return FALSE;
  
  if(GET_POS(ch)!=POSITION_FIGHTING) return FALSE;
  
  if(!ch->specials.fighting) return FALSE;

  if (check_soundproof(ch)) return(FALSE);
    
  /* Find a dude to do very evil things upon ! */
  
  for (tch=real_roomp(ch->in_room)->people; tch; tch = tch->next_in_room) {
    if( GetMaxLevel(tch)>10 && CAN_SEE(ch, tch)) {
      act("The sentry snaps out of his trance and ...", 1, ch, 0, 0, TO_ROOM);
        do_say(ch, "You will die for your insolence, pig-dog!", 0);
        for ( counter = 0 ; counter < 4 ; counter++ )
          if (check_nomagic(ch, 0, 0))
            return(FALSE);
          if ( GET_POS(tch) > POSITION_SITTING)
            cast_fireball(15, ch, "", SPELL_TYPE_SPELL, tch, 0);
          else
            return TRUE;
        return TRUE;
      }
    else
      {
        act("The sentry looks concerned and continues to push you away",
            1, ch, 0, 0, TO_ROOM);
        do_say(ch, "Leave me alone. My vows do not permit me to kill you!", 0);
      }
  }
  return TRUE;
}

#if 0
#define WW_LOOSE 0
#define WW_FOLLOW 1

int Whirlwind (struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  struct char_data *tmp;
  const char *names[] = { "Loki", "Belgarath", 0};
  int i = 0;
  
  if (ch->in_room == -1) return(FALSE);
  
  if (cmd == 0 && ch->generic == WW_LOOSE)  {   
    for (tmp = real_roomp(ch->in_room)->people; tmp ; tmp = tmp->next_in_room) {
      while (names[i])  {
        if ( !strcmp(GET_NAME(tmp), names[i] ) && ch->generic == WW_LOOSE)  {
          /* start following */
          if (circle_follow(ch, tmp)) 
            return(FALSE);
          if (ch->master)
            stop_follower(ch);
          add_follower(ch, tmp);
          ch->generic = WW_FOLLOW;
        }
        i++;
      }
    }
    if (ch->generic == WW_LOOSE && !cmd )  {
      act("The $n suddenly dissispates into nothingness.",0,ch,0,0,TO_ROOM);   
      extract_char(ch);      
    }
  }
}
#endif

#define NN_LOOSE  0
#define NN_FOLLOW 1
#define NN_STOP   2

int NudgeNudge(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{

  struct char_data *vict;
  
  if (cmd || !AWAKE(ch))
    return (FALSE);
  
  if (ch->specials.fighting) {
    return(FALSE);
  }

  
  switch(ch->generic) {
  case NN_LOOSE:
     /*
     ** find a victim
     */
    vict = FindVictim(ch);
    if (!vict)
      return(FALSE);
    /* start following */
    if (circle_follow(ch, vict)) {
      return(FALSE);
    }
    if (ch->master)
      stop_follower(ch);
    add_follower(ch, vict);
    ch->generic = NN_FOLLOW;
    if (!check_soundproof(ch))
       do_say (ch, "Good Evenin' Squire!" , 0 );
    act ("$n nudges you.", FALSE, ch, 0, 0, TO_CHAR);
    act ("$n nudges $N.", FALSE, ch, 0, ch->master, TO_ROOM);
    break;
  case NN_FOLLOW:
    switch(number(0,20)) {
    case 0:
      if (!check_soundproof(ch))
        do_say  (ch, "Is your wife a goer?  Know what I mean, eh?", 0 );
      act ("$n nudges you.", FALSE, ch, 0, 0, TO_CHAR);
      act ("$n nudges $N.", FALSE, ch, 0, ch->master, TO_ROOM);
      break;
    case 1:
      act ("$n winks at you.", FALSE, ch, 0, 0, TO_CHAR);
      act ("$n winks at you.", FALSE, ch, 0, 0, TO_CHAR);
      act ("$n winks at $N.", FALSE, ch, 0, ch->master, TO_ROOM);
      act ("$n winks at $N.", FALSE, ch, 0, ch->master, TO_ROOM);
      act ("$n nudges you.", FALSE, ch, 0, 0, TO_CHAR);
      act ("$n nudges $N.", FALSE, ch, 0, ch->master, TO_ROOM);
      act ("$n nudges you.", FALSE, ch, 0, 0, TO_CHAR);
      act ("$n nudges $N.", FALSE, ch, 0, ch->master, TO_ROOM);
      if (!check_soundproof(ch))
        do_say  (ch, "Say no more!  Say no MORE!", 0);   
      break;
    case 2:
      if (!check_soundproof(ch)) {
        do_say  (ch, "You been around, eh?", 0);
        do_say  (ch, "...I mean you've ..... done it, eh?", 0);
      }
      act ("$n nudges you.", FALSE, ch, 0, 0, TO_CHAR);
      act ("$n nudges $N.", FALSE, ch, 0, ch->master, TO_ROOM);
      act ("$n nudges you.", FALSE, ch, 0, 0, TO_CHAR);
      act ("$n nudges $N.", FALSE, ch, 0, ch->master, TO_ROOM);
      break;
    case 3:
      if (!check_soundproof(ch))
        do_say  (ch, "A nod's as good as a wink to a blind bat, eh?", 0);  
      act ("$n nudges you.", FALSE, ch, 0, 0, TO_CHAR);
      act ("$n nudges $N.", FALSE, ch, 0, ch->master, TO_ROOM);
      act ("$n nudges you.", FALSE, ch, 0, 0, TO_CHAR);
      act ("$n nudges $N.", FALSE, ch, 0, ch->master, TO_ROOM);
      break;
    case 4:
      if (!check_soundproof(ch))
        do_say  (ch, "You're WICKED, eh!  WICKED!", 0);
      act ("$n winks at you.", FALSE, ch, 0, 0, TO_CHAR);
      act ("$n winks at you.", FALSE, ch, 0, 0, TO_CHAR);
      act ("$n winks at $N.", FALSE, ch, 0, ch->master, TO_ROOM);
      act ("$n winks at $N.", FALSE, ch, 0, ch->master, TO_ROOM);
      break;
    case 5:
      if (!check_soundproof(ch))
        do_say  (ch, "Wink. Wink.", 0);
      break;
    case 6:
      if (!check_soundproof(ch))
        do_say  (ch, "Nudge. Nudge.", 0);
      break;
    case 7:
    case 8:
      ch->generic = NN_STOP;
      break;
    default:
      break;
    }
    break;
  case NN_STOP:
    /*
    **  Stop following
    */
    if (!check_soundproof(ch))
      do_say(ch, "Evening, Squire", 0);
    stop_follower(ch);
    ch->generic = NN_LOOSE;
    break;
  default:
    ch->generic = NN_LOOSE;
    break;
  }  
  return(TRUE);
}

int AGGRESSIVE(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  struct char_data *i, *next;

  if (cmd || !AWAKE(ch)) return(FALSE);

  if (check_peaceful(ch, ""))
    return FALSE;

  if (ch->in_room > -1) {
    for (i = real_roomp(ch->in_room)->people; i; i = next) {
      next = i->next_in_room;
      if (GET_RACE(i) != GET_RACE(ch)) {
        if (!IS_IMMORTAL(i) && CAN_SEE(ch, i)) {
          hit(ch, i, TYPE_UNDEFINED);
          break;
        }
      }
    }
  }
}

int citizen(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  if (cmd || !AWAKE(ch))
    return(FALSE);
  
  if (ch->specials.fighting) {
    fighter(ch, cmd, arg,mob,type);

    if (check_soundproof(ch)) return(FALSE);

    if (number(0,18) == 0) {
      do_shout(ch, "Guards! Help me! Please!", 0);
    } else {
      act("$n shouts 'Guards!  Help me! Please!'", TRUE, ch, 0, 0, TO_ROOM);
    }
  }
  return(FALSE);
}

int MidgaardCityguard(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
   return(GenericCityguardHateUndead(ch, cmd, arg, mob, MIDGAARD));
}



#define ONE_RING 1105
int Ringwraith( struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  static char buf[256];
  struct char_data *victim;
  static int    howmanyrings=-1;
  struct obj_data       *ring;
  struct wraith_hunt {
    int ringnumber;
    int chances;
  } *wh;
  int   rnum,dir;

  if (!AWAKE(ch) || !IS_NPC(ch) || cmd) {
    return(FALSE);
  }
  
  if (ch->specials.fighting) {
  if (GET_POS(ch)>POSITION_SLEEPING &&
      GET_POS(ch)<POSITION_FIGHTING) {
      do_stand(ch, "", 0);
    } else
      wraith(ch, cmd, arg,mob,type);
      
    return(FALSE);
  }

  if (howmanyrings==-1) { /* how many one rings are in the game? */
    howmanyrings = 1;
    get_obj_vis_world(ch, "999.one ring.", &howmanyrings);
  }
  
  if (ch->act_ptr==0) { /* does our ringwraith have his state info? */
    ch->act_ptr = (struct wraith_hunt *)malloc(sizeof(*wh)); /* this will never get freed :( */
    wh = (struct wraith_hunt *)ch->act_ptr;
    wh->ringnumber=0;
  } else
    wh = (struct wraith_hunt *)ch->act_ptr; /* yuck, talk to loki about the act_ptr */
  
  if (!wh->ringnumber) { /* is he currently tracking a ring */
    wh->chances=0;
    wh->ringnumber = number(1,howmanyrings++);
  }
  
  sprintf(buf, "%d.one ring.", (int)wh->ringnumber); /* where is this ring? */
  if (NULL== (ring=get_obj_vis_world(ch, buf, NULL))) {
    /* there aren't as many one rings in the game as we thought */
    howmanyrings = 1;
    get_obj_vis_world(ch, "999.one ring.", &howmanyrings);
    wh->ringnumber = 0;
    return FALSE;
  }
  
  rnum = room_of_object(ring);
  
  if (rnum != ch->in_room) {
    dir = find_path(ch->in_room, is_target_room_p, (void *)rnum, -5000, 0);
    if (dir<0) { /* we can't find the ring */
      wh->ringnumber = 0;
      return FALSE;
    }
    go_direction(ch, dir);
    return TRUE;
  }
  
  /* the ring is in the same room! */
  
  if (victim = char_holding(ring)) {
    if (victim==ch) {
      obj_from_char(ring);
      extract_obj(ring);
      wh->ringnumber=0;
      act("$n grimaces happily.", FALSE, ch, NULL, victim, TO_ROOM);
    } else {
      switch (wh->chances) {
      case 0:
        do_wake(ch, GET_NAME(victim), 0);
        if (!check_soundproof(ch))
          act("$n says '$N, give me The Ring'.", FALSE, ch, NULL, victim,
            TO_ROOM);
        else 
          act("$n pokes you in the ribs.", FALSE, ch, NULL, victim, TO_ROOM);
        wh->chances++;
        return(TRUE);
        break;
      case 1:
        if (IS_NPC(victim)) {
          act("$N quickly surrenders The Ring to $n.", FALSE, ch, NULL, victim,
              TO_ROOM);
          if (ring->carried_by)
             obj_from_char(ring);
          else if (ring->equipped_by)
             unequip_char(victim, ring->eq_pos);
          obj_to_char(ring, ch);
        } else {
          if (!check_soundproof(ch))
             act("$n says '$N, give me The Ring *NOW*'.", 
                 FALSE, ch, NULL, victim,
              TO_ROOM);
           else {
             act("$n pokes you in the ribs very painfully.", 
                 FALSE, ch, NULL, victim, TO_ROOM);
           }

          wh->chances++;
        }
        return(TRUE);
        break;
      default:
        if (check_peaceful(ch, "Damn, he's in a safe spot.")) {
          if (!check_soundproof(ch))
             act("$n says 'You can't stay here forever, $N'.", FALSE, ch,
              NULL, victim, TO_ROOM);
        } else {
          if (!check_soundproof(ch))
           act("$n says 'I guess I'll just have to get it myself'.", FALSE, ch,
            NULL, victim, TO_ROOM);
        hit(ch, victim, TYPE_UNDEFINED);
        }
        break;
      }
    }
  } else if (ring->in_obj) {
    /* the ring is in an object */
    obj_from_obj(ring);
    obj_to_char(ring, ch);
    act("$n gets the One Ring.", FALSE, ch, NULL, victim, TO_ROOM);
  } else if (ring->in_room != NOWHERE) {
    obj_from_room(ring);
    obj_to_char(ring, ch);
    act("$n gets the Ring.", FALSE, ch, NULL, 0, TO_ROOM);    
  } else {
    log("a One Ring was completely disconnected!?");
    wh->ringnumber = 0;
  }
  return TRUE;


}

int WarrenGuard(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
{
  struct char_data *tch, *good;
  int max_good;
  
  if (cmd || !AWAKE(ch))
    return (FALSE);
  
  if (ch->specials.fighting) {
    fighter(ch, cmd, arg,mob,type);
    return(TRUE);
  }

  max_good = -1000;
  good = 0;
  
  if (check_peaceful(ch, ""))
    return FALSE;
  
  for (tch=real_roomp(ch->in_room)->people; tch; tch = tch->next_in_room) {
    if (tch->specials.fighting) {
      if ((GET_ALIGNMENT(tch) > max_good) &&
          (IS_NPC(tch) || IS_NPC(tch->specials.fighting))) {
        max_good = GET_ALIGNMENT(tch);
        good = tch;
      }
    }
  }
  
  if (good && (GET_ALIGNMENT(good->specials.fighting) <= 0)) {
    if (!check_soundproof(ch))
       act("$n screams 'DEATH TO GOODY-GOODIES!!!!'", 
           FALSE, ch, 0, 0, TO_ROOM);
    hit(ch, good, TYPE_UNDEFINED);
    return(TRUE);
  }
  
  return(FALSE);
}



int zm_tired(struct char_data *zmaster)
{
  return GET_HIT(zmaster) < GET_MAX_HIT(zmaster)/2 ||
    GET_MANA(zmaster) < 40;
}

int zm_stunned_followers(struct char_data *zmaster)
{
  struct follow_type    *fwr;
  for (fwr = zmaster->followers; fwr; fwr = fwr->next)
    if (GET_POS(fwr->follower)==POSITION_STUNNED)
      return TRUE;
  return FALSE;
}

zm_init_combat(struct char_data *zmaster, struct char_data *target)
{
  struct follow_type    *fwr;
  for (fwr = zmaster->followers; fwr; fwr = fwr->next)
    if (IS_AFFECTED(fwr->follower, AFF_CHARM) &&
        fwr->follower->specials.fighting==NULL &&
        fwr->follower->in_room == target->in_room)
      if (GET_POS(fwr->follower) == POSITION_STANDING) {
        hit(fwr->follower, target, TYPE_UNDEFINED);
      } else if (GET_POS(fwr->follower)>POSITION_SLEEPING &&
                 GET_POS(fwr->follower)<POSITION_FIGHTING) {
        do_stand(fwr->follower, "", -1);
      }
}

int zm_kill_fidos(struct char_data *zmaster)
{
  struct char_data      *fido_b;
  fido_b = find_mobile_here_with_spec_proc(fido, zmaster->in_room);
  if (fido_b) {
    if (!check_soundproof(zmaster)) {
       act("$n shrilly screams 'Kill that carrion beast!'", FALSE,
        zmaster, 0,0, TO_ROOM);
       zm_init_combat(zmaster, fido_b);
    }
    return TRUE;
  }
  return FALSE;
}

int zm_kill_aggressor(struct char_data *zmaster)
{
  struct follow_type    *fwr;
  if (zmaster->specials.fighting)
    {
      if (!check_soundproof(zmaster)) {
         act("$n bellows 'Kill that mortal that dares lay hands on me!'", 
             FALSE, zmaster, 0,0, TO_ROOM);
         zm_init_combat(zmaster, zmaster->specials.fighting);
         return TRUE;
       }
    }
  for (fwr = zmaster->followers; fwr; fwr = fwr->next)
    if (fwr->follower->specials.fighting &&
        IS_AFFECTED(fwr->follower, AFF_CHARM))
      {
        if (!check_soundproof(zmaster)) {
          act("$n bellows 'Assist your brethren, my loyal servants!'", FALSE,
            zmaster, 0,0, TO_ROOM);
          zm_init_combat(zmaster, fwr->follower->specials.fighting);
          return TRUE;
        }
      }
  return FALSE;
}

int zombie_master(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type)
#define ZM_MANA 10
#define ZM_NEMESIS 3060
{
  struct obj_data *temp1;
  struct char_data      *zmaster;
  char  buf[240];
  int   dir;

  zmaster = find_mobile_here_with_spec_proc(zombie_master, ch->in_room);

  if (cmd!=0 || ch != zmaster || !AWAKE(ch))
    return FALSE;

  if (!check_peaceful(ch, "") &&
      (zm_kill_fidos(zmaster) || zm_kill_aggressor(zmaster))
      ) {
    do_stand(zmaster, "", -1);
    return TRUE;
  }

  switch (GET_POS(zmaster)) {
  case POSITION_RESTING:
    if (!zm_tired(zmaster))
      do_stand(zmaster, "", -1);
    break;
  case POSITION_SITTING:
    if (!zm_stunned_followers(zmaster)) {
      if (!check_soundproof(ch))
        act("$n says 'It took you long enough...'", FALSE,
          zmaster, 0, 0, TO_ROOM);
      do_stand(zmaster, "", -1);
    }
    break;
  case POSITION_STANDING:
    if (zm_tired(zmaster)) {
      do_rest(zmaster, "", -1);
      return TRUE;
    }

    temp1 = get_obj_in_list_vis(zmaster, "corpse",
                                real_roomp(zmaster->in_room)->contents);
    
    if (temp1) {
      

Showing the first 100 KB of 191.9 KB. Download the archive for the full file.

Site Stats

Snippets: 1791
Codebases: 571