Refactor wallow command & update changelog
This commit is contained in:
parent
0b890f9507
commit
01fc41968d
3 changed files with 19 additions and 15 deletions
|
|
@ -18,6 +18,8 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
|
||||||
* Changed the spawnboss command to support silent command specifiers. (@QuiCM, suggested by @nojomyth-dev)
|
* Changed the spawnboss command to support silent command specifiers. (@QuiCM, suggested by @nojomyth-dev)
|
||||||
* Updated /godmode to use Journey Mode's Godmode power instead of healing on damage. (requested by @tlworks, backported by @bartico6, implemented preemptive bugfix for creative powers mentioned by @Stealownz)
|
* Updated /godmode to use Journey Mode's Godmode power instead of healing on damage. (requested by @tlworks, backported by @bartico6, implemented preemptive bugfix for creative powers mentioned by @Stealownz)
|
||||||
* Fixed /r attempting to send messages to players that have since disconnected. (@bartico6, reported by @Arthri)
|
* Fixed /r attempting to send messages to players that have since disconnected. (@bartico6, reported by @Arthri)
|
||||||
|
* Added ban ticket ID to ban messages (@QuiCM, suggested by @Bippity)
|
||||||
|
* Refactored /wallow command. /reply no longer bypasses /wallow (@QuiCM)
|
||||||
|
|
||||||
## TShock 4.5.0.1
|
## TShock 4.5.0.1
|
||||||
* Fixed conversion from old to new ban system for MySQL hosted ban databases. (@DeathCradle, @ATFGK)
|
* Fixed conversion from old to new ban system for MySQL hosted ban databases. (@DeathCradle, @ATFGK)
|
||||||
|
|
|
||||||
|
|
@ -5309,8 +5309,6 @@ namespace TShockAPI
|
||||||
args.Player.SendFileTextAsMessage(FileTools.RulesPath);
|
args.Player.SendFileTextAsMessage(FileTools.RulesPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool[] WDisabled { get; set; } = new bool[256];
|
|
||||||
|
|
||||||
public static void Whisper(CommandArgs args)
|
public static void Whisper(CommandArgs args)
|
||||||
{
|
{
|
||||||
if (args.Parameters.Count < 2)
|
if (args.Parameters.Count < 2)
|
||||||
|
|
@ -5334,12 +5332,12 @@ namespace TShockAPI
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var plr = players[0];
|
var plr = players[0];
|
||||||
var msg = string.Join(" ", args.Parameters.ToArray(), 1, args.Parameters.Count - 1);
|
if (!plr.AcceptingWhispers)
|
||||||
if (WDisabled[players[0].Index])
|
|
||||||
{
|
{
|
||||||
args.Player.SendErrorMessage("This player has disabled people from sending whispers!");
|
args.Player.SendErrorMessage("This player is not accepting whispers.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var msg = string.Join(" ", args.Parameters.ToArray(), 1, args.Parameters.Count - 1);
|
||||||
plr.SendMessage(String.Format("<From {0}> {1}", args.Player.Name, msg), Color.MediumPurple);
|
plr.SendMessage(String.Format("<From {0}> {1}", args.Player.Name, msg), Color.MediumPurple);
|
||||||
args.Player.SendMessage(String.Format("<To {0}> {1}", plr.Name, msg), Color.MediumPurple);
|
args.Player.SendMessage(String.Format("<To {0}> {1}", plr.Name, msg), Color.MediumPurple);
|
||||||
plr.LastWhisper = args.Player;
|
plr.LastWhisper = args.Player;
|
||||||
|
|
@ -5347,17 +5345,11 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Wallow(CommandArgs args)
|
private static void Wallow(CommandArgs args)
|
||||||
{
|
{
|
||||||
int index = args.Player.Index;
|
args.Player.AcceptingWhispers = !args.Player.AcceptingWhispers;
|
||||||
if (WDisabled[index])
|
args.Player.SendSuccessMessage($"You {(args.Player.AcceptingWhispers ? "may now" : "will no longer")} receive whispers from other players.");
|
||||||
{
|
args.Player.SendSuccessMessage($"You can toggle this with the '{Specifier}wallow' command.");
|
||||||
args.Player.SendSuccessMessage("You will now recieve whispers from other players!");
|
|
||||||
WDisabled[index] = !WDisabled[index];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
WDisabled[index] = !WDisabled[index];
|
|
||||||
args.Player.SendSuccessMessage("You will now not recieve whispers from other players, type '/wallow' to recieve them again!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Reply(CommandArgs args)
|
private static void Reply(CommandArgs args)
|
||||||
|
|
@ -5368,6 +5360,11 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
else if (args.Player.LastWhisper != null && args.Player.LastWhisper.Active)
|
else if (args.Player.LastWhisper != null && args.Player.LastWhisper.Active)
|
||||||
{
|
{
|
||||||
|
if (!args.Player.LastWhisper.AcceptingWhispers)
|
||||||
|
{
|
||||||
|
args.Player.SendErrorMessage("This player is not accepting whispers.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
var msg = string.Join(" ", args.Parameters);
|
var msg = string.Join(" ", args.Parameters);
|
||||||
args.Player.LastWhisper.SendMessage(String.Format("<From {0}> {1}", args.Player.Name, msg), Color.MediumPurple);
|
args.Player.LastWhisper.SendMessage(String.Format("<From {0}> {1}", args.Player.Name, msg), Color.MediumPurple);
|
||||||
args.Player.SendMessage(String.Format("<To {0}> {1}", args.Player.LastWhisper.Name, msg), Color.MediumPurple);
|
args.Player.SendMessage(String.Format("<To {0}> {1}", args.Player.LastWhisper.Name, msg), Color.MediumPurple);
|
||||||
|
|
|
||||||
|
|
@ -599,6 +599,11 @@ namespace TShockAPI
|
||||||
|
|
||||||
public bool SilentJoinInProgress;
|
public bool SilentJoinInProgress;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the player is accepting whispers from other users
|
||||||
|
/// </summary>
|
||||||
|
public bool AcceptingWhispers = true;
|
||||||
|
|
||||||
/// <summary>Checks if a player is in range of a given tile if range checks are enabled.</summary>
|
/// <summary>Checks if a player is in range of a given tile if range checks are enabled.</summary>
|
||||||
/// <param name="x"> The x coordinate of the tile.</param>
|
/// <param name="x"> The x coordinate of the tile.</param>
|
||||||
/// <param name="y">The y coordinate of the tile.</param>
|
/// <param name="y">The y coordinate of the tile.</param>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue