Ejemplo n.º 1
0
        /// <summary>
        /// Loads a new room from the provided XmlNode.
        /// </summary>
        /// <param name="room"></param>
        public void Load(XmlNode room)
        {
            Name        = room.Attributes["name"].Value;
            Description = room["desc"].InnerText;

            foreach (XmlNode exit in room["exits"].ChildNodes)
            {
                Directions dir = Directions.North;
                switch (exit.Attributes["name"].Value)
                {
                case "north":
                    dir = Directions.North;
                    break;

                case "south":
                    dir = Directions.South;
                    break;

                case "west":
                    dir = Directions.West;
                    break;

                case "east":
                    dir = Directions.East;
                    break;

                case "up":
                    dir = Directions.Up;
                    break;

                case "down":
                    dir = Directions.Down;
                    break;
                }
                Exits[dir] = new Exit(IndexNumber, Convert.ToInt32(exit.Attributes["index"].Value));
            }

            if (room["mobresets"] != null)
            {
                foreach (XmlNode mob in room["mobresets"].ChildNodes)
                {
                    MobReset mobreset = new MobReset(this, Convert.ToInt32(mob.Attributes["index"].Value), Convert.ToInt32(mob.Attributes["maxroom"].Value), Convert.ToInt32(mob.Attributes["respawn"].Value));
                    MobResets.Add(mobreset);
                    Global.Log("    Added ID #" + mobreset.IndexNumber);
                }
            }

            Global.Log("    Room: " + Name + " with ID #" + IndexNumber + "\n");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads a new room from the provided XmlNode.
        /// </summary>
        /// <param name="room"></param>
        public void Load(XmlNode room)
        {
            Name = room.Attributes["name"].Value;
            Description = room["desc"].InnerText;

            foreach (XmlNode exit in room["exits"].ChildNodes)
            {
                Directions dir = Directions.North;
                switch (exit.Attributes["name"].Value)
                {
                    case "north":
                        dir = Directions.North;
                        break;
                    case "south":
                        dir = Directions.South;
                        break;
                    case "west":
                        dir = Directions.West;
                        break;
                    case "east":
                        dir = Directions.East;
                        break;
                    case "up":
                        dir = Directions.Up;
                        break;
                    case "down":
                        dir = Directions.Down;
                        break;
                }
                Exits[dir] = new Exit(IndexNumber, Convert.ToInt32(exit.Attributes["index"].Value));
            }

            if (room["mobresets"] != null)
            {
                foreach (XmlNode mob in room["mobresets"].ChildNodes)
                {
                    MobReset mobreset = new MobReset(this, Convert.ToInt32(mob.Attributes["index"].Value), Convert.ToInt32(mob.Attributes["maxroom"].Value), Convert.ToInt32(mob.Attributes["respawn"].Value));
                    MobResets.Add(mobreset);
                    Global.Log("    Added ID #" + mobreset.IndexNumber);
                }
            }

            Global.Log("    Room: " + Name + " with ID #" + IndexNumber + "\n");
        }