Ejemplo n.º 1
0
        /// <summary> Load up all server groups </summary>
        public static void InitAll()
        {
            GroupList = new List <Group>();
            if (File.Exists("properties/ranks.properties"))
            {
                GroupProperties.InitAll();
            }

            if (findPerm(LevelPermission.Banned) == null)
            {
                GroupList.Add(new Group(LevelPermission.Banned, 1, 1, "Banned", '8', String.Empty, "banned.txt"));
            }
            if (findPerm(LevelPermission.Guest) == null)
            {
                GroupList.Add(new Group(LevelPermission.Guest, 1, 120, "Guest", '7', String.Empty, "guest.txt"));
            }
            if (findPerm(LevelPermission.Builder) == null)
            {
                GroupList.Add(new Group(LevelPermission.Builder, 400, 300, "Builder", '2', String.Empty, "builders.txt"));
            }
            if (findPerm(LevelPermission.AdvBuilder) == null)
            {
                GroupList.Add(new Group(LevelPermission.AdvBuilder, 1200, 900, "AdvBuilder", '3', String.Empty, "advbuilders.txt"));
            }
            if (findPerm(LevelPermission.Operator) == null)
            {
                GroupList.Add(new Group(LevelPermission.Operator, 2500, 5400, "Operator", 'c', String.Empty, "operators.txt"));
            }
            if (findPerm(LevelPermission.Admin) == null)
            {
                GroupList.Add(new Group(LevelPermission.Admin, 65536, int.MaxValue, "SuperOP", 'e', String.Empty, "uberOps.txt"));
            }
            GroupList.Add(new Group(LevelPermission.Nobody, 65536, -1, "Nobody", '0', String.Empty, "nobody.txt"));
            GroupList.Sort((a, b) => a.Permission.CompareTo(b.Permission));

            if (Group.Find(Server.defaultRank) != null)
            {
                standard = Group.Find(Server.defaultRank);
            }
            else
            {
                standard = Group.findPerm(LevelPermission.Guest);
            }

            Player[] players = PlayerInfo.Online.Items;
            foreach (Player pl in players)
            {
                pl.group = findPerm(pl.group.Permission);
                if (pl.group == null)
                {
                    pl.group = standard;
                }
            }
            if (OnGroupLoad != null)
            {
                OnGroupLoad();
            }
            OnGroupLoadEvent.Call();
            saveGroups(GroupList);
        }
Ejemplo n.º 2
0
        public static void LoadAll()
        {
            GroupList = new List <Group>();
            if (File.Exists(Paths.RankPropsFile))
            {
                GroupProperties.InitAll();
            }
            else
            {
                // Add some default ranks
                Register(new Group(LevelPermission.Builder, 4096, 300, "Builder", '2'));            // 16^3 draw volume
                Register(new Group(LevelPermission.AdvBuilder, 262144, 900, "AdvBuilder", '3'));    // 64^3
                Register(new Group(LevelPermission.Operator, 2097152, 5400, "Operator", 'c'));      // 128^3
                Register(new Group(LevelPermission.Admin, 16777216, int.MaxValue, "SuperOP", 'e')); // 256^3
            }

            if (BannedRank == null)
            {
                Register(new Group(LevelPermission.Banned, 1, 1, "Banned", '8'));
            }
            if (GuestRank == null)
            {
                Register(new Group(LevelPermission.Guest, 1, 120, "Guest", '7'));
            }
            if (NobodyRank == null)
            {
                Register(new Group(LevelPermission.Nobody, 65536, int.MaxValue, "Nobody", '0'));
            }

            GroupList.Sort((a, b) => a.Permission.CompareTo(b.Permission));
            DefaultRank = Find(ServerConfig.DefaultRankName);
            if (DefaultRank == null)
            {
                DefaultRank = GuestRank;
            }

            OnGroupLoadEvent.Call();
            reloading = true;
            SaveAll(GroupList);

            Player.Console.group = NobodyRank;
            Player[] players = PlayerInfo.Online.Items;
            foreach (Player p in players)
            {
                p.group = Group.Find(p.group.Permission);
                if (p.group == null)
                {
                    p.group = DefaultRank;
                }
                if (PlayerDB.FindColor(p).Length > 0 || p.color == p.group.Color)
                {
                    continue;
                }

                p.color = p.group.Color;
                Entities.GlobalRespawn(p);
                p.SetPrefix();
            }
        }
Ejemplo n.º 3
0
        public static void LoadAll()
        {
            GroupList = new List <Group>();
            if (File.Exists(Paths.RankPropsFile))
            {
                LoadFromDisc();
            }
            else
            {
                // Add some default ranks
                Add(LevelPermission.Builder, 4096, 5, "Builder", "&2", GEN_LIMIT, 3);                 // 16^3 draw volume
                Add(LevelPermission.AdvBuilder, 262144, 15, "AdvBuilder", "&3", GEN_LIMIT, 5);        // 64^3
                Add(LevelPermission.Operator, 2097152, 90, "Operator", "&c", GEN_LIMIT, 8);           // 128^3
                Add(LevelPermission.Admin, 16777216, 21024000, "Admin", "&e", GEN_ADMIN, 12);         // 256^3
                Add(LevelPermission.Owner, 134217728, 21024000, "Owner", "&4", GEN_ADMIN, 16);        // 512^3
            }

            if (BannedRank == null)
            {
                Add(LevelPermission.Banned, 1, 0, "Banned", "&8", GEN_LIMIT, 0);
            }
            if (GuestRank == null)
            {
                Add(LevelPermission.Guest, 1, 2, "Guest", "&7", GEN_LIMIT, 3);
            }

            GroupList.Sort((a, b) => a.Permission.CompareTo(b.Permission));
            DefaultRank = Find(Server.Config.DefaultRankName);
            if (DefaultRank == null)
            {
                DefaultRank = GuestRank;
            }

            AllRanks.Clear();
            AllRanks.AddRange(GroupList);
            AllRanks.Add(ConsoleRank);

            OnGroupLoadEvent.Call();
            reloading = true;
            SaveAll(GroupList);

            Player[] players = PlayerInfo.Online.Items;
            foreach (Player p in players)
            {
                UpdateGroup(p);
            }
        }
Ejemplo n.º 4
0
        public static void LoadAll()
        {
            GroupList = new List <Group>();
            if (File.Exists(Paths.RankPropsFile))
            {
                GroupProperties.InitAll();
            }
            else
            {
                // Add some default ranks
                Add(LevelPermission.Builder, 4096, 5, "Builder", '2', 3);                 // 16^3 draw volume
                Add(LevelPermission.AdvBuilder, 262144, 15, "AdvBuilder", '3', 5);        // 64^3
                Add(LevelPermission.Operator, 2097152, 90, "Operator", 'c', 8);           // 128^3
                Add(LevelPermission.Admin, 16777216, 21024000, "Admin", 'e', 12);         // 256^3
            }

            if (BannedRank == null)
            {
                Add(LevelPermission.Banned, 1, 0, "Banned", '8', 0);
            }
            if (GuestRank == null)
            {
                Add(LevelPermission.Guest, 1, 2, "Guest", '7', 3);
            }
            if (NobodyRank == null)
            {
                Add(LevelPermission.Nobody, 134217728, 21024000, "Owner", '0', 16);  // 512^3
            }
            GroupList.Sort((a, b) => a.Permission.CompareTo(b.Permission));
            DefaultRank = Find(Server.Config.DefaultRankName);
            if (DefaultRank == null)
            {
                DefaultRank = GuestRank;
            }

            OnGroupLoadEvent.Call();
            reloading = true;
            SaveAll(GroupList);

            Player.Console.group = NobodyRank;
            Player[] players = PlayerInfo.Online.Items;
            foreach (Player p in players)
            {
                UpdateGroup(p);
            }
        }
Ejemplo n.º 5
0
        public static void InitAll()
        {
            GroupList = new List <Group>();
            if (File.Exists(Paths.RankPropsFile))
            {
                GroupProperties.InitAll();
            }
            else
            {
                // Add some default ranks
                Register(new Group(LevelPermission.Builder, 400, 300, "Builder", '2'));
                Register(new Group(LevelPermission.AdvBuilder, 1200, 900, "AdvBuilder", '3'));
                Register(new Group(LevelPermission.Operator, 2500, 5400, "Operator", 'c'));
                Register(new Group(LevelPermission.Admin, 65536, int.MaxValue, "SuperOP", 'e'));
            }

            if (BannedRank == null)
            {
                Register(new Group(LevelPermission.Banned, 1, 1, "Banned", '8'));
            }
            if (GuestRank == null)
            {
                Register(new Group(LevelPermission.Guest, 1, 120, "Guest", '7'));
            }
            if (NobodyRank == null)
            {
                Register(new Group(LevelPermission.Nobody, 65536, -1, "Nobody", '0'));
            }

            GroupList.Sort((a, b) => a.Permission.CompareTo(b.Permission));
            standard = Find(ServerConfig.DefaultRankName);
            if (standard == null)
            {
                standard = GuestRank;
            }

            OnGroupLoadEvent.Call();
            reloading = true;
            SaveList(GroupList);
        }