Ejemplo n.º 1
0
        public static void show_colorthemes(CharacterInstance ch)
        {
            ch.SendToPager("&Ythe following themes are available:\r\n");

            var proxy = new DirectoryProxy();
            var path  = SystemConstants.GetSystemDirectory(SystemDirectoryTypes.Color);

            var count = 0;
            var col   = 0;

            foreach (var file in proxy.GetFiles(path).ToList()
                     .Where(x => !x.EqualsIgnoreCase("cvs") && !x.StartsWith(".")))
            {
                ++count;
                ch.PagerPrintf("%s%-15.15s", color_str(ATTypes.AT_PLAIN, ch), file);
                if (++col % 6 == 0)
                {
                    ch.SendToPager("\r\n");
                }
            }

            if (count == 0)
            {
                ch.SendToPager("No themes defined yet.\r\n");
            }

            if (col % 6 != 0)
            {
                ch.SendToPager("\r\n");
            }
        }
        public void Load()
        {
            var dirProxy = new DirectoryProxy();
            var files    = dirProxy.GetFiles(Directory);

            var validLines = new List <string> {
                "level", "roomrange", "mobrange", "objrange"
            };

            foreach (var file in files.Where(x => !x.Equals(".")))
            {
                using (var proxy = new TextReaderProxy(new StreamReader(Directory + file)))
                {
                    IEnumerable <string> lines = proxy.ReadIntoList();

                    int low = 0, hi = 0, rlow = 0, rhi = 0, mlow, mhi, olow, ohi;
                    var badFile = false;

                    foreach (var line in lines)
                    {
                        string[] words;
                        switch (line.ToLower())
                        {
                        case "level":
                            if (low < LevelConstants.ImmortalLevel)
                            {
                                LogManager.Instance.Bug("God file {0} with level {1} < {2}", file, low,
                                                        LevelConstants.ImmortalLevel);
                                badFile = true;
                            }
                            break;

                        case "roomrange":
                            words = line.Split();
                            rlow  = low = words[1].ToInt32();
                            rhi   = hi = words[2].ToInt32();
                            break;

                        case "mobrange":
                            words = line.Split();
                            rlow  = low = words[1].ToInt32();
                            rhi   = hi = words[2].ToInt32();
                            break;

                        case "objrange":
                            words = line.Split();
                            rlow  = low = words[1].ToInt32();
                            rhi   = hi = words[2].ToInt32();
                            break;
                        }
                    }

                    if (rlow > 0 && rhi > 0 && !badFile)
                    {
                    }
                }
            }
        }