TRADERSW.C

LIB3/D/HOME/CITY/TRADERSW.C · 3.2 KB

From the archive nm4dos.zip

Download the archive   « Back to the archive contents

#include "path.h"
inherit "/std/room.c";

object guard1, guard2;

setup ()
{
   set_short("North end of Traders Walk");
   set_long("This is Traders Walk, which runs North"+
      "/South through "+CITYNAME+". To the north, a heavy gate "+
      "allows exit from the city to the north.\n");
   add_item( ({"road", "street", "traders walk", "Traders Walk"}),
      "Traders Walk carries most of the city's commerce "+
      "from the northern traders. It is kept in good repair, "+
      "but only to encourage the tourists.\n");
   add_item( ({"crowd", "people", "tourist", "trader"}),
      "All the tourists, traders, and locals swarming "+
      "about here are doing it just to annoy you.\n");
      add_item( ({"gate", "entrance", "exit"}),
         "The gates are constructed from heavy oak reinforced with "
         +"wide iron bands. They are usually left open, to allow the "
         +"traders from the north free access to the city.\n");
      add_monster(MONSTERS+"guard", 2);
      add_exit("south", HOMECITY+"traderswalk2", "road");
      add_exit("north", SURROUND+"northroad1", "road");
   modify_exit("north", ({"function", "leave_city"}) );
      set_zone("trader");
      set_light(60);
   }

void reset()
{
if(!guard1)
{
   guard1 = clone_object(MONSTERS+"guard");
   guard1->move(this_object());
}
if(!guard2)
{
   guard2 = clone_object(MONSTERS+"guard");
   guard2->move(this_object());
}
}

void dest_me()
{
if(guard1) guard1->dest_me();
if(guard2) guard2->dest_me();
::dest_me();
}

int leave_city()
{
   if(guard1 || guard2)
      {
      if((string)this_player()->query_race_ob() == "std/races/polymorph")
         {
         notify_fail("The guard stops you, saying 'Hey, you'll have "
               +"to choose a race before leaving the city!'\n");
         say("A guard stops "+this_player()->query_cap_name()
            +" from leaving the city, on the grounds that "
            +this_player()->query_pronoun()+" is still a polymorph.\n");
         return 0;
      }
      if(this_player()->query_level() < 2)
         {
         notify_fail("A guard stops you leaving the city, saying "
               +"'You are too inexperienced to leave the city yet, "
            +this_player()->query_cap_name()+". Why not gain "
            +"a bit more experience before venturing out into the "
            +"big bad world?'\n");
         say("A guard stops "+this_player()->query_cap_name()+" leaving"
            +" the city on the grounds that "+this_player()->query_pronoun()
            +" is too inexperienced.\n");
         return 0;
      }
      if(this_player()->query_level() < 5)
         {
         write("A guard steps up to you, saying 'Beware, "
            +this_player()->query_cap_name()+". You are still "
            +"rather inexperienced to be leaving the city. Do not "
            +"wander too far!'\n");
         say("A guard says something to "+this_player()->query_cap_name()+
            " before allowing "+this_player()->query_objective()
            +" to leave the city.\n");
         return 1;
      }
      write("A guard gives you a cursory glance before "
         +"motioning you on.\n");
      return 1;
   }
write("There are no guards here, so you pass freely through the gate.\n");
return 1;
}

Site Stats

Snippets: 1791
Codebases: 571