Пример #1
0
 public static bool Orb_Command_Maintenence_Group_Represent_Method(Server.NetObject NetObj, CommandReader Command)
 {
     Database.GroupDB.Group TargetGroup = Database.GroupDB.NoGroup;
     #region FindTargetGroup
     if (Database.GroupDB.FindGroup(Command._CmdElements()[1]) == Database.GroupDB.NoGroup)
     {
         NetObj.ClientObject.SendMessage("Group not found: \"" + Command._CmdElements()[1] + "\".");
         return(false);
     }
     TargetGroup = Database.GroupDB.FindGroup(Command._CmdElements()[1]);
     #endregion
     #region Test Permissions
     if (NetObj.UserObject.Groups.Select(x => x.Group).Contains(TargetGroup))
     {
         //THIS User is a member of the group. (Required to be able to represent the group.
     }
     else
     {
         NetObj.ClientObject.SendMessage("You need to be a member of the group yourself in order to represent it.");
         return(false);
     }
     #endregion
     NetObj.UserObject.GroupRepresented = TargetGroup;
     NetObj.ClientObject.SendMessage("You are now representing Group: \"" + TargetGroup.Name + "\".");
     NetObj.UserObject.SaveAll();
     return(true);
 }
Пример #2
0
        public static bool Orb_Command_Maintenence_Group_Ranks_List_Method(Server.NetObject NetObj, CommandReader Command)
        {
            Database.GroupDB.Group TargetGroup = Database.GroupDB.NoGroup;
            #region FindTargetGroup
            if (Command._CmdElements()[1] == "-")
            {
                if (NetObj.CommandHandling.PreviousGroup == Database.GroupDB.NoGroup)
                {
                    NetObj.ClientObject.SendMessage("No previous groups iterated over.");
                    return(false);
                }
                else
                {
                    TargetGroup = NetObj.CommandHandling.PreviousGroup;
                }
            }
            else
            {
                if (Database.GroupDB.FindGroup(Command._CmdElements()[1]) == Database.GroupDB.NoGroup)
                {
                    NetObj.ClientObject.SendMessage("Group not found: \"" + Command._CmdElements()[1] + "\".");
                    return(false);
                }
                TargetGroup = Database.GroupDB.FindGroup(Command._CmdElements()[1]);
            }
            #endregion
            #region ListRanks
            NetObj.ClientObject.SendMessage("Ranks in Group \"" + TargetGroup.Name + "\": " + TargetGroup.Ranks.Select(z => z.Name).ToList().ToStringList());
            return(true);

            #endregion
        }
Пример #3
0
        public static bool Orb_Command_Maintenence_Group_Ranks_Add_Method(Server.NetObject NetObj, CommandReader Command)
        {
            Database.GroupDB.Group TargetGroup = Database.GroupDB.NoGroup;
            string TargetRankName = "";

            #region FindTargetGroup
            if (Command._CmdElements()[1] == "-")
            {
                if (NetObj.CommandHandling.PreviousGroup == Database.GroupDB.NoGroup)
                {
                    NetObj.ClientObject.SendMessage("No previous groups iterated over.");
                    return(false);
                }
                else
                {
                    TargetGroup = NetObj.CommandHandling.PreviousGroup;
                }
            }
            else
            {
                if (Database.GroupDB.FindGroup(Command._CmdElements()[1]) == Database.GroupDB.NoGroup)
                {
                    NetObj.ClientObject.SendMessage("Group not found: \"" + Command._CmdElements()[1] + "\".");
                    return(false);
                }
                TargetGroup = Database.GroupDB.FindGroup(Command._CmdElements()[1]);
            }
            #endregion
            #region FindTargetRank
            if (Command._CmdArguments.Count() < 1)
            {
                NetObj.ClientObject.SendMessage("No rank specified to be added to the group.");
                return(false);
            }
            else
            {
                TargetRankName = Command._CmdArguments[1].ToUpperInvariant();
                if (TargetGroup.Ranks.Count() == 0)
                {
                }
                else if (TargetGroup.Ranks.Select(x => x.Name.ToUpperInvariant()).Contains(TargetRankName))
                {
                    NetObj.ClientObject.SendMessage("Rank: \"" + TargetRankName + "\" already exists in Group: \"" + TargetGroup.Name + "\".");
                    return(false);
                }
            }
            #endregion
            #region SuperUser Override
            if (NetObj.UserObject == Database.UserDB.SuperUser || NetObj.UserObject == TargetGroup.Founder)
            {
                //continue
            }
            #endregion
            #region Standard Testing
            if (NetObj.UserObject.Groups.Select(x => x.Group).Contains(TargetGroup))
            {
                //THIS User is a member of the group. (Required to be able to modify the group.
                Database.UserDB.User.GroupReference ThisGroupReference = NetObj.UserObject.Groups.Where(x => x.Group == TargetGroup).ToArray()[0];
                if (ThisGroupReference.Rank.Permissions.Group_ManageMembers <= 0)
                {
                    NetObj.ClientObject.SendMessage("Your rank does not have permission to manage group ranks in this group.");
                    return(false);
                }
                //continue
            }
            else
            {
                NetObj.ClientObject.SendMessage("You need to be a member of the group yourself in order to add ranks. (Group founders are excepted from this rule.)");
                return(false);
            }
            #endregion

            if (TargetGroup.Ranks.Select(x => x.Name).Contains(TargetRankName))
            {
                NetObj.ClientObject.SendMessage("Rank: \"" + TargetRankName + "\" is already in Group: \"" + TargetGroup.Name + "\".");
                return(false);
            }
            TargetGroup.NewRank(TargetRankName);
            TargetGroup.SaveAll();
            Server.EmptyClientList.Include(NetObj).SendMessage("You added a new Rank: \"" + TargetRankName + "\" to Group: \"" + TargetGroup.Name + "\".");
            Server.AllClients.Except(NetObj).SendMessage("New Rank: \"" + TargetRankName + "\" was added to Group: \"" + TargetGroup.Name + "\" by \"" + NetObj.UserObject.Name + "\".");
            return(true);
        }
Пример #4
0
        public static bool Orb_Command_Maintenence_Group_Users_Remove_Method(Server.NetObject NetObj, CommandReader Command)
        {
            Database.UserDB.User   TargetUser  = Database.UserDB.Nobody;
            Database.GroupDB.Group TargetGroup = Database.GroupDB.NoGroup;
            #region FindTargetUser
            if (Command._CmdArguments.Count() < 1)
            {
                NetObj.ClientObject.SendMessage("No user specified to change group ownership to.");
                return(false);
            }
            if (Command._CmdArguments[0] == "-")
            {
                if (NetObj.CommandHandling.PreviousUser == Database.UserDB.Nobody)
                {
                    NetObj.ClientObject.SendMessage("No previous users iterated over.");
                    return(false);
                }
                else
                {
                    TargetUser = NetObj.CommandHandling.PreviousUser;
                }
            }
            else
            {
                if (Database.UserDB.Find(Command._CmdArguments[0]) != Database.UserDB.Nobody)
                {
                    TargetUser = Database.UserDB.Find(Command._CmdArguments[0]);
                }
                else
                {
                    NetObj.ClientObject.SendMessage("User not found: \"" + Command._CmdArguments[0] + "\".");
                    return(false);
                }
            }
            #endregion
            #region FindTargetGroup
            if (Command._CmdElements()[1] == "-")
            {
                if (NetObj.CommandHandling.PreviousGroup == Database.GroupDB.NoGroup)
                {
                    NetObj.ClientObject.SendMessage("No previous groups iterated over.");
                    return(false);
                }
                else
                {
                    TargetGroup = NetObj.CommandHandling.PreviousGroup;
                }
            }
            else
            {
                if (Database.GroupDB.FindGroup(Command._CmdElements()[1]) == Database.GroupDB.NoGroup)
                {
                    NetObj.ClientObject.SendMessage("Group not found: \"" + Command._CmdElements()[1] + "\".");
                    return(false);
                }
                TargetGroup = Database.GroupDB.FindGroup(Command._CmdElements()[1]);
            }
            #endregion
            #region SuperUser Override
            if (NetObj.UserObject == Database.UserDB.SuperUser || NetObj.UserObject == TargetGroup.Founder)
            {
                //continue
            }
            #endregion
            #region Standard Testing
            else
            {
                if (NetObj.UserObject.Groups.Select(x => x.Group).Contains(TargetGroup))
                {
                    //THIS User is a member of the group. (Required to be able to modify the group.
                    Database.UserDB.User.GroupReference ThisGroupReference = NetObj.UserObject.Groups.Where(x => x.Group == TargetGroup).ToArray()[0];
                    if (ThisGroupReference.Rank.Permissions.Group_ManageMembers <= 0)
                    {
                        NetObj.ClientObject.SendMessage("Your rank does not have permission to manage group memebers in this group.");
                        return(false);
                    }
                    if (ThisGroupReference.Rank.Permissions.Group_DemoteableRank < 0) //<0 No Member.
                    {
                        NetObj.ClientObject.SendMessage("You are not able to remove members from the group as you do not have permission to demote to the lowest rank in the group.");
                        return(false);
                    }
                    //continue
                }
                else
                {
                    NetObj.ClientObject.SendMessage("You need to be a member of the group yourself in order to remove members. (Group founders are excepted from this rule.)");
                    return(false);
                }
            }
            #endregion

            if (TargetGroup.Leavable == false)
            {
                NetObj.ClientObject.SendMessage("Failed to remove User: \"" + TargetUser.Name + "\" from Group: \"" + TargetGroup.Name + "\". The Group is set to un-leaveable.");
                return(false);
            }
            if (!(TargetUser.Groups.Select(x => x.Group).Contains(TargetGroup)))
            {
                NetObj.ClientObject.SendMessage("User: \"" + TargetUser.Name + "\" is already not a member of Group: \"" + TargetGroup.Name + "\".");
                return(false);
            }
            TargetUser.RemoveFromGroup(TargetGroup);
            TargetUser.SaveAll();
            Server.EmptyClientList.Include(TargetUser).SendMessage("You were removed from Group: \"" + TargetGroup.Name + "\" by \"" + NetObj.UserObject.Name + "\".");
            Server.AllClients.Except(TargetUser).SendMessage("User: \"" + TargetUser.Name + "\" was removed from Group: \"" + TargetGroup.Name + "\" by \"" + NetObj.UserObject.Name + "\".");
            return(true);
        }
Пример #5
0
        public static bool Orb_Command_Maintenence_Group_Ranks_Decrement_Method(Server.NetObject NetObj, CommandReader Command)
        {
            string TargetRankName = "";

            Database.GroupDB.Group.Rank TargetRank  = Database.GroupDB.NoRank;
            Database.GroupDB.Group      TargetGroup = Database.GroupDB.NoGroup;
            #region FindTargetGroup
            if (Database.GroupDB.FindGroup(Command._CmdElements()[1]) == Database.GroupDB.NoGroup)
            {
                NetObj.ClientObject.SendMessage("Group not found: \"" + Command._CmdElements()[1] + "\".");
                return(false);
            }
            TargetGroup = Database.GroupDB.FindGroup(Command._CmdElements()[1]);
            #endregion
            #region FindTargetRank
            if (Command._CmdArguments.Count() < 1)
            {
                NetObj.ClientObject.SendMessage("No rank specified to be decremented in the group.");
                return(false);
            }
            else
            {
                TargetRankName = Command._CmdArguments[1].ToUpperInvariant();
                if (!(TargetGroup.Ranks.Select(x => x.Name.ToUpperInvariant()).Contains(TargetRankName)))
                {
                    NetObj.ClientObject.SendMessage("Rank: \"" + TargetRankName + "\" not found in Group: \"" + TargetGroup.Name + "\".");
                    return(false);
                }
                else
                {
                    TargetRank = TargetGroup.Ranks.First(x => x.Name.ToUpperInvariant() == TargetRankName);
                }
            }
            #endregion
            #region SuperUser Override
            if (NetObj.UserObject == Database.UserDB.SuperUser || NetObj.UserObject == TargetGroup.Founder)
            {
                //Continue
            }
            #endregion
            #region Standard Testing
            if (NetObj.UserObject.Groups.Select(x => x.Group).Contains(TargetGroup))
            {
                //THIS User is a member of the group. (Required to be able to modify the group.
                Database.UserDB.User.GroupReference ThisGroupReference = NetObj.UserObject.Groups.Where(x => x.Group == TargetGroup).ToArray()[0];
                if (ThisGroupReference.Rank.Permissions.Group_ManageMembers <= 0)
                {
                    NetObj.ClientObject.SendMessage("Your rank does not have permission to manage group ranks in this group.");
                    return(false);
                }
                //Continue
            }
            else
            {
                NetObj.ClientObject.SendMessage("You need to be a member of the group yourself in order to move ranks. (Group founders are excepted from this rule.)");
                return(false);
            }
            #endregion

            if (TargetGroup.Ranks.IndexOf(TargetRank) == 0)
            {
                NetObj.ClientObject.SendMessage("Unable to decrement Rank: \"" + TargetRank.Name + "\" in Group: \"" + TargetGroup.Name + "\" any lower. It is the lowest rank already.");
                return(false);
            }
            int CurrentPosition = TargetGroup.Ranks.IndexOf(TargetRank);
            int NextPosition    = CurrentPosition - 1;
            Database.GroupDB.Group.Rank SwapContainer = TargetGroup.Ranks[NextPosition];
            TargetGroup.Ranks[NextPosition]    = TargetRank;
            TargetGroup.Ranks[CurrentPosition] = SwapContainer;
            TargetGroup.SaveAll();
            Server.EmptyClientList.Include(NetObj).SendMessage("Rank: \"" + TargetRank.Name + "\" in Group: \"" + TargetGroup.Name + "\" decremented to position " + NextPosition.ToString() + ".");
            Server.AllClients.Except(NetObj).SendMessage("User: \"" + NetObj.UserObject.Name + "\" decremented Rank: \"" + TargetRank.Name + "\" in Group: \"" + TargetGroup.Name + "\" to position " + NextPosition.ToString() + ".");
            return(true);
        }
Пример #6
0
        public static bool Orb_Command_Moderation_User_Kick_Method(Server.NetObject NetObj, CommandReader Command)
        {
            Database.UserDB.User TargetUser = Database.UserDB.Nobody;
            string Reason = "";

            #region FindTargetUser
            if (Command._CmdElements()[1] == "-")
            {
                if (NetObj.CommandHandling.PreviousUser == Database.UserDB.Nobody)
                {
                    NetObj.ClientObject.SendMessage("No previous users iterated over.");
                    return(false);
                }
                else
                {
                    TargetUser = NetObj.CommandHandling.PreviousUser;
                }
            }
            else
            {
                if (Database.UserDB.Find(Command._CmdElements()[1]) != Database.UserDB.Nobody)
                {
                    TargetUser = Database.UserDB.Find(Command._CmdElements()[1]);
                }
                else
                {
                    NetObj.ClientObject.SendMessage("User not found: \"" + Command._CmdElements()[1] + "\".");
                    return(false);
                }
            }
            #endregion
            #region GetKickReason
            if (Command._CmdArguments.Count() < 1)
            {
                //Ban reason not given.
            }
            else
            {
                Reason = Command._CmdRawArguments;
            }
            #endregion
            #region SuperUser Override
            if (NetObj.UserObject == Database.UserDB.SuperUser || NetObj.UserObject.Can(Database.PermissionDB.Strings.Kick))
            {
                //continue
            }
            else
            {
                NetObj.ClientObject.SendMessage("You do not have permission to kick users from the server.");
                return(false);
            }
            #endregion

            if (TargetUser == NetObj.UserObject)
            {
                NetObj.ClientObject.SendMessage("You are not able to kick yourself!");
                return(false);
            }
            if (!Server.ClientList.Select(x => x.UserObject).Contains(TargetUser))
            {
                NetObj.ClientObject.SendMessage("User: \"" + TargetUser.Name + "\" is not online.");
                return(false);
            }
            TargetUser.TimesKicked++;
            TargetUser.KickedBy   = NetObj.UserObject;
            TargetUser.KickReason = Reason;
            TargetUser.SaveAll();
            Server.EmptyClientList.Include(TargetUser).SendMessage("&cYou have been KICKED by \"" + NetObj.UserObject.Name + "\".");
            Server.AllClients.Except(TargetUser).SendMessage("&cUser: \"" + TargetUser.Name + "\" was KICKED by \"" + NetObj.UserObject.Name + "\".");
            if (TargetUser.KickReason != "")
            {
                Server.AllClients.SendMessage("&cKick Reason: \"" + TargetUser.KickReason + "\".");
            }
            foreach (Server.NetObject ThisClient in Server.ClientList.Where(x => x.UserObject == TargetUser).ToArray())
            {
                ThisClient.Close(); //Kicks the target user.
            }
            return(true);
        }
Пример #7
0
        public static bool Orb_Command_Maintenence_Group_Users_Demote_Method(Server.NetObject NetObj, CommandReader Command)
        {
            Database.UserDB.User        TargetUser  = Database.UserDB.Nobody;
            Database.GroupDB.Group      TargetGroup = Database.GroupDB.NoGroup;
            Database.GroupDB.Group.Rank TargetRank  = Database.GroupDB.NoRank;
            Database.GroupDB.Group.Rank CurrentRank = Database.GroupDB.NoRank;
            int    CurrentRankInt;
            int    TargetRankInt;
            string Reason = "";

            #region FindTargetUser
            if (Command._CmdArguments.Count() < 1)
            {
                NetObj.ClientObject.SendMessage("No user specified to demote.");
                return(false);
            }
            if (Command._CmdArguments[0] == "-")
            {
                if (NetObj.CommandHandling.PreviousUser == Database.UserDB.Nobody)
                {
                    NetObj.ClientObject.SendMessage("No previous users iterated over.");
                    return(false);
                }
                else
                {
                    TargetUser = NetObj.CommandHandling.PreviousUser;
                }
            }
            else
            {
                if (Database.UserDB.Find(Command._CmdArguments[0]) != Database.UserDB.Nobody)
                {
                    TargetUser = Database.UserDB.Find(Command._CmdArguments[0]);
                }
                else
                {
                    NetObj.ClientObject.SendMessage("User not found: \"" + Command._CmdArguments[0] + "\".");
                    return(false);
                }
            }
            #endregion
            #region FindTargetGroup
            if (Command._CmdElements()[1] == "-")
            {
                if (NetObj.CommandHandling.PreviousGroup == Database.GroupDB.NoGroup)
                {
                    NetObj.ClientObject.SendMessage("No previous groups iterated over.");
                    return(false);
                }
                else
                {
                    TargetGroup = NetObj.CommandHandling.PreviousGroup;
                }
            }
            else
            {
                if (Database.GroupDB.FindGroup(Command._CmdElements()[1]) == Database.GroupDB.NoGroup)
                {
                    NetObj.ClientObject.SendMessage("Group not found: \"" + Command._CmdElements()[1] + "\".");
                    return(false);
                }
                TargetGroup = Database.GroupDB.FindGroup(Command._CmdElements()[1]);
            }
            #endregion
            #region TargetIsInGroup?
            if (!(TargetUser.Groups.Select(x => x.Group).Contains(TargetGroup)))
            {
                //User NOT in the group.
                NetObj.ClientObject.SendMessage("User \"" + TargetUser.Name + "\" is not a member of Group \"" + TargetGroup.Name + "\". They cannot be promoted without being a member first.");
                return(false);
            }
            CurrentRank    = TargetUser.Groups.First(x => x.Group == TargetGroup).Rank;
            CurrentRankInt = TargetGroup.Ranks.IndexOf(TargetUser.Groups.First(y => y.Group == TargetGroup).Rank);
            #endregion
            #region FindTargetRank
            if (Command._CmdArguments.Count() < 2)
            {
                //TargetUser.Groups.First(x => x.Group == TargetGroup).Group.Ranks.IndexOf(TargetUser.Groups.First(x => x.Group == TargetGroup).Rank); //USERS CURRENT RANK;
                //Logger.Console.WriteLine(CurrentRankInt.ToString());
                //Logger.Console.WriteLine((TargetUser.Groups.First(x => x.Group == TargetGroup).Group.Ranks.Count() - 1).ToString());

                if (CurrentRankInt <= 0)
                {
                    //Users current rank IS the lowest rank, cannot demote any lower.
                    TargetRank = Database.GroupDB.NoRank;
                    NetObj.ClientObject.SendMessage("User \"" + TargetUser.Name + "\" is already the lowest rank of Group \"" + TargetGroup.Name + "\". They cannot be demoted any lower.");
                    return(false);
                }
                else
                {
                    //There is a rank below this one, set that as the target.
                    TargetRank    = TargetUser.Groups.First(x => x.Group == TargetGroup).Group.Ranks[CurrentRankInt - 1];
                    TargetRankInt = CurrentRankInt - 1;
                }
            }
            else
            {
                if (TargetGroup.FindRank(Command._CmdArguments[1]) == Database.GroupDB.NoRank)
                {
                    NetObj.ClientObject.SendMessage("Rank \"" + Command._CmdArguments[1] + "\" not found in Group: \"" + TargetGroup.Name + "\".");
                    return(false);
                }
                TargetRank    = TargetGroup.FindRank(Command._CmdArguments[1]);
                TargetRankInt = TargetGroup.Ranks.IndexOf(TargetRank);
            }
            if (TargetRank == Database.GroupDB.NoRank)
            {
                NetObj.ClientObject.SendMessage("Rank \"" + Command._CmdArguments[1] + "\" not found in Group: \"" + TargetGroup.Name + "\".");
                return(false);
            }
            if (TargetRankInt > CurrentRankInt)
            {
                NetObj.ClientObject.SendMessage("Rank: \"" + TargetRank.Name + "\" is higher then Rank: \"" + CurrentRank.Name + "\" in Group: \"" + TargetGroup.Name + "\". Use the /Promote Command instead.");
                return(false);
            }
            #endregion
            #region RankReason?
            if (Command._CmdArguments.Count() >= 3)
            {
                Reason = Command._CmdRawArguments.Split(new string[] { " " }, 3, StringSplitOptions.None)[2];
            }
            #endregion
            #region SuperUser Override
            if (NetObj.UserObject == Database.UserDB.SuperUser || NetObj.UserObject == TargetGroup.Founder)
            {
                //continue
            }
            #endregion
            #region Standard Testing
            else
            {
                if (NetObj.UserObject.Groups.Select(x => x.Group).Contains(TargetGroup))
                {
                    //THIS User is a member of the group. (Required to be able to modify the group.
                    Database.UserDB.User.GroupReference ThisGroupReference = NetObj.UserObject.Groups.First(x => x.Group == TargetGroup);
                    if (ThisGroupReference.Rank.Permissions.Group_ManageMembers <= 0)
                    {
                        NetObj.ClientObject.SendMessage("Your rank does not have permission to manage group memebers in this group.");
                        return(false);
                    }
                    if (ThisGroupReference.Rank.Permissions.Group_DemoteableRank < 0)
                    {
                        NetObj.ClientObject.SendMessage("You are not able to demote members in the group as you do not have permission to demote from the lowest rank in the group.");
                        return(false);
                    }
                    if (ThisGroupReference.Rank.Permissions.Group_DemoteableRank < CurrentRankInt) //<0 No Member.
                    {
                        NetObj.ClientObject.SendMessage("You are not able to demote User: \"" + TargetUser.Name + "\" as your Rank: \"" + NetObj.UserObject.Groups.First(x => x.Group == TargetGroup).Rank.Name + "\" is unable to demote Rank: \"" + TargetRank.Name + "\" in Group: \"" + TargetGroup.Name + "\".");
                        return(false);
                    }
                    //continue
                }
                else
                {
                    NetObj.ClientObject.SendMessage("You need to be a member of the group yourself in order to demote members. (Group founders are excepted from this rule.)");
                    return(false);
                }
            }
            #endregion
            Orb_Command_Maintenence_Group_Users_Rank_Common_Method(NetObj, TargetUser, TargetGroup, TargetRank, Reason);
            return(true);
        }
Пример #8
0
        public static bool Orb_Command_Maintenence_Group_Ranks_Remove_Method(Server.NetObject NetObj, CommandReader Command)
        {
            Database.GroupDB.Group      TargetGroup = Database.GroupDB.NoGroup;
            Database.GroupDB.Group.Rank TargetRank  = Database.GroupDB.NoRank;
            string TargetRankName = "";

            #region FindTargetGroup
            if (Command._CmdElements()[1] == "-")
            {
                if (NetObj.CommandHandling.PreviousGroup == Database.GroupDB.NoGroup)
                {
                    NetObj.ClientObject.SendMessage("No previous groups iterated over.");
                    return(false);
                }
                else
                {
                    TargetGroup = NetObj.CommandHandling.PreviousGroup;
                }
            }
            else
            {
                if (Database.GroupDB.FindGroup(Command._CmdElements()[1]) == Database.GroupDB.NoGroup)
                {
                    NetObj.ClientObject.SendMessage("Group not found: \"" + Command._CmdElements()[1] + "\".");
                    return(false);
                }
                TargetGroup = Database.GroupDB.FindGroup(Command._CmdElements()[1]);
            }
            #endregion
            #region FindTargetRank
            if (Command._CmdArguments.Count() < 1)
            {
                NetObj.ClientObject.SendMessage("No rank specified to be removed from the group.");
                return(false);
            }
            else
            {
                if (TargetGroup.Ranks.Select(x => x.Name.ToUpperInvariant()).Contains(Command._CmdArguments[0].ToUpperInvariant()))
                {
                    TargetRank = TargetGroup.Ranks.First(x => x.Name.ToUpperInvariant() == Command._CmdArguments[0].ToUpperInvariant());
                }
                else
                {
                    NetObj.ClientObject.SendMessage("Rank not found: \"" + Command._CmdArguments[0] + "\".");
                    return(false);
                }
            }
            #endregion
            #region SuperUser Override
            if (NetObj.UserObject == Database.UserDB.SuperUser || NetObj.UserObject == TargetGroup.Founder)
            {
                //continue
            }
            #endregion
            #region Standard Testing
            if (NetObj.UserObject.Groups.Select(x => x.Group).Contains(TargetGroup))
            {
                //THIS User is a member of the group. (Required to be able to modify the group.
                Database.UserDB.User.GroupReference ThisGroupReference = NetObj.UserObject.Groups.Where(x => x.Group == TargetGroup).ToArray()[0];
                if (ThisGroupReference.Rank.Permissions.Group_ManageMembers <= 0)
                {
                    NetObj.ClientObject.SendMessage("Your rank does not have permission to manage group ranks in this group.");
                    return(false);
                }
                //continue
            }
            else
            {
                NetObj.ClientObject.SendMessage("You need to be a member of the group yourself in order to remove ranks. (Group founders are excepted from this rule.)");
                return(false);
            }
            #endregion

            TargetRankName = TargetRank.Name;
            if (!(TargetGroup.Ranks.Contains(TargetRank)))
            {
                NetObj.ClientObject.SendMessage("Rank: \"" + TargetRank.Name + "\" not found in Group: \"" + TargetGroup.Name + "\".");
                return(false);
            }
            NetObj.ClientObject.SendMessage("You are about to remove Rank: \"" + TargetRank.Name + "\" from Group: \"" + TargetGroup.Name + "\".");
            NetObj.ClientObject.SendMessage("THIS IS NOT REVERSABLE!");
            NetObj.ClientObject.SendMessage("Please confirm this action by typing \"/OK\".");
            if (!NetObj.GetCommandConfirmation(5000))
            {
                NetObj.ClientObject.SendMessage("No response, command cancelled.");
                return(false);
            }
            TargetGroup.RemoveRankFromGroup(TargetRank);
            TargetGroup.SaveAll();
            Server.EmptyClientList.Include(NetObj).SendMessage("You removed Rank: \"" + TargetRankName + "\" from Group: \"" + TargetGroup.Name + "\".");
            Server.AllClients.Except(NetObj).SendMessage("Rank: \"" + TargetRankName + "\" was removed from Group: \"" + TargetGroup.Name + "\" by \"" + NetObj.UserObject.Name + "\".");
            return(true);
        }
Пример #9
0
        public static bool Orb_Command_Information_Group_Info_Method(Server.NetObject NetObj, CommandReader Command)
        {
            Database.GroupDB.Group TargetGroup = Database.GroupDB.NoGroup;
            #region FindTargetGroup
            if (Command._CmdElements()[0].ToUpperInvariant() == "GROUP" || Command._CmdElements()[0].ToUpperInvariant() == "GROUPS")
            {
                //    /GROUP.*

                if (Database.GroupDB.FindGroup(Command._CmdElements()[1]) != Database.GroupDB.NoGroup)
                {
                    TargetGroup = Database.GroupDB.FindGroup(Command._CmdElements()[1]);
                }
                else
                {
                    NetObj.ClientObject.SendMessage("Group not found: \"" + Command._CmdElements()[1] + "\".");
                    return(false);
                }
            }
            else
            {
                //     /INFO *
                if (Command._CmdArguments.Count() < 1)
                {
                    TargetGroup = NetObj.UserObject.GroupRepresented;
                }
                else if (Command._CmdArguments[0] == "-")
                {
                    if (NetObj.CommandHandling.PreviousGroup == Database.GroupDB.NoGroup)
                    {
                        NetObj.ClientObject.SendMessage("No previous groups iterated over.");
                        return(false);
                    }
                    else
                    {
                        TargetGroup = NetObj.CommandHandling.PreviousGroup;
                    }
                }
                else
                {
                    if (Database.GroupDB.FindGroup(Command._CmdArguments[0]) != Database.GroupDB.NoGroup)
                    {
                        TargetGroup = Database.GroupDB.FindGroup(Command._CmdArguments[0]);
                    }
                    else
                    {
                        NetObj.ClientObject.SendMessage("Group not found: \"" + Command._CmdArguments[0] + "\".");
                        return(false);
                    }
                }
            }
            #endregion

            #region Info
            NetObj.ClientObject.SendMessage("&eAbout Group \"" + TargetGroup.Name + "\":");
            string[] CreationDate = Utilities.DateTimeUtilities.FormatDateTime(TargetGroup.DateCreated);
            string[] ModofiedDate = Utilities.DateTimeUtilities.FormatDateTime(TargetGroup.DateLastModified);
            NetObj.ClientObject.SendMessage("&e    Created:&f " + (CreationDate[2] + "/" + CreationDate[1] + "/" + CreationDate[0].Slice(2, 4)).SuffixLimit(15) + " " +
                                            "&eModified:&f " + (CreationDate[2] + "/" + CreationDate[1] + "/" + CreationDate[0].Slice(2, 4)).SuffixLimit(15) + " " +
                                            "&eMembers:&f " + Database.UserDB.List.Where(x => x.Groups.Select(y => y.Group).Contains(TargetGroup)).Count().ToString().SuffixLimit(15));

            NetObj.ClientObject.SendMessage("&e    Founder:&f " + TargetGroup.Founder.Name.Slice(0, 15).SuffixLimit(15) + " " +
                                            "&eJoinable:&f " + TargetGroup.Joinable.ToString().SuffixLimit(15) + " " +
                                            "&eLeavable:&f " + TargetGroup.Leavable.ToString().SuffixLimit(15));

            #region Ranks
            if (TargetGroup.Ranks.Count() > 12)
            {
                NetObj.ClientObject.SendMessage("&e    Contains " + TargetGroup.Ranks.Count() + " Ranks.");
            }
            else if (TargetGroup.Ranks.Count() > 0)
            {
                NetObj.ClientObject.SendMessage("&e");
                NetObj.ClientObject.SendMessage("&e    Ranks:");
                string output  = "";
                int    repeats = 0;
                foreach (Database.GroupDB.Group.Rank ThisRank in TargetGroup.Ranks)
                {
                    string shortrankname = ThisRank.Name;
                    if (shortrankname.Length > 7)
                    {
                        shortrankname = shortrankname.Substring(0, 7);
                    }
                    else
                    {
                        shortrankname = shortrankname + new string(' ', 7 - shortrankname.Length);
                    }

                    int    ThisCount  = Database.UserDB.List.Where(x => x.Groups.Select(y => y.Rank).Contains(ThisRank)).Count();
                    string ThisCount2 = ThisCount.ToString();
                    while (ThisCount2.Length < 2)
                    {
                        ThisCount2 = " " + ThisCount2;
                    }
                    if (ThisCount2.Length > 2)
                    {
                        ThisCount2 = ">99";
                    }
                    else
                    {
                        ThisCount2 = " " + ThisCount2;
                    }

                    if ((repeats + 1) < 3)
                    {
                        if (Database.UserDB.List.Where(x => x.Groups.Select(y => y.Group).Contains(TargetGroup)).Count() > 0)
                        {
                            output += "    &e" + ThisCount2 + "&f " + shortrankname;
                        }
                        else
                        {
                            output += "        " + shortrankname;
                        }

                        repeats++;
                    }
                    else
                    {
                        if (Database.UserDB.List.Where(x => x.Groups.Select(y => y.Group).Contains(TargetGroup)).Count() > 0)
                        {
                            output += "    &e" + ThisCount2 + "&f " + shortrankname;
                        }
                        else
                        {
                            output += "        " + shortrankname;
                        }

                        NetObj.ClientObject.SendMessage("&f" + output);
                        output  = "";
                        repeats = 0;
                    }
                }
                if (repeats > 0)
                {
                    NetObj.ClientObject.SendMessage("&f" + output);
                    output  = "";
                    repeats = 0;
                }
            }
            return(true);

            #endregion
            #endregion
        }
Пример #10
0
        public static bool Orb_Command_Moderation_User_UnMute_Method(Server.NetObject NetObj, CommandReader Command)
        {
            Database.UserDB.User TargetUser = Database.UserDB.Nobody;
            string Reason = "";

            #region FindTargetUser
            if (Command._CmdElements()[1] == "-")
            {
                if (NetObj.CommandHandling.PreviousUser == Database.UserDB.Nobody)
                {
                    NetObj.ClientObject.SendMessage("No previous users iterated over.");
                    return(false);
                }
                else
                {
                    TargetUser = NetObj.CommandHandling.PreviousUser;
                }
            }
            else
            {
                if (Database.UserDB.Find(Command._CmdElements()[1]) != Database.UserDB.Nobody)
                {
                    TargetUser = Database.UserDB.Find(Command._CmdElements()[1]);
                }
                else
                {
                    NetObj.ClientObject.SendMessage("User not found: \"" + Command._CmdElements()[1] + "\".");
                    return(false);
                }
            }
            #endregion
            #region GetMuteReason
            if (Command._CmdArguments.Count() < 1)
            {
                //Mute reason not given.
            }
            else
            {
                Reason = Command._CmdArguments[0];
            }
            #endregion
            #region SuperUser Override
            if (NetObj.UserObject == Database.UserDB.SuperUser || NetObj.UserObject.Can(Database.PermissionDB.Strings.Mute))
            {
                //continue
            }
            else
            {
                NetObj.ClientObject.SendMessage("You do not have permission to unmute users on the server.");
                return(false);
            }
            #endregion

            if (TargetUser == NetObj.UserObject)
            {
                NetObj.ClientObject.SendMessage("You are not able to unmute yourself!");
                return(false);
            }
            if (!TargetUser.Muted)
            {
                NetObj.ClientObject.SendMessage("User: \"" + TargetUser.Name + "\" is not muted.");
                return(false);
            }
            TargetUser.MuteExpires = new DateTime();
            TargetUser.Muted       = false;
            TargetUser.MutedBy     = NetObj.UserObject;
            TargetUser.MuteReason  = Reason;
            TargetUser.SaveAll();
            Server.EmptyClientList.Include(TargetUser).SendMessage("&eYou have been &aUNMUTED&e by \"" + NetObj.UserObject.Name + "\".");
            Server.AllClients.Except(TargetUser).SendMessage("&eUser: \"" + TargetUser.Name + "\" was &aUNMUTED&e by \"" + NetObj.UserObject.Name + "\".");
            if (TargetUser.MuteReason != "")
            {
                Server.AllClients.SendMessage("&aUnMute &eReason: \"" + TargetUser.MuteReason + "\".");
            }
            return(true);
        }
Пример #11
0
        public static bool Orb_Command_Moderation_User_Mute_Method(Server.NetObject NetObj, CommandReader Command)
        {
            Database.UserDB.User TargetUser = Database.UserDB.Nobody;
            DateTime             MuteEnds   = new DateTime();
            TimeSpan             Duration   = new TimeSpan();
            string Reason = "";

            #region FindTargetUser
            if (Command._CmdElements()[1] == "-")
            {
                if (NetObj.CommandHandling.PreviousUser == Database.UserDB.Nobody)
                {
                    NetObj.ClientObject.SendMessage("No previous users iterated over.");
                    return(false);
                }
                else
                {
                    TargetUser = NetObj.CommandHandling.PreviousUser;
                }
            }
            else
            {
                if (Database.UserDB.Find(Command._CmdElements()[1]) != Database.UserDB.Nobody)
                {
                    TargetUser = Database.UserDB.Find(Command._CmdElements()[1]);
                }
                else
                {
                    NetObj.ClientObject.SendMessage("User not found: \"" + Command._CmdElements()[1] + "\".");
                    return(false);
                }
            }
            #endregion
            #region GetMutexpiry
            if (Command._CmdArguments.Count() < 1)
            {
                //Mute is Permanent by default
            }
            else
            {
                if (Command._CmdArguments[0].ToUpperInvariant() == "INF" ||
                    Command._CmdArguments[0].ToUpperInvariant() == "INFINITE" ||
                    Command._CmdArguments[0].ToUpperInvariant() == "INFINITY" ||
                    Command._CmdArguments[0].ToUpperInvariant() == "0" ||
                    Command._CmdArguments[0].ToUpperInvariant() == "-" ||
                    Command._CmdArguments[0].ToUpperInvariant() == "FOREVER" ||
                    Command._CmdArguments[0].ToUpperInvariant() == "PERMANENT" ||
                    Command._CmdArguments[0].ToUpperInvariant() == "PERM" ||
                    Command._CmdArguments[0].ToUpperInvariant() == "!")
                {
                    //New Date Time == Permanent Mute.
                    //This is already set, we don't need to do anything.
                }
                else
                {
                    if (!Utilities.DateTimeUtilities.TryParseMiniTimespan(Command._CmdArguments[0], out Duration))
                    {
                        NetObj.ClientObject.SendMessage("Mute Duration Format Invalid. Acceptable Format/s: \"*w*d*h*m*s\" eg: \"1w2d5h3m2s\" or \"7w2m\" or even \"5s\".");
                        return(false);
                    }
                    MuteEnds = DateTime.Now + Duration;
                }
            }
            #endregion
            #region GetMuteReason
            if (Command._CmdArguments.Count() < 2)
            {
                //Mute reason not given.
            }
            else
            {
                Reason = Command._CmdRawArguments.Split(new string[] { " " }, 2, StringSplitOptions.None)[1];
            }
            #endregion
            #region SuperUser Override
            if (NetObj.UserObject == Database.UserDB.SuperUser || NetObj.UserObject.Can(Database.PermissionDB.Strings.Mute))
            {
                //continue
            }
            else
            {
                NetObj.ClientObject.SendMessage("You do not have permission to mute users on the server.");
                return(false);
            }
            #endregion

            if (DateTime.Now - TimeSpan.FromSeconds(30) > MuteEnds && MuteEnds != new DateTime())
            {
                NetObj.ClientObject.SendMessage("MuteTime is in the past! Unable to mute the target!");
                return(false);
            }
            if (TargetUser == NetObj.UserObject)
            {
                NetObj.ClientObject.SendMessage("You are not able to mute yourself!");
                return(false);
            }
            if (TargetUser.Muted)
            {
                NetObj.ClientObject.SendMessage("User: \"" + TargetUser.Name + "\" is already muted.");
                return(false);
            }
            TargetUser.TimesMuted++;
            TargetUser.MuteExpires = MuteEnds;
            TargetUser.Muted       = true;
            TargetUser.MutedBy     = NetObj.UserObject;
            TargetUser.MuteReason  = Reason;
            TargetUser.SaveAll();
            if (TargetUser.MuteExpires == new DateTime())
            {
                Server.EmptyClientList.Include(TargetUser).SendMessage("&cYou have been PERMANTENTLY MUTED by \"" + NetObj.UserObject.Name + "\".");
                Server.AllClients.Except(TargetUser).SendMessage("&cUser: \"" + TargetUser.Name + "\" was PERMANTENTLY MUTED by \"" + NetObj.UserObject.Name + "\".");
                if (TargetUser.MuteReason != "")
                {
                    Server.AllClients.SendMessage("&cMute Reason: \"" + TargetUser.MuteReason + "\".");
                }
            }
            else
            {
                Server.EmptyClientList.Include(TargetUser).SendMessage("&cYou have been MUTED by \"" + NetObj.UserObject.Name + "\" until " + Utilities.DateTimeUtilities.ToYearTimeDescending(Utilities.DateTimeUtilities.FormatDateTime(TargetUser.MuteExpires)) + ".");
                Server.AllClients.Except(TargetUser).SendMessage("&cUser: \"" + TargetUser.Name + "\" was MUTED by \"" + NetObj.UserObject.Name + "\" until " + Utilities.DateTimeUtilities.ToYearTimeDescending(Utilities.DateTimeUtilities.FormatDateTime(TargetUser.MuteExpires)) + ".");
                if (TargetUser.MuteReason != "")
                {
                    Server.AllClients.SendMessage("&cMute Reason: \"" + TargetUser.MuteReason + "\".");
                }
            }
            return(true);
        }
Пример #12
0
        public static bool Orb_Command_Information_User_Info_Method(Server.NetObject NetObj, CommandReader Command)
        {
            Database.UserDB.User TargetUser = Database.UserDB.Nobody;
            #region FindTargetUser
            if (Command._CmdElements()[0].ToUpperInvariant() == "/USER" | Command._CmdElements()[0].ToUpperInvariant() == "/USERS")
            {
                //    /USER.*

                if (Database.UserDB.Find(Command._CmdElements()[1]) != Database.UserDB.Nobody)
                {
                    TargetUser = Database.UserDB.Find(Command._CmdElements()[1]);
                }
                else
                {
                    NetObj.ClientObject.SendMessage("User not found: \"" + Command._CmdElements()[1] + "\".");
                    return(false);
                }
            }
            else
            {
                //     /INFO *
                if (Command._CmdArguments.Count() < 1)
                {
                    TargetUser = NetObj.UserObject;
                }
                else if (Command._CmdArguments[0] == "-")
                {
                    if (NetObj.CommandHandling.PreviousUser == Database.UserDB.Nobody)
                    {
                        NetObj.ClientObject.SendMessage("No previous users iterated over.");
                        return(false);
                    }
                    else
                    {
                        TargetUser = NetObj.CommandHandling.PreviousUser;
                    }
                }
                else
                {
                    if (Database.UserDB.Find(Command._CmdArguments[0]) != Database.UserDB.Nobody)
                    {
                        TargetUser = Database.UserDB.Find(Command._CmdArguments[0]);
                    }
                    else
                    {
                        NetObj.ClientObject.SendMessage("User not found: \"" + Command._CmdArguments[0] + "\".");
                        return(false);
                    }
                }
            }
            #endregion

            #region DummyObjects
            if (TargetUser == Database.UserDB.Nobody)
            {
                NetObj.ClientObject.SendMessage("This is the dummy object used to protect Orb from crashing when database links break.");
                return(true);
            }
            if (TargetUser == Database.UserDB.Connecting)
            {
                NetObj.ClientObject.SendMessage("This is the dummy object used to protect Orb from crashing when a user starts connecting.");
                return(true);
            }
            if (TargetUser == Database.UserDB.SuperUser)
            {
                NetObj.ClientObject.SendMessage("This is the dummy object used to represent the Orb Console.");
                return(true);
            }
            #endregion
            #region BasicInfo
            Server.NetObject.Client x = NetObj.ClientObject;
            string OnlineStatus       = "&cOFFLINE";
            if (Server.ClientList.Select(y => y.UserObject).Contains(TargetUser))
            {
                OnlineStatus = "&aONLINE";
            }

            string Status = "";
            if (TargetUser.IsMuted)
            {
                if (TargetUser.MuteExpires == new DateTime())
                {
                    Status = "&e[&cMUTED&e]";
                }
                else
                {
                    Status = "&e[&cMUTED UNTIL " + Utilities.DateTimeUtilities.ToYearTimeDescending(Utilities.DateTimeUtilities.FormatDateTime(TargetUser.MuteExpires)) + "&e]";
                }
            }
            if (TargetUser.IsBanned)
            {
                if (TargetUser.BanExpires == new DateTime())
                {
                    Status = "&e[&cBANNED&e].";
                }
                else
                {
                    Status = "&e[&cBANNED UNTIL " + Utilities.DateTimeUtilities.ToYearTimeDescending(Utilities.DateTimeUtilities.FormatDateTime(TargetUser.BanExpires)) + "&e]";
                }
            }
            if (OnlineStatus.EndsWith("ONLINE"))
            {
                x.SendMessage("&eAbout &f" + TargetUser.Name + "&e: " + OnlineStatus + " &e(Connected from " + TargetUser.LastIP.Mask() + ")." + Status);
            }
            else
            {
                x.SendMessage("&eAbout &f" + TargetUser.Name + "&e: " + OnlineStatus + " &e(Last connected from " + TargetUser.LastIP.Mask() + ")." + Status);
            }
            string[] JoinDate = Utilities.DateTimeUtilities.FormatDateTime(TargetUser.DateJoined);
            x.SendMessage("&e    JoinDate:  &f" + JoinDate[2] + "/" + JoinDate[1] + "/" + JoinDate[0].Slice(2, 4) + "         " +
                          "&e    Logins: &f" + TargetUser.LoginCount.To8BitString() + "");

            x.SendMessage("&e    Playtime:   &f" + Utilities.DateTimeUtilities.GetTotalHoursAs8BitStr(TargetUser.PlayTime) + "Hrs " +
                          "&e    FlightTime: &f" + Utilities.DateTimeUtilities.GetTotalHoursAs8BitStr(TargetUser.FlightHours) + "Hrs " +
                          "&e  TotalFlights: &f" + TargetUser.FlightsFlown.To8BitString());

            string KDR = "Perfect ";
            if (TargetUser.Deaths > 0)
            {
                KDR = "";
                KDR = (Math.Round((double)(TargetUser.Kills / TargetUser.Deaths), 3)).ToString();
                if (KDR.Length > 7)
                {
                    KDR = "Perfect ";
                }
            }
            // x.SendMessage("    TotalKills: " + TargetUser.Kills.To8BitString() + "    " +
            //                 "   TotalDeaths: " + TargetUser.Deaths.To8BitString() + "    " +
            //                 "    K:D Ratio:  " + KDR + "    ");

            //^^ NOT YET COMPLETE!
            #endregion
            #region Groups
            if (TargetUser.Groups.Count() > 12)
            {
                x.SendMessage("&e    Is a Member of " + TargetUser.Groups.Count() + " Groups.");
            }
            else if (TargetUser.Groups.Count() > 0)
            {
                x.SendMessage("&e");
                x.SendMessage("&e    Groups:");
                string output  = "";
                int    repeats = 0;
                foreach (Database.UserDB.User.GroupReference ThisGroupRef in TargetUser.Groups)
                {
                    string shortgroupname = ThisGroupRef.Group.Name;
                    if (shortgroupname.Length > 7)
                    {
                        shortgroupname = shortgroupname.Substring(0, 7);
                    }
                    else
                    {
                        shortgroupname = shortgroupname + new string(' ', 7 - shortgroupname.Length);
                    }
                    string shortgrouprank = ThisGroupRef.Rank.Name;
                    if (shortgrouprank.Length > 7)
                    {
                        shortgrouprank = shortgrouprank.Substring(0, 7);
                    }
                    else
                    {
                        shortgrouprank = shortgrouprank + new string(' ', 7 - shortgrouprank.Length);
                    }

                    if ((repeats + 1) < 3)
                    {
                        if (TargetUser.GroupRepresented == ThisGroupRef.Group)
                        {
                            output += "      &e*&f " + shortgroupname + " " + shortgrouprank + " ";
                        }
                        else
                        {
                            output += "        " + shortgroupname + " " + shortgrouprank + " ";
                        }

                        repeats++;
                    }
                    else
                    {
                        if (TargetUser.GroupRepresented == ThisGroupRef.Group)
                        {
                            output += "      &e*&f " + shortgroupname + " " + shortgrouprank + " ";
                        }
                        else
                        {
                            output += "        " + shortgroupname + " " + shortgrouprank + " ";
                        }

                        x.SendMessage("&f" + output);
                        output  = "";
                        repeats = 0;
                    }
                }
                if (repeats > 0)
                {
                    x.SendMessage("&f" + output);
                    output  = "";
                    repeats = 0;
                }
            }
            return(true);

            #endregion
        }
Пример #13
0
        public static bool Orb_Command_Maintenence_Group_Owner_Method(Server.NetObject NetObj, CommandReader Command)
        {
            Database.UserDB.User   TargetUser  = Database.UserDB.Nobody;
            Database.GroupDB.Group TargetGroup = Database.GroupDB.NoGroup;
            #region FindTargetUser
            if (Command._CmdArguments.Count() < 1)
            {
                NetObj.ClientObject.SendMessage("No user specified to change group ownership to.");
                return(false);
            }
            if (Command._CmdArguments[0] == "-")
            {
                if (NetObj.CommandHandling.PreviousUser == Database.UserDB.Nobody)
                {
                    NetObj.ClientObject.SendMessage("No previous users iterated over.");
                    return(false);
                }
                else
                {
                    TargetUser = NetObj.CommandHandling.PreviousUser;
                }
            }
            else
            {
                if (Database.UserDB.Find(Command._CmdArguments[0]) != Database.UserDB.Nobody)
                {
                    TargetUser = Database.UserDB.Find(Command._CmdArguments[0]);
                }
                else
                {
                    NetObj.ClientObject.SendMessage("User not found: \"" + Command._CmdArguments[0] + "\".");
                    return(false);
                }
            }
            #endregion
            #region FindTargetGroup
            if (Command._CmdElements()[1] == "-")
            {
                if (NetObj.CommandHandling.PreviousGroup == Database.GroupDB.NoGroup)
                {
                    NetObj.ClientObject.SendMessage("No previous groups iterated over.");
                    return(false);
                }
                else
                {
                    TargetGroup = NetObj.CommandHandling.PreviousGroup;
                }
            }
            else
            {
                if (Database.GroupDB.FindGroup(Command._CmdElements()[1]) == Database.GroupDB.NoGroup)
                {
                    NetObj.ClientObject.SendMessage("Group not found: \"" + Command._CmdElements()[1] + "\".");
                    return(false);
                }
                TargetGroup = Database.GroupDB.FindGroup(Command._CmdElements()[1]);
            }
            #endregion
            #region SuperUser Override
            if (NetObj.UserObject == Database.UserDB.SuperUser || NetObj.UserObject == TargetGroup.Founder)
            {
                //Continue.
            }
            #endregion
            #region Standard Testing
            else
            {
                NetObj.ClientObject.SendMessage("Only Group Owners are able to change ownership of the group. Please contact " + TargetGroup.Founder.Name + " if you wish to take over this group.");
                return(false);
            }
            #endregion

            if (NetObj.UserObject == TargetUser)
            {
                NetObj.ClientObject.SendMessage("You already ARE the founder of this group!");
                return(false);
            }
            else
            {
                NetObj.ClientObject.SendMessage("You are about to relinquish ownership of Group: \"" + TargetGroup.Name + "\" to \"" + TargetUser.Name + "\".");
                NetObj.ClientObject.SendMessage("THIS IS NOT REVERSABLE!");
                NetObj.ClientObject.SendMessage("Please confirm this action by typing \"/OK\".");
                if (!NetObj.GetCommandConfirmation(5000))
                {
                    NetObj.ClientObject.SendMessage("No response, command cancelled.");
                    return(false);
                }
            }
            TargetGroup.Founder = TargetUser;
            TargetGroup.SaveAll();
            NetObj.ClientObject.SendMessage("You have relinquished ownership of Group: \"" + TargetGroup.Name + "\" to \"" + TargetUser.Name + "\".");
            Server.EmptyClientList.Include(TargetUser).SendMessage("You have been assigned ownership of Group: \"" + TargetGroup.Name + "\" by \"" + NetObj.UserObject.Name + "\".");
            Server.AllClients.Except(TargetUser).SendMessage("User: \"" + TargetUser.Name + "\" was assigned ownership of Group: \"" + TargetGroup.Name + "\" by \"" + NetObj.UserObject.Name + "\".");
            return(true);
        }