Ejemplo n.º 1
0
 public static void Restart_OnCommand(KonsoleCommandEventArgs e)
 {
     if (e.Arguments.Length > 0)
     {
         string arg = e.Arguments[0].ToString();
         if (HelperTools.IsNumeric(arg))
         {
             string bcMsg = string.Format("Restarting in {0} {1}", arg, int.Parse(arg) > 1 ? "minutes" : "minute");
             Console.WriteLine(bcMsg);
             HelperTools.BroadcastToAll(bcMsg);
             World.Restart(int.Parse(arg));
         }
         else
         {
             Console.WriteLine("Restart requires a numeric value as parameter.");
             return;
         }
     }
     else
     {
         Console.Write("Restarting now");
         HelperTools.BroadcastToAll("Server is restarting now");
         World.Restart(0);
     }
 }
Ejemplo n.º 2
0
        public static void CreateAccount_OnCommand(KonsoleCommandEventArgs e)
        {
            Console.Write("Input account name: ");
            string name = Console.ReadLine();

            if (HelperTools.AccExists(name))
            {
                Console.WriteLine("This name already exists, try another..");
                return;
            }
            Console.Write("Input account password: "******"Input account plevel (0-player, 1-gm, 2-admin): ");
            string       splevel = Console.ReadLine();
            AccessLevels plevel  = AccessLevels.PlayerLevel;

            switch (splevel)
            {
            case "2": { plevel = AccessLevels.Admin; break; }

            case "1": { plevel = AccessLevels.GM; break; }

            default:  { plevel = AccessLevels.PlayerLevel; break; }
            }
            World.allAccounts.Add(new Account(name, pass, plevel));
            Console.WriteLine("Account: \"{0}\", pass: \"{1}\", plevel: \"{2}\" created", name, pass, plevel);
        }
Ejemplo n.º 3
0
 public static void Info_OnCommand(KonsoleCommandEventArgs e)
 {
     try
     {
         Process[] list = Process.GetProcessesByName("WowwoW");
         foreach (Process p in list)
         {
             Console.WriteLine("\n--------=[( Usage Information )]=--------");
             Console.WriteLine("> Handles total:\t{0}", p.HandleCount);
             Console.WriteLine("> Threads total:\t{0}", p.Threads.Count);
             Console.WriteLine("> Physical Memory:\t{0}", p.WorkingSet / 1024 + "k");
             Console.WriteLine("> Peak Physical Memory:\t{0}", p.PeakWorkingSet / 1024 + "k");
             Console.WriteLine("> Virtual Memory:\t{0}", p.VirtualMemorySize / 1024 + "k");
             Console.WriteLine("> Peak Virtual Memory:\t{0}", p.PeakVirtualMemorySize / 1024 + "k");
             Console.WriteLine("> NonPaged Memory:\t{0}", p.NonpagedSystemMemorySize / 1024 + "k");
             Console.WriteLine("> Paged Memory:\t\t{0}", p.PagedMemorySize / 1024 + "k");
             Console.WriteLine("> Private Memory: \t{0}", p.PrivateMemorySize / 1024 + "k");
             Console.WriteLine("> Total Processor Time:\t{0}", p.TotalProcessorTime);
             Console.WriteLine("> User Processor Time:\t{0}", p.UserProcessorTime);
             Console.WriteLine("--------=========================--------\n");
         }
     }
     catch
     {
         Console.WriteLine("Could not find 'WoWWoW' process");
     }
 }
Ejemplo n.º 4
0
 public static void Test_OnCommand(KonsoleCommandEventArgs e)
 {
     Console.WriteLine("LEN: " + e.Length + " TEXT: " + e.ArgString + " ARGS: " + e.Arguments.Length);
     for (int i = 0; i < e.Length; ++i)
     {
         Console.WriteLine("ARG: " + e.Arguments[i]);
     }
 }
Ejemplo n.º 5
0
        private static void SaveRestart_OnCommand(KonsoleCommandEventArgs e)
        {
            Console.Write("Saving...");
            World.Save();
            Console.WriteLine("done");

            Restart_OnCommand(e);
        }
Ejemplo n.º 6
0
 public static void Status_OnCommand(KonsoleCommandEventArgs e)
 {
     Console.WriteLine("\n--------=[( Statistics )]=--------");
     Console.WriteLine("> Accounts:{0}\t", World.allAccounts.Count);
     Console.WriteLine("> Characters:{0}\t", World.allConnectedChars.Count);
     Console.WriteLine("> GameObjects:{0}\t", World.allGameObjects.Count);
     Console.WriteLine("> Mobiles:{0}\t", World.allMobiles.Count);
     Console.WriteLine("--------==================--------\n");
 }
Ejemplo n.º 7
0
 public static void AccountList_OnCommand(KonsoleCommandEventArgs e)
 {
     Console.WriteLine("Account list:");
     foreach (Account a in World.allAccounts)
     {
         Console.WriteLine("\t\"{0}\"", a.Username);
     }
     Console.WriteLine("Total: {0} accounts.", World.allAccounts.Count);
 }
Ejemplo n.º 8
0
        public static void Shutdown_OnCommand(KonsoleCommandEventArgs e)
        {
            Thread.CurrentThread.Priority = ThreadPriority.Highest;
            Console.WriteLine("Shutdown...");
            Process proc = Process.GetCurrentProcess();

            if (MainConsole.sw1 != null)
            {
                MainConsole.sw1.Flush();
            }
            proc.Kill();
        }
Ejemplo n.º 9
0
 public static void Broadcast_OnCommand(KonsoleCommandEventArgs e)
 {
     if (e.Arguments.Length > 0)
     {
         string arg = e.Arguments[0].ToString();
         HelperTools.BroadcastToAll(arg);
         Console.WriteLine("Broadcast complete.");
     }
     else
     {
         Console.WriteLine("Usage: Broadcast <text>");
     }
 }
Ejemplo n.º 10
0
        public static void Help_OnCommand(KonsoleCommandEventArgs e)
        {
            try
            {
                if (e.Length > 0 && e.Arguments[0].ToUpper() != "ALL")
                {
                    KonsoleCommandEntry c = (KonsoleCommandEntry)Server.Konsole.KonsoleCommands.Commands[e.Arguments[0]];
                    if (c == null)
                    {
                        Console.WriteLine("\nType 'help all' for a list of commands or help <command>");
                        return;
                    }
                    else
                    {
                        HelpHeader();
                        ShowCommandInfo(c, null);
                        HelpFooter();
                    }
                }
                else if (e.Length > 0 && e.Arguments[0].ToUpper() == "ALL")
                {
                    HelpHeader();
                    ArrayList list = new ArrayList(Server.Konsole.KonsoleCommands.Commands.Values);
                    Clean(list);

                    foreach (CategoryAttribute cat in categories)
                    {
                        Console.WriteLine("|=- {0} -=|", cat.Category);
                        foreach (KonsoleCommandEntry c in list)
                        {
                            ShowCommandInfo(c, cat);
                        }
                        Console.WriteLine("|");
                    }

                    HelpFooter();
                }
                else
                {
                    Console.WriteLine("\nType 'help all' for a list of commands or help <command>");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message, "\r\n", ex.StackTrace);
            }
        }
Ejemplo n.º 11
0
        public static void Jail_OnCommand(KonsoleCommandEventArgs e)
        {
            if (e.Arguments.Length != 4)
            {
                ShowJailUsage();
                return;
            }

            if (HelperTools.IsNumeric(e.Arguments[1]) &&
                HelperTools.IsNumeric(e.Arguments[2]) &&
                HelperTools.IsNumeric(e.Arguments[3]))
            {
                //Validate player exists
                Character player = GetCharacterByName(e.Arguments[0]);
                if (player == null)
                {
                    Console.WriteLine("Could not find a character with the name: ", e.Arguments[0]);
                    ShowJailUsage();
                    return;
                }

                Jail.JailCharacter(player, int.Parse(e.Arguments[1]), int.Parse(e.Arguments[2]), int.Parse(e.Arguments[3]));
                Console.WriteLine(player.Name, " has been jailed!");

                //Some fun
                //HelperTools.BroadcastToAll("Admin is on a rampage! ", e.Arguments[0], " has been jailed!");

                if (player.Logged)
                {
                    player.SendMessage("You have been jailed!");
                }
            }
            else
            {
                Console.WriteLine("<d> <h> <m> parameters must be numeric");
                ShowJailUsage();
                return;
            }
        }
Ejemplo n.º 12
0
        public static void SetPLevel_OnCommand(KonsoleCommandEventArgs e)
        {
            Console.Write("Input acc name: ");

            string acc = Console.ReadLine();

            if (acc.Length <= 0)
            {
                return;
            }

            Account a = HelperTools.GetAccByName(acc);

            if (a == null)
            {
                return;
            }
            Console.WriteLine("Current plevel: {0}", a.AccessLevel);
            Console.Write("Input account plevel (0-player, 1-gm, 2-admin): ");

            string plevel = Console.ReadLine();

            if (plevel.Length <= 0)
            {
                return;
            }

            switch (plevel)
            {
            case "2": a.AccessLevel = AccessLevels.Admin; break;

            case "1": a.AccessLevel = AccessLevels.GM; break;

            default: a.AccessLevel = AccessLevels.PlayerLevel; break;
            }
            Console.WriteLine("User: \"{0}\"; plevel: \"{1}\"", a.Username, a.AccessLevel);
        }
Ejemplo n.º 13
0
 public static void Save_OnCommand(KonsoleCommandEventArgs e)
 {
     Console.Write("Saving...");
     World.Save();
     Console.WriteLine("done");
 }