From 4ef324e0264c1bc342332dacda4a238b201cc0b3 Mon Sep 17 00:00:00 2001 From: Zack Piispanen Date: Sun, 19 Jan 2014 18:45:45 -0500 Subject: [PATCH 001/135] Fix bypassing SSC using items in hand (trashcans are still exploitable until Redigit or his merry men decide that its a bug and fix it) --- TShockAPI/GetDataHandlers.cs | 6 ++++++ TShockAPI/TSPlayer.cs | 1 + TShockAPI/TShock.cs | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 57ffe22a..9dc09447 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -1310,6 +1310,12 @@ namespace TShockAPI args.Player.IgnoreActionsForClearingTrashCan = true; } + if (slot == 58) //this is the hand + { + item.stack = stack; + args.Player.ItemInHand = item; + } + return false; } diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 67bee342..24525246 100755 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -809,6 +809,7 @@ namespace TShockAPI private DateTime LastDisableNotification = DateTime.UtcNow; public int ActiveChest = -1; + public Item ItemInHand = new Item(); public virtual void Disable(string reason = "", bool displayConsole = true) { diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 647693da..b453c4f0 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -393,6 +393,12 @@ namespace TShockAPI { if (args.Player.IsLoggedIn) args.Player.SaveServerCharacter(); + + if (args.Player.ItemInHand.type != 0) + { + args.Player.SendErrorMessage("Attempting to bypass SSC with item in hand."); + args.Handled = true; + } } private void NetHooks_NameCollision(NameCollisionEventArgs args) From 4c5de2f57c7a444a2beb1540eb9d129e61fc4671 Mon Sep 17 00:00:00 2001 From: White Date: Thu, 6 Feb 2014 09:40:52 +1030 Subject: [PATCH 002/135] Adds a few missing blocks to creep checks Hallowed vines Pink ice blocks Red ice blocks From brief research, this should be all the missing biome spreading blocks --- TShockAPI/TShock.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index b453c4f0..9b4c927a 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -851,8 +851,9 @@ namespace TShockAPI if (args.Handled) return; - if (!Config.AllowCrimsonCreep && (args.Type == 0 || args.Type == 199 || args.Type == 203 || args.Type == 234)) - { + if (!Config.AllowCrimsonCreep && (args.Type == 0 || args.Type == 199 || args.Type == 200 || args.Type == 203 + || args.Type == 234)) + { args.Handled = true; return; } @@ -864,7 +865,8 @@ namespace TShockAPI return; } - if (!Config.AllowHallowCreep && (args.Type == 109 || args.Type == 117 || args.Type == 116)) + if (!Config.AllowHallowCreep && (args.Type == 109 || args.Type == 117 || args.Type == 116 || args.Type == 115 + || args.Type == 164)) { args.Handled = true; } From 29f59b4f867a14a388779be21e8b51b7bd14e8a7 Mon Sep 17 00:00:00 2001 From: MarioE Date: Thu, 13 Feb 2014 21:01:06 -0500 Subject: [PATCH 003/135] Tentative update to 1.2.3 --- TShockAPI/GetDataHandlers.cs | 10 +++++----- TShockAPI/SaveManager.cs | 4 ++-- TShockAPI/TShock.cs | 2 +- TerrariaServerAPI | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 9dc09447..003d64bd 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -79,7 +79,7 @@ namespace TShockAPI /// /// The Tile ID being edited. /// - public byte EditData { get; set; } + public ushort EditData { get; set; } /// /// The EditType. /// (KillTile = 0, PlaceTile = 1, KillWall = 2, PlaceWall = 3, KillTileNoItem = 4, PlaceWire = 5, KillWire = 6) @@ -101,7 +101,7 @@ namespace TShockAPI /// TileEdit - called when a tile is placed or destroyed /// public static HandlerList TileEdit; - private static bool OnTileEdit(TSPlayer ply, int x, int y, EditAction action, EditType editDetail, byte editData, byte style) + private static bool OnTileEdit(TSPlayer ply, int x, int y, EditAction action, EditType editDetail, ushort editData, byte style) { if (TileEdit == null) return false; @@ -1600,7 +1600,7 @@ namespace TShockAPI /// /// Tiles that can be oriented (e.g., beds, chairs, bathtubs, etc). /// - private static byte[] orientableTiles = new byte[] { 15, 79, 90, 105, 128, 137, 139, 171, 207, 209 }; + private static int[] orientableTiles = new int[] { 15, 79, 90, 105, 128, 137, 139, 171, 207, 209 }; private static bool HandleSendTileSquare(GetDataHandlerArgs args) { @@ -1756,7 +1756,7 @@ namespace TShockAPI /// /// Tiles that can be broken without any tools. /// - private static byte[] breakableTiles = new byte[] { 4, 13, 33, 49, 50, 127, 128, 162 }; + private static int[] breakableTiles = new int[] { 4, 13, 33, 49, 50, 127, 128, 162 }; /// /// The maximum place styles for each tile. /// @@ -1774,7 +1774,7 @@ namespace TShockAPI try { - var editData = args.Data.ReadInt8(); + var editData = args.Data.ReadUInt16(); EditType type = (action == EditAction.KillTile || action == EditAction.KillWall || action == EditAction.KillTileNoItem) ? EditType.Fail diff --git a/TShockAPI/SaveManager.cs b/TShockAPI/SaveManager.cs index 3b001a0f..de623e83 100644 --- a/TShockAPI/SaveManager.cs +++ b/TShockAPI/SaveManager.cs @@ -125,10 +125,10 @@ namespace TShockAPI if (task.direct) { OnSaveWorld(new WorldSaveEventArgs()); - WorldGen.realsaveWorld(task.resetTime); + WorldFile.realsaveWorld(task.resetTime); } else - WorldGen.saveWorld(task.resetTime); + WorldFile.saveWorld(task.resetTime); TShock.Utils.Broadcast("World saved.", Color.Yellow); Log.Info(string.Format("World saved at ({0})", Main.worldPathName)); } diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index b453c4f0..32827d00 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1548,7 +1548,7 @@ namespace TShockAPI return false; } - public static bool CheckTilePermission(TSPlayer player, int tileX, int tileY, byte tileType, GetDataHandlers.EditAction actionType) + public static bool CheckTilePermission(TSPlayer player, int tileX, int tileY, ushort tileType, GetDataHandlers.EditAction actionType) { if (!player.Group.HasPermission(Permissions.canbuild)) { diff --git a/TerrariaServerAPI b/TerrariaServerAPI index 0ddd492a..69061acd 160000 --- a/TerrariaServerAPI +++ b/TerrariaServerAPI @@ -1 +1 @@ -Subproject commit 0ddd492aa03e5c97dddbc95b2e605fa2823804ab +Subproject commit 69061acd612172ae6f3aa1d5d9f9e50174e350d3 From 68b171ab42e03d5178e9760f500f73e00961d9d0 Mon Sep 17 00:00:00 2001 From: MarioE Date: Thu, 13 Feb 2014 21:10:14 -0500 Subject: [PATCH 004/135] Update submodule --- TerrariaServerAPI | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TerrariaServerAPI b/TerrariaServerAPI index 69061acd..0fe91dd0 160000 --- a/TerrariaServerAPI +++ b/TerrariaServerAPI @@ -1 +1 @@ -Subproject commit 69061acd612172ae6f3aa1d5d9f9e50174e350d3 +Subproject commit 0fe91dd05a5a54dff48d5ce61c7e3275c393a8b6 From cabdb7aa8d95bfb9189b878af6e23676df27a4f3 Mon Sep 17 00:00:00 2001 From: MarioE Date: Thu, 13 Feb 2014 21:52:32 -0500 Subject: [PATCH 005/135] Update submodule, fix NetTile, tick version --- TShockAPI/Net/NetTile.cs | 8 +++++++- TShockAPI/TShock.cs | 2 +- TerrariaServerAPI | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/TShockAPI/Net/NetTile.cs b/TShockAPI/Net/NetTile.cs index 06cd4a28..e30ca13e 100644 --- a/TShockAPI/Net/NetTile.cs +++ b/TShockAPI/Net/NetTile.cs @@ -45,6 +45,7 @@ namespace TShockAPI.Net public byte WallColor { get; set; } public bool Slope { get; set; } public bool Slope2 { get; set; } + public bool Slope3 { get; set; } public bool HasColor { @@ -150,6 +151,9 @@ namespace TShockAPI.Net if (Slope2) flags2 |= TileFlags2.Slope2; + if (Slope3) + flags2 |= TileFlags2.Slope3; + stream.WriteInt8((byte)flags2); @@ -192,6 +196,7 @@ namespace TShockAPI.Net Wire3 = flags2.HasFlag(TileFlags2.Wire3); Slope = flags2.HasFlag(TileFlags2.Slope); Slope2 = flags2.HasFlag(TileFlags2.Slope2); + Slope3 = flags2.HasFlag(TileFlags2.Slope3); if (flags2.HasFlag(TileFlags2.Color)) { @@ -270,6 +275,7 @@ namespace TShockAPI.Net Color = 4, WallColor = 8, Slope = 16, - Slope2 = 32 + Slope2 = 32, + Slope3 = 64 } } diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 32827d00..b0448e76 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -41,7 +41,7 @@ using System.Threading.Tasks; namespace TShockAPI { - [ApiVersion(1, 14)] + [ApiVersion(1, 15)] public class TShock : TerrariaPlugin { public static readonly Version VersionNum = Assembly.GetExecutingAssembly().GetName().Version; diff --git a/TerrariaServerAPI b/TerrariaServerAPI index 0fe91dd0..943e996c 160000 --- a/TerrariaServerAPI +++ b/TerrariaServerAPI @@ -1 +1 @@ -Subproject commit 0fe91dd05a5a54dff48d5ce61c7e3275c393a8b6 +Subproject commit 943e996ca3e9ad9df981f36d98468c591fc54a7f From a4806463c858578b962f394e3f940af87b3d1c68 Mon Sep 17 00:00:00 2001 From: MarioE Date: Thu, 13 Feb 2014 22:28:57 -0500 Subject: [PATCH 006/135] Update submodule again, force recompile due to Main statics. --- TerrariaServerAPI | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TerrariaServerAPI b/TerrariaServerAPI index 943e996c..2a967a9d 160000 --- a/TerrariaServerAPI +++ b/TerrariaServerAPI @@ -1 +1 @@ -Subproject commit 943e996ca3e9ad9df981f36d98468c591fc54a7f +Subproject commit 2a967a9d6e736fbd1305a02994e79347b23cae9c From f6078a959465284603ce798a698e1f5689ae8282 Mon Sep 17 00:00:00 2001 From: MarioE Date: Fri, 14 Feb 2014 10:37:51 -0500 Subject: [PATCH 007/135] Fixed chests --- TShockAPI/GetDataHandlers.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 003d64bd..33cd9079 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2674,8 +2674,10 @@ namespace TShockAPI private static bool HandleTileKill(GetDataHandlerArgs args) { - var tileX = args.Data.ReadInt32(); - var tileY = args.Data.ReadInt32(); + int flag = args.Data.ReadByte(); + int tileX = args.Data.ReadInt16(); + int tileY = args.Data.ReadInt16(); + if (OnTileKill(tileX, tileY)) return true; if (!TShock.Utils.TilePlacementValid(tileX, tileY) || (args.Player.Dead && TShock.Config.PreventDeadModification)) @@ -2687,7 +2689,7 @@ namespace TShockAPI return true; } - if (Main.tile[tileX, tileY].type != 0x15 && (!TShock.Utils.MaxChests() && Main.tile[tileX, tileY].type != 0)) //Chest + if (flag != 0 && Main.tile[tileX, tileY].type != 21 && (!TShock.Utils.MaxChests() && Main.tile[tileX, tileY].type != 0)) //Chest { args.Player.SendTileSquare(tileX, tileY, 3); return true; @@ -2704,7 +2706,6 @@ namespace TShockAPI args.Player.SendTileSquare(tileX, tileY, 3); return true; } - return false; } From ae2461d05041e81c84b4b099f8ab073bcfd9a859 Mon Sep 17 00:00:00 2001 From: PhoenixICE Date: Sat, 15 Feb 2014 09:05:23 +1100 Subject: [PATCH 008/135] Fix SSC Saving for New Item Slots --- TShockAPI/TSPlayer.cs | 62 ++++++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 21 deletions(-) diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 24525246..d9216f5b 100755 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -1491,9 +1491,19 @@ namespace TShockAPI NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[8].name, player.Index, 67f, (float)Main.player[player.Index].armor[8].prefix, 0f, 0); NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[9].name, player.Index, 68f, (float)Main.player[player.Index].armor[9].prefix, 0f, 0); NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[10].name, player.Index, 69f, (float)Main.player[player.Index].armor[10].prefix, 0f, 0); - NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[0].name, player.Index, 70f, (float)Main.player[player.Index].dye[0].prefix, 0f, 0); - NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[1].name, player.Index, 71f, (float)Main.player[player.Index].dye[1].prefix, 0f, 0); - NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[2].name, player.Index, 72f, (float)Main.player[player.Index].dye[2].prefix, 0f, 0); + NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[11].name, player.Index, 70f, (float)Main.player[player.Index].armor[11].prefix, 0f, 0); + NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[12].name, player.Index, 71f, (float)Main.player[player.Index].armor[12].prefix, 0f, 0); + NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[13].name, player.Index, 72f, (float)Main.player[player.Index].armor[13].prefix, 0f, 0); + NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[14].name, player.Index, 73f, (float)Main.player[player.Index].armor[14].prefix, 0f, 0); + NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[15].name, player.Index, 74f, (float)Main.player[player.Index].armor[15].prefix, 0f, 0); + NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[0].name, player.Index, 75f, (float)Main.player[player.Index].dye[0].prefix, 0f, 0); + NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[1].name, player.Index, 76f, (float)Main.player[player.Index].dye[1].prefix, 0f, 0); + NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[2].name, player.Index, 77f, (float)Main.player[player.Index].dye[2].prefix, 0f, 0); + NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[3].name, player.Index, 78f, (float)Main.player[player.Index].dye[3].prefix, 0f, 0); + NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[4].name, player.Index, 79f, (float)Main.player[player.Index].dye[4].prefix, 0f, 0); + NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[5].name, player.Index, 80f, (float)Main.player[player.Index].dye[5].prefix, 0f, 0); + NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[6].name, player.Index, 81f, (float)Main.player[player.Index].dye[6].prefix, 0f, 0); + NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[7].name, player.Index, 82f, (float)Main.player[player.Index].dye[7].prefix, 0f, 0); NetMessage.SendData(4, -1, -1, player.Name, player.Index, 0f, 0f, 0f, 0); NetMessage.SendData(42, -1, -1, "", player.Index, 0f, 0f, 0f, 0); NetMessage.SendData(16, -1, -1, "", player.Index, 0f, 0f, 0f, 0); @@ -1502,25 +1512,35 @@ namespace TShockAPI { NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].inventory[k].name, player.Index, (float)k, (float)Main.player[player.Index].inventory[k].prefix, 0f, 0); } - NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[0].name, player.Index, 59f, (float)Main.player[player.Index].armor[0].prefix, 0f, 0); - NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[1].name, player.Index, 60f, (float)Main.player[player.Index].armor[1].prefix, 0f, 0); - NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[2].name, player.Index, 61f, (float)Main.player[player.Index].armor[2].prefix, 0f, 0); - NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[3].name, player.Index, 62f, (float)Main.player[player.Index].armor[3].prefix, 0f, 0); - NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[4].name, player.Index, 63f, (float)Main.player[player.Index].armor[4].prefix, 0f, 0); - NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[5].name, player.Index, 64f, (float)Main.player[player.Index].armor[5].prefix, 0f, 0); - NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[6].name, player.Index, 65f, (float)Main.player[player.Index].armor[6].prefix, 0f, 0); - NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[7].name, player.Index, 66f, (float)Main.player[player.Index].armor[7].prefix, 0f, 0); - NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[8].name, player.Index, 67f, (float)Main.player[player.Index].armor[8].prefix, 0f, 0); - NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[9].name, player.Index, 68f, (float)Main.player[player.Index].armor[9].prefix, 0f, 0); - NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[10].name, player.Index, 69f, (float)Main.player[player.Index].armor[10].prefix, 0f, 0); - NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[0].name, player.Index, 70f, (float)Main.player[player.Index].dye[0].prefix, 0f, 0); - NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[1].name, player.Index, 71f, (float)Main.player[player.Index].dye[1].prefix, 0f, 0); - NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[2].name, player.Index, 72f, (float)Main.player[player.Index].dye[2].prefix, 0f, 0); + NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[0].name, player.Index, 59f, (float)Main.player[player.Index].armor[0].prefix, 0f, 0); + NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[1].name, player.Index, 60f, (float)Main.player[player.Index].armor[1].prefix, 0f, 0); + NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[2].name, player.Index, 61f, (float)Main.player[player.Index].armor[2].prefix, 0f, 0); + NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[3].name, player.Index, 62f, (float)Main.player[player.Index].armor[3].prefix, 0f, 0); + NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[4].name, player.Index, 63f, (float)Main.player[player.Index].armor[4].prefix, 0f, 0); + NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[5].name, player.Index, 64f, (float)Main.player[player.Index].armor[5].prefix, 0f, 0); + NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[6].name, player.Index, 65f, (float)Main.player[player.Index].armor[6].prefix, 0f, 0); + NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[7].name, player.Index, 66f, (float)Main.player[player.Index].armor[7].prefix, 0f, 0); + NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[8].name, player.Index, 67f, (float)Main.player[player.Index].armor[8].prefix, 0f, 0); + NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[9].name, player.Index, 68f, (float)Main.player[player.Index].armor[9].prefix, 0f, 0); + NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[10].name, player.Index, 69f, (float)Main.player[player.Index].armor[10].prefix, 0f, 0); + NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[11].name, player.Index, 70f, (float)Main.player[player.Index].armor[11].prefix, 0f, 0); + NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[12].name, player.Index, 71f, (float)Main.player[player.Index].armor[12].prefix, 0f, 0); + NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[13].name, player.Index, 72f, (float)Main.player[player.Index].armor[13].prefix, 0f, 0); + NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[14].name, player.Index, 73f, (float)Main.player[player.Index].armor[14].prefix, 0f, 0); + NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[15].name, player.Index, 74f, (float)Main.player[player.Index].armor[15].prefix, 0f, 0); + NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[0].name, player.Index, 75f, (float)Main.player[player.Index].dye[0].prefix, 0f, 0); + NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[1].name, player.Index, 76f, (float)Main.player[player.Index].dye[1].prefix, 0f, 0); + NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[2].name, player.Index, 77f, (float)Main.player[player.Index].dye[2].prefix, 0f, 0); + NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[3].name, player.Index, 78f, (float)Main.player[player.Index].dye[3].prefix, 0f, 0); + NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[4].name, player.Index, 79f, (float)Main.player[player.Index].dye[4].prefix, 0f, 0); + NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[5].name, player.Index, 80f, (float)Main.player[player.Index].dye[5].prefix, 0f, 0); + NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[6].name, player.Index, 81f, (float)Main.player[player.Index].dye[6].prefix, 0f, 0); + NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[7].name, player.Index, 82f, (float)Main.player[player.Index].dye[7].prefix, 0f, 0); NetMessage.SendData(4, player.Index, -1, player.Name, player.Index, 0f, 0f, 0f, 0); NetMessage.SendData(42, player.Index, -1, "", player.Index, 0f, 0f, 0f, 0); NetMessage.SendData(16, player.Index, -1, "", player.Index, 0f, 0f, 0f, 0); - for (int k = 0; k < 10; k++) + for (int k = 0; k < 22; k++) { player.TPlayer.buffType[k] = 0; } @@ -1531,9 +1551,9 @@ namespace TShockAPI public class NetItem { - public static readonly int maxNetInventory = 73; - public static readonly int armorSlots = 11; - public static readonly int dyeSlots = 3; + public static readonly int maxNetInventory = 83; + public static readonly int armorSlots = 16; + public static readonly int dyeSlots = 8; public int netID; public int stack; public int prefix; From ef72cc4451e4cc6b004be34799c66f041992524b Mon Sep 17 00:00:00 2001 From: MarioE Date: Sun, 16 Feb 2014 09:08:14 -0500 Subject: [PATCH 009/135] Fix NetTile not having ushort Type --- TShockAPI/Net/NetTile.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TShockAPI/Net/NetTile.cs b/TShockAPI/Net/NetTile.cs index e30ca13e..b526acba 100644 --- a/TShockAPI/Net/NetTile.cs +++ b/TShockAPI/Net/NetTile.cs @@ -26,7 +26,7 @@ namespace TShockAPI.Net public class NetTile : IPackable { public bool Active { get; set; } - public byte Type { get; set; } + public ushort Type { get; set; } public short FrameX { get; set; } public short FrameY { get; set; } public bool Lighted { get; set; } @@ -169,7 +169,7 @@ namespace TShockAPI.Net if (Active) { - stream.WriteInt8(Type); + stream.WriteInt16((short)Type); if (FrameImportant) { stream.WriteInt16(FrameX); @@ -211,7 +211,7 @@ namespace TShockAPI.Net Active = flags.HasFlag(TileFlags.Active); if (Active) { - Type = stream.ReadInt8(); + Type = stream.ReadUInt16(); if (FrameImportant) { FrameX = stream.ReadInt16(); From a450bff22f6721ea3e22970afc19c388d1012e85 Mon Sep 17 00:00:00 2001 From: MarioE Date: Sun, 16 Feb 2014 12:29:59 -0500 Subject: [PATCH 010/135] Fix SSC --- TShockAPI/Net/WorldInfoMsg.cs | 6 +- TShockAPI/TSPlayer.cs | 120 +++++++++++++++--------------- TShockAPI/TShock.cs | 133 +++++++++++++++++----------------- 3 files changed, 131 insertions(+), 128 deletions(-) diff --git a/TShockAPI/Net/WorldInfoMsg.cs b/TShockAPI/Net/WorldInfoMsg.cs index 772cb314..9730b88a 100644 --- a/TShockAPI/Net/WorldInfoMsg.cs +++ b/TShockAPI/Net/WorldInfoMsg.cs @@ -33,7 +33,8 @@ namespace TShockAPI.Net DownedBoss3 = 8, HardMode = 16, DownedClown = 32, - ServerSideCharacter = 64 + ServerSideCharacter = 64, + DownedPlantBoss = 128 } [Flags] @@ -46,7 +47,8 @@ namespace TShockAPI.Net DownedMechBossAny = 8, CloudBg = 16, Crimson = 32, - Pumpkin = 64 + PumpkinMoon = 64, + SnowMoon = 128 } public class WorldInfoMsg : BaseMsg diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index d9216f5b..87091889 100755 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -520,65 +520,67 @@ namespace TShockAPI using (var ms = new MemoryStream()) { var msg = new WorldInfoMsg - { - Time = (int) Main.time, - DayTime = Main.dayTime, - MoonPhase = (byte) Main.moonPhase, - BloodMoon = Main.bloodMoon, - MaxTilesX = Main.maxTilesX, - MaxTilesY = Main.maxTilesY, - SpawnX = tilex, - SpawnY = tiley, - WorldSurface = (int) Main.worldSurface, - RockLayer = (int) Main.rockLayer, - //Sending a fake world id causes the client to not be able to find a stored spawnx/y. - //This fixes the bed spawn point bug. With a fake world id it wont be able to find the bed spawn. - WorldID = !fakeid ? Main.worldID : -1, - MoonType = (byte)Main.moonType, - TreeX0 = Main.treeX[0], - TreeX1 = Main.treeX[1], - TreeX2 = Main.treeX[2], - TreeStyle0 = (byte)Main.treeStyle[0], - TreeStyle1 = (byte)Main.treeStyle[1], - TreeStyle2 = (byte)Main.treeStyle[2], - TreeStyle3 = (byte)Main.treeStyle[3], - CaveBackX0 = Main.caveBackX[0], - CaveBackX1 = Main.caveBackX[1], - CaveBackX2 = Main.caveBackX[2], - CaveBackStyle0 = (byte)Main.caveBackStyle[0], - CaveBackStyle1 = (byte)Main.caveBackStyle[1], - CaveBackStyle2 = (byte)Main.caveBackStyle[2], - CaveBackStyle3 = (byte)Main.caveBackStyle[3], - SetBG0 = (byte)WorldGen.treeBG, - SetBG1 = (byte)WorldGen.corruptBG, - SetBG2 = (byte)WorldGen.jungleBG, - SetBG3 = (byte)WorldGen.snowBG, - SetBG4 = (byte)WorldGen.hallowBG, - SetBG5 = (byte)WorldGen.crimsonBG, - SetBG6 = (byte)WorldGen.desertBG, - SetBG7 = (byte)WorldGen.oceanBG, - IceBackStyle = (byte)Main.iceBackStyle, - JungleBackStyle = (byte)Main.jungleBackStyle, - HellBackStyle = (byte)Main.hellBackStyle, - WindSpeed = Main.windSpeed, - NumberOfClouds = (byte)Main.numClouds, - BossFlags = (WorldGen.shadowOrbSmashed ? BossFlags.OrbSmashed : BossFlags.None) | - (NPC.downedBoss1 ? BossFlags.DownedBoss1 : BossFlags.None) | - (NPC.downedBoss2 ? BossFlags.DownedBoss2 : BossFlags.None) | - (NPC.downedBoss3 ? BossFlags.DownedBoss3 : BossFlags.None) | - (Main.hardMode ? BossFlags.HardMode : BossFlags.None) | - (NPC.downedClown ? BossFlags.DownedClown : BossFlags.None) | - (Main.ServerSideCharacter ? BossFlags.ServerSideCharacter : BossFlags.None), - BossFlags2 = (NPC.downedMechBoss1 ? BossFlags2.DownedMechBoss1 : BossFlags2.None) | - (NPC.downedMechBoss2 ? BossFlags2.DownedMechBoss2 : BossFlags2.None) | - (NPC.downedMechBoss3 ? BossFlags2.DownedMechBoss3 : BossFlags2.None) | - (NPC.downedMechBossAny ? BossFlags2.DownedMechBossAny : BossFlags2.None) | - (Main.cloudBGActive == 1f ? BossFlags2.CloudBg : BossFlags2.None) | - (WorldGen.crimson ? BossFlags2.Crimson : BossFlags2.None) | - (Main.pumpkinMoon ? BossFlags2.Pumpkin : BossFlags2.None), - Rain = Main.maxRaining, - WorldName = TShock.Config.UseServerName ? TShock.Config.ServerName : Main.worldName - }; + { + Time = (int)Main.time, + DayTime = Main.dayTime, + MoonPhase = (byte)Main.moonPhase, + BloodMoon = Main.bloodMoon, + MaxTilesX = Main.maxTilesX, + MaxTilesY = Main.maxTilesY, + SpawnX = Main.spawnTileX, + SpawnY = Main.spawnTileY, + WorldSurface = (int)Main.worldSurface, + RockLayer = (int)Main.rockLayer, + //Sending a fake world id causes the client to not be able to find a stored spawnx/y. + //This fixes the bed spawn point bug. With a fake world id it wont be able to find the bed spawn. + WorldID = Main.worldID, + MoonType = (byte)Main.moonType, + TreeX0 = Main.treeX[0], + TreeX1 = Main.treeX[1], + TreeX2 = Main.treeX[2], + TreeStyle0 = (byte)Main.treeStyle[0], + TreeStyle1 = (byte)Main.treeStyle[1], + TreeStyle2 = (byte)Main.treeStyle[2], + TreeStyle3 = (byte)Main.treeStyle[3], + CaveBackX0 = Main.caveBackX[0], + CaveBackX1 = Main.caveBackX[1], + CaveBackX2 = Main.caveBackX[2], + CaveBackStyle0 = (byte)Main.caveBackStyle[0], + CaveBackStyle1 = (byte)Main.caveBackStyle[1], + CaveBackStyle2 = (byte)Main.caveBackStyle[2], + CaveBackStyle3 = (byte)Main.caveBackStyle[3], + SetBG0 = (byte)WorldGen.treeBG, + SetBG1 = (byte)WorldGen.corruptBG, + SetBG2 = (byte)WorldGen.jungleBG, + SetBG3 = (byte)WorldGen.snowBG, + SetBG4 = (byte)WorldGen.hallowBG, + SetBG5 = (byte)WorldGen.crimsonBG, + SetBG6 = (byte)WorldGen.desertBG, + SetBG7 = (byte)WorldGen.oceanBG, + IceBackStyle = (byte)Main.iceBackStyle, + JungleBackStyle = (byte)Main.jungleBackStyle, + HellBackStyle = (byte)Main.hellBackStyle, + WindSpeed = Main.windSpeed, + NumberOfClouds = (byte)Main.numClouds, + BossFlags = (WorldGen.shadowOrbSmashed ? BossFlags.OrbSmashed : BossFlags.None) | + (NPC.downedBoss1 ? BossFlags.DownedBoss1 : BossFlags.None) | + (NPC.downedBoss2 ? BossFlags.DownedBoss2 : BossFlags.None) | + (NPC.downedBoss3 ? BossFlags.DownedBoss3 : BossFlags.None) | + (Main.hardMode ? BossFlags.HardMode : BossFlags.None) | + (NPC.downedClown ? BossFlags.DownedClown : BossFlags.None) | + (Main.ServerSideCharacter ? BossFlags.ServerSideCharacter : BossFlags.None) | + (NPC.downedPlantBoss ? BossFlags.DownedPlantBoss : BossFlags.None), + BossFlags2 = (NPC.downedMechBoss1 ? BossFlags2.DownedMechBoss1 : BossFlags2.None) | + (NPC.downedMechBoss2 ? BossFlags2.DownedMechBoss2 : BossFlags2.None) | + (NPC.downedMechBoss3 ? BossFlags2.DownedMechBoss3 : BossFlags2.None) | + (NPC.downedMechBossAny ? BossFlags2.DownedMechBossAny : BossFlags2.None) | + (Main.cloudBGActive == 1f ? BossFlags2.CloudBg : BossFlags2.None) | + (WorldGen.crimson ? BossFlags2.Crimson : BossFlags2.None) | + (Main.pumpkinMoon ? BossFlags2.PumpkinMoon : BossFlags2.None) | + (Main.snowMoon ? BossFlags2.SnowMoon : BossFlags2.None), + Rain = Main.maxRaining, + WorldName = TShock.Config.UseServerName ? TShock.Config.ServerName : Main.worldName + }; msg.PackFull(ms); SendRawData(ms.ToArray()); } diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 0914a7db..990a92f9 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1359,76 +1359,75 @@ namespace TShockAPI if (e.remoteClient == -1) return; var player = Players[e.remoteClient]; if (player == null) return; - if (Config.UseServerName) + using (var ms = new MemoryStream()) { - using (var ms = new MemoryStream()) + var msg = new WorldInfoMsg { - var msg = new WorldInfoMsg - { - Time = (int)Main.time, - DayTime = Main.dayTime, - MoonPhase = (byte)Main.moonPhase, - BloodMoon = Main.bloodMoon, - MaxTilesX = Main.maxTilesX, - MaxTilesY = Main.maxTilesY, - SpawnX = Main.spawnTileX, - SpawnY = Main.spawnTileY, - WorldSurface = (int)Main.worldSurface, - RockLayer = (int)Main.rockLayer, - //Sending a fake world id causes the client to not be able to find a stored spawnx/y. - //This fixes the bed spawn point bug. With a fake world id it wont be able to find the bed spawn. - WorldID = Main.worldID, - MoonType = (byte)Main.moonType, - TreeX0 = Main.treeX[0], - TreeX1 = Main.treeX[1], - TreeX2 = Main.treeX[2], - TreeStyle0 = (byte)Main.treeStyle[0], - TreeStyle1 = (byte)Main.treeStyle[1], - TreeStyle2 = (byte)Main.treeStyle[2], - TreeStyle3 = (byte)Main.treeStyle[3], - CaveBackX0 = Main.caveBackX[0], - CaveBackX1 = Main.caveBackX[1], - CaveBackX2 = Main.caveBackX[2], - CaveBackStyle0 = (byte)Main.caveBackStyle[0], - CaveBackStyle1 = (byte)Main.caveBackStyle[1], - CaveBackStyle2 = (byte)Main.caveBackStyle[2], - CaveBackStyle3 = (byte)Main.caveBackStyle[3], - SetBG0 = (byte)WorldGen.treeBG, - SetBG1 = (byte)WorldGen.corruptBG, - SetBG2 = (byte)WorldGen.jungleBG, - SetBG3 = (byte)WorldGen.snowBG, - SetBG4 = (byte)WorldGen.hallowBG, - SetBG5 = (byte)WorldGen.crimsonBG, - SetBG6 = (byte)WorldGen.desertBG, - SetBG7 = (byte)WorldGen.oceanBG, - IceBackStyle = (byte)Main.iceBackStyle, - JungleBackStyle = (byte)Main.jungleBackStyle, - HellBackStyle = (byte)Main.hellBackStyle, - WindSpeed = Main.windSpeed, - NumberOfClouds = (byte)Main.numClouds, - BossFlags = (WorldGen.shadowOrbSmashed ? BossFlags.OrbSmashed : BossFlags.None) | - (NPC.downedBoss1 ? BossFlags.DownedBoss1 : BossFlags.None) | - (NPC.downedBoss2 ? BossFlags.DownedBoss2 : BossFlags.None) | - (NPC.downedBoss3 ? BossFlags.DownedBoss3 : BossFlags.None) | - (Main.hardMode ? BossFlags.HardMode : BossFlags.None) | - (NPC.downedClown ? BossFlags.DownedClown : BossFlags.None) | - (Main.ServerSideCharacter ? BossFlags.ServerSideCharacter : BossFlags.None), - BossFlags2 = (NPC.downedMechBoss1 ? BossFlags2.DownedMechBoss1 : BossFlags2.None) | - (NPC.downedMechBoss2 ? BossFlags2.DownedMechBoss2 : BossFlags2.None) | - (NPC.downedMechBoss3 ? BossFlags2.DownedMechBoss3 : BossFlags2.None) | - (NPC.downedMechBossAny ? BossFlags2.DownedMechBossAny : BossFlags2.None) | - (Main.cloudBGActive == 1f ? BossFlags2.CloudBg : BossFlags2.None) | - (WorldGen.crimson ? BossFlags2.Crimson : BossFlags2.None) | - (Main.pumpkinMoon ? BossFlags2.Pumpkin : BossFlags2.None), - Rain = Main.maxRaining, - WorldName = TShock.Config.UseServerName ? TShock.Config.ServerName : Main.worldName - }; - msg.PackFull(ms); - player.SendRawData(ms.ToArray()); - } - e.Handled = true; - return; + Time = (int)Main.time, + DayTime = Main.dayTime, + MoonPhase = (byte)Main.moonPhase, + BloodMoon = Main.bloodMoon, + MaxTilesX = Main.maxTilesX, + MaxTilesY = Main.maxTilesY, + SpawnX = Main.spawnTileX, + SpawnY = Main.spawnTileY, + WorldSurface = (int)Main.worldSurface, + RockLayer = (int)Main.rockLayer, + //Sending a fake world id causes the client to not be able to find a stored spawnx/y. + //This fixes the bed spawn point bug. With a fake world id it wont be able to find the bed spawn. + WorldID = Main.worldID, + MoonType = (byte)Main.moonType, + TreeX0 = Main.treeX[0], + TreeX1 = Main.treeX[1], + TreeX2 = Main.treeX[2], + TreeStyle0 = (byte)Main.treeStyle[0], + TreeStyle1 = (byte)Main.treeStyle[1], + TreeStyle2 = (byte)Main.treeStyle[2], + TreeStyle3 = (byte)Main.treeStyle[3], + CaveBackX0 = Main.caveBackX[0], + CaveBackX1 = Main.caveBackX[1], + CaveBackX2 = Main.caveBackX[2], + CaveBackStyle0 = (byte)Main.caveBackStyle[0], + CaveBackStyle1 = (byte)Main.caveBackStyle[1], + CaveBackStyle2 = (byte)Main.caveBackStyle[2], + CaveBackStyle3 = (byte)Main.caveBackStyle[3], + SetBG0 = (byte)WorldGen.treeBG, + SetBG1 = (byte)WorldGen.corruptBG, + SetBG2 = (byte)WorldGen.jungleBG, + SetBG3 = (byte)WorldGen.snowBG, + SetBG4 = (byte)WorldGen.hallowBG, + SetBG5 = (byte)WorldGen.crimsonBG, + SetBG6 = (byte)WorldGen.desertBG, + SetBG7 = (byte)WorldGen.oceanBG, + IceBackStyle = (byte)Main.iceBackStyle, + JungleBackStyle = (byte)Main.jungleBackStyle, + HellBackStyle = (byte)Main.hellBackStyle, + WindSpeed = Main.windSpeed, + NumberOfClouds = (byte)Main.numClouds, + BossFlags = (WorldGen.shadowOrbSmashed ? BossFlags.OrbSmashed : BossFlags.None) | + (NPC.downedBoss1 ? BossFlags.DownedBoss1 : BossFlags.None) | + (NPC.downedBoss2 ? BossFlags.DownedBoss2 : BossFlags.None) | + (NPC.downedBoss3 ? BossFlags.DownedBoss3 : BossFlags.None) | + (Main.hardMode ? BossFlags.HardMode : BossFlags.None) | + (NPC.downedClown ? BossFlags.DownedClown : BossFlags.None) | + (Main.ServerSideCharacter ? BossFlags.ServerSideCharacter : BossFlags.None) | + (NPC.downedPlantBoss ? BossFlags.DownedPlantBoss : BossFlags.None), + BossFlags2 = (NPC.downedMechBoss1 ? BossFlags2.DownedMechBoss1 : BossFlags2.None) | + (NPC.downedMechBoss2 ? BossFlags2.DownedMechBoss2 : BossFlags2.None) | + (NPC.downedMechBoss3 ? BossFlags2.DownedMechBoss3 : BossFlags2.None) | + (NPC.downedMechBossAny ? BossFlags2.DownedMechBossAny : BossFlags2.None) | + (Main.cloudBGActive == 1f ? BossFlags2.CloudBg : BossFlags2.None) | + (WorldGen.crimson ? BossFlags2.Crimson : BossFlags2.None) | + (Main.pumpkinMoon ? BossFlags2.PumpkinMoon : BossFlags2.None) | + (Main.snowMoon ? BossFlags2.SnowMoon : BossFlags2.None) , + Rain = Main.maxRaining, + WorldName = TShock.Config.UseServerName ? TShock.Config.ServerName : Main.worldName + }; + msg.PackFull(ms); + player.SendRawData(ms.ToArray()); } + e.Handled = true; + return; } else if (e.MsgId == PacketTypes.PlayerHp) { From 7af6d72bc3138c5c3667df933141740927a52085 Mon Sep 17 00:00:00 2001 From: MarioE Date: Sun, 16 Feb 2014 22:25:41 -0500 Subject: [PATCH 011/135] Rewrite SendRawData to trigger SendBytes hooks --- TShockAPI/TSPlayer.cs | 7 +++---- TerrariaServerAPI | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 87091889..40866999 100755 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -887,12 +887,11 @@ namespace TShockAPI NetMessage.SendData((int) msgType, Index, -1, text, ply, number2, number3, number4, number5); } - public virtual bool SendRawData(byte[] data) + public virtual void SendRawData(byte[] data) { if (!RealPlayer || !ConnectionAlive) - return false; - - return TShock.SendBytes(Netplay.serverSock[Index], data); + return; + NetMessage.SendBytes(Netplay.serverSock[Index], data, 0, data.Length, Netplay.serverSock[Index].ServerWriteCallBack, Netplay.serverSock[Index].networkStream); } /// diff --git a/TerrariaServerAPI b/TerrariaServerAPI index 2a967a9d..6bac1465 160000 --- a/TerrariaServerAPI +++ b/TerrariaServerAPI @@ -1 +1 @@ -Subproject commit 2a967a9d6e736fbd1305a02994e79347b23cae9c +Subproject commit 6bac1465ee2dfe7544cb162436f78e3ef1d76bb8 From ccccd641d7bc39c26573a41c474dfac4c318b418 Mon Sep 17 00:00:00 2001 From: CoderCow Date: Mon, 17 Feb 2014 12:19:45 +0100 Subject: [PATCH 012/135] Fixed PlayerInfo packet handling. --- TShockAPI/GetDataHandlers.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 33cd9079..4a30e84f 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -1385,7 +1385,15 @@ namespace TShockAPI var playerid = args.Data.ReadInt8(); var hair = args.Data.ReadInt8(); var male = args.Data.ReadBoolean(); - args.Data.Position += 21; + byte hairDye = args.Data.ReadInt8(); + BitsByte hideVisual = args.Data.ReadInt8(); + Color hairColor = new Color(args.Data.ReadInt8(), args.Data.ReadInt8(), args.Data.ReadInt8()); + Color skinColor = new Color(args.Data.ReadInt8(), args.Data.ReadInt8(), args.Data.ReadInt8()); + Color eyeColor = new Color(args.Data.ReadInt8(), args.Data.ReadInt8(), args.Data.ReadInt8()); + Color shirtColor = new Color(args.Data.ReadInt8(), args.Data.ReadInt8(), args.Data.ReadInt8()); + Color underShirtColor = new Color(args.Data.ReadInt8(), args.Data.ReadInt8(), args.Data.ReadInt8()); + Color pantsColor = new Color(args.Data.ReadInt8(), args.Data.ReadInt8(), args.Data.ReadInt8()); + Color shoeColor = new Color(args.Data.ReadInt8(), args.Data.ReadInt8(), args.Data.ReadInt8()); var difficulty = args.Data.ReadInt8(); string name = Encoding.UTF8.GetString(args.Data.ReadBytes((int) (args.Data.Length - args.Data.Position - 1))); @@ -1402,6 +1410,14 @@ namespace TShockAPI } if (args.Player.ReceivedInfo) { + args.Player.TPlayer.hairDye = hairDye; + + // Since Terraria 1.2.3 these settings can be changed afterwards. + args.Player.TPlayer.shirtColor = shirtColor; + args.Player.TPlayer.shirtColor = shirtColor; + args.Player.TPlayer.underShirtColor = underShirtColor; + args.Player.TPlayer.shoeColor = shoeColor; + args.Player.TPlayer.hideVisual = hideVisual; return true; } if (TShock.Config.MediumcoreOnly && difficulty < 1) From 1fd56011764208c64a95d04a338feca9ad78cfbe Mon Sep 17 00:00:00 2001 From: CoderCow Date: Mon, 17 Feb 2014 12:33:22 +0100 Subject: [PATCH 013/135] Fix to previous commit. --- TShockAPI/GetDataHandlers.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 4a30e84f..f933c81f 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -1410,10 +1410,9 @@ namespace TShockAPI } if (args.Player.ReceivedInfo) { - args.Player.TPlayer.hairDye = hairDye; - // Since Terraria 1.2.3 these settings can be changed afterwards. - args.Player.TPlayer.shirtColor = shirtColor; + args.Player.TPlayer.hairDye = hairDye; + args.Player.TPlayer.pantsColor = pantsColor; args.Player.TPlayer.shirtColor = shirtColor; args.Player.TPlayer.underShirtColor = underShirtColor; args.Player.TPlayer.shoeColor = shoeColor; From 9b07ecaa67550577b72366eb03bcac291a80698e Mon Sep 17 00:00:00 2001 From: CoderCow Date: Mon, 17 Feb 2014 15:23:35 +0100 Subject: [PATCH 014/135] Allowed for ingame hair color changes too. --- TShockAPI/GetDataHandlers.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index f933c81f..5dfdcfb6 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -1410,7 +1410,8 @@ namespace TShockAPI } if (args.Player.ReceivedInfo) { - // Since Terraria 1.2.3 these settings can be changed afterwards. + // Since Terraria 1.2.3 these character properties can change ingame. + args.Player.TPlayer.hairColor = hairColor; args.Player.TPlayer.hairDye = hairDye; args.Player.TPlayer.pantsColor = pantsColor; args.Player.TPlayer.shirtColor = shirtColor; From 0d8d83b1653337133c4a0da56bb790dd7e0226bb Mon Sep 17 00:00:00 2001 From: MarioE Date: Mon, 17 Feb 2014 16:52:10 -0500 Subject: [PATCH 015/135] Fix kick caused by drinking super mana potions --- TShockAPI/GetDataHandlers.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 33cd9079..4281c703 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -1364,12 +1364,6 @@ namespace TShockAPI if (args.Player.FirstMaxMP == 0) args.Player.FirstMaxMP = max; - if (cur < 0 || cur > 400 || max < 0 || max > 200) //Abnormal values have the potential to cause infinite loops in the server. - { - TShock.Utils.ForceKick(args.Player, "Crash Exploit Attempt", true); - return false; - } - if (args.Player.IsLoggedIn) { args.Player.TPlayer.statMana = cur; From ecc6139f5c54d8e63d6a693a850a1076e4f4cc6d Mon Sep 17 00:00:00 2001 From: MarioE Date: Tue, 18 Feb 2014 16:45:09 -0500 Subject: [PATCH 016/135] Tick version --- TShockAPI/Properties/AssemblyInfo.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TShockAPI/Properties/AssemblyInfo.cs b/TShockAPI/Properties/AssemblyInfo.cs index 1ce5b404..33adcd10 100644 --- a/TShockAPI/Properties/AssemblyInfo.cs +++ b/TShockAPI/Properties/AssemblyInfo.cs @@ -28,7 +28,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Nyx Studios & TShock Contributors")] [assembly: AssemblyProduct("TShockAPI")] -[assembly: AssemblyCopyright("Copyright © Nyx Studios 2011-2013")] +[assembly: AssemblyCopyright("Copyright © Nyx Studios 2011-2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -49,5 +49,5 @@ using System.Runtime.InteropServices; // Build Number // MMdd of the build -[assembly: AssemblyVersion("4.2.2.1228")] -[assembly: AssemblyFileVersion("4.2.2.1228")] +[assembly: AssemblyVersion("4.2.2.0218")] +[assembly: AssemblyFileVersion("4.2.2.0218")] From 7d18575d96a0acab95beac7ad76f133ba9fcc429 Mon Sep 17 00:00:00 2001 From: PhoenixICE Date: Mon, 24 Feb 2014 14:27:31 +1100 Subject: [PATCH 017/135] Added BIGINT and expanded log errors --- TShockAPI/DB/IQueryBuilder.cs | 2 ++ TShockAPI/GetDataHandlers.cs | 3 +++ 2 files changed, 5 insertions(+) diff --git a/TShockAPI/DB/IQueryBuilder.cs b/TShockAPI/DB/IQueryBuilder.cs index ac38c86f..60f72a88 100644 --- a/TShockAPI/DB/IQueryBuilder.cs +++ b/TShockAPI/DB/IQueryBuilder.cs @@ -67,6 +67,7 @@ namespace TShockAPI.DB { MySqlDbType.Double, "REAL" }, { MySqlDbType.Int32, "INTEGER" }, { MySqlDbType.Blob, "BLOB" }, + { MySqlDbType.Int64, "BIGINT"}, }; public string DbTypeToString(MySqlDbType type, int? length) @@ -115,6 +116,7 @@ namespace TShockAPI.DB { MySqlDbType.Float, "FLOAT" }, { MySqlDbType.Double, "DOUBLE" }, { MySqlDbType.Int32, "INT" }, + { MySqlDbType.Int64, "BIGINT"}, }; public string DbTypeToString(MySqlDbType type, int? length) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 7746705a..64351603 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -1334,6 +1334,7 @@ namespace TShockAPI if (cur < 0 || cur > 500 || max < 100 || max > 500) //Abnormal values have the potential to cause infinite loops in the server. { TShock.Utils.ForceKick(args.Player, "Crash Exploit Attempt", true); + Log.ConsoleError("HP Exploit Attempt: Current HP {0}, Max HP {0}", cur, max); return true; } @@ -2523,6 +2524,7 @@ namespace TShockAPI if (dmg > 20000) //Abnormal values have the potential to cause infinite loops in the server. { TShock.Utils.ForceKick(args.Player, "Crash Exploit Attempt", true); + Log.ConsoleError("Death Exploit Attempt: Damage {0}", dmg); return false; } @@ -3023,6 +3025,7 @@ namespace TShockAPI if (dmg > 12000) //Abnormal values have the potential to cause infinite loops in the server. { //12000 because Skely Prime Head does 10339 or some bs during the day. TShock.Utils.ForceKick(args.Player, "Crash Exploit Attempt", true); + Log.ConsoleError("Damage Exploit Attempt: Damage {0}", dmg); return false; } From 2a62bf84dfb878e0011bbd9aa0418bcb3ca57266 Mon Sep 17 00:00:00 2001 From: MarioE Date: Mon, 24 Feb 2014 17:04:22 -0500 Subject: [PATCH 018/135] Tick version --- TShockAPI/Properties/AssemblyInfo.cs | 4 ++-- TerrariaServerAPI | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/TShockAPI/Properties/AssemblyInfo.cs b/TShockAPI/Properties/AssemblyInfo.cs index 33adcd10..296beab9 100644 --- a/TShockAPI/Properties/AssemblyInfo.cs +++ b/TShockAPI/Properties/AssemblyInfo.cs @@ -49,5 +49,5 @@ using System.Runtime.InteropServices; // Build Number // MMdd of the build -[assembly: AssemblyVersion("4.2.2.0218")] -[assembly: AssemblyFileVersion("4.2.2.0218")] +[assembly: AssemblyVersion("4.2.2.0224")] +[assembly: AssemblyFileVersion("4.2.2.0224")] diff --git a/TerrariaServerAPI b/TerrariaServerAPI index 6bac1465..32544b40 160000 --- a/TerrariaServerAPI +++ b/TerrariaServerAPI @@ -1 +1 @@ -Subproject commit 6bac1465ee2dfe7544cb162436f78e3ef1d76bb8 +Subproject commit 32544b409a0c40f2be57d27071fd97c36dbe73e4 From 39a81cfa667444b1705522e6d3d38d62ce21ca25 Mon Sep 17 00:00:00 2001 From: CoderCow Date: Wed, 26 Feb 2014 22:24:03 +0100 Subject: [PATCH 019/135] -SSC now saves player hair, hair color, hair dye, cloth colors and accessory visibility. -Fixed hair changes now showing up to other players ingame. --- TShockAPI/DB/CharacterManager.cs | 27 ++++++++++++++++---- TShockAPI/Extensions/DbExt.cs | 32 ++++++++++++++++++++++++ TShockAPI/GetDataHandlers.cs | 1 + TShockAPI/TSPlayer.cs | 35 ++++++++++++++++++++++++++ TShockAPI/Utils.cs | 42 ++++++++++++++++++++++++++++++++ 5 files changed, 132 insertions(+), 5 deletions(-) diff --git a/TShockAPI/DB/CharacterManager.cs b/TShockAPI/DB/CharacterManager.cs index c0c0a6d7..7286c264 100755 --- a/TShockAPI/DB/CharacterManager.cs +++ b/TShockAPI/DB/CharacterManager.cs @@ -19,6 +19,7 @@ along with this program. If not, see . using System; using System.Data; using MySql.Data.MySqlClient; +using Terraria; namespace TShockAPI.DB { @@ -38,7 +39,15 @@ namespace TShockAPI.DB new SqlColumn("MaxMana", MySqlDbType.Int32), new SqlColumn("Inventory", MySqlDbType.Text), new SqlColumn("spawnX", MySqlDbType.Int32), - new SqlColumn("spawnY", MySqlDbType.Int32) + new SqlColumn("spawnY", MySqlDbType.Int32), + new SqlColumn("hair", MySqlDbType.Int32), + new SqlColumn("hairDye", MySqlDbType.Int32), + new SqlColumn("hairColor", MySqlDbType.Int32), + new SqlColumn("pantsColor", MySqlDbType.Int32), + new SqlColumn("shirtColor", MySqlDbType.Int32), + new SqlColumn("underShirtColor", MySqlDbType.Int32), + new SqlColumn("shoeColor", MySqlDbType.Int32), + new SqlColumn("hideVisuals", MySqlDbType.Int32) ); var creator = new SqlTableCreator(db, db.GetSqlType() == SqlType.Sqlite @@ -65,6 +74,14 @@ namespace TShockAPI.DB playerData.inventory = NetItem.Parse(reader.Get("Inventory")); playerData.spawnX = reader.Get("spawnX"); playerData.spawnY = reader.Get("spawnY"); + playerData.hair = reader.Get("hair"); + playerData.hairDye = (byte)reader.Get("hairDye"); + playerData.hairColor = TShock.Utils.DecodeColor(reader.Get("hairColor")); + playerData.pantsColor = TShock.Utils.DecodeColor(reader.Get("pantsColor")); + playerData.shirtColor = TShock.Utils.DecodeColor(reader.Get("shirtColor")); + playerData.underShirtColor = TShock.Utils.DecodeColor(reader.Get("underShirtColor")); + playerData.shoeColor = TShock.Utils.DecodeColor(reader.Get("shoeColor")); + playerData.hideVisuals = TShock.Utils.DecodeBitsByte(reader.Get("hideVisuals")); return playerData; } } @@ -106,8 +123,8 @@ namespace TShockAPI.DB { try { - database.Query("INSERT INTO tsCharacter (Account, Health, MaxHealth, Mana, MaxMana, Inventory, spawnX, spawnY) VALUES (@0, @1, @2, @3, @4, @5, @6, @7);", player.UserID, - playerData.health, playerData.maxHealth, playerData.mana, playerData.maxMana, NetItem.ToString(playerData.inventory), player.TPlayer.SpawnX, player.TPlayer.SpawnY); + database.Query("INSERT INTO tsCharacter (Account, Health, MaxHealth, Mana, MaxMana, Inventory, spawnX, spawnY, hair, hairDye, hairColor, pantsColor, shirtColor, underShirtColor, shoeColor, hideVisuals) VALUES (@0, @1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12, @13, @14);", player.UserID, + playerData.health, playerData.maxHealth, playerData.mana, playerData.maxMana, NetItem.ToString(playerData.inventory), player.TPlayer.SpawnX, player.TPlayer.SpawnY, player.TPlayer.hair, player.TPlayer.hairDye, TShock.Utils.EncodeColor(player.TPlayer.hairColor), TShock.Utils.EncodeColor(player.TPlayer.pantsColor), TShock.Utils.EncodeColor(player.TPlayer.shirtColor), TShock.Utils.EncodeColor(player.TPlayer.underShirtColor), TShock.Utils.EncodeColor(player.TPlayer.shoeColor), TShock.Utils.EncodeBitsByte(player.TPlayer.hideVisual)); return true; } catch (Exception ex) @@ -119,8 +136,8 @@ namespace TShockAPI.DB { try { - database.Query("UPDATE tsCharacter SET Health = @0, MaxHealth = @1, Mana = @2, MaxMana = @3, Inventory = @4, spawnX = @6, spawnY = @7 WHERE Account = @5;", playerData.health, playerData.maxHealth, - playerData.mana, playerData.maxMana, NetItem.ToString(playerData.inventory), player.UserID, player.TPlayer.SpawnX, player.TPlayer.SpawnY); + database.Query("UPDATE tsCharacter SET Health = @0, MaxHealth = @1, Mana = @2, MaxMana = @3, Inventory = @4, spawnX = @6, spawnY = @7, hair = @8, hairDye = @9, hairColor = @10, pantsColor = @11, shirtColor = @12, underShirtColor = @13, shoeColor = @14, hideVisuals = @15 WHERE Account = @5;", playerData.health, playerData.maxHealth, + playerData.mana, playerData.maxMana, NetItem.ToString(playerData.inventory), player.UserID, player.TPlayer.SpawnX, player.TPlayer.SpawnY, player.TPlayer.hair, player.TPlayer.hairDye, TShock.Utils.EncodeColor(player.TPlayer.hairColor), TShock.Utils.EncodeColor(player.TPlayer.pantsColor), TShock.Utils.EncodeColor(player.TPlayer.shirtColor), TShock.Utils.EncodeColor(player.TPlayer.underShirtColor), TShock.Utils.EncodeColor(player.TPlayer.shoeColor), TShock.Utils.EncodeBitsByte(player.TPlayer.hideVisual)); return true; } catch (Exception ex) diff --git a/TShockAPI/Extensions/DbExt.cs b/TShockAPI/Extensions/DbExt.cs index 3f1db5c7..16340719 100644 --- a/TShockAPI/Extensions/DbExt.cs +++ b/TShockAPI/Extensions/DbExt.cs @@ -118,22 +118,42 @@ namespace TShockAPI.DB typeof (bool), (s, i) => s.GetBoolean(i) }, + { + typeof (bool?), + (s, i) => s.IsDBNull(i) ? null : (object)s.GetBoolean(i) + }, { typeof (byte), (s, i) => s.GetByte(i) }, + { + typeof (byte?), + (s, i) => s.IsDBNull(i) ? null : (object)s.GetByte(i) + }, { typeof (Int16), (s, i) => s.GetInt16(i) }, + { + typeof (Int16?), + (s, i) => s.IsDBNull(i) ? null : (object)s.GetInt16(i) + }, { typeof (Int32), (s, i) => s.GetInt32(i) }, + { + typeof (Int32?), + (s, i) => s.IsDBNull(i) ? null : (object)s.GetInt32(i) + }, { typeof (Int64), (s, i) => s.GetInt64(i) }, + { + typeof (Int64?), + (s, i) => s.IsDBNull(i) ? null : (object)s.GetInt64(i) + }, { typeof (string), (s, i) => s.GetString(i) @@ -142,14 +162,26 @@ namespace TShockAPI.DB typeof (decimal), (s, i) => s.GetDecimal(i) }, + { + typeof (decimal?), + (s, i) => s.IsDBNull(i) ? null : (object)s.GetDecimal(i) + }, { typeof (float), (s, i) => s.GetFloat(i) }, + { + typeof (float?), + (s, i) => s.IsDBNull(i) ? null : (object)s.GetFloat(i) + }, { typeof (double), (s, i) => s.GetDouble(i) }, + { + typeof (double?), + (s, i) => s.IsDBNull(i) ? null : (object)s.GetDouble(i) + }, { typeof (object), (s, i) => s.GetValue(i) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 7746705a..305b5053 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -1405,6 +1405,7 @@ namespace TShockAPI if (args.Player.ReceivedInfo) { // Since Terraria 1.2.3 these character properties can change ingame. + args.Player.TPlayer.hair = hair; args.Player.TPlayer.hairColor = hairColor; args.Player.TPlayer.hairDye = hairDye; args.Player.TPlayer.pantsColor = pantsColor; diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 40866999..ea04eca2 100755 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -1274,6 +1274,14 @@ namespace TShockAPI public bool exists; public int spawnX= -1; public int spawnY= -1; + public int? hair; + public byte hairDye; + public Color? hairColor; + public Color? pantsColor; + public Color? shirtColor; + public Color? underShirtColor; + public Color? shoeColor; + public BitsByte? hideVisuals; public PlayerData(TSPlayer player) @@ -1333,6 +1341,15 @@ namespace TShockAPI this.spawnX = player.TPlayer.SpawnX; this.spawnY = player.TPlayer.SpawnY; } + this.hair = player.TPlayer.hair; + this.hairDye = player.TPlayer.hairDye; + this.hairColor = player.TPlayer.hairColor; + this.pantsColor = player.TPlayer.pantsColor; + this.shirtColor = player.TPlayer.shirtColor; + this.underShirtColor = player.TPlayer.underShirtColor; + this.shoeColor = player.TPlayer.shoeColor; + this.hideVisuals = player.TPlayer.hideVisual; + Item[] inventory = player.TPlayer.inventory; Item[] armor = player.TPlayer.armor; Item[] dye = player.TPlayer.dye; @@ -1419,6 +1436,24 @@ namespace TShockAPI player.TPlayer.SpawnY = this.spawnY; player.sX = this.spawnX; player.sY = this.spawnY; + player.TPlayer.hairDye = this.hairDye; + + if (this.hair != null) + player.TPlayer.hair = this.hair.Value; + if (this.hairColor != null) + player.TPlayer.hairColor = this.hairColor.Value; + if (this.pantsColor != null) + player.TPlayer.pantsColor = this.pantsColor.Value; + if (this.shirtColor != null) + player.TPlayer.shirtColor = this.shirtColor.Value; + if (this.underShirtColor != null) + player.TPlayer.underShirtColor = this.underShirtColor.Value; + if (this.shoeColor != null) + player.TPlayer.shoeColor = this.shoeColor.Value; + if (this.hideVisuals != null) + player.TPlayer.hideVisual = this.hideVisuals.Value; + else + player.TPlayer.hideVisual.ClearAll(); for (int i = 0; i < NetItem.maxNetInventory; i++) { diff --git a/TShockAPI/Utils.cs b/TShockAPI/Utils.cs index 5d13d6db..93f8db18 100644 --- a/TShockAPI/Utils.cs +++ b/TShockAPI/Utils.cs @@ -975,5 +975,47 @@ namespace TShockAPI yield return new Point(regionArea.Right, regionArea.Top + y); } } + + public int? EncodeColor(Color? color) + { + if (color == null) + return null; + + return BitConverter.ToInt32(new[] { color.Value.R, color.Value.G, color.Value.B, color.Value.A }, 0); + } + + public Color? DecodeColor(int? encodedColor) + { + if (encodedColor == null) + return null; + + byte[] data = BitConverter.GetBytes(encodedColor.Value); + return new Color(data[0], data[1], data[2], data[3]); + } + + public byte? EncodeBitsByte(BitsByte? bitsByte) + { + if (bitsByte == null) + return null; + + byte result = 0; + for (int i = 0; i < 8; i++) + if (bitsByte.Value[i]) + result |= (byte)(1 << i); + + return result; + } + + public BitsByte? DecodeBitsByte(int? encodedBitsByte) + { + if (encodedBitsByte == null) + return null; + + BitsByte result = new BitsByte(); + for (int i = 0; i < 8; i++) + result[i] = (encodedBitsByte & 1 << i) != 0; + + return result; + } } } From fee116c6df2907f2993032aab4b722532bebe4a9 Mon Sep 17 00:00:00 2001 From: Zack Date: Thu, 27 Feb 2014 21:50:16 -0500 Subject: [PATCH 020/135] Update BanManager.cs Fix uuid arg in constructor --- TShockAPI/DB/BanManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/DB/BanManager.cs b/TShockAPI/DB/BanManager.cs index 6f6adf5b..12bcc19a 100644 --- a/TShockAPI/DB/BanManager.cs +++ b/TShockAPI/DB/BanManager.cs @@ -232,7 +232,7 @@ namespace TShockAPI.DB { IP = ip; Name = name; - UUID = UUID; + UUID = uuid; Reason = reason; BanningUser = banner; Date = date; From 0f3156b4ac7c1db0894805c422d3cc7d91825ba3 Mon Sep 17 00:00:00 2001 From: Zack Piispanen Date: Sun, 2 Mar 2014 19:49:59 -0500 Subject: [PATCH 021/135] Added config to allow the choice for what string starts a command, ie '/login' can become '.login'. Changing this from default will introduce inconsistencies with plugins and help text, you have been warned. --- TShockAPI/Commands.cs | 6 +++--- TShockAPI/ConfigFile.cs | 4 +++- TShockAPI/TShock.cs | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 72e7ff34..19ccd9ed 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -572,14 +572,14 @@ namespace TShockAPI call(new CommandArgs(cmdText, player, args)); return true; } - player.SendErrorMessage("Invalid command entered. Type /help for a list of valid commands."); + player.SendErrorMessage("Invalid command entered. Type {0}help for a list of valid commands.", TShock.Config.CommandSpecifier); return true; } foreach (Command cmd in cmds) { if (!cmd.CanRun(player)) { - TShock.Utils.SendLogs(string.Format("{0} tried to execute /{1}.", player.Name, cmdText), Color.PaleVioletRed, player); + TShock.Utils.SendLogs(string.Format("{0} tried to execute {1}{2}.", player.Name, TShock.Config.CommandSpecifier, cmdText), Color.PaleVioletRed, player); player.SendErrorMessage("You do not have access to this command."); } else if (!cmd.AllowServer && !player.RealPlayer) @@ -589,7 +589,7 @@ namespace TShockAPI else { if (cmd.DoLog) - TShock.Utils.SendLogs(string.Format("{0} executed: /{1}.", player.Name, cmdText), Color.PaleVioletRed, player); + TShock.Utils.SendLogs(string.Format("{0} executed: {1}{2}.", player.Name, TShock.Config.CommandSpecifier, cmdText), Color.PaleVioletRed, player); cmd.Run(cmdText, player, args); } } diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index bebfc148..f2d7b400 100755 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -281,7 +281,9 @@ namespace TShockAPI [Description("Allows anyone to break grass, pots, etc.")] public bool AllowCutTilesAndBreakables = false; - /// + [Description("Specifies which string starts a command")] public string CommandSpecifier = "/"; + + /// /// Reads a configuration file from a given path /// /// string path diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 990a92f9..e1481fd4 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1042,7 +1042,7 @@ namespace TShockAPI return; }*/ - if (args.Text.StartsWith("/") && args.Text.Length > 1) + if (args.Text.StartsWith(Config.CommandSpecifier) && args.Text.Length > 1) { try { From 88ac9be55aeb4fc9b3fa2108a9a8a7fb5ece6595 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 7 Mar 2014 01:19:54 +0400 Subject: [PATCH 022/135] Add can-build check in /grow --- TShockAPI/Commands.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 19ccd9ed..2863be5f 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -4494,6 +4494,13 @@ namespace TShockAPI var name = "Fail"; var x = args.Player.TileX; var y = args.Player.TileY + 3; + + if (!TShock.Regions.CanBuild(x, y, args.Player)) + { + args.Player.SendErrorMessage("You're not allowed to build here!"); + return; + } + switch (args.Parameters[0].ToLower()) { case "tree": From d7a90e6b2c34e32539555ab7a12f9a94086c7f36 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 8 Mar 2014 04:03:27 +0400 Subject: [PATCH 023/135] Change the message --- TShockAPI/Commands.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 2863be5f..81c3336a 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -4497,7 +4497,7 @@ namespace TShockAPI if (!TShock.Regions.CanBuild(x, y, args.Player)) { - args.Player.SendErrorMessage("You're not allowed to build here!"); + args.Player.SendErrorMessage("You have no permission to /grow in this area."); return; } From a6f6af24992fe14d64694b66397216e4e8312e5e Mon Sep 17 00:00:00 2001 From: Enerdy Date: Sat, 8 Mar 2014 00:40:36 +0000 Subject: [PATCH 024/135] Added string[] HelpDesc to Command. Can be used optionally by devs to create a multi-line, detailed version of HelpText. If HelpDesc is given a value, the command's HelpText won't show. --- TShockAPI/Commands.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 19ccd9ed..6e37f61b 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -69,6 +69,10 @@ namespace TShockAPI /// Gets or sets the help text of this command. /// public string HelpText { get; set; } + /// + /// Gets or sets an extended description of this command. + /// + public string[] HelpDesc { get; set; } /// /// Gets the name of the command. /// @@ -118,6 +122,7 @@ namespace TShockAPI CommandDelegate = cmd; DoLog = true; HelpText = "No help available."; + HelpDesc = null; Names = new List(names); Permissions = new List(); } @@ -3608,7 +3613,15 @@ namespace TShockAPI } args.Player.SendSuccessMessage("/{0} help: ", command.Name); - args.Player.SendInfoMessage(command.HelpText); + if (command.HelpDesc == null) + { + args.Player.SendInfoMessage(command.HelpText); + return; + } + foreach (string line in command.HelpDesc) + { + args.Player.SendInfoMessage(line); + } } } From 65d3b973cb4dd1367a19418e66eb20b1458d2a19 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 8 Mar 2014 06:19:27 +0400 Subject: [PATCH 025/135] You're not allowed to change tiles here --- TShockAPI/Commands.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 81c3336a..cc679441 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -4497,7 +4497,7 @@ namespace TShockAPI if (!TShock.Regions.CanBuild(x, y, args.Player)) { - args.Player.SendErrorMessage("You have no permission to /grow in this area."); + args.Player.SendErrorMessage("You're not allowed to change tiles here!"); return; } From 4e93d8d30e3a6d50827a880cea1b0da8cd18de25 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 6 Apr 2014 22:29:59 +0400 Subject: [PATCH 026/135] Add DoorUse handler Fixes exploit hopefully --- TShockAPI/GetDataHandlers.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index f590ce5a..87abb97d 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -1242,7 +1242,8 @@ namespace TShockAPI {PacketTypes.Teleport, HandleTeleport}, {PacketTypes.PaintTile, HandlePaintTile}, {PacketTypes.PaintWall, HandlePaintWall}, - {PacketTypes.Placeholder, HandleRaptor} + {PacketTypes.Placeholder, HandleRaptor}, + {PacketTypes.DoorUse, HandleDoorUse} }; } @@ -3547,5 +3548,20 @@ namespace TShockAPI return true; } } + + private static bool HandleDoorUse(GetDataHandlerArgs e) + { + var Close = e.Data.ReadByte(); + var X = e.Data.ReadInt32(); + var Y = e.Data.ReadInt32(); + + if (X >= Main.tile.GetLength(0) || Y >= Main.tile.GetLength(1) || X < 0 || Y < 0) // Check for out of range + return true; + + if (Main.tile[X, Y].type != 10 && Main.tile[X, Y].type != 11) // Check for tile types + return true; + + return false; + } } } From b3f8ec62c971f00fccb05a3dc0594b725b1b1859 Mon Sep 17 00:00:00 2001 From: Ijwu Date: Wed, 9 Apr 2014 17:56:02 -0400 Subject: [PATCH 027/135] Fixes ItemDrop exploits. --- TShockAPI/GetDataHandlers.cs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 87abb97d..4709ee21 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2976,17 +2976,31 @@ namespace TShockAPI if (OnItemDrop(id, pos, vel, stacks, prefix, noDelay, type)) return true; - // player is attempting to crash clients + // player is attempting to crash clients if (type < -48 || type >= Main.maxItemTypes) { + args.Player.SendData(PacketTypes.ItemDrop, "", id); return true; } - if (type == 0) //Item removed, let client do this to prevent item duplication client side + + if (prefix > Item.maxPrefixes) //make sure the prefix is a legit value + { + args.Player.SendData(PacketTypes.ItemDrop, "", id); + return true; + } + + if (TShock.CheckRangePermission(args.Player, (int)(pos.X / 16f), (int)(pos.Y / 16f))) + { + args.Player.SendData(PacketTypes.ItemDrop, "", id); + return true; + } + + if (type == 0) //Item removed, let client do this to prevent item duplication client side (but only if it passed the range check above) { return false; } - if (TShock.CheckRangePermission(args.Player, (int) (pos.X/16f), (int) (pos.Y/16f))) + if (Main.item[id].active && Main.item[id].netID != type) //stop the client from changing the item type of a drop but only if the client isn't picking up the item { args.Player.SendData(PacketTypes.ItemDrop, "", id); return true; From eb7f66b986a6dff95d535e09f87526d983a7ba10 Mon Sep 17 00:00:00 2001 From: Zack Date: Wed, 9 Apr 2014 18:01:18 -0400 Subject: [PATCH 028/135] Tick version --- TShockAPI/Properties/AssemblyInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TShockAPI/Properties/AssemblyInfo.cs b/TShockAPI/Properties/AssemblyInfo.cs index 296beab9..e41e4a93 100644 --- a/TShockAPI/Properties/AssemblyInfo.cs +++ b/TShockAPI/Properties/AssemblyInfo.cs @@ -49,5 +49,5 @@ using System.Runtime.InteropServices; // Build Number // MMdd of the build -[assembly: AssemblyVersion("4.2.2.0224")] -[assembly: AssemblyFileVersion("4.2.2.0224")] +[assembly: AssemblyVersion("4.2.2.0409")] +[assembly: AssemblyFileVersion("4.2.2.0409")] From 61d05ffdc6b3fb9544be72d333585a8aace835da Mon Sep 17 00:00:00 2001 From: Zack Piispanen Date: Wed, 9 Apr 2014 18:37:41 -0400 Subject: [PATCH 029/135] Fix range check on item clearing to refer to the Main.item[] being cleared and not the fake coordinates being sent by the client. --- TShockAPI/GetDataHandlers.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 4709ee21..ae11532a 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2989,17 +2989,23 @@ namespace TShockAPI return true; } + if (type == 0) //Item removed, let client do this to prevent item duplication client side (but only if it passed the range check) + { + if (TShock.CheckRangePermission(args.Player, (int)(Main.item[id].position.X / 16f), (int)(Main.item[id].position.Y / 16f))) + { + args.Player.SendData(PacketTypes.ItemDrop, "", id); + return true; + } + + return false; + } + if (TShock.CheckRangePermission(args.Player, (int)(pos.X / 16f), (int)(pos.Y / 16f))) { args.Player.SendData(PacketTypes.ItemDrop, "", id); return true; } - if (type == 0) //Item removed, let client do this to prevent item duplication client side (but only if it passed the range check above) - { - return false; - } - if (Main.item[id].active && Main.item[id].netID != type) //stop the client from changing the item type of a drop but only if the client isn't picking up the item { args.Player.SendData(PacketTypes.ItemDrop, "", id); From 84d8049ac699f0549bbcff956f1c1a62d0144022 Mon Sep 17 00:00:00 2001 From: Zack Piispanen Date: Fri, 11 Apr 2014 13:44:47 -0400 Subject: [PATCH 030/135] Add projectile bans and the commands needed to set them up. --- TShockAPI/Commands.cs | 186 +++++++++++++++++++++- TShockAPI/DB/ProjectileManager.cs | 253 ++++++++++++++++++++++++++++++ TShockAPI/GetDataHandlers.cs | 10 +- TShockAPI/Permissions.cs | 6 + TShockAPI/TShock.cs | 2 + TShockAPI/TShockAPI.csproj | 3 +- 6 files changed, 456 insertions(+), 4 deletions(-) create mode 100644 TShockAPI/DB/ProjectileManager.cs diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 547b0711..261df60c 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -235,6 +235,10 @@ namespace TShockAPI { HelpText = "Manages item bans." }); + add(new Command(Permissions.manageprojectile, ProjectileBan, "projban") + { + HelpText = "Manages item bans." + }); add(new Command(Permissions.manageregion, Region, "region") { HelpText = "Manages regions." @@ -2769,9 +2773,187 @@ namespace TShockAPI } #endregion Item Management - #region Server Config Commands + #region Projectile Management - private static void SetSpawn(CommandArgs args) + private static void ProjectileBan(CommandArgs args) + { + if (args.Parameters.Count == 0) + { + args.Player.SendInfoMessage("Invalid syntax! Proper syntax: /projban [arguments]"); + args.Player.SendInfoMessage("Commands: add, allow, del, disallow, list"); + args.Player.SendInfoMessage("Arguments: add , allow "); + args.Player.SendInfoMessage("Arguments: del , disallow , list [page]"); + return; + } + + switch (args.Parameters[0].ToLower()) + { + case "add": + #region Add projectile + { + if (args.Parameters.Count != 2) + { + args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /projban add "); + return; + } + short id; + if (Int16.TryParse(args.Parameters[1], out id)) + { + TShock.ProjectileBans.AddNewBan(id); + args.Player.SendSuccessMessage("Banned Projectile: " + id + "."); + return; + } + else + { + args.Player.SendErrorMessage("Invalid syntax! Projectile Id must be a number."); + return; + } + + } + #endregion + return; + case "allow": + #region Allow group to projectile + { + if (args.Parameters.Count != 3) + { + args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /projban allow "); + return; + } + + short id; + if (Int16.TryParse(args.Parameters[1], out id)) + { + if (!TShock.Groups.GroupExists(args.Parameters[2])) + { + args.Player.SendErrorMessage("Invalid group."); + return; + } + + ProjectileBan ban = TShock.ProjectileBans.GetBanById(id); + if (ban == null) + { + args.Player.SendErrorMessage("Projectile " + id + " is not banned."); + return; + } + if (!ban.AllowedGroups.Contains(args.Parameters[2])) + { + TShock.ProjectileBans.AllowGroup(id, args.Parameters[2]); + args.Player.SendSuccessMessage(String.Format("{0} has been allowed to use projectile {1}.", args.Parameters[2], id)); + return; + } + else + { + args.Player.SendWarningMessage(String.Format("{0} is already allowed to use projectile {1}.", args.Parameters[2], id)); + return; + } + } + else + { + args.Player.SendErrorMessage("Invalid syntax! Projectile Id must be a number."); + return; + } + } + #endregion + + case "del": + #region Delete item + { + if (args.Parameters.Count != 2) + { + args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /projban del "); + return; + } + + short id; + if (Int16.TryParse(args.Parameters[1], out id)) + { + TShock.ProjectileBans.RemoveBan(id); + args.Player.SendSuccessMessage("Unbanned Projectile: " + id + "."); + return; + } + else + { + args.Player.SendErrorMessage("Invalid syntax! Projectile Id must be a number."); + return; + } + } + #endregion + return; + case "disallow": + #region Allow group to item + { + if (args.Parameters.Count != 3) + { + args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /projban disallow "); + return; + } + + short id; + if (Int16.TryParse(args.Parameters[1], out id)) + { + if (!TShock.Groups.GroupExists(args.Parameters[2])) + { + args.Player.SendErrorMessage("Invalid group."); + return; + } + + ProjectileBan ban = TShock.ProjectileBans.GetBanById(id); + if (ban == null) + { + args.Player.SendErrorMessage("Projectile " + id + " is not banned."); + return; + } + if (ban.AllowedGroups.Contains(args.Parameters[2])) + { + TShock.ProjectileBans.RemoveGroup(id, args.Parameters[2]); + args.Player.SendSuccessMessage(String.Format("{0} has been disallowed from using projectile {1}.", args.Parameters[2], id)); + return; + } + else + { + args.Player.SendWarningMessage(String.Format("{0} is already prevented from using projectile {1}.", args.Parameters[2], id)); + return; + } + } + else + { + args.Player.SendErrorMessage("Invalid syntax! Projectile Id must be a number."); + return; + } + } + #endregion + return; + case "help": + args.Player.SendInfoMessage("Syntax: /projban [arguments]"); + args.Player.SendInfoMessage("Commands: add, allow, del, disallow, list"); + args.Player.SendInfoMessage("Arguments: add , allow "); + args.Player.SendInfoMessage("Arguments: del , disallow , list [page]"); + return; + case "list": + #region List items + int pageNumber; + if (!PaginationTools.TryParsePageNumber(args.Parameters, 1, args.Player, out pageNumber)) + return; + IEnumerable projectileIds = from projectileBan in TShock.ProjectileBans.ProjectileBans + select projectileBan.ID; + PaginationTools.SendPage(args.Player, pageNumber, PaginationTools.BuildLinesFromTerms(projectileIds), + new PaginationTools.Settings + { + HeaderFormat = "Projectile bans ({0}/{1}):", + FooterFormat = "Type /Projectile list {0} for more.", + NothingToDisplayString = "There are currently no banned projectiles." + }); + #endregion + return; + } + } + + #endregion Projectile Management + + #region Server Config Commands + + private static void SetSpawn(CommandArgs args) { Main.spawnTileX = args.Player.TileX + 1; Main.spawnTileY = args.Player.TileY + 3; diff --git a/TShockAPI/DB/ProjectileManager.cs b/TShockAPI/DB/ProjectileManager.cs new file mode 100644 index 00000000..961baacf --- /dev/null +++ b/TShockAPI/DB/ProjectileManager.cs @@ -0,0 +1,253 @@ +/* +TShock, a server mod for Terraria +Copyright (C) 2011-2013 Nyx Studios (fka. The TShock Team) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using MySql.Data.MySqlClient; + +namespace TShockAPI.DB +{ + public class ProjectileManagager + { + private IDbConnection database; + public List ProjectileBans = new List(); + + public ProjectileManagager(IDbConnection db) + { + database = db; + + var table = new SqlTable("ProjectileBans", + new SqlColumn("ProjectileID", MySqlDbType.Int32) { Primary = true }, + new SqlColumn("AllowedGroups", MySqlDbType.Text) + ); + var creator = new SqlTableCreator(db, + db.GetSqlType() == SqlType.Sqlite + ? (IQueryBuilder)new SqliteQueryCreator() + : new MysqlQueryCreator()); + creator.EnsureExists(table); + UpdateBans(); + } + + public void UpdateBans() + { + ProjectileBans.Clear(); + + using (var reader = database.QueryReader("SELECT * FROM ProjectileBans")) + { + while (reader != null && reader.Read()) + { + ProjectileBan ban = new ProjectileBan((short)reader.Get("ProjectileID")); + ban.SetAllowedGroups(reader.Get("AllowedGroups")); + ProjectileBans.Add(ban); + } + } + } + + public void AddNewBan(short id = 0) + { + try + { + database.Query("INSERT INTO ProjectileBans (ProjectileID, AllowedGroups) VALUES (@0, @1);", + id, ""); + + if (!ProjectileIsBanned(id, null)) + ProjectileBans.Add(new ProjectileBan(id)); + } + catch (Exception ex) + { + Log.Error(ex.ToString()); + } + } + + public void RemoveBan(short id) + { + if (!ProjectileIsBanned(id, null)) + return; + try + { + database.Query("DELETE FROM ProjectileBans WHERE ProjectileId=@0;", id); + ProjectileBans.Remove(new ProjectileBan(id)); + } + catch (Exception ex) + { + Log.Error(ex.ToString()); + } + } + + public bool ProjectileIsBanned(short id) + { + if (ProjectileBans.Contains(new ProjectileBan(id))) + { + return true; + } + return false; + } + + public bool ProjectileIsBanned(short id, TSPlayer ply) + { + if (ProjectileBans.Contains(new ProjectileBan(id))) + { + ProjectileBan b = GetBanById(id); + return !b.HasPermissionToCreateProjectile(ply); + } + return false; + } + + public bool AllowGroup(short id, string name) + { + string groupsNew = ""; + ProjectileBan b = GetBanById(id); + if (b != null) + { + try + { + groupsNew = String.Join(",", b.AllowedGroups); + if (groupsNew.Length > 0) + groupsNew += ","; + groupsNew += name; + b.SetAllowedGroups(groupsNew); + + int q = database.Query("UPDATE ProjectileBans SET AllowedGroups=@0 WHERE ProjectileId=@1", groupsNew, + id); + + return q > 0; + } + catch (Exception ex) + { + Log.Error(ex.ToString()); + } + } + + return false; + } + + public bool RemoveGroup(short id, string group) + { + ProjectileBan b = GetBanById(id); + if (b != null) + { + try + { + b.RemoveGroup(group); + string groups = string.Join(",", b.AllowedGroups); + int q = database.Query("UPDATE ProjectileBans SET AllowedGroups=@0 WHERE ProjectileId=@1", groups, + id); + + if (q > 0) + return true; + } + catch (Exception ex) + { + Log.Error(ex.ToString()); + } + } + return false; + } + + public ProjectileBan GetBanById(short id) + { + foreach (ProjectileBan b in ProjectileBans) + { + if (b.ID == id) + { + return b; + } + } + return null; + } + } + + public class ProjectileBan : IEquatable + { + public short ID { get; set; } + public List AllowedGroups { get; set; } + + public ProjectileBan(short id) + : this() + { + ID = id; + AllowedGroups = new List(); + } + + public ProjectileBan() + { + ID = 0; + AllowedGroups = new List(); + } + + public bool Equals(ProjectileBan other) + { + return ID == other.ID; + } + + public bool HasPermissionToCreateProjectile(TSPlayer ply) + { + if (ply == null) + return false; + + if (ply.Group.HasPermission(Permissions.canusebannedprojectiles)) + return true; + + var cur = ply.Group; + var traversed = new List(); + while (cur != null) + { + if (AllowedGroups.Contains(cur.Name)) + { + return true; + } + if (traversed.Contains(cur)) + { + throw new InvalidOperationException("Infinite group parenting ({0})".SFormat(cur.Name)); + } + traversed.Add(cur); + cur = cur.Parent; + } + return false; + // could add in the other permissions in this class instead of a giant if switch. + } + + public void SetAllowedGroups(String groups) + { + // prevent null pointer exceptions + if (!string.IsNullOrEmpty(groups)) + { + List groupArr = groups.Split(',').ToList(); + + for (int i = 0; i < groupArr.Count; i++) + { + groupArr[i] = groupArr[i].Trim(); + //Console.WriteLine(groupArr[i]); + } + AllowedGroups = groupArr; + } + } + + public bool RemoveGroup(string groupName) + { + return AllowedGroups.Remove(groupName); + } + + public override string ToString() + { + return ID + (AllowedGroups.Count > 0 ? " (" + String.Join(",", AllowedGroups) + ")" : ""); + } + } +} \ No newline at end of file diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index ae11532a..4c5e40b1 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2393,9 +2393,17 @@ namespace TShockAPI if (index > Main.maxProjectiles || index < 0) { - return false; + args.Player.RemoveProjectile(ident, owner); + return true; } + if (TShock.ProjectileBans.ProjectileIsBanned(type, args.Player)) + { + args.Player.Disable("Player does not have permission to create that projectile.", true); + args.Player.SendErrorMessage("You do not have permission to create that projectile."); + args.Player.RemoveProjectile(ident, owner); + return false; + } // Server now checks owner + ident, if owner is different, server will create new projectile. /*if (args.Player.Index != owner) { diff --git a/TShockAPI/Permissions.cs b/TShockAPI/Permissions.cs index 4f7d68f4..32d85331 100644 --- a/TShockAPI/Permissions.cs +++ b/TShockAPI/Permissions.cs @@ -64,6 +64,9 @@ namespace TShockAPI [Description("User can manage item bans.")] public static readonly string manageitem = "tshock.admin.itemban"; + [Description("User can manage projectile bans.")] + public static readonly string manageprojectile = "tshock.admin.projectileban"; + [Description("User can manage groups.")] public static readonly string managegroup = "tshock.admin.group"; @@ -322,6 +325,9 @@ namespace TShockAPI [Description("Player can chat")] public static readonly string canchat = "tshock.canchat"; + [Description("Player can use banned projectiles.")] + public static readonly string canusebannedprojectiles = "tshock.projectiles.usebanned"; + /// /// Lists all commands associated with a given permission /// diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index e1481fd4..aee1cac3 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -62,6 +62,7 @@ namespace TShockAPI public static GroupManager Groups; public static UserManager Users; public static ItemManager Itembans; + public static ProjectileManagager ProjectileBans; public static RememberedPosManager RememberedPos; public static CharacterManager CharacterDB; public static ConfigFile Config { get; set; } @@ -223,6 +224,7 @@ namespace TShockAPI Users = new UserManager(DB); Groups = new GroupManager(DB); Itembans = new ItemManager(DB); + ProjectileBans = new ProjectileManagager(DB); RememberedPos = new RememberedPosManager(DB); CharacterDB = new CharacterManager(DB); RestApi = new SecureRest(Netplay.serverListenIP, Config.RestApiPort); diff --git a/TShockAPI/TShockAPI.csproj b/TShockAPI/TShockAPI.csproj index 3ebc9d93..6b931512 100644 --- a/TShockAPI/TShockAPI.csproj +++ b/TShockAPI/TShockAPI.csproj @@ -72,6 +72,7 @@ + @@ -179,7 +180,7 @@ - + - \ No newline at end of file diff --git a/UnitTests/UnitTests.licenseheader b/UnitTests/UnitTests.licenseheader deleted file mode 100644 index 12ed0ea9..00000000 --- a/UnitTests/UnitTests.licenseheader +++ /dev/null @@ -1,18 +0,0 @@ -extensions: .cs -/* -TShock, a server mod for Terraria -Copyright (C) 2011-2012 The TShock Team - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ \ No newline at end of file From 1421c23df7fd41b4130f2a422dc4b83344bc426c Mon Sep 17 00:00:00 2001 From: Zack Piispanen Date: Wed, 3 Sep 2014 02:48:57 -0400 Subject: [PATCH 117/135] Remove crappy spaces in this file. --- TShockAPI/DB/RegionManager.cs | 198 +++++++++++++++++----------------- 1 file changed, 99 insertions(+), 99 deletions(-) diff --git a/TShockAPI/DB/RegionManager.cs b/TShockAPI/DB/RegionManager.cs index dd6d73e2..7fc6173d 100644 --- a/TShockAPI/DB/RegionManager.cs +++ b/TShockAPI/DB/RegionManager.cs @@ -39,22 +39,22 @@ namespace TShockAPI.DB database = db; var table = new SqlTable("Regions", new SqlColumn("Id", MySqlDbType.Int32) {Primary = true, AutoIncrement = true}, - new SqlColumn("X1", MySqlDbType.Int32), - new SqlColumn("Y1", MySqlDbType.Int32), - new SqlColumn("width", MySqlDbType.Int32), - new SqlColumn("height", MySqlDbType.Int32), - new SqlColumn("RegionName", MySqlDbType.VarChar, 50) {Unique = true}, + new SqlColumn("X1", MySqlDbType.Int32), + new SqlColumn("Y1", MySqlDbType.Int32), + new SqlColumn("width", MySqlDbType.Int32), + new SqlColumn("height", MySqlDbType.Int32), + new SqlColumn("RegionName", MySqlDbType.VarChar, 50) {Unique = true}, new SqlColumn("WorldID", MySqlDbType.Text) {Unique = true}, - new SqlColumn("UserIds", MySqlDbType.Text), - new SqlColumn("Protected", MySqlDbType.Int32), - new SqlColumn("Groups", MySqlDbType.Text), - new SqlColumn("Owner", MySqlDbType.VarChar, 50), - new SqlColumn("Z", MySqlDbType.Int32){ DefaultValue = "0" } + new SqlColumn("UserIds", MySqlDbType.Text), + new SqlColumn("Protected", MySqlDbType.Int32), + new SqlColumn("Groups", MySqlDbType.Text), + new SqlColumn("Owner", MySqlDbType.VarChar, 50), + new SqlColumn("Z", MySqlDbType.Int32){ DefaultValue = "0" } ); var creator = new SqlTableCreator(db, - db.GetSqlType() == SqlType.Sqlite - ? (IQueryBuilder) new SqliteQueryCreator() - : new MysqlQueryCreator()); + db.GetSqlType() == SqlType.Sqlite + ? (IQueryBuilder) new SqliteQueryCreator() + : new MysqlQueryCreator()); creator.EnsureExists(table); } @@ -79,7 +79,7 @@ namespace TShockAPI.DB string name = reader.Get("RegionName"); string owner = reader.Get("Owner"); string groups = reader.Get("Groups"); - int z = reader.Get("Z"); + int z = reader.Get("Z"); string[] splitids = mergedids.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries); @@ -157,7 +157,7 @@ namespace TShockAPI.DB try { database.Query("UPDATE Regions SET Protected=@0 WHERE RegionName=@1 AND WorldID=@2", state ? 1 : 0, name, - Main.worldID.ToString()); + Main.worldID.ToString()); var region = GetRegionByName(name); if (region != null) region.DisableBuild = state; @@ -193,26 +193,26 @@ namespace TShockAPI.DB { return false; } - Region top = null; + Region top = null; - foreach (Region region in Regions.ToList()) - { - if (region.InArea(x, y)) - { - if (top == null || region.Z > top.Z) - top = region; - } - } - return top == null || top.HasPermissionToBuildInRegion(ply); + foreach (Region region in Regions.ToList()) + { + if (region.InArea(x, y)) + { + if (top == null || region.Z > top.Z) + top = region; + } + } + return top == null || top.HasPermissionToBuildInRegion(ply); } public bool InArea(int x, int y) { - foreach (Region region in Regions.ToList()) + foreach (Region region in Regions.ToList()) { if (x >= region.Area.Left && x <= region.Area.Right && - y >= region.Area.Top && y <= region.Area.Bottom && - region.DisableBuild) + y >= region.Area.Top && y <= region.Area.Bottom && + region.DisableBuild) { return true; } @@ -220,35 +220,35 @@ namespace TShockAPI.DB return false; } - public List InAreaRegionName(int x, int y) - { - List regions = new List() { }; - foreach (Region region in Regions.ToList()) - { - if (x >= region.Area.Left && x <= region.Area.Right && - y >= region.Area.Top && y <= region.Area.Bottom && - region.DisableBuild) - { - regions.Add(region.Name); - } - } - return regions; - } + public List InAreaRegionName(int x, int y) + { + List regions = new List() { }; + foreach (Region region in Regions.ToList()) + { + if (x >= region.Area.Left && x <= region.Area.Right && + y >= region.Area.Top && y <= region.Area.Bottom && + region.DisableBuild) + { + regions.Add(region.Name); + } + } + return regions; + } - public List InAreaRegion(int x, int y) - { - List regions = new List() { }; - foreach (Region region in Regions.ToList()) - { - if (x >= region.Area.Left && x <= region.Area.Right && - y >= region.Area.Top && y <= region.Area.Bottom && - region.DisableBuild) - { - regions.Add(region); - } - } - return regions; - } + public List InAreaRegion(int x, int y) + { + List regions = new List() { }; + foreach (Region region in Regions.ToList()) + { + if (x >= region.Area.Left && x <= region.Area.Right && + y >= region.Area.Top && y <= region.Area.Bottom && + region.DisableBuild) + { + regions.Add(region); + } + } + return regions; + } public static List ListIDs(string MergedIDs) { @@ -269,7 +269,7 @@ namespace TShockAPI.DB try { using (var reader = database.QueryReader("SELECT X1, Y1, height, width FROM Regions WHERE RegionName=@0 AND WorldID=@1", - regionName, Main.worldID.ToString())) + regionName, Main.worldID.ToString())) { if (reader.Read()) { @@ -321,7 +321,7 @@ namespace TShockAPI.DB r.RemoveID(TShock.Users.GetUserID(userName)); string ids = string.Join(",", r.AllowedIDs); int q = database.Query("UPDATE Regions SET UserIds=@0 WHERE RegionName=@1 AND WorldID=@2", ids, - regionName, Main.worldID.ToString()); + regionName, Main.worldID.ToString()); if (q > 0) return true; } @@ -335,7 +335,7 @@ namespace TShockAPI.DB string mergedIDs = string.Empty; using ( var reader = database.QueryReader("SELECT UserIds FROM Regions WHERE RegionName=@0 AND WorldID=@1", regionName, - Main.worldID.ToString())) + Main.worldID.ToString())) { if (reader.Read()) mergedIDs = reader.Get("UserIds"); @@ -353,7 +353,7 @@ namespace TShockAPI.DB mergedIDs = string.Concat(mergedIDs, ",", userIdToAdd); int q = database.Query("UPDATE Regions SET UserIds=@0 WHERE RegionName=@1 AND WorldID=@2", mergedIDs, - regionName, Main.worldID.ToString()); + regionName, Main.worldID.ToString()); foreach (var r in Regions) { if (r.Name == regionName && r.WorldID == Main.worldID.ToString()) @@ -430,7 +430,7 @@ namespace TShockAPI.DB { region.Owner = newOwner; int q = database.Query("UPDATE Regions SET Owner=@0 WHERE RegionName=@1 AND WorldID=@2", newOwner, - regionName, Main.worldID.ToString()); + regionName, Main.worldID.ToString()); if (q > 0) return true; } @@ -442,7 +442,7 @@ namespace TShockAPI.DB string mergedGroups = ""; using ( var reader = database.QueryReader("SELECT Groups FROM Regions WHERE RegionName=@0 AND WorldID=@1", regionName, - Main.worldID.ToString())) + Main.worldID.ToString())) { if (reader.Read()) mergedGroups = reader.Get("Groups"); @@ -458,7 +458,7 @@ namespace TShockAPI.DB mergedGroups += groupName; int q = database.Query("UPDATE Regions SET Groups=@0 WHERE RegionName=@1 AND WorldID=@2", mergedGroups, - regionName, Main.worldID.ToString()); + regionName, Main.worldID.ToString()); Region r = GetRegionByName(regionName); if (r != null) @@ -481,47 +481,47 @@ namespace TShockAPI.DB r.RemoveGroup(group); string groups = string.Join(",", r.AllowedGroups); int q = database.Query("UPDATE Regions SET Groups=@0 WHERE RegionName=@1 AND WorldID=@2", groups, - regionName, Main.worldID.ToString()); + regionName, Main.worldID.ToString()); if (q > 0) return true; } return false; } - public Region GetTopRegion( List regions ) - { - Region ret = null; - foreach( Region r in regions) - { - if (ret == null) - ret = r; - else - { - if (r.Z > ret.Z) - ret = r; - } - } - return ret; - } + public Region GetTopRegion( List regions ) + { + Region ret = null; + foreach( Region r in regions) + { + if (ret == null) + ret = r; + else + { + if (r.Z > ret.Z) + ret = r; + } + } + return ret; + } - public bool SetZ( string name, int z ) - { - try - { - database.Query("UPDATE Regions SET Z=@0 WHERE RegionName=@1 AND WorldID=@2", z, name, - Main.worldID.ToString()); + public bool SetZ( string name, int z ) + { + try + { + database.Query("UPDATE Regions SET Z=@0 WHERE RegionName=@1 AND WorldID=@2", z, name, + Main.worldID.ToString()); - var region = GetRegionByName(name); - if (region != null) - region.Z = z; - return true; - } - catch (Exception ex) - { - Log.Error(ex.ToString()); - return false; - } - } + var region = GetRegionByName(name); + if (region != null) + region.Z = z; + return true; + } + catch (Exception ex) + { + Log.Error(ex.ToString()); + return false; + } + } } public class Region @@ -533,7 +533,7 @@ namespace TShockAPI.DB public string WorldID { get; set; } public List AllowedIDs { get; set; } public List AllowedGroups { get; set; } - public int Z { get; set; } + public int Z { get; set; } public Region(Rectangle region, string name, string owner, bool disablebuild, string RegionWorldIDz, int z) : this() @@ -543,7 +543,7 @@ namespace TShockAPI.DB Owner = owner; DisableBuild = disablebuild; WorldID = RegionWorldIDz; - Z = z; + Z = z; } public Region() @@ -554,7 +554,7 @@ namespace TShockAPI.DB WorldID = string.Empty; AllowedIDs = new List(); AllowedGroups = new List(); - Z = 0; + Z = 0; } public bool InArea(Rectangle point) From 444af6cf57e61b8f111d00e2c29cb2ed3bf54c1e Mon Sep 17 00:00:00 2001 From: Zack Piispanen Date: Tue, 9 Sep 2014 03:49:57 -0400 Subject: [PATCH 118/135] Update to latest TSAPI. Changed update manager to use same code as stat tracker, which hopefully doesnt break on mono. Also changed it to not check every update to see if time has passed. Made packetbufferer async for windows and if specified for mono. Fixed maxspawns error message to explain range. Ticked version. --- TShockAPI/Commands.cs | 12 ++++- TShockAPI/PacketBufferer.cs | 4 +- TShockAPI/Properties/AssemblyInfo.cs | 4 +- TShockAPI/StatTracker.cs | 17 +----- TShockAPI/TShock.cs | 3 +- TShockAPI/UpdateManager.cs | 78 ++++++++++++++++++---------- TShockAPI/Utils.cs | 15 ++++++ TerrariaServerAPI | 2 +- 8 files changed, 83 insertions(+), 52 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index ff74e903..6c9aeb38 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -1541,7 +1541,15 @@ namespace TShockAPI private static void CheckUpdates(CommandArgs args) { args.Player.SendInfoMessage("An update check has been queued."); - ThreadPool.QueueUserWorkItem(UpdateManager.CheckUpdate); + try + { + TShock.UpdateManager.UpdateCheck(null); + } + catch (Exception) + { + //swallow the exception + return; + } } private static void UpdatePlugins(CommandArgs args) @@ -3363,7 +3371,7 @@ namespace TShockAPI int maxSpawns = -1; if (!int.TryParse(args.Parameters[0], out maxSpawns) || maxSpawns < 0 || maxSpawns > Main.maxNPCs) { - args.Player.SendWarningMessage("Invalid maximum spawns!"); + args.Player.SendWarningMessage("Invalid maximum spawns! Acceptable range is {0} to {1}", 0, Main.maxNPCs); return; } diff --git a/TShockAPI/PacketBufferer.cs b/TShockAPI/PacketBufferer.cs index ad3b6d03..1722bfe4 100644 --- a/TShockAPI/PacketBufferer.cs +++ b/TShockAPI/PacketBufferer.cs @@ -197,10 +197,10 @@ namespace TShockAPI { if (socket.tcpClient.Client != null && socket.tcpClient.Client.Poll(0, SelectMode.SelectWrite)) { - if (ServerApi.RunningMono) + if (ServerApi.RunningMono && !ServerApi.UseAsyncSocketsInMono) socket.networkStream.Write(buffer, offset, count); else - socket.tcpClient.Client.Send(buffer, offset, count, SocketFlags.None); + socket.networkStream.BeginWrite(buffer, offset, count, socket.ServerWriteCallBack, socket.networkStream); return true; } } diff --git a/TShockAPI/Properties/AssemblyInfo.cs b/TShockAPI/Properties/AssemblyInfo.cs index b6820aaf..ba209b94 100644 --- a/TShockAPI/Properties/AssemblyInfo.cs +++ b/TShockAPI/Properties/AssemblyInfo.cs @@ -49,5 +49,5 @@ using System.Runtime.InteropServices; // Build Number // MMdd of the build -[assembly: AssemblyVersion("4.2.3.0720")] -[assembly: AssemblyFileVersion("4.2.3.0720")] +[assembly: AssemblyVersion("4.2.3.0909")] +[assembly: AssemblyFileVersion("4.2.3.0909")] diff --git a/TShockAPI/StatTracker.cs b/TShockAPI/StatTracker.cs index ccda72f9..d8f422c5 100644 --- a/TShockAPI/StatTracker.cs +++ b/TShockAPI/StatTracker.cs @@ -28,21 +28,6 @@ namespace TShockAPI } } - private HttpWebResponse GetResponseNoException(HttpWebRequest req) - { - try - { - return (HttpWebResponse)req.GetResponse(); - } - catch (WebException we) - { - var resp = we.Response as HttpWebResponse; - if (resp == null) - throw; - return resp; - } - } - private void SendUpdate(object info) { Thread.Sleep(1000*60*15); @@ -65,7 +50,7 @@ namespace TShockAPI client.Timeout = 5000; try { - using (var resp = GetResponseNoException(client)) + using (var resp = TShock.Utils.GetResponseNoException(client)) { if (resp.StatusCode != HttpStatusCode.OK) { diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 3e7e66e5..206ead01 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -77,6 +77,7 @@ namespace TShockAPI public static RestManager RestManager; public static Utils Utils = Utils.Instance; public static StatTracker StatTracker = new StatTracker(); + public static UpdateManager UpdateManager; /// /// Used for implementing REST Tokens prior to the REST system starting up. /// @@ -613,6 +614,7 @@ namespace TShockAPI FixChestStacks(); StatTracker.Initialize(); + UpdateManager = new UpdateManager(); } private void ComputeMaxStyles() @@ -656,7 +658,6 @@ namespace TShockAPI private void OnUpdate(EventArgs args) { - UpdateManager.UpdateProcedureCheck(); if (Backups.IsBackupTime) Backups.Backup(); //call these every second, not every update diff --git a/TShockAPI/UpdateManager.cs b/TShockAPI/UpdateManager.cs index a3eff893..4f8305f6 100644 --- a/TShockAPI/UpdateManager.cs +++ b/TShockAPI/UpdateManager.cs @@ -18,32 +18,44 @@ along with this program. If not, see . using System; using System.Collections.Generic; +using System.IO; using System.Net; using System.Threading; using Newtonsoft.Json; namespace TShockAPI { - internal class UpdateManager + public class UpdateManager { - private static string updateUrl = "https://github.com/NyxStudios/TShock/blob/general-devel/tshock_update.json?raw=true"; - public static DateTime lastcheck = DateTime.MinValue; + private string updateUrl = "https://github.com/NyxStudios/TShock/blob/general-devel/tshock_update.json?raw=true"; /// /// Check once every X minutes. /// - private static readonly int CheckXMinutes = 30; + private readonly int CheckXMinutes = 30; - public static void UpdateProcedureCheck() + public UpdateManager() { - if ((DateTime.Now - lastcheck).TotalMinutes >= CheckXMinutes) - { - ThreadPool.QueueUserWorkItem(CheckUpdate); - lastcheck = DateTime.Now; - } + ThreadPool.QueueUserWorkItem(CheckForUpdates); } - public static void CheckUpdate(object o) + private void CheckForUpdates(object state) + { + try + { + UpdateCheck(state); + } + catch (Exception) + { + //swallow the exception + return; + } + + Thread.Sleep(CheckXMinutes * 60 * 1000); + ThreadPool.QueueUserWorkItem(CheckForUpdates); + } + + public void UpdateCheck(object o) { var updates = ServerIsOutOfDate(); if (updates != null) @@ -56,29 +68,39 @@ namespace TShockAPI /// Checks to see if the server is out of date. /// /// - private static Dictionary ServerIsOutOfDate() + private Dictionary ServerIsOutOfDate() { - using (var client = new WebClient()) + var client = (HttpWebRequest)WebRequest.Create(updateUrl); + client.Timeout = 5000; + try { - client.Headers.Add("user-agent", - "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705;)"); - try + using (var resp = TShock.Utils.GetResponseNoException(client)) { - string updatejson = client.DownloadString(updateUrl); - var update = JsonConvert.DeserializeObject>(updatejson); - var version = new Version(update["version"]); - if (TShock.VersionNum.CompareTo(version) < 0) - return update; + if (resp.StatusCode != HttpStatusCode.OK) + { + throw new IOException("Server did not respond with an OK."); + } + + using(var reader = new StreamReader(resp.GetResponseStream())) + { + string updatejson = reader.ReadToEnd(); + var update = JsonConvert.DeserializeObject>(updatejson); + var version = new Version(update["version"]); + if (TShock.VersionNum.CompareTo(version) < 0) + return update; + } } - catch (Exception e) - { - Log.Error(e.ToString()); - } - return null; } + catch (Exception e) + { + Log.ConsoleError("UpdateManager Exception: {0}", e); + throw e; + } + + return null; } - private static void NotifyAdministrators(Dictionary update) + private void NotifyAdministrators(Dictionary update) { var changes = update["changes"].Split(new[] {'\n'}, StringSplitOptions.RemoveEmptyEntries); NotifyAdministrator(TSPlayer.Server, changes); @@ -91,7 +113,7 @@ namespace TShockAPI } } - private static void NotifyAdministrator(TSPlayer player, string[] changes) + private void NotifyAdministrator(TSPlayer player, string[] changes) { player.SendMessage("The server is out of date.", Color.Red); for (int j = 0; j < changes.Length; j++) diff --git a/TShockAPI/Utils.cs b/TShockAPI/Utils.cs index bfe6c0c6..4b6c6208 100644 --- a/TShockAPI/Utils.cs +++ b/TShockAPI/Utils.cs @@ -1014,5 +1014,20 @@ namespace TShockAPI return result; } + + public HttpWebResponse GetResponseNoException(HttpWebRequest req) + { + try + { + return (HttpWebResponse)req.GetResponse(); + } + catch (WebException we) + { + var resp = we.Response as HttpWebResponse; + if (resp == null) + throw; + return resp; + } + } } } diff --git a/TerrariaServerAPI b/TerrariaServerAPI index d446a828..2fc5b098 160000 --- a/TerrariaServerAPI +++ b/TerrariaServerAPI @@ -1 +1 @@ -Subproject commit d446a8288a5d7984f4298a507a64249865259472 +Subproject commit 2fc5b098323ce7062df5ed91b1c532066fb8cb65 From c29f01b9591f11c4092ac0da790299dd81c6583a Mon Sep 17 00:00:00 2001 From: Zack Piispanen Date: Tue, 9 Sep 2014 04:03:31 -0400 Subject: [PATCH 119/135] Add new rest endpoint /v3/players/read to read the players inventory, armor, and dyes. Armor contains both armor and accessories, as well as vanity. Dyes contain all 8 dye slots. Closes #835 --- TShockAPI/Rest/RestManager.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/TShockAPI/Rest/RestManager.cs b/TShockAPI/Rest/RestManager.cs index 2bcdcbc5..e34177ff 100644 --- a/TShockAPI/Rest/RestManager.cs +++ b/TShockAPI/Rest/RestManager.cs @@ -89,6 +89,7 @@ namespace TShockAPI Rest.Register(new SecureRestCommand("/lists/players", PlayerList)); Rest.Register(new SecureRestCommand("/v2/players/list", PlayerListV2)); Rest.Register(new SecureRestCommand("/v2/players/read", PlayerReadV2, RestPermissions.restuserinfo)); + Rest.Register(new SecureRestCommand("/v3/players/read", PlayerReadV3, RestPermissions.restuserinfo)); Rest.Register(new SecureRestCommand("/v2/players/kick", PlayerKickV2, RestPermissions.restkick)); Rest.Register(new SecureRestCommand("/v2/players/ban", PlayerBanV2, RestPermissions.restban, RestPermissions.restmanagebans)); Rest.Register(new SecureRestCommand("/v2/players/kill", PlayerKill, RestPermissions.restkill)); @@ -602,6 +603,30 @@ namespace TShockAPI }; } + private object PlayerReadV3(RestRequestArgs args) + { + var ret = PlayerFind(args.Parameters); + if (ret is RestObject) + return ret; + + TSPlayer player = (TSPlayer)ret; + var inventory = player.TPlayer.inventory.Where(p => p.active).ToList(); + var equipment = player.TPlayer.armor.Where(p => p.active).ToList(); + var dyes = player.TPlayer.dye.Where(p => p.active).ToList(); + return new RestObject() + { + {"nickname", player.Name}, + {"username", null == player.UserAccountName ? "" : player.UserAccountName}, + {"ip", player.IP}, + {"group", player.Group.Name}, + {"position", player.TileX + "," + player.TileY}, + {"inventory", string.Join(", ", inventory.Select(p => (p.name + ":" + p.stack)))}, + {"armor", string.Join(", ", equipment.Select(p => (p.netID + ":" + p.prefix)))}, + {"dyes", string.Join(", ", dyes.Select(p => (p.name)))}, + {"buffs", string.Join(", ", player.TPlayer.buffType)} + }; + } + private object PlayerKickV2(RestRequestArgs args) { var ret = PlayerFind(args.Parameters); From 70a9fc04c5c911c2b73934d9ce2939c12d870a95 Mon Sep 17 00:00:00 2001 From: White Date: Wed, 10 Sep 2014 14:31:20 +0930 Subject: [PATCH 120/135] Suppress those pesky warnings --- TShockAPI/PacketBufferer.cs | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/TShockAPI/PacketBufferer.cs b/TShockAPI/PacketBufferer.cs index ad3b6d03..0bb7cada 100644 --- a/TShockAPI/PacketBufferer.cs +++ b/TShockAPI/PacketBufferer.cs @@ -206,23 +206,36 @@ namespace TShockAPI } catch (ObjectDisposedException e) { - Log.Warn(e.ToString()); + Log.Warn(e.ToString()); } catch (SocketException e) { - switch ((uint)e.ErrorCode) - { - case 0x80004005: + switch ((uint)e.ErrorCode) + { + case 0x80004005: case 10053: - break; - default: - Log.Warn(e.ToString()); - break; - } + break; + default: + Log.Warn(e.ToString()); + break; + } } catch (IOException e) { - Log.Warn(e.ToString()); + if (e.InnerException is SocketException) + { + switch (((SocketException)e.InnerException).SocketErrorCode) + { + case SocketError.Shutdown: + case SocketError.ConnectionReset: + break; + default: + Log.Warn(e.ToString()); + break; + } + } + else + Log.Warn(e.ToString()); } return false; } From d5527ade4266cdd01625c21283c16e32a96dc3e6 Mon Sep 17 00:00:00 2001 From: Zack Piispanen Date: Mon, 15 Sep 2014 09:05:28 -0400 Subject: [PATCH 121/135] Add length to database primary keys. Tweak some of the itembans code to be less inefficient. Removed a chunk of code from the buff code that prevented users from being buffed with a buff that comes from an item. This code seemed to cause max cpu usage when being disabled. I don't think this code is useful, but I leave that to people who own servers. IMO all buff code should be removed. --- TShockAPI/DB/ItemManager.cs | 14 +++++--------- TShockAPI/DB/RegionManager.cs | 2 +- TShockAPI/DB/WarpsManager.cs | 2 +- TShockAPI/GetDataHandlers.cs | 4 ++-- TShockAPI/TShock.cs | 1 + 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/TShockAPI/DB/ItemManager.cs b/TShockAPI/DB/ItemManager.cs index 58a27269..9ef62d47 100644 --- a/TShockAPI/DB/ItemManager.cs +++ b/TShockAPI/DB/ItemManager.cs @@ -101,12 +101,8 @@ namespace TShockAPI.DB public bool ItemIsBanned(string name, TSPlayer ply) { - if (ItemBans.Contains(new ItemBan(name))) - { - ItemBan b = GetItemBanByName(name); - return !b.HasPermissionToUseItem(ply); - } - return false; + ItemBan b = GetItemBanByName(name); + return b != null &&!b.HasPermissionToUseItem(ply); } public bool AllowGroup(string item, string name) @@ -162,11 +158,11 @@ namespace TShockAPI.DB public ItemBan GetItemBanByName(String name) { - foreach (ItemBan b in ItemBans) + for (int i = 0; i < ItemBans.Count; i++) { - if (b.Name == name) + if (ItemBans[i].Name == name) { - return b; + return ItemBans[i]; } } return null; diff --git a/TShockAPI/DB/RegionManager.cs b/TShockAPI/DB/RegionManager.cs index 7fc6173d..dd66c20d 100644 --- a/TShockAPI/DB/RegionManager.cs +++ b/TShockAPI/DB/RegionManager.cs @@ -44,7 +44,7 @@ namespace TShockAPI.DB new SqlColumn("width", MySqlDbType.Int32), new SqlColumn("height", MySqlDbType.Int32), new SqlColumn("RegionName", MySqlDbType.VarChar, 50) {Unique = true}, - new SqlColumn("WorldID", MySqlDbType.Text) {Unique = true}, + new SqlColumn("WorldID", MySqlDbType.VarChar, 50) { Unique = true }, new SqlColumn("UserIds", MySqlDbType.Text), new SqlColumn("Protected", MySqlDbType.Int32), new SqlColumn("Groups", MySqlDbType.Text), diff --git a/TShockAPI/DB/WarpsManager.cs b/TShockAPI/DB/WarpsManager.cs index 317f1730..709298f2 100644 --- a/TShockAPI/DB/WarpsManager.cs +++ b/TShockAPI/DB/WarpsManager.cs @@ -44,7 +44,7 @@ namespace TShockAPI.DB new SqlColumn("WarpName", MySqlDbType.VarChar, 50) {Unique = true}, new SqlColumn("X", MySqlDbType.Int32), new SqlColumn("Y", MySqlDbType.Int32), - new SqlColumn("WorldID", MySqlDbType.Text) {Unique = true}, + new SqlColumn("WorldID", MySqlDbType.VarChar, 50) { Unique = true }, new SqlColumn("Private", MySqlDbType.Text) ); var creator = new SqlTableCreator(db, diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index ff7885f6..4ab5a2e8 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -3292,7 +3292,7 @@ namespace TShockAPI { var buff = args.Data.ReadInt8(); - if (TShock.Itembans.ItemBans.Any(s => + /*if (TShock.Itembans.ItemBans.Any(s => { Item item = new Item(); item.SetDefaults(s.Name); @@ -3300,7 +3300,7 @@ namespace TShockAPI })) { buff = 0; - } + }*/ if (buff == 10 && TShock.Config.DisableInvisPvP && args.TPlayer.hostile) buff = 0; diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 206ead01..688773bc 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -804,6 +804,7 @@ namespace TShockAPI } player.IgnoreActionsForCheating = check; check = "none"; + //todo: pretty sure we check every place a players inventory can change, so do we really need to do this? foreach (Item item in player.TPlayer.armor) { if (Itembans.ItemIsBanned(item.name, player)) From 5ffd3730833a35395b78b2a63e50949f76308433 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Tue, 23 Sep 2014 22:23:02 -0600 Subject: [PATCH 122/135] Removed two semicolons at the end of a line --- TShockAPI/TShock.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 688773bc..c298e091 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1755,7 +1755,7 @@ namespace TShockAPI public static bool CheckIgnores(TSPlayer player) { - return player.IgnoreActionsForInventory != "none" || player.IgnoreActionsForCheating != "none" || player.IgnoreActionsForDisabledArmor != "none" || player.IgnoreActionsForClearingTrashCan || !player.IsLoggedIn && Config.RequireLogin;; + return player.IgnoreActionsForInventory != "none" || player.IgnoreActionsForCheating != "none" || player.IgnoreActionsForDisabledArmor != "none" || player.IgnoreActionsForClearingTrashCan || !player.IsLoggedIn && Config.RequireLogin; } public void OnConfigRead(ConfigFile file) From b688a31fd5ae6e9e78d181bf818faf26ef0d177f Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Sun, 26 Oct 2014 15:22:51 +0000 Subject: [PATCH 123/135] Fix HandleProjectileNew for banned projectiles --- TShockAPI/GetDataHandlers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 4ab5a2e8..da1951f2 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2447,7 +2447,7 @@ namespace TShockAPI args.Player.Disable("Player does not have permission to create that projectile.", true); args.Player.SendErrorMessage("You do not have permission to create that projectile."); args.Player.RemoveProjectile(ident, owner); - return false; + return true; } // Server now checks owner + ident, if owner is different, server will create new projectile. /*if (args.Player.Index != owner) From 2a8d3dd09a5575cc6e1effa902003777181f2a2c Mon Sep 17 00:00:00 2001 From: Sam Eaton Date: Sat, 8 Nov 2014 22:18:27 +0000 Subject: [PATCH 124/135] Added npcStreamSpeed configuration parameter. --- TShockAPI/ConfigFile.cs | 3 +++ TShockAPI/TShock.cs | 1 + 2 files changed, 4 insertions(+) diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index 51e909e2..d91b818b 100755 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -388,6 +388,9 @@ namespace TShockAPI [Description("The maximum allowable MP, before equipment buffs.")] public int MaxMP = 200; + [Description("Reduces enemy skipping but increases bandwidth usage. The lower the number the less skipping will happen, but more data is sent. 0 is off.")] + public int NpcStreamSpeed = 60; + /// /// Reads a configuration file from a given path /// diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index c298e091..8d1cbf72 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1763,6 +1763,7 @@ namespace TShockAPI NPC.defaultMaxSpawns = file.DefaultMaximumSpawns; NPC.defaultSpawnRate = file.DefaultSpawnRate; + Main.npcStreamSpeed = file.NpcStreamSpeed; Main.autoSave = file.AutoSave; if (Backups != null) { From 4ac6e70cc5a5baa0004fa328cbba1040e0f0067f Mon Sep 17 00:00:00 2001 From: Sam Eaton Date: Sat, 8 Nov 2014 22:36:16 +0000 Subject: [PATCH 125/135] Attempt at correcting indentation. --- TShockAPI/ConfigFile.cs | 4 ++-- TShockAPI/TShock.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index d91b818b..d7109d82 100755 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -388,8 +388,8 @@ namespace TShockAPI [Description("The maximum allowable MP, before equipment buffs.")] public int MaxMP = 200; - [Description("Reduces enemy skipping but increases bandwidth usage. The lower the number the less skipping will happen, but more data is sent. 0 is off.")] - public int NpcStreamSpeed = 60; + [Description("Reduces enemy skipping but increases bandwidth usage. The lower the number the less skipping will happen, but more data is sent. 0 is off.")] + public int NpcStreamSpeed = 60; /// /// Reads a configuration file from a given path diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 8d1cbf72..fad2ddce 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1763,7 +1763,7 @@ namespace TShockAPI NPC.defaultMaxSpawns = file.DefaultMaximumSpawns; NPC.defaultSpawnRate = file.DefaultSpawnRate; - Main.npcStreamSpeed = file.NpcStreamSpeed; + Main.npcStreamSpeed = file.NpcStreamSpeed; Main.autoSave = file.AutoSave; if (Backups != null) { From 05b29081bd8bcd83fa736cbf6130aa078ba7c57d Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sat, 8 Nov 2014 17:28:28 -0700 Subject: [PATCH 126/135] Revert "Added npcStreamSpeed configuration parameter." --- TShockAPI/ConfigFile.cs | 3 --- TShockAPI/TShock.cs | 1 - 2 files changed, 4 deletions(-) diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index d7109d82..51e909e2 100755 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -388,9 +388,6 @@ namespace TShockAPI [Description("The maximum allowable MP, before equipment buffs.")] public int MaxMP = 200; - [Description("Reduces enemy skipping but increases bandwidth usage. The lower the number the less skipping will happen, but more data is sent. 0 is off.")] - public int NpcStreamSpeed = 60; - /// /// Reads a configuration file from a given path /// diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index fad2ddce..c298e091 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1763,7 +1763,6 @@ namespace TShockAPI NPC.defaultMaxSpawns = file.DefaultMaximumSpawns; NPC.defaultSpawnRate = file.DefaultSpawnRate; - Main.npcStreamSpeed = file.NpcStreamSpeed; Main.autoSave = file.AutoSave; if (Backups != null) { From 421702b8de08fbabb5ae87dd3f475193763dd123 Mon Sep 17 00:00:00 2001 From: Zack Date: Tue, 11 Nov 2014 23:04:12 -0500 Subject: [PATCH 127/135] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f394cf6c..a44151ff 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +# This project is in maintenance mode. This means that the developer time dedicated to this project is very limited and only extremely game breaking bugs will be fixed. Improvements, new features, and minor issues will have to be resolved via pull requests or until a developer has time. + # TShock [![Build Status](https://travis-ci.org/NyxStudios/TShock.png?branch=general-devel)](https://travis-ci.org/NyxStudios/TShock) TShock is a server modification for Terraria, written in C#, and based upon the [Terraria Server API](https://github.com/Deathmax/TerrariaAPI-Server). It uses JSON for configuration management, and offers several features not present in the Terraria Server normally. From 95b14a3b69d2d402419239c36a38b1b3c6112781 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Tue, 11 Nov 2014 21:10:59 -0700 Subject: [PATCH 128/135] Made disclaimer a little nicer. --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a44151ff..13d50d62 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ -# This project is in maintenance mode. This means that the developer time dedicated to this project is very limited and only extremely game breaking bugs will be fixed. Improvements, new features, and minor issues will have to be resolved via pull requests or until a developer has time. +# Current Status +This project is in maintenance mode. This means that the core team of developers' time is very limited, and only extremely game breaking bugs will be fixed. Improvements, new features, and minor issues will not be resolved by direct development until this time restriction has passed. Issues created reflecting these requests will not be worked on until this notice is removed. + +Thanks for your continued support of TShock for Terraria. # TShock [![Build Status](https://travis-ci.org/NyxStudios/TShock.png?branch=general-devel)](https://travis-ci.org/NyxStudios/TShock) From 0dcbbc9f1838c49001836edb1beb00ae27f1c44a Mon Sep 17 00:00:00 2001 From: PhoenixICE Date: Thu, 18 Dec 2014 21:54:12 +0800 Subject: [PATCH 129/135] Added Kicking for Damage Threshold --- TShockAPI/ConfigFile.cs | 3 +++ TShockAPI/GetDataHandlers.cs | 20 ++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index 51e909e2..e1eb1014 100755 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -271,6 +271,9 @@ namespace TShockAPI [Description("The maximum damage a projectile can inflict.")] public int MaxProjDamage = 175; + [Description("Kicks a user if set to true, if they inflict more damage then the max damage.")] + public bool KickOnDamageThresholdBroken = false; + [Description("Ignores checking to see if player 'can' update a projectile.")] public bool IgnoreProjUpdate = false; diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index da1951f2..e3beae8f 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -3150,7 +3150,15 @@ namespace TShockAPI if (dmg > TShock.Config.MaxDamage && !args.Player.Group.HasPermission(Permissions.ignoredamagecap) && id != args.Player.Index) { - args.Player.Disable(String.Format("Player damage exceeded {0}.", TShock.Config.MaxDamage)); + if (TShock.Config.KickOnDamageThresholdBroken) + { + TShock.Utils.Kick(args.Player, string.Format("Player damage exceeded {0}.", TShock.Config.MaxDamage)); + return true; + } + else + { + args.Player.Disable(String.Format("Player damage exceeded {0}.", TShock.Config.MaxDamage)); + } args.Player.SendData(PacketTypes.PlayerHp, "", id); args.Player.SendData(PacketTypes.PlayerUpdate, "", id); return true; @@ -3208,7 +3216,15 @@ namespace TShockAPI if (dmg > TShock.Config.MaxDamage && !args.Player.Group.HasPermission(Permissions.ignoredamagecap)) { - args.Player.Disable(String.Format("NPC damage exceeded {0}.", TShock.Config.MaxDamage ) ); + if (TShock.Config.KickOnDamageThresholdBroken) + { + TShock.Utils.Kick(args.Player, string.Format("NPC damage exceeded {0}.", TShock.Config.MaxDamage)); + return true; + } + else + { + args.Player.Disable(String.Format("NPC damage exceeded {0}.", TShock.Config.MaxDamage)); + } args.Player.SendData(PacketTypes.NpcUpdate, "", id); return true; } From e5a4f825d2ef93d032774a40bf57f4954f17912c Mon Sep 17 00:00:00 2001 From: Zack Date: Wed, 28 Jan 2015 15:05:19 -0500 Subject: [PATCH 130/135] Commit latest TSAPI to repo. --- TerrariaServerAPI | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TerrariaServerAPI b/TerrariaServerAPI index 2fc5b098..50a04c45 160000 --- a/TerrariaServerAPI +++ b/TerrariaServerAPI @@ -1 +1 @@ -Subproject commit 2fc5b098323ce7062df5ed91b1c532066fb8cb65 +Subproject commit 50a04c45bfc2d1de2de1a31b215f7bdc546cfdd5 From f188bd743cae8fe729f71b0507ba42636d9f5b8b Mon Sep 17 00:00:00 2001 From: Zack Date: Wed, 28 Jan 2015 15:24:50 -0500 Subject: [PATCH 131/135] Remove StatTracker --- TShockAPI/TShock.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index c298e091..dcbb70e5 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -76,7 +76,6 @@ namespace TShockAPI public static SecureRest RestApi; public static RestManager RestManager; public static Utils Utils = Utils.Instance; - public static StatTracker StatTracker = new StatTracker(); public static UpdateManager UpdateManager; /// /// Used for implementing REST Tokens prior to the REST system starting up. @@ -613,7 +612,6 @@ namespace TShockAPI ComputeMaxStyles(); FixChestStacks(); - StatTracker.Initialize(); UpdateManager = new UpdateManager(); } From f9bf470b1dc9414812a42f597db4e89433900f6f Mon Sep 17 00:00:00 2001 From: Zack Date: Wed, 28 Jan 2015 15:29:13 -0500 Subject: [PATCH 132/135] Tick version and update copyright --- TShockAPI/BackupManager.cs | 2 +- TShockAPI/Commands.cs | 2 +- TShockAPI/ConfigFile.cs | 2 +- TShockAPI/DB/BanManager.cs | 2 +- TShockAPI/DB/CharacterManager.cs | 2 +- TShockAPI/DB/GroupManager.cs | 2 +- TShockAPI/DB/IQueryBuilder.cs | 2 +- TShockAPI/DB/ItemManager.cs | 2 +- TShockAPI/DB/ProjectileManager.cs | 2 +- TShockAPI/DB/RegionManager.cs | 2 +- TShockAPI/DB/RememberedPosManager.cs | 2 +- TShockAPI/DB/SqlColumn.cs | 2 +- TShockAPI/DB/SqlTable.cs | 2 +- TShockAPI/DB/SqlValue.cs | 2 +- TShockAPI/DB/TileManager.cs | 2 +- TShockAPI/DB/UserManager.cs | 2 +- TShockAPI/DB/WarpsManager.cs | 2 +- TShockAPI/Extensions/DbExt.cs | 2 +- TShockAPI/Extensions/LinqExt.cs | 2 +- TShockAPI/Extensions/RandomExt.cs | 2 +- TShockAPI/Extensions/StringExt.cs | 2 +- TShockAPI/FileTools.cs | 2 +- TShockAPI/GeoIPCountry.cs | 2 +- TShockAPI/GetDataHandlers.cs | 2 +- TShockAPI/Group.cs | 2 +- TShockAPI/HandlerList.cs | 2 +- TShockAPI/Hooks/GeneralHooks.cs | 2 +- TShockAPI/Hooks/PlayerHooks.cs | 2 +- TShockAPI/IPackable.cs | 2 +- TShockAPI/Log.cs | 2 +- TShockAPI/Net/BaseMsg.cs | 2 +- TShockAPI/Net/DisconnectMsg.cs | 2 +- TShockAPI/Net/NetTile.cs | 2 +- TShockAPI/Net/ProjectileRemoveMsg.cs | 2 +- TShockAPI/Net/SpawnMsg.cs | 2 +- TShockAPI/Net/WorldInfoMsg.cs | 2 +- TShockAPI/PacketBufferer.cs | 2 +- TShockAPI/PaginationTools.cs | 2 +- TShockAPI/Permissions.cs | 2 +- TShockAPI/Properties/AssemblyInfo.cs | 8 ++++---- TShockAPI/RconHandler.cs | 2 +- TShockAPI/Rest/Rest.cs | 2 +- TShockAPI/Rest/RestCommand.cs | 2 +- TShockAPI/Rest/RestManager.cs | 2 +- TShockAPI/Rest/RestObject.cs | 2 +- TShockAPI/Rest/RestPermissions.cs | 2 +- TShockAPI/Rest/RestVerbs.cs | 2 +- TShockAPI/Rest/SecureRest.cs | 2 +- TShockAPI/SaveManager.cs | 2 +- TShockAPI/ServerSideCharacters/ServerSideConfig.cs | 2 +- TShockAPI/TSPlayer.cs | 2 +- TShockAPI/TShock.cs | 2 +- TShockAPI/TShockAPI.licenseheader | 2 +- TShockAPI/UpdateManager.cs | 2 +- TShockAPI/Utils.cs | 2 +- 55 files changed, 58 insertions(+), 58 deletions(-) diff --git a/TShockAPI/BackupManager.cs b/TShockAPI/BackupManager.cs index 13f94587..1882d0bb 100644 --- a/TShockAPI/BackupManager.cs +++ b/TShockAPI/BackupManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 6c9aeb38..7837af80 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index e1eb1014..2b4726d8 100755 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/DB/BanManager.cs b/TShockAPI/DB/BanManager.cs index 4e38bd3f..89a62c99 100644 --- a/TShockAPI/DB/BanManager.cs +++ b/TShockAPI/DB/BanManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/DB/CharacterManager.cs b/TShockAPI/DB/CharacterManager.cs index 7df75c29..a1f6b5b2 100755 --- a/TShockAPI/DB/CharacterManager.cs +++ b/TShockAPI/DB/CharacterManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/DB/GroupManager.cs b/TShockAPI/DB/GroupManager.cs index cf0e8006..cd0f6d87 100644 --- a/TShockAPI/DB/GroupManager.cs +++ b/TShockAPI/DB/GroupManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/DB/IQueryBuilder.cs b/TShockAPI/DB/IQueryBuilder.cs index 64988c7c..ac030759 100644 --- a/TShockAPI/DB/IQueryBuilder.cs +++ b/TShockAPI/DB/IQueryBuilder.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/DB/ItemManager.cs b/TShockAPI/DB/ItemManager.cs index 9ef62d47..141f2925 100644 --- a/TShockAPI/DB/ItemManager.cs +++ b/TShockAPI/DB/ItemManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/DB/ProjectileManager.cs b/TShockAPI/DB/ProjectileManager.cs index bba1d15b..a9cbf31b 100644 --- a/TShockAPI/DB/ProjectileManager.cs +++ b/TShockAPI/DB/ProjectileManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/DB/RegionManager.cs b/TShockAPI/DB/RegionManager.cs index dd66c20d..40e9b957 100644 --- a/TShockAPI/DB/RegionManager.cs +++ b/TShockAPI/DB/RegionManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/DB/RememberedPosManager.cs b/TShockAPI/DB/RememberedPosManager.cs index 86943784..ad2d62e2 100644 --- a/TShockAPI/DB/RememberedPosManager.cs +++ b/TShockAPI/DB/RememberedPosManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/DB/SqlColumn.cs b/TShockAPI/DB/SqlColumn.cs index e72297a6..8fd72d88 100644 --- a/TShockAPI/DB/SqlColumn.cs +++ b/TShockAPI/DB/SqlColumn.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/DB/SqlTable.cs b/TShockAPI/DB/SqlTable.cs index 0f8fd974..7fb62ed9 100644 --- a/TShockAPI/DB/SqlTable.cs +++ b/TShockAPI/DB/SqlTable.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/DB/SqlValue.cs b/TShockAPI/DB/SqlValue.cs index e7c393b7..9edb13e0 100644 --- a/TShockAPI/DB/SqlValue.cs +++ b/TShockAPI/DB/SqlValue.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/DB/TileManager.cs b/TShockAPI/DB/TileManager.cs index dc73f2c3..9362e664 100644 --- a/TShockAPI/DB/TileManager.cs +++ b/TShockAPI/DB/TileManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/DB/UserManager.cs b/TShockAPI/DB/UserManager.cs index 38dc8745..07b94f63 100644 --- a/TShockAPI/DB/UserManager.cs +++ b/TShockAPI/DB/UserManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/DB/WarpsManager.cs b/TShockAPI/DB/WarpsManager.cs index 709298f2..fc4890af 100644 --- a/TShockAPI/DB/WarpsManager.cs +++ b/TShockAPI/DB/WarpsManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Extensions/DbExt.cs b/TShockAPI/Extensions/DbExt.cs index d11309ef..5dd6e0e6 100644 --- a/TShockAPI/Extensions/DbExt.cs +++ b/TShockAPI/Extensions/DbExt.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Extensions/LinqExt.cs b/TShockAPI/Extensions/LinqExt.cs index 99448df1..e1885bbd 100644 --- a/TShockAPI/Extensions/LinqExt.cs +++ b/TShockAPI/Extensions/LinqExt.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Extensions/RandomExt.cs b/TShockAPI/Extensions/RandomExt.cs index 68fc37a5..42abce9a 100644 --- a/TShockAPI/Extensions/RandomExt.cs +++ b/TShockAPI/Extensions/RandomExt.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Extensions/StringExt.cs b/TShockAPI/Extensions/StringExt.cs index 57d4cf1d..fe6dcfa2 100644 --- a/TShockAPI/Extensions/StringExt.cs +++ b/TShockAPI/Extensions/StringExt.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/FileTools.cs b/TShockAPI/FileTools.cs index fe7a6040..071da3fc 100644 --- a/TShockAPI/FileTools.cs +++ b/TShockAPI/FileTools.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/GeoIPCountry.cs b/TShockAPI/GeoIPCountry.cs index 2131fd17..764a69a2 100644 --- a/TShockAPI/GeoIPCountry.cs +++ b/TShockAPI/GeoIPCountry.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index e3beae8f..2680ac10 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Group.cs b/TShockAPI/Group.cs index ddd3c029..7efcb07a 100644 --- a/TShockAPI/Group.cs +++ b/TShockAPI/Group.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/HandlerList.cs b/TShockAPI/HandlerList.cs index 9524c79e..07b9d548 100644 --- a/TShockAPI/HandlerList.cs +++ b/TShockAPI/HandlerList.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Hooks/GeneralHooks.cs b/TShockAPI/Hooks/GeneralHooks.cs index 8e6168d6..d07c4f4f 100644 --- a/TShockAPI/Hooks/GeneralHooks.cs +++ b/TShockAPI/Hooks/GeneralHooks.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Hooks/PlayerHooks.cs b/TShockAPI/Hooks/PlayerHooks.cs index 6e69e19d..73e862a8 100644 --- a/TShockAPI/Hooks/PlayerHooks.cs +++ b/TShockAPI/Hooks/PlayerHooks.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/IPackable.cs b/TShockAPI/IPackable.cs index ffef9e42..7dbb2d93 100644 --- a/TShockAPI/IPackable.cs +++ b/TShockAPI/IPackable.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Log.cs b/TShockAPI/Log.cs index 9b239ce9..b2bb540f 100644 --- a/TShockAPI/Log.cs +++ b/TShockAPI/Log.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Net/BaseMsg.cs b/TShockAPI/Net/BaseMsg.cs index 02d4c201..c6f3de54 100644 --- a/TShockAPI/Net/BaseMsg.cs +++ b/TShockAPI/Net/BaseMsg.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Net/DisconnectMsg.cs b/TShockAPI/Net/DisconnectMsg.cs index 5ca32855..9e5789b4 100644 --- a/TShockAPI/Net/DisconnectMsg.cs +++ b/TShockAPI/Net/DisconnectMsg.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Net/NetTile.cs b/TShockAPI/Net/NetTile.cs index bd8249a6..c3ee7d6f 100644 --- a/TShockAPI/Net/NetTile.cs +++ b/TShockAPI/Net/NetTile.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Net/ProjectileRemoveMsg.cs b/TShockAPI/Net/ProjectileRemoveMsg.cs index 4d68305e..a576e5bd 100644 --- a/TShockAPI/Net/ProjectileRemoveMsg.cs +++ b/TShockAPI/Net/ProjectileRemoveMsg.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Net/SpawnMsg.cs b/TShockAPI/Net/SpawnMsg.cs index bb5d7fed..2fa15e59 100644 --- a/TShockAPI/Net/SpawnMsg.cs +++ b/TShockAPI/Net/SpawnMsg.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Net/WorldInfoMsg.cs b/TShockAPI/Net/WorldInfoMsg.cs index a2e4fc1e..e4763bb6 100644 --- a/TShockAPI/Net/WorldInfoMsg.cs +++ b/TShockAPI/Net/WorldInfoMsg.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/PacketBufferer.cs b/TShockAPI/PacketBufferer.cs index b624d394..051a9531 100644 --- a/TShockAPI/PacketBufferer.cs +++ b/TShockAPI/PacketBufferer.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/PaginationTools.cs b/TShockAPI/PaginationTools.cs index eb208ae7..e3161a3c 100644 --- a/TShockAPI/PaginationTools.cs +++ b/TShockAPI/PaginationTools.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Permissions.cs b/TShockAPI/Permissions.cs index 85847bfc..d970182a 100644 --- a/TShockAPI/Permissions.cs +++ b/TShockAPI/Permissions.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Properties/AssemblyInfo.cs b/TShockAPI/Properties/AssemblyInfo.cs index ba209b94..1ace0f53 100644 --- a/TShockAPI/Properties/AssemblyInfo.cs +++ b/TShockAPI/Properties/AssemblyInfo.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Nyx Studios & TShock Contributors")] [assembly: AssemblyProduct("TShockAPI")] -[assembly: AssemblyCopyright("Copyright © Nyx Studios 2011-2014")] +[assembly: AssemblyCopyright("Copyright © Nyx Studios 2011-2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -49,5 +49,5 @@ using System.Runtime.InteropServices; // Build Number // MMdd of the build -[assembly: AssemblyVersion("4.2.3.0909")] -[assembly: AssemblyFileVersion("4.2.3.0909")] +[assembly: AssemblyVersion("4.2.4.0128")] +[assembly: AssemblyFileVersion("4.2.4.0128")] diff --git a/TShockAPI/RconHandler.cs b/TShockAPI/RconHandler.cs index cdd76d3e..39f32fa2 100644 --- a/TShockAPI/RconHandler.cs +++ b/TShockAPI/RconHandler.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Rest/Rest.cs b/TShockAPI/Rest/Rest.cs index 740f9bde..c23d0552 100644 --- a/TShockAPI/Rest/Rest.cs +++ b/TShockAPI/Rest/Rest.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Rest/RestCommand.cs b/TShockAPI/Rest/RestCommand.cs index d08616cb..681d7cbf 100644 --- a/TShockAPI/Rest/RestCommand.cs +++ b/TShockAPI/Rest/RestCommand.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Rest/RestManager.cs b/TShockAPI/Rest/RestManager.cs index e34177ff..93d81eee 100644 --- a/TShockAPI/Rest/RestManager.cs +++ b/TShockAPI/Rest/RestManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Rest/RestObject.cs b/TShockAPI/Rest/RestObject.cs index 890c33c7..65503bec 100644 --- a/TShockAPI/Rest/RestObject.cs +++ b/TShockAPI/Rest/RestObject.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Rest/RestPermissions.cs b/TShockAPI/Rest/RestPermissions.cs index 18851ac9..5b8c765d 100644 --- a/TShockAPI/Rest/RestPermissions.cs +++ b/TShockAPI/Rest/RestPermissions.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Rest/RestVerbs.cs b/TShockAPI/Rest/RestVerbs.cs index 02e5d056..ab8c1500 100644 --- a/TShockAPI/Rest/RestVerbs.cs +++ b/TShockAPI/Rest/RestVerbs.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Rest/SecureRest.cs b/TShockAPI/Rest/SecureRest.cs index 9845bc08..ee9eac2f 100644 --- a/TShockAPI/Rest/SecureRest.cs +++ b/TShockAPI/Rest/SecureRest.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/SaveManager.cs b/TShockAPI/SaveManager.cs index 725637ff..0557183d 100644 --- a/TShockAPI/SaveManager.cs +++ b/TShockAPI/SaveManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/ServerSideCharacters/ServerSideConfig.cs b/TShockAPI/ServerSideCharacters/ServerSideConfig.cs index fbec579f..ea4cc931 100644 --- a/TShockAPI/ServerSideCharacters/ServerSideConfig.cs +++ b/TShockAPI/ServerSideCharacters/ServerSideConfig.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.ComponentModel; /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 158dc5d7..3c711431 100755 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index dcbb70e5..04a4551f 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/TShockAPI.licenseheader b/TShockAPI/TShockAPI.licenseheader index aa42eaf1..936b8a9b 100644 --- a/TShockAPI/TShockAPI.licenseheader +++ b/TShockAPI/TShockAPI.licenseheader @@ -1,7 +1,7 @@ extensions: .cs /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/UpdateManager.cs b/TShockAPI/UpdateManager.cs index 4f8305f6..bfe7c836 100644 --- a/TShockAPI/UpdateManager.cs +++ b/TShockAPI/UpdateManager.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/TShockAPI/Utils.cs b/TShockAPI/Utils.cs index 4b6c6208..8fc6a0c1 100644 --- a/TShockAPI/Utils.cs +++ b/TShockAPI/Utils.cs @@ -1,6 +1,6 @@ /* TShock, a server mod for Terraria -Copyright (C) 2011-2014 Nyx Studios (fka. The TShock Team) +Copyright (C) 2011-2015 Nyx Studios (fka. The TShock Team) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by From da856554727e690448980befc6efc784561848a0 Mon Sep 17 00:00:00 2001 From: Zack Date: Wed, 28 Jan 2015 15:38:52 -0500 Subject: [PATCH 133/135] Update tshock_update.json --- tshock_update.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tshock_update.json b/tshock_update.json index 67fd67a0..c62d91bf 100644 --- a/tshock_update.json +++ b/tshock_update.json @@ -1,4 +1,4 @@ { - "version": "4.2.3.0720", - "changes": "TShock 4.2.3 for Terraria 1.2.4.1 Update 1\nhttp://tshock.co/xf/index.php?threads/tshock-4-2-3-for-terraria-1-2-4-1-update-1.3055/" + "version": "4.2.4.0128", + "changes": "TShock 4.2.4 for Terraria 1.2.4.1\nhttp://tshock.co/xf/index.php?threads/tshock-4-2-4-for-terraria-1-2-4-1.3398/" } From e93d4c97418ba4bf4f898e8297eb8fd88965c867 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sat, 21 Feb 2015 15:21:44 -0700 Subject: [PATCH 134/135] Switch UpdateManager to use mimic server --- TShockAPI/UpdateManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 TShockAPI/UpdateManager.cs diff --git a/TShockAPI/UpdateManager.cs b/TShockAPI/UpdateManager.cs old mode 100644 new mode 100755 index bfe7c836..bfb96740 --- a/TShockAPI/UpdateManager.cs +++ b/TShockAPI/UpdateManager.cs @@ -27,7 +27,7 @@ namespace TShockAPI { public class UpdateManager { - private string updateUrl = "https://github.com/NyxStudios/TShock/blob/general-devel/tshock_update.json?raw=true"; + private string updateUrl = "http://update.tshock.co/latest/"; /// /// Check once every X minutes. @@ -115,7 +115,7 @@ namespace TShockAPI private void NotifyAdministrator(TSPlayer player, string[] changes) { - player.SendMessage("The server is out of date.", Color.Red); + player.SendMessage("The server is out of date. Latest version: ", Color.Red); for (int j = 0; j < changes.Length; j++) { player.SendMessage(changes[j], Color.Red); From 3104e76d21948bd2521f57ce8c0285e3161c7593 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sat, 21 Feb 2015 15:26:00 -0700 Subject: [PATCH 135/135] Version tick: 4.2.5 Changed versioning system to remove the date from the version string. Fixes #836 --- TShockAPI/Properties/AssemblyInfo.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) mode change 100644 => 100755 TShockAPI/Properties/AssemblyInfo.cs diff --git a/TShockAPI/Properties/AssemblyInfo.cs b/TShockAPI/Properties/AssemblyInfo.cs old mode 100644 new mode 100755 index 1ace0f53..61a58e2a --- a/TShockAPI/Properties/AssemblyInfo.cs +++ b/TShockAPI/Properties/AssemblyInfo.cs @@ -47,7 +47,11 @@ using System.Runtime.InteropServices; // Major Version // Minor Version // Build Number -// MMdd of the build +// Starting in version 4.2.5, we are no longer including the fourth decimal +// location, which previously held the date and time. -[assembly: AssemblyVersion("4.2.4.0128")] -[assembly: AssemblyFileVersion("4.2.4.0128")] +// Also, be sure to release on github with the exact assembly version tag as below +// so that the update manager works correctly (via the Github releases api and mimic) + +[assembly: AssemblyVersion("4.2.5")] +[assembly: AssemblyFileVersion("4.2.5")]