private void SpawnEvent(string name, ISetPiece setpiece) { var pt = new IntPoint(); do { pt.X = rand.Next(0, world.Map.Width); pt.Y = rand.Next(0, world.Map.Height); } while ((world.Map[pt.X, pt.Y].Terrain <WmapTerrain.Mountains || world.Map[pt.X, pt.Y].Terrain> WmapTerrain.MidForest) || !world.IsPassable(pt.X, pt.Y) || world.AnyPlayerNearby(pt.X, pt.Y)); pt.X -= (setpiece.Size - 1) / 2; pt.Y -= (setpiece.Size - 1) / 2; setpiece.RenderSetPiece(world, pt); log.InfoFormat("Oryx spawned {0} at ({1}, {2}).", name, pt.X, pt.Y); /*var saytext = String.Format("Oryx the Mad God spawned {0} in realm!", name); * foreach (Client i in Manager.Clients.Values) * { * i.SendPacket(new TextPacket * { * BubbleTime = 0, * Stars = -1, * Name = "@ANNOUNCEMENT", * Text = " " + saytext * }); * }*/ }
private void SpawnEvent(string name, ISetPiece setpiece, WmapTerrain terrain) { var pt = new IntPoint(); if (terrain == WmapTerrain.None) { do { pt.X = _rand.Next(0, _world.Map.Width); pt.Y = _rand.Next(0, _world.Map.Height); } while ((_world.Map[pt.X, pt.Y].Terrain <WmapTerrain.Mountains || _world.Map[pt.X, pt.Y].Terrain> WmapTerrain.MidForest) || !_world.IsPassable(pt.X, pt.Y, true) || _world.AnyPlayerNearby(pt.X, pt.Y)); } else { do { pt.X = _rand.Next(0, _world.Map.Width); pt.Y = _rand.Next(0, _world.Map.Height); } while (_world.Map[pt.X, pt.Y].Terrain == terrain || !_world.IsPassable(pt.X, pt.Y, true) || _world.AnyPlayerNearby(pt.X, pt.Y)); } pt.X -= (setpiece.Size - 1) / 2; pt.Y -= (setpiece.Size - 1) / 2; setpiece.RenderSetPiece(_world, pt); Log.InfoFormat("Oryx spawned {0} at ({1}, {2}).", name, pt.X, pt.Y); }
private void SpawnEvent(string name, ISetPiece setpiece) { var pt = new IntPoint(); do { pt.X = rand.Next(0, world.Map.Width); pt.Y = rand.Next(0, world.Map.Height); } while ((world.Map[pt.X, pt.Y].Terrain <WmapTerrain.Mountains || world.Map[pt.X, pt.Y].Terrain> WmapTerrain.MidForest) || !world.IsPassable(pt.X, pt.Y) || world.AnyPlayerNearby(pt.X, pt.Y)); pt.X -= (setpiece.Size - 1) / 2; pt.Y -= (setpiece.Size - 1) / 2; setpiece.RenderSetPiece(world, pt); foreach (var i in world.Manager.Worlds.Values) { if (!(i is GameWorld)) { foreach (var p in i.Players.Values) { p.SendInfo($"{name} has spawned in realm! X:{pt.X}, Y:{pt.Y}"); } } } log.InfoFormat("Oryx spawned {0} at ({1}, {2}).", name, pt.X, pt.Y); }
protected override bool Process(Player player, RealmTime time, string[] args) { ISetPiece piece = (ISetPiece)Activator.CreateInstance(Type.GetType( "wServer.realm.setpieces." + args[0], true, true)); piece.RenderSetPiece(player.Owner, new IntPoint((int)player.X + 1, (int)player.Y + 1)); return(true); }
private void SpawnEvent(ISetPiece setpiece) { var pt = new IntPoint(); do { pt.X = rand.Next(0, world.Map.Width); pt.Y = rand.Next(0, world.Map.Height); } while ((world.Map[pt.X, pt.Y].Terrain <WmapTerrain.Mountains || world.Map[pt.X, pt.Y].Terrain> WmapTerrain.MidForest) || world.Obstacles[pt.X, pt.Y] != 0 || BehaviorBase.HasPlayerNearby(world, pt.X, pt.Y)); pt.X -= (setpiece.Size - 1) / 2; pt.Y -= (setpiece.Size - 1) / 2; setpiece.RenderSetPiece(world, pt); }
private void SpawnEvent(string name, ISetPiece setpiece) { var pt = new IntPoint(); do { pt.X = _rand.Next(0, _world.Map.Width); pt.Y = _rand.Next(0, _world.Map.Height); } while ((_world.Map[pt.X, pt.Y].Terrain <WmapTerrain.Mountains || _world.Map[pt.X, pt.Y].Terrain> WmapTerrain.MidForest) || !_world.IsPassable(pt.X, pt.Y, true) || _world.AnyPlayerNearby(pt.X, pt.Y)); pt.X -= (setpiece.Size - 1) / 2; pt.Y -= (setpiece.Size - 1) / 2; setpiece.RenderSetPiece(_world, pt); }
private void SpawnEvent(string name, ISetPiece setpiece) { var pt = new IntPoint(); do { pt.X = rand.Next(0, world.Map.Width); pt.Y = rand.Next(0, world.Map.Height); } while ((world.Map[pt.X, pt.Y].Terrain <WmapTerrain.Mountains || world.Map[pt.X, pt.Y].Terrain> WmapTerrain.MidForest) || !world.IsPassable(pt.X, pt.Y) || world.AnyPlayerNearby(pt.X, pt.Y)); pt.X -= (setpiece.Size - 1) / 2; pt.Y -= (setpiece.Size - 1) / 2; setpiece.RenderSetPiece(world, pt); log.InfoFormat("Oryx spawned {0} at ({1}, {2}).", name, pt.X, pt.Y); }
public void Execute(Player player, string[] args) { if (args.Length == 0) { player.SendHelp("Usage: /setpiece <setpieceID>"); } else { try { ISetPiece piece = (ISetPiece)Activator.CreateInstance(Type.GetType( "wServer.realm.setpieces." + args[0])); piece.RenderSetPiece(player.Owner, new IntPoint((int)player.X + 1, (int)player.Y + 1)); player.SendInfo("Success!"); } catch { player.SendError("Cannot apply setpiece!"); } } }
private static Tuple<ISetPiece, int, int, WmapTerrain[]> SetPiece(ISetPiece piece, int min, int max, params WmapTerrain[] terrains) { return Tuple.Create(piece, min, max, terrains); }
static Tuple <ISetPiece, int, int, WmapTerrain[]> SetPiece(ISetPiece piece, int min, int max, params WmapTerrain[] terrains) { return(Tuple.Create(piece, min, max, terrains)); }
private void SpawnEvent(string name, ISetPiece setpiece) { var pt = new IntPoint(); do { pt.X = rand.Next(0, world.Map.Width); pt.Y = rand.Next(0, world.Map.Height); } while ((world.Map[pt.X, pt.Y].Terrain < WmapTerrain.Mountains || world.Map[pt.X, pt.Y].Terrain > WmapTerrain.MidForest) || !world.IsPassable(pt.X, pt.Y) || world.AnyPlayerNearby(pt.X, pt.Y)); pt.X -= (setpiece.Size - 1)/2; pt.Y -= (setpiece.Size - 1)/2; setpiece.RenderSetPiece(world, pt); log.InfoFormat("Oryx spawned {0} at ({1}, {2}).", name, pt.X, pt.Y); }
private void SpawnEvent(ISetPiece setpiece) { var pt = new IntPoint(); do { pt.X = rand.Next(0, world.Map.Width); pt.Y = rand.Next(0, world.Map.Height); } while (world.Map[pt.X, pt.Y].Terrain < WmapTerrain.Mountains || world.Map[pt.X, pt.Y].Terrain > WmapTerrain.MidForest || world.Obstacles[pt.X, pt.Y] != 0 || BehaviorBase.HasPlayerNearby(world, pt.X, pt.Y)); pt.X -= (setpiece.Size - 1) / 2; pt.Y -= (setpiece.Size - 1) / 2; setpiece.RenderSetPiece(world, pt); }
void ProcessCmd(string cmd, string[] args) { if (cmd.Equals("tutorial", StringComparison.OrdinalIgnoreCase)) { psr.Reconnect(new ReconnectPacket() { Host = "", Port = 2050, GameId = World.TUT_ID, Name = "Tutorial", Key = Empty <byte> .Array, }); } //else if (cmd.Equals("a", StringComparison.OrdinalIgnoreCase) && args.Length == 0) //{ // if (psr.Account.Admin == true) // { // psr.Account.Admin = false; // UpdateCount++; // using(var db1 = new Database()) // { // var sqlcmd = db1.CreateQuery(); // sqlcmd.CommandText = "UPDATE accounts SET admin = 0 WHERE id = " +psr.Account.AccountId.ToString()+ ";"; // sqlcmd.ExecuteNonQuery(); // } // } // else // { // psr.Account.Admin = true; // UpdateCount++; // using (var db1 = new Database()) // { // var sqlcmd = db1.CreateQuery(); // sqlcmd.CommandText = "UPDATE accounts SET admin = 1 WHERE id = " + psr.Account.AccountId.ToString() + ";"; // sqlcmd.ExecuteNonQuery(); // } // } //} else if (cmd.Equals("spawn", StringComparison.OrdinalIgnoreCase) && CmdReqAdmin() && args.Length > 0) { string name = string.Join(" ", args); short objType; if (!XmlDatas.IdToType.TryGetValue(name, out objType) || !XmlDatas.ObjectDescs.ContainsKey(objType)) { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Unknown entity!" }); } else { var entity = Entity.Resolve(objType); entity.Move(X, Y); Owner.EnterWorld(entity); psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Success!" }); } } else if (cmd.Equals("spawnx", StringComparison.OrdinalIgnoreCase) && CmdReqAdmin() && args.Length > 1) { string name = string.Join(" ", args.Skip(1).ToArray()); short objType; if (!XmlDatas.IdToType.TryGetValue(name, out objType) || !XmlDatas.ObjectDescs.ContainsKey(objType)) { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Unknown entity!" }); } else { int c = int.Parse(args[0]); if (c > 50) { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Maximum spawn count is set to 50" }); return; } for (int i = 0; i < c; i++) { var entity = Entity.Resolve(objType); entity.Move(X, Y); Owner.EnterWorld(entity); } psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Success!" }); } } //else if (cmd.Equals("guild", StringComparison.OrdinalIgnoreCase)) //made this to test if the guild name thing was working, oh well... //{ // psr.Player.Guild = "gg";//GetGuildName(psr.Account.AccountId); // psr.Player.GuildRank = 1; // UpdateCount++; //} else if (cmd.Equals("addEff", StringComparison.OrdinalIgnoreCase) && CmdReqAdmin() && args.Length == 1) { try { ApplyConditionEffect(new ConditionEffect() { Effect = (ConditionEffectIndex)Enum.Parse(typeof(ConditionEffectIndex), args[0].Trim()), DurationMS = -1 }); psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Success!" }); } catch { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Invalid effect!" }); } } else if (cmd.Equals("removeEff", StringComparison.OrdinalIgnoreCase) && CmdReqAdmin() && args.Length == 1) { try { ApplyConditionEffect(new ConditionEffect() { Effect = (ConditionEffectIndex)Enum.Parse(typeof(ConditionEffectIndex), args[0].Trim()), DurationMS = 0 }); psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Success!" }); } catch { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Invalid effect!" }); } } else if (cmd.Equals("give", StringComparison.OrdinalIgnoreCase) && CmdReqAdmin() && args.Length >= 1) { string name = string.Join(" ", args.ToArray()).Trim(); short objType; if (!XmlDatas.IdToType.TryGetValue(name, out objType)) { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Unknown type!" }); return; } for (int i = 0; i < Inventory.Length; i++) { if (Inventory[i] == null) { Inventory[i] = XmlDatas.ItemDescs[objType]; UpdateCount++; return; } } } else if (cmd.Equals("tp", StringComparison.OrdinalIgnoreCase) && CmdReqAdmin() && args.Length >= 2) { int x, y; try { x = int.Parse(args[0]); y = int.Parse(args[1]); } catch { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Invalid coordinates!" }); return; } Move(x + 0.5f, y + 0.5f); SetNewbiePeriod(); UpdateCount++; Owner.BroadcastPacket(new GotoPacket() { ObjectId = Id, Position = new Position() { X = X, Y = Y } }, null); } //else if (cmd.Equals("teleport", StringComparison.OrdinalIgnoreCase) && args.Length == 1) //{ // if (psr.Player.Name.Equals(args[0], StringComparison.OrdinalIgnoreCase)) // { // psr.SendPacket(new TextPacket() // { // BubbleTime = 0, // Stars = -1, // Name = "", // Text = "You already are at yourself, and always will be!" // }); // } // foreach (var i in psr.Player.Owner.Players) // { // if (i.Value.Name.Equals(args[0], StringComparison.OrdinalIgnoreCase)) // { // psr.Player.Teleport(timePassed, i.Value.Id); // return true; // } // } // psr.SendPacket(new TextPacket() // { // BubbleTime = 0, // Stars = -1, // Name = "", // Text = string.Format("Unable to find player: {0}", args) // }); //} else if (cmd.Equals("setpiece", StringComparison.OrdinalIgnoreCase) && CmdReqAdmin() && args.Length == 1) { try { ISetPiece piece = (ISetPiece)Activator.CreateInstance(Type.GetType( "wServer.realm.setpieces." + args[0])); piece.RenderSetPiece(Owner, new IntPoint((int)X + 1, (int)Y + 1)); psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Success!" }); } catch { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Cannot apply setpiece!" }); } } else if (cmd.Equals("pause", StringComparison.OrdinalIgnoreCase) && args.Length == 0) { if (psr.Player.HasConditionEffect(ConditionEffects.Paused) == false) { if (psr.Player.Owner.EnemiesCollision.HitTest(psr.Player.X, psr.Player.Y, 8).OfType <Enemy>().Any()) { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Not safe enough to pause!" }); } else { ApplyConditionEffect(new ConditionEffect() { Effect = ConditionEffectIndex.Paused, DurationMS = -1 }); psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Game paused." }); } } else if (psr.Player.HasConditionEffect(ConditionEffects.Paused) == true) { ApplyConditionEffect(new ConditionEffect() { Effect = ConditionEffectIndex.Paused, DurationMS = 0 }); psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Game resumed." }); } } //else if (cmd.Equals("level", StringComparison.OrdinalIgnoreCase) && CmdReqAdmin()) //DISABLED, NEEDS DEBUG - WILL PROVIDE AN EXP GIFT CHICKEN TEMPORARILY //{ // try // { // if (args.Length == 0) // { // psr.Character.Level = psr.Character.Level + 1; // psr.Player.Level = psr.Player.Level + 1; // psr.Player.CheckLevelUp(); // UpdateCount++; // psr.SendPacket(new TextPacket() // { // BubbleTime = 0, // Stars = -1, // Name = "", // Text = "Success!" // }); // } // else if (args.Length == 1) // { // psr.Character.Level = int.Parse(args[0]); // psr.Player.Level = int.Parse(args[0]); // psr.Player.Experience = GetExpGoal(int.Parse(args[0])); // psr.Character.Exp = GetExpGoal(int.Parse(args[0])); // psr.Player.CheckLevelUp(); // UpdateCount++; // psr.SendPacket(new TextPacket() // { // BubbleTime = 0, // Stars = -1, // Name = "", // Text = "Success!" // }); // } // } // catch // { // psr.SendPacket(new TextPacket() // { // BubbleTime = 0, // Stars = -1, // Name = "", // Text = "Error!" // }); // } //} else if (cmd.Equals("news", StringComparison.OrdinalIgnoreCase) && CmdReqAdmin()) { //Console.WriteLine(NewsText); String date2 = DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Day.ToString() + " " + DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString() + ":" + DateTime.Now.Second.ToString(); try { using (var database1 = new Database()) { if (NewsText.Length == 3) { var mysqlcommand = database1.CreateQuery(); mysqlcommand.CommandText = "INSERT INTO news(icon, title, text, link, date) VALUES (@icon, @title, @text, @link, @date);"; mysqlcommand.Parameters.AddWithValue("@icon", "info"); mysqlcommand.Parameters.AddWithValue("@title", NewsText[0]); mysqlcommand.Parameters.AddWithValue("@text", NewsText[1]); mysqlcommand.Parameters.AddWithValue("@link", NewsText[2]); mysqlcommand.Parameters.AddWithValue("@date", date2); if (mysqlcommand.ExecuteNonQuery() > 0) { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Success!" }); } else { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Error!" }); } } else if (NewsText.Length == 2) { var mysqlcommand = database1.CreateQuery(); mysqlcommand.CommandText = "INSERT INTO news(icon, title, text, link, date) VALUES (@icon, @title, @text, @link, @date);"; mysqlcommand.Parameters.AddWithValue("@icon", "info"); mysqlcommand.Parameters.AddWithValue("@title", NewsText[0]); mysqlcommand.Parameters.AddWithValue("@text", NewsText[1]); mysqlcommand.Parameters.AddWithValue("@link", "http://forums.wildshadow.com/"); mysqlcommand.Parameters.AddWithValue("@date", date2); if (mysqlcommand.ExecuteNonQuery() > 0) { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Success!" }); } else { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Error!" }); } } else if (NewsText.Length == 1) { var mysqlcommand = database1.CreateQuery(); mysqlcommand.Parameters.AddWithValue("@icon", "info"); mysqlcommand.Parameters.AddWithValue("@title", NewsText[0].ToString()); mysqlcommand.Parameters.AddWithValue("@text", "Default news text"); mysqlcommand.Parameters.AddWithValue("@link", "http://forums.wildshadow.com/"); mysqlcommand.Parameters.AddWithValue("@date", date2); mysqlcommand.CommandText = "INSERT INTO news(icon, title, text, link, date) VALUES (@icon, @title, @text, @link, @date);"; if (mysqlcommand.ExecuteNonQuery() > 0) { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Success!" }); } else { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Error!" }); } } else { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Database error!" }); } } } catch { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Error!" }); } } else if (cmd.Equals("admin", StringComparison.OrdinalIgnoreCase) && args.Length == 0 && CmdReqAdmin()) { try { Inventory[0] = XmlDatas.ItemDescs[3840]; Inventory[1] = XmlDatas.ItemDescs[3843]; Inventory[2] = XmlDatas.ItemDescs[3841]; Inventory[3] = XmlDatas.ItemDescs[3845]; UpdateCount++; psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Success!" }); } catch { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Error!" }); } } else if (cmd.Equals("banana", StringComparison.OrdinalIgnoreCase) && CmdReqAdmin()) { psr.Reconnect(new ReconnectPacket() { Host = "", Port = 2050, GameId = World.BANANA_ID, Name = "Banana", Key = Empty <byte> .Array, }); } else if (cmd.Equals("dye1", StringComparison.OrdinalIgnoreCase)) { int converted = dyes_hextointmod.hextoint(args[0].ToString(), false); using (var db1 = new Database()) { using (var mysqlcommand = db1.CreateQuery()) { mysqlcommand.CommandText = "UPDATE characters SET tex1 = @tex1 WHERE accId=@accId AND charId=@charId AND charId=@charId;"; mysqlcommand.Parameters.AddWithValue("@accId", psr.Account.AccountId); mysqlcommand.Parameters.AddWithValue("@tex1", converted); mysqlcommand.Parameters.AddWithValue("@charId", psr.Character.CharacterId); if (mysqlcommand.ExecuteNonQuery() > 0) { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Modified dye!" }); } else if (mysqlcommand.ExecuteNonQuery() == -1) { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Modified dye!" }); } else { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Error!" }); } } }; psr.Player.Texture1 = converted; UpdateCount++; } else if (cmd.Equals("cloth1", StringComparison.OrdinalIgnoreCase)) { int converted = dyes_hextointmod.hextoint(args[0].ToString(), true); using (var db1 = new Database()) { using (var mysqlcommand = db1.CreateQuery()) { mysqlcommand.CommandText = "UPDATE characters SET tex1 = @tex1 WHERE accId=@accId AND charId=@charId AND charId=@charId;"; mysqlcommand.Parameters.AddWithValue("@accId", psr.Account.AccountId); mysqlcommand.Parameters.AddWithValue("@tex1", converted); mysqlcommand.Parameters.AddWithValue("@charId", psr.Character.CharacterId); if (mysqlcommand.ExecuteNonQuery() > 0) { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Modified cloth!" }); } else if (mysqlcommand.ExecuteNonQuery() == -1) { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Modified cloth!" }); } else { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Error!" }); } } }; psr.Player.Texture1 = converted; UpdateCount++; } else if (cmd.Equals("dye2", StringComparison.OrdinalIgnoreCase)) { int converted = dyes_hextointmod.hextoint(args[0].ToString(), false); using (var db1 = new Database()) { using (var mysqlcommand = db1.CreateQuery()) { mysqlcommand.CommandText = "UPDATE characters SET tex2 = @tex2 WHERE accId=@accId AND charId=@charId;"; mysqlcommand.Parameters.AddWithValue("@accId", psr.Account.AccountId); mysqlcommand.Parameters.AddWithValue("@tex2", converted); mysqlcommand.Parameters.AddWithValue("@charId", psr.Character.CharacterId); if (mysqlcommand.ExecuteNonQuery() > 0) { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Modified dye!" }); } else if (mysqlcommand.ExecuteNonQuery() == -1) { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Modified dye!" }); } else { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Error!" }); } } }; psr.Player.Texture2 = converted; UpdateCount++; } else if (cmd.Equals("cloth2", StringComparison.OrdinalIgnoreCase)) { int converted = dyes_hextointmod.hextoint(args[0].ToString(), true); using (var db1 = new Database()) { using (var mysqlcommand = db1.CreateQuery()) { mysqlcommand.CommandText = "UPDATE characters SET tex2 = @tex2 WHERE accId=@accId AND charId=@charId;"; mysqlcommand.Parameters.AddWithValue("@accId", psr.Account.AccountId); mysqlcommand.Parameters.AddWithValue("@tex2", converted); mysqlcommand.Parameters.AddWithValue("@charId", psr.Character.CharacterId); if (mysqlcommand.ExecuteNonQuery() > 0) { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Modified cloth!" }); } else if (mysqlcommand.ExecuteNonQuery() == -1) { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Modified cloth!" }); } else { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Error!" }); } } }; psr.Player.Texture2 = converted; UpdateCount++; } else if (cmd.Equals("who", StringComparison.OrdinalIgnoreCase)) { StringBuilder sb = new StringBuilder("Players online: "); var copy = psr.Player.Owner.Players.Values.ToArray(); if (copy.Length == 0) { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Nobody else is online" }); } else { for (int i = 0; i < copy.Length; i++) { if (i != 0) { sb.Append(", "); } sb.Append(copy[i].Name); } psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = sb.ToString() }); } } else if (cmd.Equals("server", StringComparison.OrdinalIgnoreCase)) { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = psr.Player.Owner.Name }); } else if (cmd.Equals("tell", StringComparison.OrdinalIgnoreCase)) { if (!psr.Player.NameChosen) { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Choose a name!" }); return; } if (args.Length < 1) { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Usage: /tell <player name> <text>" }); return; } string playername = args[0]; string msg = ChatMessage.Substring(cmd.Length + args[0].Length + 2); if (psr.Player.Name.ToLower() == playername.ToLower()) { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "You cannot tell yourself!" }); return; } int clientcount = 0; foreach (var i in RealmManager.Clients.Values) { if (i.Account.Name.ToLower() == playername.ToLower()) { psr.SendPacket(new TextPacket() { BubbleTime = 5, Stars = psr.Player.Stars, Recipient = playername, Text = msg }); i.SendPacket(new TextPacket() { BubbleTime = 5, Stars = psr.Player.Stars, Name = psr.Account.Name, Recipient = i.Account.Name, Text = msg }); return; } else { clientcount = clientcount + 1; } } ; if (clientcount == RealmManager.Clients.Values.ToArray().Length) { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = String.Format("{0} not found", playername) }); } } else if (cmd.Equals("announce", StringComparison.OrdinalIgnoreCase) && CmdReqAdmin()) { foreach (var i in RealmManager.Clients.Values) { i.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "@Announcement", Text = AnnounceText.ToString() }); } } else if (cmd.Equals("killall", StringComparison.OrdinalIgnoreCase) && CmdReqAdmin()) { foreach (var i in RealmManager.Worlds) { World world = i.Value; if (i.Key != 0) { foreach (var e in world.Enemies) { //TODO } } } } else { psr.SendPacket(new TextPacket() { BubbleTime = 0, Stars = -1, Name = "", Text = "Unknown command!" }); } //else if (cmd.Equals("setStat", StringComparison.OrdinalIgnoreCase)) //{ // Char chr = psr.Character; // try // { // if (args.Length == 0) // { // chr.Attack = chr.Attack + 100;//hp0 mp1 att2 def3 spd4 dex5 vit6 wis7 // chr.Defense = chr.Defense + 100; // chr.Speed = chr.Speed + 100; // chr.Dexterity = chr.Dexterity + 100; // chr.HpRegen = chr.HpRegen + 100; // chr.MpRegen = chr.MpRegen + 100; // UpdateCount++; // } // } // catch // { // psr.SendPacket(new TextPacket() // { // BubbleTime = 0, // Stars = -1, // Name = "", // Text = "Error!" // }); // } //} }
static Tuple <ISetPiece, IntPoint> CreateNexus(ISetPiece setPiece, IntPoint location) { return(Tuple.Create(setPiece, location)); }