Exemplo n.º 1
0
        public static void reset_colors(PlayerInstance ch)
        {
            var path = SystemConstants.GetSystemDirectory(SystemDirectoryTypes.Color) + "default";

            using (var proxy = new TextReaderProxy(new StreamReader(path)))
            {
                IEnumerable <string> lines = proxy.ReadIntoList();
                foreach (var line in lines.Where(l => !l.EqualsIgnoreCase("#colortheme") &&
                                                 !l.StartsWithIgnoreCase("name") &&
                                                 !l.EqualsIgnoreCase("maxcolors")))
                {
                    var tuple = line.FirstArgument();
                    switch (tuple.Item1.ToLower())
                    {
                    case "colors":
                        var colors = tuple.Item2.Split(' ');
                        for (var i = 0; i < colors.Length; i++)
                        {
                            ch.Colors[EnumerationExtensions.GetEnum <ATTypes>(i)] = (char)colors[i].ToInt32();
                        }
                        break;

                    case "end":
                        return;
                    }
                }
            }
        }
Exemplo n.º 2
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");
            }
        }
Exemplo n.º 3
0
        public void Save()
        {
            string path = SystemConstants.GetSystemDirectory(SystemDirectoryTypes.System) + "time.dat";

            using (TextWriterProxy proxy = new TextWriterProxy(new StreamWriter(path)))
            {
                proxy.Write("#TIME\n");
                proxy.Write("Mhour  {0}\n", Hour);
                proxy.Write("Mday   {0}\n", Day);
                proxy.Write("Mmonth {0}\n", Month);
                proxy.Write("Myear  {0}\n", Year);
                proxy.Write("End\n\n");
                proxy.Write("#END\n");
            }
        }
Exemplo n.º 4
0
        public virtual void Load()
        {
            var path = SystemConstants.GetSystemDirectory(SystemDirectory);

            var appSetting = GameConstants.GetAppSetting(AppSettingName);

            if (string.IsNullOrEmpty(appSetting))
            {
                throw new EntryNotFoundException($"{AppSettingName} not found in app.config");
            }

            IEnumerable <string> fileList = appSetting.Split(',');

            foreach (var fileName in fileList)
            {
                _luaManager.DoLuaScript($"{path}\\{fileName}.lua");
            }
        }
Exemplo n.º 5
0
        public static void mudprog_file_read(Template index, string filename)
        {
            var path = SystemConstants.GetSystemDirectory(SystemDirectoryTypes.Prog) + filename;

            using (var proxy = new TextReaderProxy(new StreamReader(path)))
            {
                do
                {
                    var line = proxy.ReadLine();
                    if (line.StartsWith("|"))
                    {
                        break;
                    }
                    if (line.StartsWith(">"))
                    {
                        continue;
                    }

                    var type = (MudProgTypes)EnumerationFunctions.GetEnumByName <MudProgTypes>(proxy.ReadNextWord());
                    if (type == MudProgTypes.Error ||
                        type == MudProgTypes.InFile)
                    {
                        LogManager.Instance.Bug("Invalid mud prog type {0} in file {1}", type, path);
                        continue;
                    }

                    var prog = new MudProgData
                    {
                        Type       = type,
                        ArgList    = proxy.ReadString(),
                        Script     = proxy.ReadString(),
                        IsFileProg = true
                    };

                    index.AddMudProg(prog);
                    break;
                } while (!proxy.EndOfStream);
            }
        }
Exemplo n.º 6
0
        public static void make_wizlist()
        {
            var wizList   = new List <WizardData>();
            var directory = SystemConstants.GetSystemDirectory(SystemDirectoryTypes.God);
            var files     = new DirectoryProxy().GetFiles(directory);

            foreach (var file in files.Where(x => !x.StartsWithIgnoreCase(".")))
            {
                using (var proxy = new TextReaderProxy(new StreamReader(file)))
                {
                    var wizard = new WizardData {
                        Name = file
                    };
                    wizard.Level = wizard.Load(proxy.ReadIntoList());
                    wizList.Add(wizard);
                }
            }

            var buffer = $" Masters of the {GameManager.Instance.SystemData.MudTitle}!";

            var iLevel = 65535;

            foreach (var wiz in wizList)
            {
                if (wiz.Level < iLevel)
                {
                    if (!string.IsNullOrEmpty(buffer))
                    {
                        towizfile(buffer);
                        buffer = string.Empty;
                    }
                    towizfile(string.Empty);
                    iLevel = wiz.Level;
                    if (iLevel == LevelConstants.MaxLevel)
                    {
                        towizfile(" Supreme Entity");
                    }
                    else if (iLevel == LevelConstants.MaxLevel - 1)
                    {
                        towizfile(" Infinite");
                    }
                    else if (iLevel == LevelConstants.MaxLevel - 2)
                    {
                        towizfile(" Eternal");
                    }
                    else if (iLevel == LevelConstants.MaxLevel - 3)
                    {
                        towizfile(" Ancient");
                    }
                    else if (iLevel == LevelConstants.MaxLevel - 4)
                    {
                        towizfile(" Exalted Gods");
                    }
                    else if (iLevel == LevelConstants.MaxLevel - 5)
                    {
                        towizfile(" Ascendant Gods");
                    }
                    else if (iLevel == LevelConstants.MaxLevel - 6)
                    {
                        towizfile(" Greater Gods");
                    }
                    else if (iLevel == LevelConstants.MaxLevel - 7)
                    {
                        towizfile(" Gods");
                    }
                    else if (iLevel == LevelConstants.MaxLevel - 8)
                    {
                        towizfile(" Lesser Gods");
                    }
                    else if (iLevel == LevelConstants.MaxLevel - 9)
                    {
                        towizfile(" Immortals");
                    }
                    else if (iLevel == LevelConstants.MaxLevel - 10)
                    {
                        towizfile(" Demi Gods");
                    }
                    else if (iLevel == LevelConstants.MaxLevel - 11)
                    {
                        towizfile(" Saviors");
                    }
                    else if (iLevel == LevelConstants.MaxLevel - 12)
                    {
                        towizfile(" Creators");
                    }
                    else if (iLevel == LevelConstants.MaxLevel - 13)
                    {
                        towizfile(" Acolytes");
                    }
                    else if (iLevel == LevelConstants.MaxLevel - 14)
                    {
                        towizfile(" Neophytes");
                    }
                    else if (iLevel == LevelConstants.MaxLevel - 15)
                    {
                        towizfile(" Retired");
                    }
                    else if (iLevel == LevelConstants.MaxLevel - 16)
                    {
                        towizfile(" Guests");
                    }
                    else
                    {
                        towizfile(" Servants");
                    }
                }

                if (buffer.Length + wiz.Name.Length > 76)
                {
                    towizfile(buffer);
                    buffer = string.Empty;
                }
                buffer += " " + wiz.Name;
                if (buffer.Length > 70)
                {
                    towizfile(buffer);
                    buffer = string.Empty;
                }
            }

            if (!string.IsNullOrEmpty(buffer))
            {
                towizfile(buffer);
            }
        }
Exemplo n.º 7
0
 protected AreaLoader(string areaName, bool bootDb)
 {
     AreaName = areaName;
     BootDb   = bootDb;
     FilePath = SystemConstants.GetSystemDirectory(SystemDirectoryTypes.Area) + AreaName;
 }