Merge branch 'general-devel' of github.com:Pryaxis/TShock into general-devel

This commit is contained in:
Lucas Nicodemus 2021-05-20 03:32:24 -07:00
commit c9b13b493e
4 changed files with 17 additions and 13 deletions

View file

@ -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. 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 ## Developer's Guide

View file

@ -531,7 +531,7 @@ namespace TShockAPI
add(new Command(Permissions.buff, Buff, "buff") add(new Command(Permissions.buff, Buff, "buff")
{ {
AllowServer = false, 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") add(new Command(Permissions.clear, Clear, "clear")
{ {
@ -539,7 +539,7 @@ namespace TShockAPI
}); });
add(new Command(Permissions.buffplayer, GBuff, "gbuff", "buffplayer") 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") add(new Command(Permissions.godmode, ToggleGodMode, "godmode")
{ {
@ -5961,11 +5961,12 @@ namespace TShockAPI
{ {
if (args.Parameters.Count < 1 || args.Parameters.Count > 2) if (args.Parameters.Count < 1 || args.Parameters.Count > 2)
{ {
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: {0}buff <buff id/name> [time(seconds)]", Specifier); args.Player.SendErrorMessage("Invalid syntax! Proper syntax: {0}buff <buff name or ID> [time in seconds]", Specifier);
return; return;
} }
int id = 0; int id = 0;
int time = 60; int time = 60;
var timeLimit = (int.MaxValue / 60) - 1;
if (!int.TryParse(args.Parameters[0], out id)) if (!int.TryParse(args.Parameters[0], out id))
{ {
var found = TShock.Utils.GetBuffByName(args.Parameters[0]); var found = TShock.Utils.GetBuffByName(args.Parameters[0]);
@ -5985,8 +5986,9 @@ namespace TShockAPI
int.TryParse(args.Parameters[1], out time); int.TryParse(args.Parameters[1], out time);
if (id > 0 && id < Main.maxBuffTypes) if (id > 0 && id < Main.maxBuffTypes)
{ {
if (time < 0 || time > short.MaxValue) // Max possible buff duration as of 1.4.2.2 is 35791393 seconds (415 days).
time = 60; if (time < 0 || time > timeLimit)
time = timeLimit;
args.Player.SetBuff(id, time * 60); 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))); TShock.Utils.GetBuffName(id), TShock.Utils.GetBuffDescription(id), (time)));
@ -5999,11 +6001,12 @@ namespace TShockAPI
{ {
if (args.Parameters.Count < 2 || args.Parameters.Count > 3) if (args.Parameters.Count < 2 || args.Parameters.Count > 3)
{ {
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: {0}gbuff <player> <buff id/name> [time(seconds)]", Specifier); args.Player.SendErrorMessage("Invalid syntax! Proper syntax: {0}gbuff <player> <buff name or ID> [time in seconds]", Specifier);
return; return;
} }
int id = 0; int id = 0;
int time = 60; int time = 60;
var timeLimit = (int.MaxValue / 60) - 1;
var foundplr = TSPlayer.FindByNameOrID(args.Parameters[0]); var foundplr = TSPlayer.FindByNameOrID(args.Parameters[0]);
if (foundplr.Count == 0) if (foundplr.Count == 0)
{ {
@ -6036,8 +6039,8 @@ namespace TShockAPI
int.TryParse(args.Parameters[2], out time); int.TryParse(args.Parameters[2], out time);
if (id > 0 && id < Main.maxBuffTypes) if (id > 0 && id < Main.maxBuffTypes)
{ {
if (time < 0 || time > short.MaxValue) if (time < 0 || time > timeLimit)
time = 60; time = timeLimit;
foundplr[0].SetBuff(id, time * 60); 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), foundplr[0].Name, TShock.Utils.GetBuffName(id),

View file

@ -29,7 +29,7 @@ namespace TShockAPI
public class FileTools public class FileTools
{ {
private const string MotdFormat = 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"; "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";
/// <summary> /// <summary>
/// Path to the file containing the rules. /// Path to the file containing the rules.
/// </summary> /// </summary>

View file

@ -1509,6 +1509,7 @@ namespace TShockAPI
foo = foo.Replace("%map%", (TShock.Config.Settings.UseServerName ? TShock.Config.Settings.ServerName : Main.worldName)); foo = foo.Replace("%map%", (TShock.Config.Settings.UseServerName ? TShock.Config.Settings.ServerName : Main.worldName));
foo = foo.Replace("%players%", String.Join(",", players)); foo = foo.Replace("%players%", String.Join(",", players));
foo = foo.Replace("%specifier%", TShock.Config.Settings.CommandSpecifier);
SendMessage(foo, lineColor); SendMessage(foo, lineColor);
} }