|
|
case "restart":
{
Program.CommandsAI("@restart");
break;
}
case "@restart":
{
try
{
Kernel.SendWorldMessage(new Network.GamePackets.Message(string.Concat(new object[] { "Server Will Be Restart Now !" }), System.Drawing.Color.White, 0x7db), Program.Values);
CommandsAI("@save");
new Database.MySqlCommand(Database.MySqlCommandType.UPDATE).Update("configuration").Set("ItemUID", ConquerItem.ItemUID.Now).Where("Server", Constants.ServerName).Execute();
var WC = Program.Values.ToArray();
foreach (Client.GameState client in WC)
{
client.Send(" Server Will Be Restart Now ");
client.Disconnect();
}
/*GameServer.Disable();
for (int i = 0; i < AuthServer.Length; i++)
{
AuthServer[i].Disable();
}*/
if (GuildWar.IsWar)
GuildWar.End();
new Database.MySqlCommand(Database.MySqlCommandType.UPDATE).Update("configuration").Set("ItemUID", ConquerItem.ItemUID.Now).Where("Server", Constants.ServerName).Execute();
Application.Restart();
Environment.Exit(0);
}
catch (Exception e)
{
Console.WriteLine(e);
Console.ReadLine();
}
}
break;
public static void CommandsAI(string command)
{
try
{
if (command == null)
return;
string[] data = command.Split(' ');
switch (data[0])
{
case "@testmode":
{
if (TestingMode)
{
TestingMode = false;
Console.WriteLine("Test Mode Off");
}
else
{
TestingMode = true;
Kernel.SendWorldMessage(new Network.GamePackets.Message(string.Concat(new object[] { "Server will exit for 5 min to fix some bugs, please be paitent" }), System.Drawing.Color.White, 0x7db), Program.Values);
CommandsAI("@save");
new Database.MySqlCommand(Database.MySqlCommandType.UPDATE).Update("configuration").Set("ItemUID", ConquerItem.ItemUID.Now).Where("Server", Constants.ServerName).Execute();
Database.EntityVariableTable.Save(0, Vars);
var WC = Program.Values.ToArray();
foreach (Client.GameState client in WC)
{
if (client.Account.State != AccountTable.AccountState.ProjectManager)
{
client.Send("Server will exit for 5 min to fix some bugs, please be paitent !");
client.Disconnect();
}
}
if (GuildWar.IsWar)
GuildWar.End();
new Database.MySqlCommand(Database.MySqlCommandType.UPDATE).Update("configuration").Set("ItemUID", ConquerItem.ItemUID.Now).Where("Server", Constants.ServerName).Execute();
Console.WriteLine("Test Mode On");
}
break;
}
case "@clear1": //شفرة
{
Program.Clear();
Console.WriteLine("Consle Clear + Memory Optimizeed!!");
break;
}
case "@reloadnpc":
{
World.ScriptEngine.Check_Updates();
Console.WriteLine("New System's Npc Reloaded.");
break;
}
case "@char":
case "@cp":
{
Controlpanel cp = new Controlpanel();
cp.ShowDialog();
break;
}
case "@clear":
{
Console.Clear();
Mr_Panda.Console.WriteLine("Consle and program Cleared ");
break;
}
case "@rankload":
{
Database.NobilityTable.Load();
break;
}
case "@Copra":
case "@bigbos":
Mr_Panda.Console.WriteLine("Server will restart after 10 minutes.");
Kernel.SendWorldMessage(new Mr_Panda.Network.GamePackets.Message("The server will be brought down for maintenance in 5 minute, Please exit the game now.", System.Drawing.Color.Orange, 0x7db), Program.Values);
System.Threading.Thread.Sleep(0x7530);
Kernel.SendWorldMessage(new Mr_Panda.Network.GamePackets.Message("The server will be brought down for maintenance in 4 minute 30 second, Please exit the game now.", System.Drawing.Color.Orange, 0x7db), Program.Values);
System.Threading.Thread.Sleep(0x7530);
Kernel.SendWorldMessage(new Mr_Panda.Network.GamePackets.Message("The server will be brought down for maintenance in 4 minute, Please exit the game now.", System.Drawing.Color.Orange, 0x7db), Program.Values);
System.Threading.Thread.Sleep(0x7530);
Kernel.SendWorldMessage(new Mr_Panda.Network.GamePackets.Message("The server will be brought down for maintenance in 3 minute 30 second, Please exit the game now.", System.Drawing.Color.Orange, 0x7db), Program.Values);
System.Threading.Thread.Sleep(0x7530);
Kernel.SendWorldMessage(new Mr_Panda.Network.GamePackets.Message("The server will be brought down for maintenance in 3 minute, Please exit the game now.", System.Drawing.Color.Orange, 0x7db), Program.Values);
System.Threading.Thread.Sleep(0x7530);
Kernel.SendWorldMessage(new Mr_Panda.Network.GamePackets.Message("The server will be brought down for maintenance in 2 minute 30 second, Please exit the game now.", System.Drawing.Color.Orange, 0x7db), Program.Values);
System.Threading.Thread.Sleep(0x7530);
Kernel.SendWorldMessage(new Mr_Panda.Network.GamePackets.Message("The server will be brought down for maintenance in 2 minute, Please exit the game now.", System.Drawing.Color.Orange, 0x7db), Program.Values);
System.Threading.Thread.Sleep(0x7530);
Kernel.SendWorldMessage(new Mr_Panda.Network.GamePackets.Message("The server will be brought down for maintenance in 1 minute 30 second, Please exit the game now.", System.Drawing.Color.Orange, 0x7db), Program.Values);
System.Threading.Thread.Sleep(0x7530);
Kernel.SendWorldMessage(new Mr_Panda.Network.GamePackets.Message("The server will be brought down for maintenance in 1 minute, Please exit the game now.", System.Drawing.Color.Orange, 0x7db), Program.Values);
System.Threading.Thread.Sleep(0x7530);
Kernel.SendWorldMessage(new Mr_Panda.Network.GamePackets.Message("The server will be brought down for maintenance in 30 second, Please exit the game now.", System.Drawing.Color.Orange, 0x7db), Program.Values);
Mr_Panda.Console.WriteLine("Server will exit after 1 minute.");
CommandsAI("@save");
System.Threading.Thread.Sleep(0x7530);
Kernel.SendWorldMessage(new Mr_Panda.Network.GamePackets.Message("The Server restarted, Please log in after 5 minutes ", System.Drawing.Color.Orange, 0x7db), Program.Values);
try
{
CommandsAI("@restart");
}
catch
{
Mr_Panda.Console.WriteLine("Server cannot exit");
}
break;
case "@flushbans":
{
Database.IPBan.Load();
break;
}
case "@Alivetime":
{
DateTime now = DateTime.Now;
TimeSpan t2 = new TimeSpan(StartDate.ToBinary());
TimeSpan t1 = new TimeSpan(now.ToBinary());
Console.WriteLine("The server has been online " + (int)(t1.TotalHours - t2.TotalHours) + " hours, " + (int)((t1.TotalMinutes - t2.TotalMinutes) % 1) + " minutes.");
break;
}
case "@online":
{
Console.WriteLine("Online Entitys count: " + Kernel.GamePool.Count);
string line = "";
foreach (Client.GameState pClient in Program.Values)
line += pClient.Player.Name + ",";
if (line != "")
{
line = line.Remove(line.Length - 1);
Console.WriteLine("Entitys: " + line);
}
break;
}
case "@memoryusage":
{
var proc = System.Diagnostics.Process.GetCurrentProcess();
Console.WriteLine("Thread count: " + proc.Threads.Count);
Console.WriteLine("Memory set(MB): " + ((double)((double)proc.WorkingSet64 / 1024)) / 1024);
proc.Close();
break;
}
case "@PlayerCap":
{
try
{
PlayerCap = int.Parse(data[1]);
}
catch
{
}
break;
}
case "@skill":
{
Game.Features.Tournaments.TeamElitePk.SkillTeamTournament.Open();
foreach (var clien in Kernel.GamePool.Values)
{
if (clien.Team == null)
clien.Team = new Game.ConquerStructures.Team(clien);
Game.Features.Tournaments.TeamElitePk.SkillTeamTournament.Join(clien, 3);
}
break;
}
case "@team":
{
Game.Features.Tournaments.TeamElitePk.TeamTournament.Open();
foreach (var clien in Kernel.GamePool.Values)
{
if (clien.Team == null)
clien.Team = new Game.ConquerStructures.Team(clien);
Game.Features.Tournaments.TeamElitePk.TeamTournament.Join(clien, 3);
}
break;
}
case "@exit":
{
CommandsAI("@save");
/*GameServer.Disable();
for (int i = 0; i < AuthServer.Length; i++)
{
AuthServer[i].Disable();
}*/
new Database.MySqlCommand(Database.MySqlCommandType.UPDATE).Update("configuration").Set("ItemUID", ConquerItem.ItemUID.Now).Where("Server", Constants.ServerName).Execute();
Database.EntityVariableTable.Save(0, Vars);
var WC = Program.Values.ToArray();
Parallel.ForEach(Program.Values, client =>
{
client.Send(" Server will exit for 5 min to Solve The Problem, please be paitent ");
client.Disconnect();
});
Kernel.SendWorldMessage(new Network.GamePackets.Message(string.Concat(new object[] { " Server will exit for 5 min to Solve The Problem, please be paitent " }), System.Drawing.Color.White, 0x7db), Program.Values);
if (GuildWar.IsWar)
GuildWar.End();
new Database.MySqlCommand(Database.MySqlCommandType.UPDATE).Update("configuration").Set("ItemUID", ConquerItem.ItemUID.Now).Where("Server", Constants.ServerName).Execute();
Environment.Exit(0);
}
break;
case "serverpass":
{
using (MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT))
{
cmd.Select("configuration").Where("Server", Constants.ServerName);
using (MySqlReader r = new MySqlReader(cmd))
{
if (r.Read())
Constants.ServerGMPass = r.ReadString("ServerGMPass");
}
}
break;
}
case "@pressure":
{
Console.WriteLine("Genr: " + World.GenericThreadPool.ToString());
Console.WriteLine("Send: " + World.SendPool.ToString());
Console.WriteLine("Recv: " + World.ReceivePool.ToString());
break;
}
case "@restart":
{
try
{
Kernel.SendWorldMessage(new Network.GamePackets.Message(string.Concat(new object[] { "Server Will Be Restart Now !" }), System.Drawing.Color.White, 0x7db), Program.Values);
CommandsAI("@save");
new Database.MySqlCommand(Database.MySqlCommandType.UPDATE).Update("configuration").Set("ItemUID", ConquerItem.ItemUID.Now).Where("Server", Constants.ServerName).Execute();
var WC = Program.Values.ToArray();
foreach (Client.GameState client in WC)
{
client.Send(" Server Will Be Restart Now ");
client.Disconnect();
}
/*GameServer.Disable();
for (int i = 0; i < AuthServer.Length; i++)
{
AuthServer[i].Disable();
}*/
if (GuildWar.IsWar)
GuildWar.End();
new Database.MySqlCommand(Database.MySqlCommandType.UPDATE).Update("configuration").Set("ItemUID", ConquerItem.ItemUID.Now).Where("Server", Constants.ServerName).Execute();
Application.Restart();
Environment.Exit(0);
}
catch (Exception e)
{
Console.WriteLine(e);
Console.ReadLine();
}
}
break;
case "@account":
{
Database.AccountTable account = new AccountTable(data[1]);
account.Password = data[2];
account.State = AccountTable.AccountState.Entity;
account.Save();
}
break;
case "@process":
{
HandleClipboardPacket(command);
break;
}
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}
|
الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1) | |
|