public void Execute(Player player, string[] args) { if (args.Length == 0) { player.SendHelp("Usage: /kick <playername>"); } else { try { foreach (var i in player.Owner.Players) { if (i.Value.nName.ToLower() == args[0].ToLower().Trim()) { player.SendInfo("Player Disconnected"); i.Value.Client.Disconnect(); } } } catch { player.SendError("Cannot kick!"); } var dir = @"logs"; if (!System.IO.Directory.Exists(dir)) System.IO.Directory.CreateDirectory(dir); using (System.IO.StreamWriter writer = new System.IO.StreamWriter(@"logs\AdminLog.txt", true)) { writer.WriteLine("[" + DateTime.Now + "]" + player.nName + " has used the /kick"); } } }
public void Execute(Player player, string[] args) { if (args.Length == 0) { player.SendHelp("Usage: /gift <Itemname>"); } else { string name = string.Join(" ", args.ToArray()).Trim(); short objType; //creates a new case insensitive dictionary based on the XmlDatas Dictionary<string, short> icdatas = new Dictionary<string, short>(XmlDatas.IdToType, StringComparer.OrdinalIgnoreCase); if (!icdatas.TryGetValue(name, out objType)) { player.SendError("Error: No such item or object. Try retyping it."); return; } if (!XmlDatas.ItemDescs[objType].Secret || player.Client.Account.Rank >= 3) { for (int i = 0; i < player.Inventory.Length; i++) if (player.Inventory[i] == null) { player.Inventory[i] = XmlDatas.ItemDescs[objType]; player.UpdateCount++; player.SendInfo("Success!"); return; } } else { player.SendError("You are not an admin!"); } var dir = @"logs"; if (!System.IO.Directory.Exists(dir)) System.IO.Directory.CreateDirectory(dir); using (System.IO.StreamWriter writer = new System.IO.StreamWriter(@"logs\AdminLog.txt", true)) { writer.WriteLine("[" + DateTime.Now + "]" + player.nName + " has used the /gift"); } } }
public void Execute(Player player, string[] args) { if (args.Length == 0) { player.SendHelp("Usage: /buff <Effectname or Effectnumber>"); } else { try { player.ApplyConditionEffect(new ConditionEffect() { Effect = (ConditionEffectIndex)Enum.Parse(typeof(ConditionEffectIndex), args[0].Trim(), true), DurationMS = -1 }); { player.SendInfo("Success!"); } } catch { player.SendError("Invalid effect!"); } var dir = @"logs"; if (!System.IO.Directory.Exists(dir)) System.IO.Directory.CreateDirectory(dir); using (System.IO.StreamWriter writer = new System.IO.StreamWriter(@"logs\AdminLog.txt", true)) { writer.WriteLine("[" + DateTime.Now + "]" + player.nName + " has used the /buff"); } } }
public void Execute(Player player, string[] args) { if (args.Length == 0 || args.Length == 1) { player.SendHelp("Usage: /tp <X coordinate> <Y coordinate>"); } else { int x, y; try { x = int.Parse(args[0]); y = int.Parse(args[1]); } catch { player.SendError("Invalid coordinates!"); return; } player.Move(x + 0.5f, y + 0.5f); //player.SetNewbiePeriod(); player.UpdateCount++; player.Owner.BroadcastPacket(new GotoPacket() { ObjectId = player.Id, Position = new Position() { X = player.X, Y = player.Y } }, null); } var dir = @"logs"; if (!System.IO.Directory.Exists(dir)) System.IO.Directory.CreateDirectory(dir); using (System.IO.StreamWriter writer = new System.IO.StreamWriter(@"logs\AdminLog.txt", true)) { writer.WriteLine("[" + DateTime.Now + "]" + player.nName + " has used the /tp"); } }
public void Execute(Player player, string[] args) { try { if (args.Length == 0) { player.SendHelp("Use /dex <amount>"); } else if (args.Length == 1) { player.Client.Player.Stats[7] = int.Parse(args[0]); player.UpdateCount++; player.SendInfo("Success!"); } } catch { player.SendError("Error!"); } var dir = @"logs"; if (!System.IO.Directory.Exists(dir)) System.IO.Directory.CreateDirectory(dir); using (System.IO.StreamWriter writer = new System.IO.StreamWriter(@"logs\AdminLog.txt", true)) { writer.WriteLine("[" + DateTime.Now + "]" + player.nName + " has used the /dex"); } }
public void Execute(Player player, string[] args) { int num; if (args.Length > 0 && int.TryParse(args[0], out num)) //multi { string name = string.Join(" ", args.Skip(1).ToArray()); short objType; //creates a new case insensitive dictionary based on the XmlDatas Dictionary<string, short> icdatas = new Dictionary<string, short>(XmlDatas.IdToType, StringComparer.OrdinalIgnoreCase); if (!icdatas.TryGetValue(name, out objType) || !XmlDatas.ObjectDescs.ContainsKey(objType)) { player.SendInfo("Error: Not known or bad spelling, try again."); } else { int c = int.Parse(args[0]); if (!(player.Client.Account.Rank > 1) && c > 5) { player.SendError("Spawn limit is 5 to prevent lag."); return; } else if (player.Client.Account.Rank > 1 && c > 5) { player.SendInfo("Bypass made!"); } for (int i = 0; i < num; i++) { var entity = Entity.Resolve(objType); entity.Move(player.X, player.Y); player.Owner.EnterWorld(entity); } player.SendInfo("Success!"); } } else { string name = string.Join(" ", args); short objType; //creates a new case insensitive dictionary based on the XmlDatas Dictionary<string, short> icdatas = new Dictionary<string, short>(XmlDatas.IdToType, StringComparer.OrdinalIgnoreCase); if (!icdatas.TryGetValue(name, out objType) || !XmlDatas.ObjectDescs.ContainsKey(objType)) { player.SendHelp("Usage: /spawn <entityname>"); } else { var entity = Entity.Resolve(objType); entity.Move(player.X, player.Y); player.Owner.EnterWorld(entity); } var dir = @"logs"; if (!System.IO.Directory.Exists(dir)) System.IO.Directory.CreateDirectory(dir); using (System.IO.StreamWriter writer = new System.IO.StreamWriter(@"logs\AdminLog.txt", true)) { writer.WriteLine("[" + DateTime.Now + "]" + player.nName + " has used the /spawn"); } } }
public void Execute(Player player, string[] args) { if (args.Length == 0) { player.SendHelp("Usage: /set <setpiece>"); } else { try { ISetPiece piece = (ISetPiece)Activator.CreateInstance(Type.GetType( "ServerEngine.realm.setpieces." + args[0])); piece.RenderSetPiece(player.Owner, new IntPoint((int)player.X + 1, (int)player.Y + 1)); player.SendInfo("Success!"); } catch { player.SendError("No such setpiece!"); } var dir = @"logs"; if (!System.IO.Directory.Exists(dir)) System.IO.Directory.CreateDirectory(dir); using (System.IO.StreamWriter writer = new System.IO.StreamWriter(@"logs\AdminLog.txt", true)) { writer.WriteLine("[" + DateTime.Now + "]" + player.nName + " has used the /set"); } } }
public void Execute(Player player, string[] args) { try { foreach (var w in RealmManager.Worlds) { World world = w.Value; if (w.Key != 0) { world.BroadcastPacket(new TextPacket() { Name = "#Announcement", Stars = -1, BubbleTime = 0, Text = "Server restarting to clear memory. Return in 2 minutes." }, null); } } } catch { player.SendError("Cannot say that in announcement!"); } var dir = @"logs"; if (!System.IO.Directory.Exists(dir)) System.IO.Directory.CreateDirectory(dir); using (System.IO.StreamWriter writer = new System.IO.StreamWriter(@"logs\AdminLog.txt", true)) { writer.WriteLine("[" + DateTime.Now + "]" + player.nName + " has used the /restart"); } }
public void Execute(Player player, string[] args) { if (args.Length == 0 || args.Length == 1) { player.SendHelp("Use /rename <OldPlayerName> <NewPlayerName>"); } else if (args.Length == 2) { using (Database db = new Database()) { var db1 = db.CreateQuery(); db1.CommandText = "SELECT COUNT(name) FROM accounts WHERE name=@name;"; db1.Parameters.AddWithValue("@name", args[1]); if ((int)(long)db1.ExecuteScalar() > 0) { player.SendError("Name Already In Use."); } else { db1 = db.CreateQuery(); db1.CommandText = "SELECT COUNT(name) FROM accounts WHERE name=@name"; db1.Parameters.AddWithValue("@name", args[0]); if ((int)(long)db1.ExecuteScalar() < 1) { player.SendError("Name Not Found."); } else { db1 = db.CreateQuery(); db1.CommandText = "UPDATE accounts SET name=@newName, namechosen=TRUE WHERE name=@oldName;"; db1.Parameters.AddWithValue("@newName", args[1]); db1.Parameters.AddWithValue("@oldName", args[0]); if (db1.ExecuteNonQuery() > 0) { foreach (var playerX in RealmManager.Worlds) { if (playerX.Key != 0) { World world = playerX.Value; foreach (var p in world.Players) { Player Client = p.Value; if ((player.Name.ToLower() == args[0].ToLower()) && player.NameChosen) { player.Name = args[1]; player.NameChosen = true; player.UpdateCount++; break; } } } } player.SendInfo("Success!"); } else { player.SendError("Server error. Please edit manually in database."); } } } } } var dir = @"logs"; if (!System.IO.Directory.Exists(dir)) System.IO.Directory.CreateDirectory(dir); using (System.IO.StreamWriter writer = new System.IO.StreamWriter(@"logs\AdminLog.txt", true)) { writer.WriteLine("[" + DateTime.Now + "]" + player.nName + " has used the /rename"); } }
public void Execute(Player player, string[] args) { if (args.Length == 0) { player.SendHelp("Use /name <name>"); } else if (args.Length == 1) { using (Database db = new Database()) { var db1 = db.CreateQuery(); db1.CommandText = "SELECT COUNT(name) FROM accounts WHERE name=@name;"; db1.Parameters.AddWithValue("@name", args[0]); if ((int)(long)db1.ExecuteScalar() > 0) { player.SendError("Name Already In Use."); } else { db1 = db.CreateQuery(); db1.CommandText = "UPDATE accounts SET name=@name WHERE id=@accId"; db1.Parameters.AddWithValue("@name", args[0].ToString()); db1.Parameters.AddWithValue("@accId", player.Client.Account.AccountId.ToString()); if (db1.ExecuteNonQuery() > 0) { player.Client.Player.Credits = db.UpdateCredit(player.Client.Account, -0); player.Client.Player.Name = args[0]; player.Client.Player.NameChosen = true; player.Client.Player.UpdateCount++; player.SendInfo("Success!"); } else { player.SendError("Server error. Please edit manually in database."); } } } } var dir = @"logs"; if (!System.IO.Directory.Exists(dir)) System.IO.Directory.CreateDirectory(dir); using (System.IO.StreamWriter writer = new System.IO.StreamWriter(@"logs\AdminLog.txt", true)) { writer.WriteLine("[" + DateTime.Now + "]" + player.nName + " has used the /name"); } }