dsIIr4/bin/
dsIIr4/extra/creremote/
dsIIr4/extra/wolfpaw/
dsIIr4/lib/cmds/admins/
dsIIr4/lib/cmds/common/
dsIIr4/lib/cmds/creators/include/
dsIIr4/lib/cmds/creators/include/SCCS/
dsIIr4/lib/daemon/services/
dsIIr4/lib/doc/
dsIIr4/lib/domains/Ylsrim/
dsIIr4/lib/domains/Ylsrim/adm/
dsIIr4/lib/domains/Ylsrim/armor/
dsIIr4/lib/domains/Ylsrim/broken/
dsIIr4/lib/domains/Ylsrim/fish/
dsIIr4/lib/domains/Ylsrim/meal/
dsIIr4/lib/domains/Ylsrim/npc/
dsIIr4/lib/domains/Ylsrim/virtual/
dsIIr4/lib/domains/Ylsrim/weapon/
dsIIr4/lib/domains/campus/adm/
dsIIr4/lib/domains/campus/etc/
dsIIr4/lib/domains/campus/meals/
dsIIr4/lib/domains/campus/npc/
dsIIr4/lib/domains/campus/save/
dsIIr4/lib/domains/campus/txt/
dsIIr4/lib/domains/campus/txt/ai/charles/
dsIIr4/lib/domains/campus/txt/ai/charles/bak2/
dsIIr4/lib/domains/campus/txt/ai/charles/bak2/bak1/
dsIIr4/lib/domains/campus/txt/ai/charly/
dsIIr4/lib/domains/campus/txt/ai/charly/bak/
dsIIr4/lib/domains/campus/txt/jenny/
dsIIr4/lib/domains/default/creator/
dsIIr4/lib/domains/default/doors/
dsIIr4/lib/domains/default/etc/
dsIIr4/lib/domains/default/virtual/
dsIIr4/lib/domains/default/weap/
dsIIr4/lib/domains/town/virtual/
dsIIr4/lib/lib/comp/
dsIIr4/lib/lib/lvs/
dsIIr4/lib/lib/user/
dsIIr4/lib/lib/virtual/
dsIIr4/lib/log/
dsIIr4/lib/obj/book_source/
dsIIr4/lib/obj/include/
dsIIr4/lib/realms/template/
dsIIr4/lib/realms/template/adm/
dsIIr4/lib/realms/template/area/armor/
dsIIr4/lib/realms/template/area/npc/
dsIIr4/lib/realms/template/area/obj/
dsIIr4/lib/realms/template/area/room/
dsIIr4/lib/realms/template/area/weap/
dsIIr4/lib/realms/template/bak/
dsIIr4/lib/realms/template/cmds/
dsIIr4/lib/save/
dsIIr4/lib/save/kills/o/
dsIIr4/lib/secure/cfg/classes/
dsIIr4/lib/secure/cmds/creators/include/
dsIIr4/lib/secure/cmds/players/
dsIIr4/lib/secure/cmds/players/include/
dsIIr4/lib/secure/daemon/include/
dsIIr4/lib/secure/lib/
dsIIr4/lib/secure/lib/include/
dsIIr4/lib/secure/lib/net/include/
dsIIr4/lib/secure/lib/std/
dsIIr4/lib/secure/modules/
dsIIr4/lib/secure/npc/
dsIIr4/lib/secure/obj/include/
dsIIr4/lib/secure/room/
dsIIr4/lib/secure/save/
dsIIr4/lib/secure/save/boards/
dsIIr4/lib/secure/save/players/g/
dsIIr4/lib/secure/tmp/
dsIIr4/lib/secure/verbs/creators/
dsIIr4/lib/shadows/
dsIIr4/lib/spells/
dsIIr4/lib/std/board/
dsIIr4/lib/std/lib/
dsIIr4/lib/tmp/
dsIIr4/lib/verbs/admins/include/
dsIIr4/lib/verbs/common/
dsIIr4/lib/verbs/common/include/
dsIIr4/lib/verbs/creators/include/
dsIIr4/lib/verbs/players/include/SCCS/
dsIIr4/lib/verbs/rooms/
dsIIr4/lib/verbs/rooms/include/
dsIIr4/lib/www/
dsIIr4/v22.2b14-dsouls2/
dsIIr4/v22.2b14-dsouls2/ChangeLog.old/
dsIIr4/v22.2b14-dsouls2/Win32/
dsIIr4/v22.2b14-dsouls2/compat/
dsIIr4/v22.2b14-dsouls2/compat/simuls/
dsIIr4/v22.2b14-dsouls2/include/
dsIIr4/v22.2b14-dsouls2/mudlib/
dsIIr4/v22.2b14-dsouls2/testsuite/
dsIIr4/v22.2b14-dsouls2/testsuite/clone/
dsIIr4/v22.2b14-dsouls2/testsuite/command/
dsIIr4/v22.2b14-dsouls2/testsuite/data/
dsIIr4/v22.2b14-dsouls2/testsuite/etc/
dsIIr4/v22.2b14-dsouls2/testsuite/include/
dsIIr4/v22.2b14-dsouls2/testsuite/inherit/
dsIIr4/v22.2b14-dsouls2/testsuite/inherit/master/
dsIIr4/v22.2b14-dsouls2/testsuite/log/
dsIIr4/v22.2b14-dsouls2/testsuite/single/
dsIIr4/v22.2b14-dsouls2/testsuite/single/tests/compiler/
dsIIr4/v22.2b14-dsouls2/testsuite/single/tests/efuns/
dsIIr4/v22.2b14-dsouls2/testsuite/single/tests/operators/
dsIIr4/v22.2b14-dsouls2/testsuite/u/
dsIIr4/v22.2b14-dsouls2/tmp/
dsIIr4/win32/
#include <lib.h>
#include <dirs.h>
#include <virtual.h>
#define __DIR__ "/domains/town/virtual/"

inherit LIB_VIRT_LAND;

static private int XPosition, YPosition;

varargs void SetLongAndItems(int x, int y, int z);

varargs int LimitTravel(int requested, int maximum, int lessthan){
    if(lessthan && requested < maximum) return maximum;
    else if(lessthan && requested > maximum) return requested;
    else if(requested > maximum) return maximum;
    else return requested;
}

varargs static void create(int x, int y) {
    string n, s, e, w;
    string ne, nw, se, sw;

    int max_north = 25;
    int max_south = 1;
    int max_east = 25;
    int max_west = 1;

    SetNoReplace(1);
    virt_land::create();
    XPosition = x;
    YPosition = y;
    SetClimate("temperate");
    SetAmbientLight(30);
    SetLongAndItems(x, y);
    SetShort("a thick forest");
    if( x == max_east ) e = "forest/" + (x) + "," + y;
    else e = "forest/" + (x+1) + "," + y;
    if( x == max_west ) w = "forest/" + (x) + "," + y;
    else w = "forest/" + (x-1) + "," + y;
    if( y == max_north ) n = "forest/" + x + "," + (y);
    else n = "forest/" + x + "," + (y+1);
    if( y == max_south ) s = "forest/" + x+ "," + (y);
    else s = "forest/" + x + "," + (y-1);

    nw = "forest/" + LimitTravel(x - 1, max_west, 1) + "," + LimitTravel(y+1, max_north);
    ne = "forest/" + LimitTravel(x + 1, max_east) + "," + LimitTravel(y+1, max_north);
    sw = "forest/" + LimitTravel(x - 1, max_west, 1) + "," + LimitTravel(y-1, max_south, 1);
    se = "forest/" + LimitTravel(x + 1, max_east) + "," + LimitTravel(y-1, max_south, 1);

    SetGoMessage("You can't travel in that direction.");
    if( n ) AddExit("north", __DIR__ + n);
    if( s ) AddExit("south", __DIR__ + s);
    if( e ) AddExit("east", __DIR__ + e);
    if( w ) AddExit("west", __DIR__ + w);
    if( ne ) AddExit("northeast", __DIR__ + ne);
    if( nw ) AddExit("northwest", __DIR__ + nw);
    if( se ) AddExit("southeast", __DIR__ + se);
    if( sw ) AddExit("southwest", __DIR__ + sw);

    if(x == 24 && y == 1){
	RemoveExit("south");
	AddExit("south","/domains/town/room/forest_path1");
    }
    else if(y == 1){
	RemoveExit("south");
	RemoveExit("southeast");
	RemoveExit("southwest");
    }
    if(x == 24 && y == 25){
	RemoveExit("north");
	AddExit("north","/domains/town/room/cave_entrance");
    }
    else if(y == 25){
	RemoveExit("north");
	RemoveExit("northeast");
	RemoveExit("northwest");
    }
    if(x == 1){
	RemoveExit("west");
	RemoveExit("northwest");
	RemoveExit("southwest");
    }
    if(x == 25){
	RemoveExit("east");
	RemoveExit("northeast");
	RemoveExit("southeast");
    }


}

varargs void SetLongAndItems(int x, int y, int z) {
    mapping inv, items;
    string str;
    ::SetLongAndItems(x, y, z);

    inv = ([]);
    str = "You are in a vast forest. The trees and "
    "thick vegetation press in from all sides, appearing almost "
    "threatening. "
    "No path marks your way. ";
    if(query_night()) str += "The stars of the night sky "
	"are barely visible through the heavy forest canopy overhead.";
    else str+= "Sunlight penetrates the tree cover with great "
	"difficulty, rendering the forest cool and dark.";
    if(x == 25) str+= " Travel east is made impossible by a river "
	"rushing north to south here. On the other side of the river "
	"a great slope rises, and it appears that on top of it is "
	"a road that leads north to a high plateau.";
    if(y == 25) str+= " A steep cliff rises north of here, making "
	"travel north into the mountains impossible.";
    if(x == 1) str += " The forest is impassably thick to the west.";
    if(y == 1) str += " The forest is impassably thick southward.";
    if(x == 24 && y == 1) str += "\n%^GREEN%^There is a sign here you can read.%^RESET%^";
    if(x == 24 && y == 25) str += "\n%^GREEN%^There is a cave entrance in the cliff wall.%^RESET%^";
    SetItems( ([ "forest" : "It is so vast.",
	({"woods","trees","vegetation","plants"}) : "Thick, foreboding and "
	"oppressive, these seem to add to an air of danger and claustrophobia.", 
	"no path" : "You observe the presence of its absence.",
	({"mountain","mountains"}): "The snow capped peaks of the great "
	"northern range are faintly visible from here.",
	"cliff" : "To the north, a high cliff rises from the forest.",
	({"canopy","forest canopy","heavy forest canopy"}) : "The great "
	"branches and heavy leaves of the trees here form the forest "
	"canopy, almost a ceiling through which little light can pass.",
      ]) );
    if(y == 25) {
	AddItem( ({ "river", "stream", "great river"}), 
	  "This narrow but powerful river presents an insurmountable "
	  "obstacle to further travel east." );
	AddItem( ({ "slope","road","plateau"}), "Looks like that's "
	  "Fort Road, high on a slope and running north to the Fortress "
	  "on the Frontiers.");
    }
    if(x == 24 && y == 25) {
	AddItem(({"cave","opening","entrance","cave entrance"}) , 
	  "This is a rather scary looking opening in the cliff wall, leading "
	  "north into the ground.");
	AddEnter("cave","/domains/town/room/cave_entrance");
	SetObviousExits("n, s, e, w, se, sw, enter cave");
    }

    if(x == 24 && y == 1) {
	AddItem("sign" , "This is a hastily-lettered sign planted on the ground.");
	SetRead( ({"sign"}) , "Beware th");
    }
    if( !random(50) ) {
	str += "  Burnt wood, scattered rocks and twigs, and other signs "
	"of an abandoned camp site are scattered about.";
	AddItem( ({ "twigs", "sticks", "kindling", "wood", "burnt wood" }) , 
	  "Though long since burnt to nothing, scattered kindling "
	  "and burnt wood lie about as a memory of travellers who have "
	  "passed through");
	if( random(2) ) {
	    string thing;

	    foreach(thing in ({ "twigs", "sticks", "kindling", "wood" })) 
	    SetSearch(thing, function(object who, string str) {
		  object ob;
		  string thing2;

		  if( !(ob = new("/domains/Ylsrim"+ "/etc/pole")) )
		      return 0;
		  who->eventPrint("You find a fishing pole!");
		  eventPrint((string)who->GetName() + " finds a fishing pole "
		    "among the abandoned campsite.", who);
		  foreach(thing2 in ({ "twigs", "sticks", "kindling", "wood"}))
		  RemoveSearch(thing2);
		  if( !((int)ob->eventMove(this_player())) ) {
		      who->eventPrint("You drop the pole!");
		      eventPrint((string)who->GetName() + " drops the pole.",
			who);
		      ob->eventMove(this_object());
		  }
		  return;
		});
	  }
	}
	else if( !random(10) ) 
	    SetSmell("default", "You smell a distant camp fire.");
	if( !random(25) )
	    inv["/domains/town/npc/forest_orc"] = random(3);
	if( !random(45) )
	    inv["/domains/town/npc/bear"] = 1;
	if( !random(15) )
	    inv["/domains/town/npc/deer"] = 1;
	if( !random(65) )
	    inv["/domains/town/npc/gecko"] = 1;
	if( !random(35) )
	    inv["/domains/town/npc/newt"] = 1;
	if( !random(75) )
	    inv["/domains/town/npc/spider"] = 1;

	else if( !random(14) ) 
	    SetListen("default", "You hear voices in the distance.");
	//if(x == 24 && y == 1) inv["/domains/town/obj/sign"] = 1;
	SetLong(str);
	SetDayLight(25);
	SetNightLight(0);
	SetInventory(inv);
    }