예제 #1
0
 public Instance(Player owner, Area area, int indexStart, int indexEnd)
 {
     Owner = owner;
     Area = area;
     IndexStart = indexStart;
     IndexEnd = indexEnd;
 }
예제 #2
0
        public Area Generate()
        {
            Area area = new Area();
            int indexNumber;
            Room prevRoom = null;
            Room room = null;
            Exit exit;
            int i = 0;
            int x = 500;
            int y = 500;
            int dir = -1;
            int prevDir = -1;
            Directions[] dirNormal = new Directions[] { Directions.North, Directions.South, Directions.West, Directions.East };
            Directions[] dirOpposite = new Directions[] { Directions.South, Directions.North, Directions.East, Directions.West };
            Random rand = new Random();

            while (i < IndexNumbers.Count)
            {
                indexNumber = IndexNumbers[i];

                room = new Room(indexNumber);
                area.Rooms.Add(room);
                Coordinates[x, y] = indexNumber;

                if (prevRoom != null)
                {
                    while (true)
                    {
                        dir = rand.Next(0, 3);

                        if (dir != -1 && prevDir != -1 && dirNormal[dir] == dirOpposite[prevDir])
                            continue;

                        room.Exits[dirNormal[dir]] = new Exit(indexNumber, prevRoom.IndexNumber);
                        prevRoom.Exits[dirOpposite[dir]] = new Exit(prevRoom.IndexNumber, indexNumber);
                        break;
                    }

                    Global.Log("Created " + prevRoom.IndexNumber + " to " + indexNumber + " (" + dir.ToString() + ")");
                }

                prevDir = dir;
                prevRoom = room;
                i++;
            }

            return area;
        }
예제 #3
0
        public Server(Main application)
        {
            Application = application;
            Global.Server = this;

            Global.Log("Booting up PolaMUD!\n\r");

            Global.Log("Loading terrain types... ");
            Global.TerrainTable.Add("Grass", new Terrain() { Name = "Grass" });
            Global.TerrainTable.Add("Forest", new Terrain() { Name = "Forest" });
            Global.TerrainTable.Add("Desert", new Terrain() { Name = "Desert" });
            RoomStyles.Generate();
            Global.Log("done!\n");

            Global.Log("Loading skills... ");
            List<Type> types = Assembly.GetCallingAssembly().GetTypes().Where(type => type.IsSubclassOf(typeof(Skill))).ToList();
            foreach (Type type in types)
            {
                if (type == typeof(Skill))
                    continue;
                Skill skill = (Skill)Activator.CreateInstance(type);
                Global.SkillTable.Add(skill.Name, skill);
                Global.Log(skill.Name + ", ");
            }
            Global.Log("done!\n");

            Global.Log("Loading areas...\n");
            Area area = new Area();
            area.Load("00_TestData\\limbo.xml");
            new Areas.TestArea();
            Global.Log("done!\n");

            Global.Log("Initializing game loop... ");
            Global.GameLoop = new GameLoop();
            Global.Log("done!\n");
        }
예제 #4
0
파일: Commands.cs 프로젝트: ramseur/PolaMUD
        public bool CommandAload(Player user, Command command, string text)
        {
            text = Parser.GetStringArgument(text, 2).Text;

            Area area = new Area();
            area.Load(text);

            return true;
        }
예제 #5
0
파일: Room.cs 프로젝트: ramseur/PolaMUD
 /// <summary>
 /// Loads a new room from the provided XmlNode while automatically setting the area that the room belongs to.
 /// </summary>
 /// <param name="room"></param>
 /// <param name="area"></param>
 public void Load(XmlNode room, Area area)
 {
     Area = area;
     Load(room);
 }
예제 #6
0
파일: Room.cs 프로젝트: ramseur/PolaMUD
 /// <summary>
 /// Loads a new room from the provided XmlNode while automatically setting the area that the room belongs to.
 /// </summary>
 /// <param name="room"></param>
 /// <param name="area"></param>
 public void Load(XmlNode room, Area area)
 {
     Area = area;
     Load(room);
 }