Example #1
0
        public static List <WallInfo> Read(XmlNodeList wallNodeList)
        {
            var wallInfoList = new List <WallInfo>();

            for (int i = 0; i < wallNodeList.Count; i++)
            {
                var wallNode = wallNodeList[i];

                int id = 0;

                if (wallNode.Attributes["num"] != null)
                {
                    id = Convert.ToInt32(wallNode.Attributes["num"].Value);
                }

                var wallInfo = new WallInfo
                {
                    Id   = id,
                    Name = wallNode.Attributes["name"].Value
                };

                if (wallNode.Attributes["color"] != null)
                {
                    wallInfo.ColorName  = wallNode.Attributes["color"].Value;
                    wallInfo.ColorValue = TileInfos.ParseColor(wallInfo.ColorName);
                    wallInfo.Color      = (Color)ColorConverter.ConvertFromString(wallInfo.ColorName);
                }
                else
                {
                    wallInfo.Color = MapHelper.GetWallColor((ushort)id);
                }

                if (wallNode.Attributes["blend"] != null)
                {
                    wallInfo.Blend = Convert.ToInt16(wallNodeList[i].Attributes["blend"].Value);
                }
                else
                {
                    wallInfo.Blend = (Int16)id;
                }

                wallInfoList.Add(wallInfo);
            }

            return(wallInfoList);
        }
Example #2
0
        public static StaticData Read(string filename)
        {
            var staticData = new StaticData();

            var xmlDocument = new XmlDocument();

            using (var stream = File.OpenRead(filename))
            {
                xmlDocument.Load(stream);
            }

            staticData.TileInfos    = TileInfos.Read(xmlDocument);
            staticData.WallInfos    = WallInfo.Read(xmlDocument);
            staticData.GlobalColors = GlobalColors.Read(xmlDocument);
            staticData.ItemPrefixes = ItemPrefix.Read(xmlDocument);
            staticData.ItemInfos    = ItemInfo.Read(xmlDocument);
            staticData.NpcInfoList  = NpcInfo.Read(xmlDocument);

            return(staticData);
        }
Example #3
0
        public static TileInfos Read(XmlDocument xmlDocument)
        {
            var tileInfos = new TileInfos(xmlDocument.GetElementsByTagName("tile"));

            return(tileInfos);
        }