Merge branch 'general-devel' into pscheck
This commit is contained in:
commit
76ea1760fd
8 changed files with 68 additions and 39 deletions
|
|
@ -37,6 +37,7 @@ using OTAPI.Tile;
|
|||
using TShockAPI.Localization;
|
||||
using System.Text.RegularExpressions;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.GameContent.Creative;
|
||||
|
||||
namespace TShockAPI
|
||||
{
|
||||
|
|
@ -1522,7 +1523,7 @@ namespace TShockAPI
|
|||
|
||||
if (banResult?.Ban != null)
|
||||
{
|
||||
player.Disconnect($"You have been banned: {banResult.Ban.Reason}.");
|
||||
player.Disconnect($"#{banResult.Ban.TicketNumber} - You have been banned: {banResult.Ban.Reason}.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5303,8 +5304,6 @@ namespace TShockAPI
|
|||
args.Player.SendFileTextAsMessage(FileTools.RulesPath);
|
||||
}
|
||||
|
||||
public static bool[] WDisabled { get; set; } = new bool[256];
|
||||
|
||||
public static void Whisper(CommandArgs args)
|
||||
{
|
||||
if (args.Parameters.Count < 2)
|
||||
|
|
@ -5328,12 +5327,12 @@ namespace TShockAPI
|
|||
else
|
||||
{
|
||||
var plr = players[0];
|
||||
var msg = string.Join(" ", args.Parameters.ToArray(), 1, args.Parameters.Count - 1);
|
||||
if (WDisabled[players[0].Index])
|
||||
if (!plr.AcceptingWhispers)
|
||||
{
|
||||
args.Player.SendErrorMessage("This player has disabled people from sending whispers!");
|
||||
args.Player.SendErrorMessage("This player is not accepting whispers.");
|
||||
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);
|
||||
args.Player.SendMessage(String.Format("<To {0}> {1}", plr.Name, msg), Color.MediumPurple);
|
||||
plr.LastWhisper = args.Player;
|
||||
|
|
@ -5341,17 +5340,11 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
|
||||
public static void Wallow(CommandArgs args)
|
||||
private static void Wallow(CommandArgs args)
|
||||
{
|
||||
int index = args.Player.Index;
|
||||
if (WDisabled[index])
|
||||
{
|
||||
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!");
|
||||
args.Player.AcceptingWhispers = !args.Player.AcceptingWhispers;
|
||||
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.");
|
||||
}
|
||||
|
||||
private static void Reply(CommandArgs args)
|
||||
|
|
@ -5360,12 +5353,21 @@ namespace TShockAPI
|
|||
{
|
||||
args.Player.SendErrorMessage("You are muted.");
|
||||
}
|
||||
else if (args.Player.LastWhisper != null)
|
||||
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);
|
||||
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);
|
||||
}
|
||||
else if (args.Player.LastWhisper != null)
|
||||
{
|
||||
args.Player.SendErrorMessage("The player you're attempting to reply to is no longer online.");
|
||||
}
|
||||
else
|
||||
{
|
||||
args.Player.SendErrorMessage("You haven't previously received any whispers. Please use {0}whisper to whisper to other people.", Specifier);
|
||||
|
|
@ -6445,14 +6447,18 @@ namespace TShockAPI
|
|||
|
||||
playerToGod.GodMode = !playerToGod.GodMode;
|
||||
|
||||
if (playerToGod == args.Player)
|
||||
{
|
||||
args.Player.SendSuccessMessage(string.Format("You are {0} in god mode.", args.Player.GodMode ? "now" : "no longer"));
|
||||
}
|
||||
else
|
||||
var godPower = CreativePowerManager.Instance.GetPower<CreativePowers.GodmodePower>();
|
||||
|
||||
godPower.SetEnabledState(playerToGod.Index, playerToGod.GodMode);
|
||||
|
||||
if (playerToGod != args.Player)
|
||||
{
|
||||
args.Player.SendSuccessMessage(string.Format("{0} is {1} in god mode.", playerToGod.Name, playerToGod.GodMode ? "now" : "no longer"));
|
||||
playerToGod.SendSuccessMessage(string.Format("You are {0} in god mode.", playerToGod.GodMode ? "now" : "no longer"));
|
||||
}
|
||||
|
||||
if (!args.Silent || (playerToGod == args.Player))
|
||||
{
|
||||
playerToGod.SendSuccessMessage(string.Format("You are {0} in god mode.", args.Player.GodMode ? "now" : "no longer"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -205,12 +205,12 @@ namespace TShockAPI.DB
|
|||
{
|
||||
if (ban.ExpirationDateTime == DateTime.MaxValue)
|
||||
{
|
||||
player.Disconnect("You are banned: " + ban.Reason);
|
||||
player.Disconnect($"#{ban.TicketNumber} - You are banned: {ban.Reason}");
|
||||
return true;
|
||||
}
|
||||
|
||||
TimeSpan ts = ban.ExpirationDateTime - DateTime.UtcNow;
|
||||
player.Disconnect($"You are banned: {ban.Reason} ({ban.GetPrettyExpirationString()} remaining)");
|
||||
player.Disconnect($"#{ban.TicketNumber} - You are banned: {ban.Reason} ({ban.GetPrettyExpirationString()} remaining)");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2576,10 +2576,6 @@ namespace TShockAPI
|
|||
args.Player.PlayerData.maxHealth = max;
|
||||
}
|
||||
|
||||
if (args.Player.GodMode && (cur < max))
|
||||
{
|
||||
args.Player.Heal(args.TPlayer.statLifeMax2);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -3738,12 +3734,6 @@ namespace TShockAPI
|
|||
if (OnPlayerDamage(args.Player, args.Data, id, direction, dmg, pvp, crit, playerDeathReason))
|
||||
return true;
|
||||
|
||||
if (TShock.Players[id].GodMode)
|
||||
{
|
||||
TShock.Log.ConsoleDebug("GetDataHandlers / HandlePlayerDamageV2 rejected (god mode on) {0}", args.Player.Name);
|
||||
TShock.Players[id].Heal(args.TPlayer.statLifeMax);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,5 +53,5 @@ using System.Runtime.InteropServices;
|
|||
// 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.5.0.1")]
|
||||
[assembly: AssemblyFileVersion("4.5.0.1")]
|
||||
[assembly: AssemblyVersion("4.5.2")]
|
||||
[assembly: AssemblyFileVersion("4.5.2")]
|
||||
|
|
|
|||
|
|
@ -599,6 +599,11 @@ namespace TShockAPI
|
|||
|
||||
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>
|
||||
/// <param name="x"> The x coordinate of the tile.</param>
|
||||
/// <param name="y">The y coordinate of the tile.</param>
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ using TShockAPI.Sockets;
|
|||
using TShockAPI.CLI;
|
||||
using TShockAPI.Localization;
|
||||
using TShockAPI.Configuration;
|
||||
using Terraria.GameContent.Creative;
|
||||
|
||||
namespace TShockAPI
|
||||
{
|
||||
|
|
@ -57,7 +58,7 @@ namespace TShockAPI
|
|||
/// <summary>VersionNum - The version number the TerrariaAPI will return back to the API. We just use the Assembly info.</summary>
|
||||
public static readonly Version VersionNum = Assembly.GetExecutingAssembly().GetName().Version;
|
||||
/// <summary>VersionCodename - The version codename is displayed when the server starts. Inspired by software codenames conventions.</summary>
|
||||
public static readonly string VersionCodename = "Stealownz + DeathCradle edition";
|
||||
public static readonly string VersionCodename = "April Lyrids edition";
|
||||
|
||||
/// <summary>SavePath - This is the path TShock saves its data in. This path is relative to the TerrariaServer.exe (not in ServerPlugins).</summary>
|
||||
public static string SavePath = "tshock";
|
||||
|
|
@ -1216,6 +1217,23 @@ namespace TShockAPI
|
|||
|
||||
Players[args.Who] = null;
|
||||
|
||||
//Reset toggle creative powers to default, preventing potential power transfer & desync on another user occupying this slot later.
|
||||
|
||||
foreach(var kv in CreativePowerManager.Instance._powersById)
|
||||
{
|
||||
var power = kv.Value;
|
||||
|
||||
//No need to reset sliders - those are reset manually by the game, most likely an oversight that toggles don't receive this treatment.
|
||||
|
||||
if (power is CreativePowers.APerPlayerTogglePower toggle)
|
||||
{
|
||||
if (toggle._perPlayerIsEnabled[args.Who] == toggle._defaultToggleState)
|
||||
continue;
|
||||
|
||||
toggle.SetEnabledState(args.Who, toggle._defaultToggleState);
|
||||
}
|
||||
}
|
||||
|
||||
if (tsplr.ReceivedInfo)
|
||||
{
|
||||
if (!tsplr.SilentKickInProgress && tsplr.State >= 3)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue