Ejemplo n.º 1
0
void outside_message(string str) {
   string who, what, where;
   object sword, player;

   str = ANSI_D->strip_colors(str);
   str = lowercase(str);

   if (sscanf(str, "%s gives %s to you.", who, what) == 2) {
       player = this_environment()->present(who);
       sword = this_object()->present("orc slayer");

       if (sword) {
          destruct_object(sword);
          if (!player->is_completed_quest("Orc Slayer")) {
             player->add_completed_quest("Orc Slayer");
             player->increase_expr(200);
             player->message("Congratulations!!! You have just completed the " +
                "Orc Slayer quest.\n");
          }
       }
   } else if (sscanf(str, "%s says: %s",who,what) == 2) {
      if (strstr(what[0..3], "hello") == 0 || 
          strstr(what[0..1], "hi") == 0) {
          player = this_environment()->present(who);

          this_object()->respond("say Welcome " + who + ".");
          give_castle(who);
      }
   } else if (sscanf(str, "%s says:%scastle%s",who, what, where) == 3) {
      give_castle(who);
   }
}
Ejemplo n.º 2
0
void enter_hole(void) {
   object obj;

   if (this_player()->is_completed_quest("NewbieVille")) {
      write("You don't seem to fit through the hole anymore.");
      this_object()->tell_room(this_player(), this_player()->query_Name() + 
         " tries to squeeze through the hole but can not seem to " +
         "fit through it.");
      return;
   } else {
      obj = find_object(FILE);
      if (!obj) {
         obj = compile_object(FILE);
         if (!obj) {
            write("Error in loading destination.\n");
            return;
         }
         obj->setup();
         obj->setup_mudlib();
      }
      if (this_player()->move(obj)) {
         write("You wriggle through the hole.");
         this_object()->tell_room(this_player(),
            this_player()->query_Name() + " squeezes through the hole.\n");
         this_player()->do_look(this_environment());
      }
   }
   return;
}
Ejemplo n.º 3
0
void give_castle(string who) {
   object player;

   player = this_environment()->present(who);
   if (player) {
      if (query_wizard(player)) {
         /* XXX Not sure if want to do castles that way or not so do this
            instead for now */
         this_environment()->tell_room(this_object(), "Leo says: I seem to " +
            "have missplaced my portable castles, please come back later.");
      } else {
         this_environment()->tell_room(this_object(), "Leo says: sorry " +
            player->query_Name() + " you need to be a wizard to get a castle.");
      }
   }
}
Ejemplo n.º 4
0
void goto_the(string location, string dir) {
   object room;
   string error;
     
   event("body_leave", this_player());
   this_player()->query_environment()->tell_room(this_player(), 
      this_player()->query_Name() + " leaves " + dir + ".\n");
   error = catch(this_player()->move(location));

   /* Need to do last exit stuff XXX */

   if (error) {
      if (query_wizard(this_player()) == 1) {
         write("\nConstruction blocks your path.\n" + "Error: " + error + "\n");
         return;
      } else {
         write ("\nConstruction blocks your path.\n");
      }
   }

   call_other(this_player(), "do_look",this_environment());

   room = this_player()->query_environment();
   room->event("body_enter", this_player());
   room->tell_room(this_player(), this_player()->query_Name()  + " enters.\n");
}
Ejemplo n.º 5
0
void parse(string str) {
   if (str == "go away" || str == "die" || str == "dismissed") {
      remove_call_out(nFollow);
      respond("say It seems " + master_name + " no longer has a need for me.");
      this_environment()->remove_object(this_object());
      destruct_object(this_object());
   } else {
      respond(str);
   }
}
Ejemplo n.º 6
0
void main( string str ) {
  object *objs;
  int i;

  if( !str || str == "" ) {
    write( "Buy what?" );
    return;
  }

  objs = this_environment()->query_inventory();
  for( i = 0; i < sizeof( objs ); i++ ) {
    if( objs[i]->is_vendor() == 1 ) {
      /* Found the shopkeeper */

      objs[i]->do_sell( this_player(), str );
      return;

    }
  }

  write( "Buy from whom?" );
}
Ejemplo n.º 7
0
void main( string str ) {
  object target;
  int i, sz;
  int target_hp, target_damage;
  string who, target_name;
  int perc;

  if ( !str || str == "" ) {
    write("Zap someone?");
    return;
  }

  if( sscanf( str, "%s %d", who, perc ) != 2 ) {
    who = str;
    perc = 100;
  }


  if (perc <= 0) {
      write("Zapping with no power is useless.");
      return;
  }
  if (perc > 100) {
      write("Zapping with more than 100% damage is silly; setting to 100%.");
      perc = 100;
  }

  target = this_environment()->present(who);

  if (!target) {
    write("Cant find " + who + "\n");
    return;
  }

  target_hp = target->query_hp();
  target_name = target->query_id();
  target_damage = (target_hp * perc) / 100;

  write(target->query_id() + " has " + target_hp + " hitpoints");
  write(target->query_id() + " is going to receive " + target_damage + " damage");

    switch(perc) {
      case 1..20 : this_player()->targetted_action("$N $vlook slightly annoyed at $T.", target);
                   target->message( "You feel uncomfortable.");
                   break;
      case 21..40 : this_player()->targetted_action( "$N $vlook intensely at $T.", target);
                    target->message( "Your skin burns.");
                    break;
      case 41..60 : this_player()->targetted_action( "$N $vlook angry at $T", target);
                    target->message( "You feel as if you're hit by a tree.");
                    break;
      case 61..80 : this_player()->targetted_action( "$N $vstare at $T for a while", target);
                    target->message( "Your head hurts, and your nose begins to bleed.");
                    break;
      case 81..99 : this_player()->targetted_action( "Sparks fly as $N $vstare intensely at $T", target);
                    target->message( "Your brain starts to ooze out of your ears.");
                    break;
      case 100 : this_player()->targetted_action( "$N $vgive $T the evil eye.", target);
                 target->message("Your head explodes.");
                 break;
    }
  /*this_player()->simple_action("$N $vgive " + target->query_id() + " a very nasty look..."); */
  target->decrease_hp(target_damage);

  if (target->query_hp() < 1) {
    target->simple_action( "$N $vfall to the ground...dead." );
    target->message( "You have died." );
    target->die();
  } else {
    write(target->query_id() + " is left with " + target->query_hp() + " hitpoints.");
  }

}