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

@ -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")
{
@ -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")
{
@ -5961,11 +5961,12 @@ namespace TShockAPI
{
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;
}
int id = 0;
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]);
@ -5985,10 +5986,11 @@ namespace TShockAPI
int.TryParse(args.Parameters[1], out time);
if (id > 0 && id < Main.maxBuffTypes)
{
if (time < 0 || time > short.MaxValue)
time = 60;
// Max possible buff duration as of 1.4.2.2 is 35791393 seconds (415 days).
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!",
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
@ -5999,11 +6001,12 @@ namespace TShockAPI
{
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;
}
int id = 0;
int time = 60;
var timeLimit = (int.MaxValue / 60) - 1;
var foundplr = TSPlayer.FindByNameOrID(args.Parameters[0]);
if (foundplr.Count == 0)
{
@ -6036,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)));
}

View file

@ -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";
"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>
/// Path to the file containing the rules.
/// </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("%players%", String.Join(",", players));
foo = foo.Replace("%specifier%", TShock.Config.Settings.CommandSpecifier);
SendMessage(foo, lineColor);
}