From 9418e4304f3f2c035b2827eb5caa8710a83cfb1c Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Wed, 12 May 2021 13:47:27 -0400 Subject: [PATCH 01/12] Change max buff limit from short to int --- TShockAPI/Commands.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 601c2591..5b27ebd7 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -5985,7 +5985,7 @@ namespace TShockAPI int.TryParse(args.Parameters[1], out time); if (id > 0 && id < Main.maxBuffTypes) { - if (time < 0 || time > short.MaxValue) + if (time < 0 || time > int.MaxValue) time = 60; args.Player.SetBuff(id, time * 60); args.Player.SendSuccessMessage(string.Format("You have buffed yourself with {0}({1}) for {2} seconds!", From 0d686ea80f5737212da409a085c065a0120d19d1 Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Wed, 12 May 2021 15:39:11 -0400 Subject: [PATCH 02/12] Change duration to actual max value in seconds --- TShockAPI/Commands.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 5b27ebd7..5c356d04 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -5985,8 +5985,9 @@ namespace TShockAPI int.TryParse(args.Parameters[1], out time); if (id > 0 && id < Main.maxBuffTypes) { - if (time < 0 || time > int.MaxValue) - time = 60; + // Max possible buff duration as of 1.4.2.2 is 35791393 seconds (415 days). + if (time < 0 || time > 35791393) + time = 35791393; args.Player.SetBuff(id, time * 60); args.Player.SendSuccessMessage(string.Format("You have buffed yourself with {0}({1}) for {2} seconds!", TShock.Utils.GetBuffName(id), TShock.Utils.GetBuffDescription(id), (time))); From 0eadfaba52d30f2e23958ff4a9339c0071c41901 Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Wed, 12 May 2021 15:48:38 -0400 Subject: [PATCH 03/12] Minor fixes --- TShockAPI/Commands.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 5c356d04..66fce497 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -5961,11 +5961,11 @@ namespace TShockAPI { if (args.Parameters.Count < 1 || args.Parameters.Count > 2) { - args.Player.SendErrorMessage("Invalid syntax! Proper syntax: {0}buff [time(seconds)]", Specifier); + args.Player.SendErrorMessage("Invalid syntax! Proper syntax: {0}buff [time in seconds]", Specifier); return; } int id = 0; - int time = 60; + int time = 35791393; if (!int.TryParse(args.Parameters[0], out id)) { var found = TShock.Utils.GetBuffByName(args.Parameters[0]); @@ -5989,7 +5989,7 @@ namespace TShockAPI if (time < 0 || time > 35791393) time = 35791393; args.Player.SetBuff(id, time * 60); - args.Player.SendSuccessMessage(string.Format("You have buffed yourself with {0}({1}) for {2} seconds!", + args.Player.SendSuccessMessage(string.Format("You have buffed yourself with {0} ({1}) for {2} seconds!", TShock.Utils.GetBuffName(id), TShock.Utils.GetBuffDescription(id), (time))); } else From 68c650f4fa05a93b92e361067d7665f83b6bb07f Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Wed, 12 May 2021 21:36:26 -0400 Subject: [PATCH 04/12] More minor fixes Reverted default (when no duration is specified) buff duration to 60s, added formula instead of hard coding max duration as per Quake's recommendation, made error message more self-explanatory --- TShockAPI/Commands.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 66fce497..b03ad31e 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -5961,11 +5961,12 @@ namespace TShockAPI { if (args.Parameters.Count < 1 || args.Parameters.Count > 2) { - args.Player.SendErrorMessage("Invalid syntax! Proper syntax: {0}buff [time in seconds]", Specifier); + args.Player.SendErrorMessage("Invalid syntax! Proper syntax: {0}buff [optional: time in seconds]", Specifier); return; } int id = 0; - int time = 35791393; + int time = 60; + var timeLimit = (int.MaxValue / 60) - 1 if (!int.TryParse(args.Parameters[0], out id)) { var found = TShock.Utils.GetBuffByName(args.Parameters[0]); @@ -5986,8 +5987,8 @@ namespace TShockAPI if (id > 0 && id < Main.maxBuffTypes) { // Max possible buff duration as of 1.4.2.2 is 35791393 seconds (415 days). - if (time < 0 || time > 35791393) - time = 35791393; + if (time < 0 || time > timeLimit) + time = timeLimit; args.Player.SetBuff(id, time * 60); args.Player.SendSuccessMessage(string.Format("You have buffed yourself with {0} ({1}) for {2} seconds!", TShock.Utils.GetBuffName(id), TShock.Utils.GetBuffDescription(id), (time))); From dacc20e9c3657346fba0ef63c9f32048e4e654c5 Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Wed, 12 May 2021 21:40:44 -0400 Subject: [PATCH 05/12] Update buff command HelpText More properly explain the command functionality --- TShockAPI/Commands.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index b03ad31e..e66b77ac 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -531,7 +531,7 @@ namespace TShockAPI add(new Command(Permissions.buff, Buff, "buff") { AllowServer = false, - HelpText = "Gives yourself a buff for an amount of time." + HelpText = "Gives yourself a buff or debuff for an amount of time. Putting -1 for time will set it to 415 days." }); add(new Command(Permissions.clear, Clear, "clear") { From 306e4d1ab4497a62fc17f8d940324531c3bffc78 Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Wed, 12 May 2021 21:45:06 -0400 Subject: [PATCH 06/12] fix typo sigh --- TShockAPI/Commands.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index e66b77ac..51d57c7f 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -5966,7 +5966,7 @@ namespace TShockAPI } int id = 0; int time = 60; - var timeLimit = (int.MaxValue / 60) - 1 + var timeLimit = (int.MaxValue / 60) - 1; if (!int.TryParse(args.Parameters[0], out id)) { var found = TShock.Utils.GetBuffByName(args.Parameters[0]); From d2a0a539f49ce519ed7633382317dcce516f7fc6 Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Wed, 12 May 2021 22:08:10 -0400 Subject: [PATCH 07/12] fix error msg --- TShockAPI/Commands.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 51d57c7f..b89afe3d 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -5961,7 +5961,7 @@ namespace TShockAPI { if (args.Parameters.Count < 1 || args.Parameters.Count > 2) { - args.Player.SendErrorMessage("Invalid syntax! Proper syntax: {0}buff [optional: time in seconds]", Specifier); + args.Player.SendErrorMessage("Invalid syntax! Proper syntax: {0}buff [time in seconds]", Specifier); return; } int id = 0; From e0c9f4503870b44d551159136089aca3847081a2 Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Fri, 14 May 2021 12:58:16 -0400 Subject: [PATCH 08/12] Add %specifier% to SendFileTextAsMessage --- TShockAPI/TSPlayer.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 68d8e306..915399eb 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -1509,6 +1509,7 @@ namespace TShockAPI foo = foo.Replace("%map%", (TShock.Config.Settings.UseServerName ? TShock.Config.Settings.ServerName : Main.worldName)); foo = foo.Replace("%players%", String.Join(",", players)); + foo = foo.Replace("%specifier%", TShock.Config.Settings.CommandSpecifier); SendMessage(foo, lineColor); } From a9e8cd7ca50ddcdcc2421dfd4c195b425f76ff6c Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Fri, 14 May 2021 13:00:56 -0400 Subject: [PATCH 09/12] update default motd to use %specifier --- TShockAPI/FileTools.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/FileTools.cs b/TShockAPI/FileTools.cs index 3f8095ef..4789844a 100644 --- a/TShockAPI/FileTools.cs +++ b/TShockAPI/FileTools.cs @@ -29,7 +29,7 @@ namespace TShockAPI public class FileTools { private const string MotdFormat = - "This is [c/FF0000:%map%] on [c/00FFFF:TShock for Terraria].\n[c/00FF00:Current players:] [c/FFFF00:%players%]\nType [c/FF0000:/help] for a list of commands.\n"; + "This is [c/FF0000:%map%] on [c/00FFFF:TShock for Terraria].\n[c/00FF00:Current players:] [c/FFFF00:%players%]\nType [c/FF0000:%specifier%help] for a list of commands.\n"; /// /// Path to the file containing the rules. /// From a2804b6c89471dab4db6cdcae792c7b2fc375819 Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Fri, 14 May 2021 13:23:42 -0400 Subject: [PATCH 10/12] Update how it looks --- TShockAPI/FileTools.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/FileTools.cs b/TShockAPI/FileTools.cs index 4789844a..a9608c4e 100644 --- a/TShockAPI/FileTools.cs +++ b/TShockAPI/FileTools.cs @@ -29,7 +29,7 @@ namespace TShockAPI public class FileTools { private const string MotdFormat = - "This is [c/FF0000:%map%] on [c/00FFFF:TShock for Terraria].\n[c/00FF00:Current players:] [c/FFFF00:%players%]\nType [c/FF0000:%specifier%help] for a list of commands.\n"; + "Welcome to [c/ffff00:%map%] on [c/7ddff8:T][c/81dbf6:S][c/86d7f4:h][c/8ad3f3:o][c/8ecef1:c][c/93caef:k] for [c/55d284:T][c/62d27a:e][c/6fd16f:r][c/7cd165:r][c/89d15a:a][c/95d150:r][c/a4d145:i][c/b1d03b:a].\n[c/FFFFFF:Online player(s):] [c/FFFF00:%players%]\nType [c/55D284:%specifier%][c/62D27A:h][c/6FD16F:e][c/7CD165:l][c/89D15A:p] for a list of commands.\n"; /// /// Path to the file containing the rules. /// From a1ddea4f597bbf62bb7124f9b5c47050a65ef6b9 Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Fri, 14 May 2021 13:44:37 -0400 Subject: [PATCH 11/12] Update /gbuff with the same changes totally forgot this existed --- TShockAPI/Commands.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index b89afe3d..bf2db430 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -539,7 +539,7 @@ namespace TShockAPI }); add(new Command(Permissions.buffplayer, GBuff, "gbuff", "buffplayer") { - HelpText = "Gives another player a buff for an amount of time." + HelpText = "Gives another player a buff or debuff for an amount of time. Putting -1 for time will set it to 415 days." }); add(new Command(Permissions.godmode, ToggleGodMode, "godmode") { @@ -6001,11 +6001,12 @@ namespace TShockAPI { if (args.Parameters.Count < 2 || args.Parameters.Count > 3) { - args.Player.SendErrorMessage("Invalid syntax! Proper syntax: {0}gbuff [time(seconds)]", Specifier); + args.Player.SendErrorMessage("Invalid syntax! Proper syntax: {0}gbuff [time in seconds]", Specifier); return; } int id = 0; int time = 60; + var timeLimit = (int.MaxValue / 60) - 1; var foundplr = TSPlayer.FindByNameOrID(args.Parameters[0]); if (foundplr.Count == 0) { @@ -6038,13 +6039,13 @@ namespace TShockAPI int.TryParse(args.Parameters[2], out time); if (id > 0 && id < Main.maxBuffTypes) { - if (time < 0 || time > short.MaxValue) - time = 60; + if (time < 0 || time > timeLimit) + time = timeLimit; foundplr[0].SetBuff(id, time * 60); - args.Player.SendSuccessMessage(string.Format("You have buffed {0} with {1}({2}) for {3} seconds!", + args.Player.SendSuccessMessage(string.Format("You have buffed {0} with {1} ({2}) for {3} seconds!", foundplr[0].Name, TShock.Utils.GetBuffName(id), TShock.Utils.GetBuffDescription(id), (time))); - foundplr[0].SendSuccessMessage(string.Format("{0} has buffed you with {1}({2}) for {3} seconds!", + foundplr[0].SendSuccessMessage(string.Format("{0} has buffed you with {1} ({2}) for {3} seconds!", args.Player.Name, TShock.Utils.GetBuffName(id), TShock.Utils.GetBuffDescription(id), (time))); } From 44c6b69fdc111d651d89ce5c841e022190cc75d5 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Thu, 20 May 2021 02:54:27 -0700 Subject: [PATCH 12/12] Remove ref to travis builds & add video to readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d4319cf5..2f688a52 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ On [AppVeyor](https://ci.appveyor.com/project/hakusaro/tshock/), click on histor On [GitHub](https://github.com/Pryaxis/TShock/), click on the actions tab, then click on "build server" on the commit or branch you want. If it was successful, you can download either the experimental release or debug artifacts. -For old builds from Travis CI, you can still get them (for now) from us directly, on [our Travis CI artifact mirror](https://travis.tshock.co/). Please note that these builds should be considered legacy and for archival purposes only. If you need them in the long term, please raise an issue explaining why before they are removed. +These instructions are also available as a [video tutorial on Streamable](https://streamable.com/i9mfh9). ## Developer's Guide