Beispiel #1
0
        static Settings()
        {
            Main.EnqueueMessage("Loading Config file.");

            if (File.Exists(ConfigPath))
            {
                InIReader IReader = new InIReader(ConfigPath);

                //Path
                MapPath    = IReader.ReadString("Path", "MapPath", MapPath);
                LogPath    = IReader.ReadString("Path", "LogPath", LogPath);
                ClientPath = IReader.ReadString("Path", "ClientPath", ClientPath);

                //Database
                SQLServer   = IReader.ReadString("Database", "SQLServer", SQLServer);
                SQLDatabase = IReader.ReadString("Database", "SQLDatabase", SQLDatabase);
                SQLUserID   = IReader.ReadString("Database", "SQLUserID", SQLUserID);
                SQLPassword = IReader.ReadString("Database", "SQLPassword", SQLPassword);

                //Network
                IPAddress = IReader.ReadString("Network", "IPAddress", IPAddress);
                Port      = IReader.ReadInt32("Network", "Port", Port);
                TimeOut   = IReader.ReadInt64("Network", "TimeOut", TimeOut);
                MaxUser   = IReader.ReadInt32("Network", "MaxUser", MaxUser);
                ReLogTime = IReader.ReadDouble("Network", "ReLogTime", ReLogTime);

                //Security
                CheckVersion = IReader.ReadBoolean("Security", "CheckVersion", CheckVersion);

                //Permission
                AllowNewAccount      = IReader.ReadBoolean("Permission", "AllowNewAccount", AllowNewAccount);
                AllowChangePassword  = IReader.ReadBoolean("Permission", "AllowChangePassword", AllowChangePassword);
                AllowLogin           = IReader.ReadBoolean("Permission", "AllowLogin", AllowLogin);
                AllowNewCharacter    = IReader.ReadBoolean("Permission", "AllowNewCharacter", AllowNewCharacter);
                AllowDeleteCharacter = IReader.ReadBoolean("Permission", "AllowDeleteCharacter", AllowDeleteCharacter);
                AllowStartGame       = IReader.ReadBoolean("Permission", "AllowStartGame", AllowStartGame);

                //Game
                DropRange     = IReader.ReadInt32("Game", "DropRange", DropRange);
                DropStackSize = IReader.ReadInt32("Game", "DropStackSize", DropStackSize);
                ItemTimeOut   = IReader.ReadInt32("Game", "ItemTimeOut", ItemTimeOut);

                ExpRate  = IReader.ReadSingle("Game", "ExpRate", ExpRate);
                DropRate = IReader.ReadSingle("Game", "DropRate", DropRate);

                StartLevel = IReader.ReadByte("Game", "StartLevel", StartLevel);
                StartGold  = IReader.ReadInt64("Game", "StartGold", StartGold);

                if (ExpRate <= 0)
                {
                    ExpRate = 1;
                }
                if (StartLevel <= 0)
                {
                    StartLevel = 1;
                }

                Main.EnqueueMessage("Config file loaded.");
            }
            else
            {
                Main.EnqueueMessage("Config file not found, creating Config file.");
                Save();
            }
            LoadVersion();
            LoadExperienceList();
        }