Exemple #1
0
        private bool HandleCommand(string part, ChatWindow selectedTab)
        {
            var cmd = part.Substring(1).ToLower();
            switch(cmd)
            {
                case "me":
                    if (selectedTab == null)
                    {
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "No channel Selected."));
                        return false;
                    }
                    
                    var isTeam = selectedTab.Name == MessageType.Team.ToString();
                    Program.ChatServer.SendMessage(isTeam ? MessageType.Team : MessageType.Message, CommandType.Me, selectedTab.Name, ChatInput.Text.Substring(part.Length).Trim());
                    break;
                case "join":
                    JoinChannel(ChatInput.Text.Substring(part.Length).Trim());
                    break;
                case "leave":
                    if (selectedTab == null)
                    {
                        return false;
                    }
                    
                    if (selectedTab.IsPrivate)
                    {
                        ChannelTabs.TabPages.Remove(selectedTab);
                    }
                    else
                    {
                        LeaveChannel(selectedTab.Name);
                    }
                    
                    break;
                case "ping":
                    Program.ChatServer.SendPacket(DevServerPackets.Ping);
                    break;
                case "autoscroll":
                    Autoscroll = !Autoscroll;
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, (Autoscroll ? "AutoScroll Enabled." : "AutoScroll Disabled.")));
                    break;
                case "help":
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "-- Basic Commands --"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/me - Displays Username, and then your Message"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/join - Joins another channel"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/leave - Leaves the channel you're currently in"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/autoscroll - Enable/Disable autoscroll"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/ping - Ping the server"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/help - Displays the list you're reading now"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/uptime - Displays how long the server has been online"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/stats - Shows how many users are online, dueling, and how many duels"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/mute username hours - (Channel Owners/Admins) Prevents a user from sending any messages in a certain channel for a certain amount of hours."));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/unmute username - (Channel Owners/Admins) Allows a muted user to send messages again"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/setmotd message - (Channel Owners/Admins) Sets a message of the day that is sent to users when they join the channel."));

                    if(Program.UserInfo.rank == 1)
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, " -- Level 1 users are classed as helpers and don't need any extra commands"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/msg - Sends a server message"));
                    if (Program.UserInfo.rank > 2)
                    {
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "-- Mod Commands --"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/kick username reason - Kicks a user"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/msg - Sends a server message"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/smsg - Sends a server message that displays on the bottom of the launcher"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/getaccounts username - Gets a list of accounts for the the inputted username"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/cmute roomname - Mutes a room so that only admins can speak"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/cunmute roomname - Unmutes a room that was muted."));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/roomowner roomname - Gets the creator of a channel"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/killroom roomname - forces a chat channel to close"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/getuid username - Gets the UID of a username")); 
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/gmute username hours - Globally mutes a user for X hours. ( if hours is empty, it's 24hours )"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/gunmute username - Unmutes a user that was muted globally"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/info username - Gives info of an user."));
                    }
                    if (Program.UserInfo.rank > 3)
                    {
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "-- SMod Commands --"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/shutdown [forced]- instructs the duel server to shutdown. If 'forced' is added: Does not wait for games to finish."));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/restart [forced]- instructs the duel server to restart. If 'forced' is added: Does not wait for games to finish."));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/kill [forced]- Kills all crashed cores. If 'forced' is added: Kills all cores (including running games)."));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/ban username time reason - Bans a user, time format has to be in hours (max 1 hour), also you must give a reason."));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/banusername username - Bans a user's username"));

                    }

                    if (Program.UserInfo.rank == 99)
                    {
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "-- Dev Commands --"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/ban username time reason - Bans a user, time format has to be in hours, also you must give a reason."));              
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/unban username - Unbans a user"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/ip username - Gets a users IP"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/banip ip - Bans an IP"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/unbanip ip - Unbans IP"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/getbanlist - Gets ban list"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/op username level - Sets a users level"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/setmps number - Changes the messages per second"));
                    }

                    if (Program.UserInfo.teamRank >= 0 && Program.UserInfo.team != string.Empty)
                    {
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "-- Team Commands --"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/leaveteam - leaves the team"));
                    }

                    if (Program.UserInfo.teamRank >= 1)
                    {
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "-- Team User Level 1 Commands --"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/teamadd username - adds a user to the team"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/teamremove username - removes a user from the team"));
                    }

                    if (Program.UserInfo.teamRank == 99)
                    {
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "-- Team User Level 99 Commands --"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/teamdisband - disbands the team"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/teamop username level - promotes a user in the team"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/teamchangeleader username - changes the leader of a team"));
                    }
                    
                    break;
                case "teamdisband":
                    if (MessageBox.Show("Are you sure?", "Confirm team disband", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        Program.ChatServer.SendPacket(DevServerPackets.ChatCommand, JsonSerializer.SerializeToString(new PacketCommand { Command = cmd.ToUpper(), Data = ChatInput.Text.Substring(part.Length).Trim() }));
                    }
                    
                    break;
                case "setmotd":
                    Program.ChatServer.SendPacket(DevServerPackets.ChatCommand, JsonSerializer.SerializeToString(new PacketCommand { Command = cmd.ToUpper(), Data = ChatInput.Text.Substring(part.Length).Trim() + "|" + ChannelTabs.SelectedTab.Text }));
                    break;
                case "mute":
                case "unmute":
                    Program.ChatServer.SendPacket(DevServerPackets.ChatCommand, JsonSerializer.SerializeToString(new PacketCommand { Command = cmd.ToUpper(), Data = ChatInput.Text.Substring(part.Length).Trim() + "|" + ChannelTabs.SelectedTab.Text }));
                    break;
                case "info":
                    Program.ChatServer.SendPacket(DevServerPackets.ChatCommand, JsonSerializer.SerializeToString(new PacketCommand { Command = cmd.ToUpper(), Data = ChatInput.Text.Substring(part.Length).Trim() + "|" + ChannelTabs.SelectedTab.Text }));
                    break;
                default:
                    Program.ChatServer.SendPacket(DevServerPackets.ChatCommand, JsonSerializer.SerializeToString(new PacketCommand { Command = cmd.ToUpper(), Data = ChatInput.Text.Substring(part.Length).Trim() }));
                    break;
            }

            return true;
        }
Exemple #2
0
        private bool HandleCommand(string part, ChatWindow selectedTab)
        {
            var cmd = part.Substring(1).ToLower();
            switch(cmd)
            {
                case "me":
                    if (selectedTab == null)
                    {
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "No channel Selected."));
                        return false;
                    }

                    var isTeam = selectedTab.Name == MessageType.Team.ToString();
                    Program.ChatServer.SendMessage(isTeam ? MessageType.Team : MessageType.Message, CommandType.Me, selectedTab.Name, ChatInput.Text.Substring(part.Length).Trim());
                    break;
                case "join":
                    JoinChannel(ChatInput.Text.Substring(part.Length).Trim());
                    break;
                case "leave":
                    if (selectedTab == null)
                    {
                        return false;
                    }

                    if (selectedTab.IsPrivate)
                    {
                        ChannelTabs.TabPages.Remove(selectedTab);
                    }
                    else
                    {
                        LeaveChannel(selectedTab.Name);
                    }

                    break;
                case "users":
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "There's " + m_userData.Count + " users online."));
                    break;
                case "ping":
                    Program.ChatServer.SendPacket(DevServerPackets.Ping);
                    break;
                case "autoscroll":
                    Autoscroll = !Autoscroll;
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, (Autoscroll ? "AutoScroll Enabled." : "AutoScroll Disabled.")));
                    break;
                case "help":
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "-- Basic Commands --"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/admin - Get admin list"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/users - Get user count"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/me - Displays Username + Message"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/join - Join a other channel"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/leave - Leave the current channel"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/autoscroll - Enable/Disable autoscroll"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/ping - Ping the server"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/help - Displays this list your reading now"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/uptime - Displays how long the server has been online"));

                    if (Program.UserInfo.rank != 0)
                    {
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "-- Donator Commands --"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "[red][/red] [blue][/blue] [green][/green]- Color tags, wrap your text with them to change its color"));
                    }

                    if(Program.UserInfo.rank == 1)
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, " -- Level 1 users are classed as helpers and don't need any extra commands"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/msg - Send a server message"));

                    if (Program.UserInfo.rank > 1)
                    {
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "-- Level 2 Commands --"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/kick username reason - Kick a user"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/msg - Send a server message"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/mute - Prevents a user from talking"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/unmute - Allows a muted user to talk again"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/smsg - Sends a server message as a popup box"));
                    }

                    if (Program.UserInfo.rank > 2)
                    {
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "-- Level 3 Commands --"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/ban username reason - Ban a user"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/unban username - Unban a user"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/ip username - Get a users IP"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/banip ip - Ban a IP"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/unbanip ip - Unbans IP"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/getbanlist - Get ban list"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/roomowner roomname - Get the creator of a channel"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/killroom roomname - force a chat channel to close"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/getuid username - Gets the UID of a username"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/getuidaccounts uid - Gets the accnount names registered under the UID"));
                    }

                    if (Program.UserInfo.rank == 99)
                    {
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "-- Level 99 Commands --"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/op username level - Set a users level"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/addpoints amount of DevPoints - Give a user DevPoints"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/removepoints amount of DevPoints - Remove DevPoints from a user"));
                    }

                    if (Program.UserInfo.teamRank >= 0 && Program.UserInfo.team != string.Empty)
                    {
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "-- Team Commands --"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/leaveteam - leave the team"));
                    }

                    if (Program.UserInfo.teamRank >= 1)
                    {
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "-- Team User Level 1 Commands --"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/teamadd username - add a user to the team"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/teamremove username - remove a user from the team"));
                    }

                    if (Program.UserInfo.teamRank == 99)
                    {
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "-- Team User Level 99 Commands --"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/teamdisband - disbands the team"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/teamop username level - promote user in the team"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/teamchangeleader username - change the leader of a team"));
                    }

                    break;
                case "teamdisband":
                    if (MessageBox.Show("Are you sure?", "Confirm team disband", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        Program.ChatServer.SendPacket(DevServerPackets.ChatCommand, JsonSerializer.SerializeToString(new PacketCommand { Command = cmd.ToUpper(), Data = ChatInput.Text.Substring(part.Length).Trim() }));
                    }

                    break;
                case "admin":
                    string admins = string.Join(", ", m_userData.Where(x => x.Value.rank > 0).Select(x => x.Key));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "The following admins are online: " + admins + "."));
                    break;
                default:
                    Program.ChatServer.SendPacket(DevServerPackets.ChatCommand, JsonSerializer.SerializeToString(new PacketCommand { Command = cmd.ToUpper(), Data = ChatInput.Text.Substring(part.Length).Trim() }));
                    break;
            }

            return true;
        }
Exemple #3
0
        public void WriteMessage(ChatMessage message)
        {
            if (InvokeRequired)
            {
                Invoke(new Action<ChatMessage>(WriteMessage), message);
                return;
            }

            if(message.from != null && IgnoreUser(message.from))
            {
                return;
            }

            ChatWindow window;
            if ((MessageType)message.type == MessageType.Server || (MessageType)message.type == MessageType.System)
            {
                window = (ChatWindow)ChannelTabs.SelectedTab;
                if (window == null)
                {
                    window = new ChatWindow(((MessageType)message.type).ToString(), true) { IsSystemtab = true };
                    ChannelTabs.TabPages.Add(window);
                    window.WriteMessage(message, Autoscroll);
                }
                else window.WriteMessage(message, Autoscroll);
            }
            else if ((MessageType)message.type == MessageType.Join || (MessageType)message.type == MessageType.Leave || message.channel == null)
            {
                window = GetChatWindow(message.channel) ?? (ChatWindow)ChannelTabs.SelectedTab;
                if (window == null)
                {
                    window = new ChatWindow(message.type.ToString(CultureInfo.InvariantCulture), true) { IsSystemtab = true };
                    ChannelTabs.TabPages.Add(window);
                    window.WriteMessage(message, Autoscroll);
                }
                else window.WriteMessage(message, Autoscroll);
            }
            else if ((MessageType)message.type == MessageType.PrivateMessage && Program.Config.PmWindows)
            {
                if (m_pmWindows.ContainsKey(message.channel))
                {
                    m_pmWindows[message.channel].WriteMessage(message);
                }
                else
                {
                    m_pmWindows.Add(message.channel, new PmWindowFrm(message.channel, true));
                    m_pmWindows[message.channel].WriteMessage(message);
                    m_pmWindows[message.channel].Show();
                    m_pmWindows[message.channel].FormClosed += Chat_frm_FormClosed;
                }
            }
            else if ((MessageType)message.type == MessageType.Team)
            {
                window = GetChatWindow(((MessageType)message.type).ToString());
                if (window == null)
                {
                    window = new ChatWindow(((MessageType)message.type).ToString(), (MessageType)message.type == MessageType.PrivateMessage);
                    ChannelTabs.TabPages.Add(window);
                    window.WriteMessage(message, Autoscroll);
                }
                else window.WriteMessage(message, Autoscroll);
            }
            else
            {
                window = GetChatWindow(message.channel);
                if (window == null)
                {
                    window = new ChatWindow(message.channel, (MessageType)message.type == MessageType.PrivateMessage);
                    ChannelTabs.TabPages.Add(window);
                }

                window.WriteMessage(message, Autoscroll);
            }
        }
Exemple #4
0
        private bool HandleCommand(string part, ChatWindow selectedTab)
        {
            var cmd = part.Substring(1).ToLower();
            switch(cmd)
            {
                case "me":
                    if (selectedTab == null)
                    {
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "No channel Selected."));
                        return false;
                    }

                    var isTeam = selectedTab.Name == MessageType.Team.ToString();
                    Program.ChatServer.SendMessage(isTeam ? MessageType.Team : MessageType.Message, CommandType.Me, selectedTab.Name, ChatInput.Text.Substring(part.Length).Trim());
                    break;
                case "join":
                    JoinChannel(ChatInput.Text.Substring(part.Length).Trim());
                    break;
                case "leave":
                    if (selectedTab == null)
                    {
                        return false;
                    }

                    if (selectedTab.IsPrivate)
                    {
                        ChannelTabs.TabPages.Remove(selectedTab);
                    }
                    else
                    {
                        LeaveChannel(selectedTab.Name);
                    }

                    break;
                case "users":
                    //WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "There's " + m_userData.Count + " users online."));
                    break;
                case "ping":
                    Program.ChatServer.SendPacket(DevServerPackets.Ping);
                    break;
                case "autoscroll":
                    Autoscroll = !Autoscroll;
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, (Autoscroll ? "AutoScroll Enabled." : "AutoScroll Disabled.")));
                    break;
                case "help":
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "-- Basic Commands --"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/me - Displays Username, and then your Message"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/join - Joins another channel"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/leave - Leaves the channel you're currently in"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/autoscroll - Enable/Disable autoscroll"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/ping - Ping the server"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/help - Displays the list you're reading now"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/uptime - Displays how long the server has been online"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/stats - Shows how many users are online, dueling, and how many duels"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/mute username - (Channel Owners/Admins) Prevents a user from sending any messages in a certain channel."));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/unmute username - (Channel Owners/Admins) Allows a muted user to send messages again"));
                    WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/setmotd message - (Channel Owners/Admins) Sets a message of the day that is sent to users when they join the channel."));

                    if (Program.UserInfo.rank != 0)
                    {
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "-- Donator Commands --"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "None at this moment"));
                    }

                    if(Program.UserInfo.rank == 1)
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, " -- Level 1 users are classed as helpers and don't need any extra commands"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/msg - Sends a server message"));

                    if (Program.UserInfo.rank > 1)
                    {
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "-- Level 2 Commands --"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/kick username reason - Kicks a user"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/msg - Sends a server message"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/smsg - Sends a server message that displays on the bottom of the launcher"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/getaccounts username - Gets a list of accounts for the the inputted username"));
                    }

                    if (Program.UserInfo.rank > 2)
                    {
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "-- Level 3 Commands --"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/ban username time reason - Bans a user, time format has to be in hours, also you must give a reason."));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/banusername username - Bans a user's account"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/unban username - Unbans a user"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/ip username - Gets a users IP"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/banip ip - Bans an IP"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/unbanip ip - Unbans IP"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/getbanlist - Gets ban list"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/roomowner roomname - Gets the creator of a channel"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/killroom roomname - forces a chat channel to close"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/getuid username - Gets the UID of a username"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/getuidaccounts uid - Gets the account names registered under the UID"));
                    }

                    if (Program.UserInfo.rank == 99)
                    {
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "-- Level 99 Commands --"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/op username level - Sets a users level"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/addpoints amount of DevPoints - Gives a user DevPoints"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/removepoints amount of DevPoints - Removes DevPoints from a user"));
                    }

                    if (Program.UserInfo.teamRank >= 0 && Program.UserInfo.team != string.Empty)
                    {
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "-- Team Commands --"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/leaveteam - leaves the team"));
                    }

                    if (Program.UserInfo.teamRank >= 1)
                    {
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "-- Team User Level 1 Commands --"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/teamadd username - adds a user to the team"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/teamremove username - removes a user from the team"));
                    }

                    if (Program.UserInfo.teamRank == 99)
                    {
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "-- Team User Level 99 Commands --"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/teamdisband - disbands the team"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/teamop username level - promotes a user in the team"));
                        WriteMessage(new ChatMessage(MessageType.System, CommandType.None, null, "/teamchangeleader username - changes the leader of a team"));
                    }

                    break;
                case "teamdisband":
                    if (MessageBox.Show("Are you sure?", "Confirm team disband", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        Program.ChatServer.SendPacket(DevServerPackets.ChatCommand, JsonSerializer.SerializeToString(new PacketCommand { Command = cmd.ToUpper(), Data = ChatInput.Text.Substring(part.Length).Trim() }));
                    }

                    break;
                case "setmotd":
                    Program.ChatServer.SendPacket(DevServerPackets.ChatCommand, JsonSerializer.SerializeToString(new PacketCommand { Command = cmd.ToUpper(), Data = ChatInput.Text.Substring(part.Length).Trim() + "|" + ChannelTabs.SelectedTab.Text }));
                    break;
                case "mute":
                case "unmute":
                    Program.ChatServer.SendPacket(DevServerPackets.ChatCommand, JsonSerializer.SerializeToString(new PacketCommand { Command = cmd.ToUpper(), Data = ChatInput.Text.Substring(part.Length).Trim() + "|" + ChannelTabs.SelectedTab.Text }));
                    break;
                default:
                    Program.ChatServer.SendPacket(DevServerPackets.ChatCommand, JsonSerializer.SerializeToString(new PacketCommand { Command = cmd.ToUpper(), Data = ChatInput.Text.Substring(part.Length).Trim() }));
                    break;
            }

            return true;
        }