Esempio n. 1
0
        static void ConsolePoolThread()
        {
            while (true)
            {
                // NO MATTER IF U TYPE BIC OQE?
                string cmd = Console.ReadLine().ToLower();

                if (cmd == "/close")
                {
                    sqlCon.con.Close();
                }

                // Logging
                if (cmd == "/logging")
                {
                    if (FilterMain.logging == true)
                    {
                        FilterMain.logging = false;
                        Console.WriteLine(FilterMain.FILTER + "Log-save system disabled");
                    }
                    else
                    {
                        FilterMain.logging = true;
                        Console.WriteLine(FilterMain.FILTER + "Log-save system enable");
                    }
                }

                // Ban list
                if (cmd == "/banlist")
                {
                    Console.WriteLine("");
                    int n = 0;
                    foreach (string ban_list in FilterMain.ban_list)
                    {
                        Console.WriteLine(ban_list);
                        n++;
                    }
                    Console.WriteLine("Total blocked ip count: {0}", n);
                }

                // Reload bans
                if (cmd == "/banreload")
                {
                    // Reload bans
                    Program.Reloadbans();
                }

                if (cmd == "/help")
                {
                    Console.Clear();
                    Console.WriteLine("Active commands");
                    Console.WriteLine("-----------------------------------------------------");
                    Console.WriteLine("/help - Print all the existing commands.");
                    Console.WriteLine("/clear - Resets the console.");
                    Console.WriteLine("/logging - Toggles the log-save of unknown packets (on/off)");
                    Console.WriteLine("/reload - Reloads config.cfg");
                    Console.WriteLine("/reloadip - Clears IP Limit");
                    Console.WriteLine("/reopcodes - Reload opcodes");
                    Console.WriteLine("/banreload - Reload bans");
                    Console.WriteLine("/banlist - Show all active IP bans");
                    Console.WriteLine("/hwid - Gets your computer Hardware ID");
                    Console.WriteLine("/hclear - Clears you prestored hwid list");
                    Console.WriteLine("/nospam - Will disable the message showing that new filter is out!");
                    Console.WriteLine("-----------------------------------------------------");

                    Console.WriteLine();
                    Console.WriteLine();

                    Console.WriteLine("Admin commands");
                    Console.WriteLine("-----------------------------------------------------");
                    Console.WriteLine("/notice Message - Will send a notice to everyone online.");
                    Console.WriteLine("/ban Username/Charname - Will IP ban the target.");
                    Console.WriteLine("/disconnect Username/Charname - Will disconnect the target.");
                    Console.WriteLine("-----------------------------------------------------");
                }

                if (cmd == "/clear")
                {
                    Console.Clear();
                }

                if (cmd == "/reload")
                {
                    // Clear console
                    Console.Clear();

                    // Load settings
                    Config.LoadEverything(false);
                    Config.LoadEverything(true);

                    // Load regions
                    Program.LoadRegions();

                    // Load skills
                    Program.BlockedSkills();

                    // Load insult list
                    Program.Insult();

                    // Load opcodes
                    Program.LoadOpcodes();
                }

                if (cmd == "/reloadip")
                {
                    // Clear console
                    Console.Clear();

                    // Clean IP list
                    FilterMain.ip_list.Clear();

                    // Inform?
                    Console.ForegroundColor = ConsoleColor.DarkCyan;
                    Console.WriteLine(FilterMain.FILTER + "IP limit resetted.");
                    Console.ResetColor();
                }

                if (cmd == "/nospam")
                {
                    // Inform?
                    Console.ForegroundColor = ConsoleColor.DarkCyan;
                    Console.WriteLine(FilterMain.FILTER + "I have now stopped the spam about updates, oqe?");
                    Console.ResetColor();

                    // Ignore the spam message.
                    FilterMain.Ignore = true;
                }

                // Send notice
                if (cmd.Contains("/notice"))
                {
                    // Check if there is a message
                    if (cmd.Contains(" "))
                    {
                        // Get the message
                        string message = cmd.Substring(cmd.IndexOf(' ') + 1);

                        // Agent 1
                        AgentContext.SendNoticeOnline(message);

                        // If agent 2?
                        if ((!FilterMain.AGENT_IP2.Equals("0")) && (FilterMain.AGENT_IP2 != String.Empty))
                        {
                            AgentContext2.SendNoticeOnline(message);
                        }

                        // Inform?
                        Console.ForegroundColor = ConsoleColor.DarkCyan;
                        Console.WriteLine(FilterMain.FILTER + "Notice sent to all online players!");
                        Console.ResetColor();
                    }
                }

                // Disconnect user
                if (cmd.Contains("/disconnect"))
                {
                    // Check if contains space
                    if (cmd.Contains(" "))
                    {
                        string username = cmd.Substring(cmd.IndexOf(' ') + 1);

                        // Agent 1
                        AgentContext.DisconnectUser(username);

                        // Agent 2
                        if ((!FilterMain.AGENT_IP2.Equals("0")) && (FilterMain.AGENT_IP2 != String.Empty))
                        {
                            AgentContext2.DisconnectUser(username);
                        }

                        // Inform
                        Console.ForegroundColor = ConsoleColor.DarkCyan;
                        Console.WriteLine(FilterMain.FILTER + "User has been disconnected from the server!");
                        Console.ResetColor();
                    }
                }

                // Ban user
                if (cmd.Contains("/ban"))
                {
                    // Check if contains space
                    if (cmd.Contains(" "))
                    {
                        string username = cmd.Substring(cmd.IndexOf(' ') + 1);

                        // Agent 1
                        AgentContext.BanUser(username);

                        // Agent 2
                        if ((!FilterMain.AGENT_IP2.Equals("0")) && (FilterMain.AGENT_IP2 != String.Empty))
                        {
                            AgentContext2.BanUser(username);
                        }

                        // Inform
                        Console.ForegroundColor = ConsoleColor.DarkCyan;
                        Console.WriteLine(FilterMain.FILTER + "User has been banned from the server!");
                        Console.ResetColor();
                    }
                }

                // Debug
                if (cmd.Contains("/whos"))
                {
                    AgentContext.WhosOnline();
                }

                // Load opcodes
                if (cmd.Contains("/reopcodes"))
                {
                    // Load opcodes
                    Program.LoadOpcodes();

                    // Inform
                    Console.ForegroundColor = ConsoleColor.DarkCyan;
                    Console.WriteLine(FilterMain.FILTER + "Opcodes was reloaded!");
                    Console.ResetColor();
                }
                Thread.Sleep(1);
            }
        }