Merge branch 'general-devel' into feature/detect-installations-in-client-directory

This commit is contained in:
Lucas Nicodemus 2025-01-27 21:56:48 +09:00 committed by GitHub
commit 0516428f88
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
43 changed files with 3155 additions and 2069 deletions

View file

@ -1,15 +1,20 @@
# ignore every file
*
# Ignore all Git metadata and build output (in all directories).
**/.git*
**/bin/
**/obj/
# except for the ones required for building
!i18n/
!prebuilts/
!TerrariaServerAPI/
!TShockAPI/
!TShockLauncher/
!TShockLauncher.Tests/
!TShock.sln
# but exclude build artifacts
*/bin/
*/obj/
# Ignore other specific files that aren't needed for the build itself.
/.all-contributorsrc
/.dockerignore
/.editorconfig
/.vscode
/appveyor.yml
/COPYING
/crowdin.yml
/Dockerfile
/docs
/README.md
/README_cn.md
/renovate.json
/scripts
/SECURITY.md

View file

@ -1,3 +1,5 @@
> By participating in the TShock for Terraria community, all members will adhere to maintaining decorum with respect to all humans, in and out of the community. Members will not engage in discussion that inappropriately disparages or marginalizes any group of people or any individual. Members will not attempt to further or advance an agenda to the point of being overbearing or close minded (such as through spreading FUD). Members will not abuse services provided to them and will follow the guidance of community leaders on a situational basis about what abuse consists of. Members will adhere to United States and international law. If members notice a violation of this code of conduct, they will not engage but will instead contact the leadership team on either the forums or Discord.
> Do not attempt to circumvent or bypass the code of conduct by using clever logic or reasoning (e.g., insulting Facepunch members, because they weren't directly mentioned here).
> Do not abuse GitHub services by generating useless emails to all people who watch the repo. This includes unnecessary PR approvals and off-topic discussion, issue, and PR comments that serve no purpose. Due to the high visibility nature of actions that create emails, you may be blocked temporarily as your first warning.

2
.github/FUNDING.yml vendored
View file

@ -1,2 +1,2 @@
# These are supported funding model platforms
github: [SignatureBeef, hakusaro, Stealownz, QuiCM]
github: [SignatureBeef, QuiCM]

60
.github/workflows/ci-docker.yml vendored Normal file
View file

@ -0,0 +1,60 @@
name: CI (Docker image)
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
permissions:
attestations: write
id-token: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up buildx
uses: docker/setup-buildx-action@v3
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate version information
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=tag,enable=${{ !startsWith(github.ref, 'refs/tags/v') }}
type=ref,event=pr
type=semver,pattern={{version}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
type=semver,pattern={{major}}.{{minor}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
type=semver,pattern={{major}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
flavor: |
latest=${{ startsWith(github.ref, 'refs/tags/v') }}
- name: Build image
id: build
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7,windows/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
pull: true
cache-from: type=gha, scope=${{ github.workflow }}
cache-to: type=gha, scope=${{ github.workflow }}
- name: Generate build provenance attestation
if: ${{ github.event_name != 'pull_request' }}
uses: actions/attest-build-provenance@v2
with:
subject-name: ghcr.io/${{ github.repository }}
subject-digest: ${{ steps.build.outputs.digest }}
push-to-registry: true

View file

@ -63,14 +63,14 @@ jobs:
tar -cvf ../../../../../../TShock-Beta-${{ matrix.arch }}-Release.tar *
- name: Upload artifact (non-Windows)
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: ${{ matrix.arch != 'win-x64' }}
with:
name: TShock-Beta-${{ matrix.arch }}-Release
path: TShock-Beta-${{ matrix.arch }}-Release.tar
- name: Upload artifact (Windows)
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: ${{ matrix.arch == 'win-x64' }}
with:
name: TShock-Beta-${{ matrix.arch }}-Release

View file

@ -1,10 +1,8 @@
ARG TARGETPLATFORM=linux/amd64
ARG BUILDPLATFORM=${TARGETPLATFORM}
# TARGETPLATFORM and BUILDPLATFORM are automatically filled in by Docker buildx.
# They should not be set in the global scope manually.
FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/dotnet/sdk:6.0 AS builder
ARG TARGETPLATFORM
# Copy build context
WORKDIR /TShock
COPY . ./
@ -12,6 +10,10 @@ COPY . ./
# Build and package release based on target architecture
RUN dotnet build -v m
WORKDIR /TShock/TShockLauncher
# Make TARGETPLATFORM available to the container.
ARG TARGETPLATFORM
RUN \
case "${TARGETPLATFORM}" in \
"linux/amd64") export ARCH="linux-x64" \

View file

@ -1,5 +1,5 @@
<p align="center">
<img src="https://tshock.co/newlogo.png" alt="TShock for Terraria"><br />
<img src="https://tshock.s3.us-west-001.backblazeb2.com/newlogo.png" alt="TShock for Terraria"><br />
<a href="https://ci.appveyor.com/project/hakusaro/tshock">
<img src="https://ci.appveyor.com/api/projects/status/chhe61q227lqdlg1?svg=true" alt="AppVeyor Build Status">
</a>

View file

@ -1,5 +1,5 @@
<p align="center">
<img src="https://tshock.co/newlogo.png" alt="TShock for Terraria"><br />
<img src="https://tshock.s3.us-west-001.backblazeb2.com/newlogo.png" alt="TShock for Terraria"><br />
<a href="https://ci.appveyor.com/project/hakusaro/tshock">
<img src="https://ci.appveyor.com/api/projects/status/chhe61q227lqdlg1?svg=true" alt="AppVeyor Build Status">
</a>

View file

@ -424,7 +424,7 @@ namespace TShockAPI
};
PlayerAddBuffWhitelist[BuffID.BrainOfConfusionBuff] = new BuffLimit
{
MaxTicks = 240,
MaxTicks = 60 * 4,
CanBeAddedWithoutHostile = true,
CanOnlyBeAppliedToSender = true
};
@ -434,6 +434,12 @@ namespace TShockAPI
CanBeAddedWithoutHostile = true,
CanOnlyBeAppliedToSender = true
};
PlayerAddBuffWhitelist[BuffID.ParryDamageBuff] = new BuffLimit
{
MaxTicks = 60 * 5,
CanBeAddedWithoutHostile = true,
CanOnlyBeAppliedToSender = true
};
#endregion Whitelist
}
@ -1878,7 +1884,7 @@ namespace TShockAPI
return;
}
if (TShock.Players[id] == null)
if (TShock.Players[id] == null || !TShock.Players[id].Active)
{
TShock.Log.ConsoleDebug(GetString(
"Bouncer / OnPlayerBuff rejected {0} ({1}) applying buff {2} to {3} for {4} ticks: target is null", args.Player.Name,
@ -2081,7 +2087,7 @@ namespace TShockAPI
short amount = args.Amount;
byte plr = args.TargetPlayerIndex;
if (amount <= 0 || Main.player[plr] == null || !Main.player[plr].active)
if (amount <= 0 || TShock.Players[plr] == null || !TShock.Players[plr].Active)
{
TShock.Log.ConsoleDebug(GetString("Bouncer / OnHealOtherPlayer rejected null checks"));
args.Handled = true;
@ -2589,7 +2595,7 @@ namespace TShockAPI
byte direction = args.Direction;
PlayerDeathReason reason = args.PlayerDeathReason;
if (id >= Main.maxPlayers || TShock.Players[id] == null)
if (id >= Main.maxPlayers || TShock.Players[id] == null || !TShock.Players[id].Active)
{
TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerDamage rejected null check"));
args.Handled = true;
@ -2659,9 +2665,12 @@ namespace TShockAPI
* If the player was not specified, that is, the player index is -1, then it is definitely a custom cause, as you can only deal damage with a projectile or another player.
* This is how everything else works. If an NPC is specified, its value is not -1, which is a custom cause.
*
* An exception to this is damage dealt by the Inferno potion to other players -- it is only identified by the other index value of 16,
* even lacking a source player index.
*
* Checking whether this damage came from the player is necessary, because the damage from the player can come even when it is hit by a NPC
*/
if (TShock.Config.Settings.DisableCustomDeathMessages && id != args.Player.Index &&
if (TShock.Config.Settings.DisableCustomDeathMessages && id != args.Player.Index && reason._sourceOtherIndex != 16 &&
(reason._sourcePlayerIndex == -1 || reason._sourceNPCIndex != -1 || reason._sourceOtherIndex != -1 || reason._sourceCustomReason != null))
{
TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerDamage rejected custom death message from {0}", args.Player.Name));
@ -2851,7 +2860,7 @@ namespace TShockAPI
{ BuffID.Poisoned, 3600 }, // BuffID: 20
{ BuffID.OnFire, 1200 }, // BuffID: 24
{ BuffID.Confused, short.MaxValue }, // BuffID: 31 Brain of Confusion Internal Item ID: 3223
{ BuffID.CursedInferno, 420 }, // BuffID: 39
{ BuffID.CursedInferno, 600 }, // BuffID: 39
{ BuffID.Frostburn, 900 }, // BuffID: 44
{ BuffID.Ichor, 1200 }, // BuffID: 69
{ BuffID.Venom, 1800 }, // BuffID: 70

View file

@ -148,24 +148,29 @@ namespace TShockAPI
Permissions = new List<string>();
}
public bool Run(string msg, bool silent, TSPlayer ply, List<string> parms)
public bool Run(CommandArgs args)
{
if (!CanRun(ply))
if (!CanRun(args.Player))
return false;
try
{
CommandDelegate(new CommandArgs(msg, silent, ply, parms));
CommandDelegate(args);
}
catch (Exception e)
{
ply.SendErrorMessage(GetString("Command failed, check logs for more details."));
args.Player.SendErrorMessage(GetString("Command failed, check logs for more details."));
TShock.Log.Error(e.ToString());
}
return true;
}
public bool Run(string msg, bool silent, TSPlayer ply, List<string> parms)
{
return Run(new CommandArgs(msg, silent, ply, parms));
}
public bool Run(string msg, TSPlayer ply, List<string> parms)
{
return Run(msg, false, ply, parms);
@ -704,7 +709,12 @@ namespace TShockAPI
TShock.Utils.SendLogs(GetString("{0} executed: {1}{2}.", player.Name, silent ? SilentSpecifier : Specifier, cmdText), Color.PaleVioletRed, player);
else
TShock.Utils.SendLogs(GetString("{0} executed (args omitted): {1}{2}.", player.Name, silent ? SilentSpecifier : Specifier, cmdName), Color.PaleVioletRed, player);
cmd.Run(cmdText, silent, player, args);
CommandArgs arguments = new CommandArgs(cmdText, silent, player, args);
bool handled = PlayerHooks.OnPrePlayerCommand(cmd, ref arguments);
if (!handled)
cmd.Run(arguments);
PlayerHooks.OnPostPlayerCommand(cmd, arguments, handled);
}
}
return true;
@ -1176,7 +1186,7 @@ namespace TShockAPI
try
{
TShock.UserAccounts.SetUserGroup(account, args.Parameters[2]);
TShock.UserAccounts.SetUserGroup(args.Player, account, args.Parameters[2]);
TShock.Log.ConsoleInfo(GetString("{0} changed account {1} to group {2}.", args.Player.Name, account.Name, args.Parameters[2]));
args.Player.SendSuccessMessage(GetString("Account {0} has been changed to group {1}.", account.Name, args.Parameters[2]));
@ -1193,6 +1203,10 @@ namespace TShockAPI
{
args.Player.SendErrorMessage(GetString($"User {account.Name} does not exist."));
}
catch (UserGroupUpdateLockedException)
{
args.Player.SendErrorMessage(GetString("Hook blocked the attempt to change the user group."));
}
catch (UserAccountManagerException e)
{
args.Player.SendErrorMessage(GetString($"User {account.Name} could not be added. Check console for details."));
@ -2044,6 +2058,7 @@ namespace TShockAPI
private static void OffNoSave(CommandArgs args)
{
string reason = ((args.Parameters.Count > 0) ? GetString("Server shutting down: ") + String.Join(" ", args.Parameters) : GetString("Server shutting down."));
Netplay.SaveOnServerExit = false;
TShock.Utils.StopServer(false, reason);
}
@ -3070,12 +3085,12 @@ namespace TShockAPI
args.Player.SendErrorMessage(GetString("You do not have permission to teleport all other players."));
return;
}
for (int i = 0; i < Main.maxPlayers; i++)
foreach (var player in TShock.Players)
{
if (Main.player[i].active && (Main.player[i] != args.TPlayer))
if (player != null && player.Active && player.Index != args.Player.Index)
{
if (TShock.Players[i].Teleport(args.TPlayer.position.X, args.TPlayer.position.Y))
TShock.Players[i].SendSuccessMessage(GetString("You were teleported to {0}.", args.Player.Name));
if (player.Teleport(args.TPlayer.position.X, args.TPlayer.position.Y))
player.SendSuccessMessage(GetString("You were teleported to {0}.", args.Player.Name));
}
}
args.Player.SendSuccessMessage(GetString("Teleported everyone to yourself."));
@ -4622,21 +4637,22 @@ namespace TShockAPI
{
if (args.Parameters.Count != 1)
{
args.Player.SendErrorMessage(GetString("Invalid syntax. Proper syntax: {0}wind <speed>.", Specifier));
args.Player.SendErrorMessage(GetString("Invalid syntax. Proper syntax: {0}wind <speed in mph>.", Specifier));
return;
}
int speed;
if (!int.TryParse(args.Parameters[0], out speed) || speed * 100 < 0)
float mph;
if (!float.TryParse(args.Parameters[0], out mph) || mph is < -40f or > 40f)
{
args.Player.SendErrorMessage(GetString("Invalid wind speed."));
args.Player.SendErrorMessage(GetString("Invalid wind speed (must be between -40 and 40)."));
return;
}
float speed = mph / 50f; // -40 to 40 mph -> -0.8 to 0.8
Main.windSpeedCurrent = speed;
Main.windSpeedTarget = speed;
TSPlayer.All.SendData(PacketTypes.WorldInfo);
TSPlayer.All.SendInfoMessage(GetString("{0} changed the wind speed to {1}.", args.Player.Name, speed));
TSPlayer.All.SendInfoMessage(GetString("{0} changed the wind speed to {1}mph.", args.Player.Name, mph));
}
#endregion Time/PvpFun Commands
@ -6462,7 +6478,7 @@ namespace TShockAPI
if (target == user)
user.SendSuccessMessage(GetString($"You buffed yourself with {TShock.Utils.GetBuffName(id)} ({TShock.Utils.GetBuffDescription(id)}) for {time} seconds."));
else
target.SendSuccessMessage(GetString($"You have buffed {user.Name} with {TShock.Utils.GetBuffName(id)} ({TShock.Utils.GetBuffDescription(id)}) for {time} seconds!"));
user.SendSuccessMessage(GetString($"You have buffed {target.Name} with {TShock.Utils.GetBuffName(id)} ({TShock.Utils.GetBuffDescription(id)}) for {time} seconds!"));
if (!args.Silent && target != user)
target.SendSuccessMessage(GetString($"{user.Name} has buffed you with {TShock.Utils.GetBuffName(id)} ({TShock.Utils.GetBuffDescription(id)}) for {time} seconds!"));
}
@ -6740,10 +6756,6 @@ namespace TShockAPI
playerToGod.GodMode = !playerToGod.GodMode;
var godPower = CreativePowerManager.Instance.GetPower<CreativePowers.GodmodePower>();
godPower.SetEnabledState(playerToGod.Index, playerToGod.GodMode);
if (playerToGod != args.Player)
{
args.Player.SendSuccessMessage(playerToGod.GodMode

View file

@ -320,8 +320,8 @@ namespace TShockAPI.Configuration
[Description("The reason given if banning a mediumcore player on death.")]
public string MediumcoreBanReason = GetString("Death results in a ban");
/// <summary>Disbales IP bans by default, if no arguments are passed to the ban command.</summary>
[Description("Disbales IP bans by default, if no arguments are passed to the ban command.")]
/// <summary>Disables IP bans by default, if no arguments are passed to the ban command.</summary>
[Description("Disables IP bans by default, if no arguments are passed to the ban command.")]
public bool DisableDefaultIPBan;
/// <summary>Enable or disable the whitelist based on IP addresses in the whitelist.txt file.</summary>

View file

@ -189,6 +189,9 @@ namespace TShockAPI.DB
if (!player.IsLoggedIn)
return false;
if (player.State < 10)
return false;
if (player.HasPermission(Permissions.bypassssc) && !fromCommand)
{
TShock.Log.ConsoleInfo(GetParticularString("{0} is a player name", $"Skipping SSC save (due to tshock.ignore.ssc) for {player.Account.Name}"));

View file

@ -25,6 +25,7 @@ using MySql.Data.MySqlClient;
using System.Text.RegularExpressions;
using BCrypt.Net;
using System.Security.Cryptography;
using TShockAPI.Hooks;
namespace TShockAPI.DB
{
@ -166,7 +167,41 @@ namespace TShockAPI.DB
if (null == grp)
throw new GroupNotExistsException(group);
if (_database.Query("UPDATE Users SET UserGroup = @0 WHERE Username = @1;", group, account.Name) == 0)
if (AccountHooks.OnAccountGroupUpdate(account, ref grp))
throw new UserGroupUpdateLockedException(account.Name);
if (_database.Query("UPDATE Users SET UserGroup = @0 WHERE Username = @1;", grp.Name, account.Name) == 0)
throw new UserAccountNotExistException(account.Name);
try
{
// Update player group reference for any logged in player
foreach (var player in TShock.Players.Where(p => p != null && p.Account != null && p.Account.Name == account.Name))
{
player.Group = grp;
}
}
catch (Exception ex)
{
throw new UserAccountManagerException(GetString("SetUserGroup SQL returned an error"), ex);
}
}
/// <summary>
/// Sets the group for a given username
/// </summary>
/// <param name="author">Who changes the group</param>
/// <param name="account">The user account</param>
/// <param name="group">The user account group to be set</param>
public void SetUserGroup(TSPlayer author, UserAccount account, string group)
{
Group grp = TShock.Groups.GetGroupByName(group);
if (null == grp)
throw new GroupNotExistsException(group);
if (AccountHooks.OnAccountGroupUpdate(account, author, ref grp))
throw new UserGroupUpdateLockedException(account.Name);
if (_database.Query("UPDATE Users SET UserGroup = @0 WHERE Username = @1;", grp.Name, account.Name) == 0)
throw new UserAccountNotExistException(account.Name);
try
@ -619,7 +654,7 @@ namespace TShockAPI.DB
public class UserAccountNotExistException : UserAccountManagerException
{
/// <summary>Creates a new UserAccountNotExistException object, with the user account name in the message.</summary>
/// <param name="name">The user account name to be pasesd in the message.</param>
/// <param name="name">The user account name to be passed in the message.</param>
/// <returns>A new UserAccountNotExistException object with a message containing the user account name that does not exist.</returns>
public UserAccountNotExistException(string name)
: base(GetString($"User account {name} does not exist"))
@ -627,6 +662,20 @@ namespace TShockAPI.DB
}
}
/// <summary>The UserGroupUpdateLockedException used when the user group update failed and the request failed as a result.</summary>.
[Serializable]
public class UserGroupUpdateLockedException : UserAccountManagerException
{
/// <summary>Creates a new UserGroupUpdateLockedException object.</summary>
/// <param name="name">The name of the user who failed to change the group.</param>
/// <returns>New UserGroupUpdateLockedException object with a message containing the name of the user account that failed to change the group.</returns>
public UserGroupUpdateLockedException(string name) :
base(GetString($"Unable to update group of user {name}."))
{
}
}
/// <summary>A GroupNotExistsException, used when a group does not exist.</summary>
[Serializable]
public class GroupNotExistsException : UserAccountManagerException

View file

@ -2248,6 +2248,7 @@ namespace TShockAPI
var args = new SyncTilePickingEventArgs
{
Player = player,
PlayerIndex = playerIndex,
TileX = tileX,
TileY = tileY,
@ -4444,6 +4445,11 @@ namespace TShockAPI
return true;
}
// Don't modify the player data if it isn't there.
// This is the case whilst the player is connecting, as we receive the SyncLoadout packet before the ContinueConnecting2 packet.
if (args.Player.PlayerData == null)
return false;
// The client does not sync slot changes when changing loadouts, it only tells the server the loadout index changed,
// and the server will replicate the changes the client did. This means that PlayerData.StoreSlot is never called, so we need to
// swap around the PlayerData items ourself.

View file

@ -20,6 +20,8 @@ using System;
using System.Linq;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
namespace TShockAPI
{
/// <summary>
@ -52,17 +54,17 @@ namespace TShockAPI
/// <summary>
/// The group that this group inherits permissions from.
/// </summary>
public Group Parent { get; set; }
public virtual Group Parent { get; set; }
/// <summary>
/// The chat prefix for this group.
/// </summary>
public string Prefix { get; set; }
public virtual string Prefix { get; set; }
/// <summary>
/// The chat suffix for this group.
/// </summary>
public string Suffix { get; set; }
public virtual string Suffix { get; set; }
/// <summary>
/// The name of the parent, not particularly sure why this is here.
@ -164,6 +166,20 @@ namespace TShockAPI
/// </summary>
public byte B = 255;
/// <summary>
/// Simplifies work with the <see cref="R"/>, <see cref="G"/>, <see cref="B"/> properties.
/// </summary>
public virtual Color Color
{
get => new Color(R, G, B);
set
{
R = value.R;
G = value.G;
B = value.B;
}
}
/// <summary>
/// The default group attributed to unregistered users.
/// </summary>
@ -242,7 +258,7 @@ namespace TShockAPI
/// Adds a permission to the list of negated permissions.
/// </summary>
/// <param name="permission">The permission to negate.</param>
public void NegatePermission(string permission)
public virtual void NegatePermission(string permission)
{
// Avoid duplicates
if (!negatedpermissions.Contains(permission))
@ -256,7 +272,7 @@ namespace TShockAPI
/// Adds a permission to the list of permissions.
/// </summary>
/// <param name="permission">The permission to add.</param>
public void AddPermission(string permission)
public virtual void AddPermission(string permission)
{
if (permission.StartsWith("!"))
{
@ -276,7 +292,7 @@ namespace TShockAPI
/// will parse "!permission" and add it to the negated permissions.
/// </summary>
/// <param name="permission">The new list of permissions to associate with the group.</param>
public void SetPermission(List<string> permission)
public virtual void SetPermission(List<string> permission)
{
permissions.Clear();
negatedpermissions.Clear();
@ -288,7 +304,7 @@ namespace TShockAPI
/// where "!permission" will remove a negated permission.
/// </summary>
/// <param name="permission"></param>
public void RemovePermission(string permission)
public virtual void RemovePermission(string permission)
{
if (permission.StartsWith("!"))
{
@ -302,7 +318,7 @@ namespace TShockAPI
/// Assigns all fields of this instance to another.
/// </summary>
/// <param name="otherGroup">The other instance.</param>
public void AssignTo(Group otherGroup)
public virtual void AssignTo(Group otherGroup)
{
otherGroup.Name = Name;
otherGroup.Parent = Parent;

File diff suppressed because it is too large Load diff

View file

@ -16,6 +16,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System.ComponentModel;
using TShockAPI.DB;
namespace TShockAPI.Hooks
{
@ -39,6 +40,31 @@ namespace TShockAPI.Hooks
}
}
public class AccountGroupUpdateEventArgs : HandledEventArgs
{
public string AccountName { get; private set; }
public Group Group { get; set; }
public AccountGroupUpdateEventArgs(string accountName, Group group)
{
this.AccountName = accountName;
this.Group = group;
}
}
public class AccountGroupUpdateByPlayerEventArgs : AccountGroupUpdateEventArgs
{
/// <summary>
/// The player who updated the user's group
/// </summary>
public TSPlayer Player { get; private set; }
public AccountGroupUpdateByPlayerEventArgs(TSPlayer player, string accountName, Group group) : base(accountName, group)
{
this.Player = player;
}
}
public class AccountHooks
{
public delegate void AccountCreateD(AccountCreateEventArgs e);
@ -62,5 +88,25 @@ namespace TShockAPI.Hooks
AccountDelete(new AccountDeleteEventArgs(u));
}
public delegate void AccountGroupUpdateD(AccountGroupUpdateEventArgs e);
public static event AccountGroupUpdateD AccountGroupUpdate;
public static bool OnAccountGroupUpdate(UserAccount account, TSPlayer author, ref Group group)
{
AccountGroupUpdateEventArgs args = new AccountGroupUpdateByPlayerEventArgs(author, account.Name, group);
AccountGroupUpdate?.Invoke(args);
group = args.Group;
return args.Handled;
}
public static bool OnAccountGroupUpdate(UserAccount account, ref Group group)
{
AccountGroupUpdateEventArgs args = new AccountGroupUpdateEventArgs(account.Name, group);
AccountGroupUpdate?.Invoke(args);
group = args.Group;
return args.Handled;
}
}
}

View file

@ -16,6 +16,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using TShockAPI.DB;
@ -119,6 +120,49 @@ namespace TShockAPI.Hooks
public string CommandPrefix { get; set; }
}
/// <summary>
/// EventArgs used for the <see cref="PlayerHooks.PrePlayerCommand"/> event.
/// </summary>
public class PrePlayerCommandEventArgs : HandledEventArgs
{
/// <summary>
/// The command entered by the player.
/// </summary>
public Command Command { get; }
/// <summary>
/// Command arguments.
/// </summary>
public CommandArgs Arguments { get; set; }
public PrePlayerCommandEventArgs(Command command, CommandArgs args)
{
Command = command;
Arguments = args;
}
}
/// <summary>
/// EventArgs used for the <see cref="PlayerHooks.PostPlayerCommand"/> event.
/// </summary>
public class PostPlayerCommandEventArgs : HandledEventArgs
{
/// <summary>
/// The command entered by the player.
/// </summary>
public Command Command { get; }
/// <summary>
/// Command arguments.
/// </summary>
public CommandArgs Arguments { get; }
public PostPlayerCommandEventArgs(Command command, CommandArgs arguments, bool handled)
{
Command = command;
Arguments = arguments;
Handled = handled;
}
}
/// <summary>
/// EventArgs used for the <see cref="PlayerHooks.PlayerChat"/> event.
/// </summary>
@ -343,6 +387,26 @@ namespace TShockAPI.Hooks
/// </summary>
public static event PlayerCommandD PlayerCommand;
/// <summary>
/// The delegate of the <see cref="PrePlayerCommand"/> event.
/// </summary>
/// <param name="e">The EventArgs for this event.</param>
public delegate void PrePlayerCommandD(PrePlayerCommandEventArgs e);
/// <summary>
/// Fired before a command is run.
/// </summary>
public static event PrePlayerCommandD PrePlayerCommand;
/// <summary>
/// The delegate of the <see cref="PostPlayerCommand"/> event.
/// </summary>
/// <param name="e">The EventArgs for this event.</param>
public delegate void PostPlayerCommandD(PostPlayerCommandEventArgs e);
/// <summary>
/// Fired after a command is run.
/// </summary>
public static event PostPlayerCommandD PostPlayerCommand;
/// <summary>
/// The delegate of the <see cref="PlayerChat"/> event.
/// </summary>
@ -449,6 +513,40 @@ namespace TShockAPI.Hooks
return playerCommandEventArgs.Handled;
}
/// <summary>
/// Fires the <see cref="PrePlayerCommand"/> event.
/// </summary>
/// <param name="cmd">Command to be executed</param>
/// <param name="arguments">Command arguments</param>
/// <returns>True if the event has been handled.</returns>
public static bool OnPrePlayerCommand(Command cmd, ref CommandArgs arguments)
{
if (PrePlayerCommand == null)
return false;
PrePlayerCommandEventArgs args = new PrePlayerCommandEventArgs(cmd, arguments);
PrePlayerCommand(args);
arguments = args.Arguments;
return args.Handled;
}
/// <summary>
/// Fires the <see cref="PostPlayerCommand"/> event.
/// </summary>
/// <param name="cmd">Executed command.</param>
/// <param name="arguments">Command arguments.</param>
/// <param name="handled">Is the command executed.</param>
public static void OnPostPlayerCommand(Command cmd, CommandArgs arguments, bool handled)
{
if (PostPlayerCommand == null)
return;
PostPlayerCommandEventArgs args = new PostPlayerCommandEventArgs(cmd, arguments, handled);
PostPlayerCommand(args);
}
/// <summary>
/// Fires the <see cref="PlayerPreLogin"/> event.
/// </summary>

View file

@ -60,6 +60,12 @@ namespace TShockAPI
}
}
if (LanguageManager.Instance.ActiveCulture == GameCulture.DefaultCulture)
{
var bf = System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static;
// LanguageManager.SetLanguage will change this so we need to reset it back to null
typeof(CultureInfo).GetField("s_currentThreadUICulture", bf)?.SetValue(null, null);
}
return CultureInfo.CurrentUICulture;
}
}

View file

@ -20,7 +20,9 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Terraria;
using Terraria.Initializers;
using Terraria.Localization;
using Terraria.UI.Chat;
namespace TShockAPI.Localization
{
@ -37,6 +39,8 @@ namespace TShockAPI.Localization
private static readonly Dictionary<int, string> Buffs = new Dictionary<int, string>();
private static readonly Dictionary<string,string> VanillaCommandsPrefixs = new Dictionary<string, string>();
internal static void Initialize()
{
var culture = Language.ActiveCulture;
@ -71,6 +75,15 @@ namespace TShockAPI.Localization
var i = (int)field.GetValue(null);
Prefixs.Add(i, Lang.prefix[i].Value);
}
ChatInitializer.Load();
foreach (var command in ChatManager.Commands._localizedCommands)
{
if (VanillaCommandsPrefixs.ContainsKey(command.Value._name))
continue;
VanillaCommandsPrefixs.Add(command.Value._name,command.Key.Value);
}
ChatManager.Commands._localizedCommands.Clear();
}
finally
{
@ -136,5 +149,18 @@ namespace TShockAPI.Localization
return null;
}
/// <summary>
/// Get vanilla command prefix in English
/// </summary>
/// <param name="name">vanilla command name</param>
/// <returns>vanilla command prefix in English</returns>
public static string GetCommandPrefixByName(string name)
{
string commandText;
if (VanillaCommandsPrefixs.TryGetValue(name, out commandText))
return commandText;
return null;
}
}
}

View file

@ -155,13 +155,39 @@ namespace TShockAPI
/// <param name="netId">The net ID.</param>
/// <param name="stack">The stack.</param>
/// <param name="prefixId">The prefix ID.</param>
public NetItem(int netId, int stack, byte prefixId)
public NetItem(int netId, int stack = 1, byte prefixId = 0)
{
_netId = netId;
_stack = stack;
_prefixId = prefixId;
}
/// <summary>
/// Creates a new <see cref="NetItem"/>.
/// </summary>
/// <param name="item">Item in the game.</param>
public NetItem(Item item)
{
_netId = item.netID;
_stack = item.stack;
_prefixId = item.prefix;
}
/// <summary>
/// Creates <see cref="Terraria.Item"/> based on data from this structure.
/// </summary>
/// <returns>A copy of the item.</returns>
public Item ToItem()
{
Item item = new Item();
item.netDefaults(_netId);
item.stack = _stack;
item.prefix = _prefixId;
return item;
}
/// <summary>
/// Converts the <see cref="NetItem"/> to a string.
/// </summary>

View file

@ -529,18 +529,9 @@ namespace TShockAPI
field.GetCustomAttributes(false).FirstOrDefault(o => o is DescriptionAttribute) as DescriptionAttribute;
var desc = descattr != null && !string.IsNullOrWhiteSpace(descattr.Description) ? descattr.Description : GetString("No description available.");
var commands = GetCommands(name);
foreach (var c in commands)
{
for (var i = 0; i < c.Names.Count; i++)
{
c.Names[i] = "/" + c.Names[i];
}
}
var strs =
commands.Select(
c =>
c.Name + (c.Names.Count > 1 ? " ({0})".SFormat(string.Join(" ", c.Names.ToArray(), 1, c.Names.Count - 1)) : ""));
var strs = GetCommands(name).Select(c => c.Names.Count > 1
? $"/{c.Name} (/{string.Join(" /", c.Names.Skip(1))})"
: $"/{c.Name}");
sb.AppendLine($"## {name}");
sb.AppendLine($"{desc}");

View file

@ -351,7 +351,6 @@ namespace Rests
{
str = string.Format("{0}({1});", jsonp, str);
}
e.Response.Connection.Type = ConnectionType.Close;
e.Response.ContentType = new ContentTypeHeader("application/json; charset=utf-8");
e.Response.Add(serverHeader);
var bytes = Encoding.UTF8.GetBytes(str);

View file

@ -402,7 +402,7 @@ namespace TShockAPI
{"serverversion", Main.versionNumber},
{"tshockversion", TShock.VersionNum},
{"port", TShock.Config.Settings.ServerPort},
{"playercount", Main.player.Where(p => null != p && p.active).Count()},
{"playercount", TShock.Utils.GetActivePlayerCount()},
{"maxplayers", TShock.Config.Settings.MaxSlots},
{"world", (TShock.Config.Settings.UseServerName ? TShock.Config.Settings.ServerName : Main.worldName)},
{"uptime", (DateTime.Now - System.Diagnostics.Process.GetCurrentProcess().StartTime).ToString(@"d'.'hh':'mm':'ss")},
@ -555,7 +555,8 @@ namespace TShockAPI
{
try
{
TShock.UserAccounts.SetUserGroup(account, group);
TShock.UserAccounts.SetUserGroup(new TSRestPlayer(args.TokenData.Username, TShock.Groups.GetGroupByName(args.TokenData.UserGroupName)),
account, group);
response.Add("group-response", "Group updated successfully");
}
catch (Exception e)
@ -944,8 +945,8 @@ namespace TShockAPI
[Token]
private object PlayerList(RestRequestArgs args)
{
var activeplayers = Main.player.Where(p => null != p && p.active).ToList();
return new RestObject() { { "players", string.Join(", ", activeplayers.Select(p => p.name)) } };
var activeplayers = TShock.Players.Where(p => null != p && p.Active).Select(p => p.Name);
return new RestObject() { { "players", string.Join(", ", activeplayers) } };
}
[Description("Fetches detailed user information on all connected users, and can be filtered by specifying a key value pair filter users where the key is a field and the value is a users field value.")]

View file

@ -34,6 +34,7 @@ using TShockAPI.Hooks;
using TShockAPI.Net;
using Timer = System.Timers.Timer;
using System.Linq;
using Terraria.GameContent.Creative;
namespace TShockAPI
{
@ -935,9 +936,15 @@ namespace TShockAPI
public bool LoginHarassed = false;
/// <summary>
/// Player cant die, unless onehit
/// Controls the journey godmode
/// </summary>
public bool GodMode = false;
public bool GodMode
{
get =>
CreativePowerManager.Instance.GetPower<CreativePowers.GodmodePower>().IsEnabledForPlayer(Index);
set =>
CreativePowerManager.Instance.GetPower<CreativePowers.GodmodePower>().SetEnabledState(Index, value);
}
/// <summary>
/// Players controls are inverted if using SSC
@ -981,7 +988,7 @@ namespace TShockAPI
get
{
return RealPlayer
&& (Netplay.Clients[Index] != null && Netplay.Clients[Index].IsActive && !Netplay.Clients[Index].PendingTermination);
&& (Client != null && Client.IsActive && !Client.PendingTermination);
}
}
@ -998,8 +1005,8 @@ namespace TShockAPI
/// </summary>
public int State
{
get { return Netplay.Clients[Index].State; }
set { Netplay.Clients[Index].State = value; }
get { return Client.State; }
set { Client.State = value; }
}
/// <summary>
@ -1007,7 +1014,7 @@ namespace TShockAPI
/// </summary>
public string UUID
{
get { return RealPlayer ? Netplay.Clients[Index].ClientUUID : ""; }
get { return RealPlayer ? Client.ClientUUID : ""; }
}
/// <summary>
@ -1019,8 +1026,8 @@ namespace TShockAPI
{
if (string.IsNullOrEmpty(CacheIP))
return
CacheIP = RealPlayer ? (Netplay.Clients[Index].Socket.IsConnected()
? TShock.Utils.GetRealIP(Netplay.Clients[Index].Socket.GetRemoteAddress().ToString())
CacheIP = RealPlayer ? (Client.Socket.IsConnected()
? TShock.Utils.GetRealIP(Client.Socket.GetRemoteAddress().ToString())
: "")
: "127.0.0.1";
else
@ -1103,6 +1110,11 @@ namespace TShockAPI
}
/// <summary>
/// Player RemoteClient.
/// </summary>
public RemoteClient Client => Netplay.Clients[Index];
/// <summary>
/// Gets the Terraria Player object associated with the player.
/// </summary>
@ -1135,6 +1147,11 @@ namespace TShockAPI
get { return TPlayer.team; }
}
/// <summary>
/// Gets PvP player mode.
/// </summary>
public bool Hostile => TPlayer.hostile;
/// <summary>
/// Gets the player's X coordinate.
/// </summary>
@ -1487,6 +1504,41 @@ namespace TShockAPI
return false;
}
/// <summary>
/// Changes the values of the <see cref="RemoteClient.TileSections"/> array.
/// </summary>
/// <param name="rectangle">The area of the sections you want to set a value to.
/// The minimum size should be set to 200x150. If null, then the entire map is specified.</param>
/// <param name="isLoaded">Is the section loaded.</param>
// The server does not send the player the whole world, it sends it in sections. To do this, it sets up visible and invisible sections.
// If the player was not in any section(Client.TileSections[x, y] == false) then the server will send the missing section of the world.
// This method allows you to simulate what the player has or has not seen these sections.
// For example, we can put some number of earths blocks in some vast area, for example, for the whole world, but the player will not see the changes, because some section is already loaded for him. At this point this method can come into effect! With it we will be able to select some zone and make it both visible and invisible to the player.
// The server will assume that the zone is not loaded on the player, and will resend the data, but with earth blocks.
public void UpdateSection(Rectangle? rectangle = null, bool isLoaded = false)
{
if (rectangle.HasValue)
{
for (int i = Netplay.GetSectionX(rectangle.Value.X); i < Netplay.GetSectionX(rectangle.Value.X + rectangle.Value.Width) && i < Main.maxSectionsX; i++)
{
for (int j = Netplay.GetSectionY(rectangle.Value.Y); j < Netplay.GetSectionY(rectangle.Value.Y + rectangle.Value.Height) && j < Main.maxSectionsY; j++)
{
Client.TileSections[i, j] = isLoaded;
}
}
}
else
{
for (int i = 0; i < Main.maxSectionsX; i++)
{
for (int j = 0; j < Main.maxSectionsY; j++)
{
Client.TileSections[i, j] = isLoaded;
}
}
}
}
/// <summary>
/// Gives an item to the player. Includes banned item spawn prevention to check if the player can spawn the item.
/// </summary>
@ -1519,6 +1571,15 @@ namespace TShockAPI
GiveItemByDrop(type, stack, prefix);
}
/// <summary>
/// Gives an item to the player.
/// </summary>
/// <param name="item">Item with data to be given to the player.</param>
public virtual void GiveItem(NetItem item)
{
GiveItem(item.NetId, item.Stack, item.PrefixId);
}
private Item EmptySentinelItem = new Item();
private bool Depleted(Item item)
@ -1815,7 +1876,17 @@ namespace TShockAPI
/// <param name="damage">The amount of damage the player will take.</param>
public virtual void DamagePlayer(int damage)
{
NetMessage.SendPlayerHurt(Index, PlayerDeathReason.LegacyDefault(), damage, (new Random()).Next(-1, 1), false, false, 0, -1, -1);
DamagePlayer(damage, PlayerDeathReason.LegacyDefault());
}
/// <summary>
/// Wounds the player with the given damage.
/// </summary>
/// <param name="damage">The amount of damage the player will take.</param>
/// <param name="reason">The reason for causing damage to player.</param>
public virtual void DamagePlayer(int damage, PlayerDeathReason reason)
{
NetMessage.SendPlayerHurt(Index, reason, damage, (new Random()).Next(-1, 1), false, false, 0, -1, -1);
}
/// <summary>
@ -1823,7 +1894,16 @@ namespace TShockAPI
/// </summary>
public virtual void KillPlayer()
{
NetMessage.SendPlayerDeath(Index, PlayerDeathReason.LegacyDefault(), 99999, (new Random()).Next(-1, 1), false, -1, -1);
KillPlayer(PlayerDeathReason.LegacyDefault());
}
/// <summary>
/// Kills the player.
/// </summary>
/// <param name="reason">Reason for killing a player.</param>
public virtual void KillPlayer(PlayerDeathReason reason)
{
NetMessage.SendPlayerDeath(Index, reason, 99999, (new Random()).Next(-1, 1), false, -1, -1);
}
/// <summary>
@ -1832,6 +1912,8 @@ namespace TShockAPI
/// <param name="team">The team color index.</param>
public virtual void SetTeam(int team)
{
if (team < 0 || team >= Main.teamColor.Length)
throw new ArgumentException("The player's team is not in the range of available.");
Main.player[Index].team = team;
NetMessage.SendData((int)PacketTypes.PlayerTeam, -1, -1, NetworkText.Empty, Index);
}
@ -1840,6 +1922,7 @@ namespace TShockAPI
/// Sets the player's pvp.
/// </summary>
/// <param name="mode">The state of the pvp mode.</param>
/// <param name="withMsg">Whether a chat message about the change should be sent.</param>
public virtual void SetPvP(bool mode, bool withMsg = false)
{
Main.player[Index].hostile = mode;
@ -2064,7 +2147,7 @@ namespace TShockAPI
if (!RealPlayer || !ConnectionAlive)
return;
Netplay.Clients[Index].Socket.AsyncSend(data, 0, data.Length, Netplay.Clients[Index].ServerWriteCallBack);
Client.Socket.AsyncSend(data, 0, data.Length, Client.ServerWriteCallBack);
}
/// <summary>

View file

@ -63,7 +63,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 = "Thank you, everyone, for your support of TShock all these years! <3";
public static readonly string VersionCodename = "Intensity";
/// <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";
@ -428,6 +428,8 @@ namespace TShockAPI
Hooks.AccountHooks.AccountDelete += OnAccountDelete;
Hooks.AccountHooks.AccountCreate += OnAccountCreate;
On.Terraria.RemoteClient.Reset += RemoteClient_Reset;
GetDataHandlers.InitGetDataHandler();
Commands.InitCommands();
@ -496,6 +498,12 @@ namespace TShockAPI
}
}
private static void RemoteClient_Reset(On.Terraria.RemoteClient.orig_Reset orig, RemoteClient client)
{
client.ClientUUID = null;
orig(client);
}
private static void OnAchievementInitializerLoad(ILContext il)
{
// Modify AchievementInitializer.Load to remove the Main.netMode == 2 check (occupies the first 4 IL instructions)
@ -676,17 +684,13 @@ namespace TShockAPI
if (args.Chest != null)
{
// After checking for protected regions, no further range checking is necessarily because the client packet only specifies the
// inventory slot to quick stack. The vanilla Terraria server itself determines what chests are close enough to the player.
if (Config.Settings.RegionProtectChests && !Regions.CanBuild((int)args.WorldPosition.X, (int)args.WorldPosition.Y, tsplr))
{
args.Handled = true;
return;
}
if (!tsplr.IsInRange(args.Chest.x, args.Chest.y))
{
args.Handled = true;
return;
}
}
}
@ -1501,11 +1505,11 @@ namespace TShockAPI
{
if (!String.IsNullOrEmpty(text))
{
text = item.Key.Value + ' ' + text;
text = EnglishLanguage.GetCommandPrefixByName(item.Value._name) + ' ' + text;
}
else
{
text = item.Key.Value;
text = EnglishLanguage.GetCommandPrefixByName(item.Value._name);
}
break;
}

View file

@ -18,11 +18,11 @@
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)
-->
<Version>5.1.3</Version>
<Version>5.2.1</Version>
<AssemblyTitle>TShock for Terraria</AssemblyTitle>
<Company>Pryaxis &amp; TShock Contributors</Company>
<Product>TShockAPI</Product>
<Copyright>Copyright © Pryaxis &amp; TShock Contributors 2011-2022</Copyright>
<Copyright>Copyright © Pryaxis &amp; TShock Contributors 2011-2023</Copyright>
<!-- extras for nuget -->
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<PackageLicenseExpression>GPL-3.0-or-later</PackageLicenseExpression>
@ -34,7 +34,7 @@
<ItemGroup>
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
<PackageReference Include="GetText.NET" Version="1.7.14" />
<PackageReference Include="MySql.Data" Version="8.0.31" />
<PackageReference Include="MySql.Data" Version="8.4.0" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="6.0.11" />
</ItemGroup>

View file

@ -29,7 +29,8 @@ namespace TShockAPI
/// </summary>
public class TextLog : ILog, IDisposable
{
private readonly StreamWriter _logWriter;
private readonly bool ClearFile;
private StreamWriter _logWriter;
/// <summary>
/// File name of the Text log
@ -44,7 +45,7 @@ namespace TShockAPI
public TextLog(string filename, bool clear)
{
FileName = filename;
_logWriter = new StreamWriter(filename, !clear);
ClearFile = clear;
}
public bool MayWriteType(TraceLevel type)
@ -247,6 +248,10 @@ namespace TShockAPI
{
if (!MayWriteType(level))
return;
if (_logWriter is null)
{
_logWriter = new StreamWriter(FileName, !ClearFile);
}
var caller = "TShock";
@ -277,8 +282,11 @@ namespace TShockAPI
}
public void Dispose()
{
if (_logWriter != null)
{
_logWriter.Dispose();
}
}
}
}

View file

@ -172,7 +172,7 @@ namespace TShockAPI
foreach (TSPlayer player in TShock.Players)
{
if (player != null && player != excludedPlayer && player.Active && player.HasPermission(Permissions.logs) &&
player.DisplayLogs && TShock.Config.Settings.DisableSpewLogs == false)
player.DisplayLogs && !TShock.Config.Settings.DisableSpewLogs)
player.SendMessage(log, color);
}
}
@ -183,7 +183,7 @@ namespace TShockAPI
/// <returns>The number of active players on the server.</returns>
public int GetActivePlayerCount()
{
return Main.player.Where(p => null != p && p.active).Count();
return TShock.Players.Count(p => null != p && p.Active);
}
//Random should not be generated in a method
@ -330,7 +330,7 @@ namespace TShockAPI
/// <returns>The item represented by the tag.</returns>
public Item GetItemFromTag(string tag)
{
Regex regex = new Regex(@"\[i(tem)?(?:\/s(?<Stack>\d{1,3}))?(?:\/p(?<Prefix>\d{1,3}))?:(?<NetID>-?\d{1,4})\]");
Regex regex = new Regex(@"\[i(tem)?(?:\/s(?<Stack>\d{1,4}))?(?:\/p(?<Prefix>\d{1,3}))?:(?<NetID>-?\d{1,4})\]");
Match match = regex.Match(tag);
if (!match.Success)
return null;
@ -1149,11 +1149,15 @@ namespace TShockAPI
/// <param name="empty">If the server is empty; determines if we should use Utils.GetActivePlayerCount() for player count or 0.</param>
internal void SetConsoleTitle(bool empty)
{
if (ShouldSkipTitle)
return;
Console.Title = GetString("{0}{1}/{2} on {3} @ {4}:{5} (TShock for Terraria v{6})",
!string.IsNullOrWhiteSpace(TShock.Config.Settings.ServerName) ? TShock.Config.Settings.ServerName + " - " : "",
empty ? 0 : GetActivePlayerCount(),
TShock.Config.Settings.MaxSlots, Main.worldName, Netplay.ServerIP.ToString(), Netplay.ListenPort, TShock.VersionNum);
}
// Some terminals doesn't supports XTerm escape sequences for setting the title
private static bool ShouldSkipTitle = !System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows) && !(Environment.GetEnvironmentVariable("TERM")?.Contains("xterm") ?? false);
/// <summary>Determines the distance between two vectors.</summary>
/// <param name="value1">The first vector location.</param>

View file

@ -12,6 +12,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SharpZipLib" Version="1.4.1" />
<PackageReference Include="SharpZipLib" Version="1.4.2" />
</ItemGroup>
</Project>

View file

@ -30,7 +30,7 @@
<ItemGroup>
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
<PackageReference Include="MySql.Data" Version="8.0.31" />
<PackageReference Include="MySql.Data" Version="8.4.0" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="6.0.11" />
<PackageReference Include="ModFramework" Version="1.1.7" GeneratePathProperty="true" /> <!-- only used to extract out to ./bin. -->
<PackageReference Include="GetText.NET" Version="1.7.14" /> <!-- only used to extract out to ./bin. -->

View file

@ -30,7 +30,6 @@ using NuGet.Versioning;
namespace TShockPluginManager
{
public class Nugetter
{
// this object can figure out the right framework folders to use from a set of packages
@ -82,15 +81,13 @@ namespace TShockPluginManager
// make sure the source repository can actually tell us about dependencies
var dependencyInfoResource = await sourceRepository.GetResourceAsync<DependencyInfoResource>();
// get the try and dependencies
// (the above function returns a nullable value, but doesn't properly indicate it as such)
#pragma warning disable CS8602
var dependencyInfo = await dependencyInfoResource?.ResolvePackage(
if (dependencyInfoResource is null) continue;
var dependencyInfo = await dependencyInfoResource.ResolvePackage(
package, framework, cacheContext, logger, CancellationToken.None);
#pragma warning restore CS8602
// oop, we don't have the ability to get dependency info from this repository, or
// it wasn't found. let's try the next source repository!
if (dependencyInfo == null) continue;
if (dependencyInfo is null) continue;
availablePackages.Add(dependencyInfo);
foreach (var dependency in dependencyInfo.Dependencies)
@ -302,11 +299,14 @@ namespace TShockPluginManager
var relativeFolder = Path.GetDirectoryName(packageRelativeFilePath);
var targetFolder = Path.Join(isPlugin ? "./ServerPlugins" : "./bin", relativeFolder);
if (File.Exists(filePath))
{
Directory.CreateDirectory(targetFolder);
File.Copy(filePath, Path.Join(targetFolder, Path.GetFileName(filePath)), true);
}
}
}
}
/// <summary>downloads and installs the given packages</summary>
public async Task DownloadAndInstall(PackageIdentity[] userRequest)

View file

@ -7,8 +7,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NuGet.Packaging" Version="6.3.1" />
<PackageReference Include="NuGet.Protocol" Version="6.3.1" />
<PackageReference Include="NuGet.Packaging" Version="6.3.4" />
<PackageReference Include="NuGet.Protocol" Version="6.3.3" />
<PackageReference Include="NuGet.Resolver" Version="6.3.1" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageReference Include="System.Reflection.MetadataLoadContext" Version="6.0.0" />

@ -1 +1 @@
Subproject commit e0e2df24dbc618683cc75595c59bf7f88acada08
Subproject commit d4bb7e3a21e875cfeb23bcf5cf847c85d9470ccf

View file

@ -78,6 +78,39 @@ Use past tense when adding new entries; sign your name off when you add or chang
* If there is no section called "Upcoming changes" below this line, please add one with `## Upcoming changes` as the first line, and then a bulleted item directly after with the first change. -->
## Upcoming changes
* Fixed `/dump-reference-data` mutate the command names. (#2943, @sgkoishi)
* Added `ParryDamageBuff` (Striking Moment with Brand of the Inferno and shield) for player, updated `CursedInferno` buff for NPC (@sgkoishi, #3005)
* Changed the use of `Player.active` to `TSPlayer.Active` for consistency. (@sgkoishi, #2939)
* Fix typo in config for IP bans. (@redchess64)
* Updated `TShockAPI.NetItem` (@AgaSpace):
* Added constructor overload with parameter `Terraria.Item`.
* Added the `ToItem` method to get a copy of `Terraria.Item`.
* In the constructor `stack` and `prefix` are now optional parameters.
* Fixed unable to transfer long response body for REST API. (@sgkoishi, #2925)
* Fixed the `/wind` command not being very helpful. (@punchready)
* Fixed /help, /me, and /p commands can't work in non-English languages. (@ACaiCat)
* Added a hook `AccountHooks.AccountGroupUpdate`, which is called when you change the user group. (@AgaSpace)
* * Ensured `TSPlayer.PlayerData` is non-null whilst syncing loadouts. (@drunderscore)
* * Detected invalid installations, by checking for a file named `TerrariaServer.exe`. (@drunderscore)
* This made the two most common installation mistakes (extracting into the Terraria client directory, and extracting TShock 5 or newer into a TShock 4 or older install) prompt the user with a more useful diagnostic, rather than (likely) crashing moments later.
## TShock 5.2.1
* Updated `TSPlayer.GodMode`. (@AgaSpace)
* Previously the field was used as some kind of dataset changed by /godmode command, but now it is a property that receives/changes data in journey mode.
* Added the `TSPlayer.Client` property. It allows the developer to get the `RemoteClient` player, without an additional call to `Terraria.Netplay.Clients`. (@AgaSpace)
* Updated the documentation for the `TSPlayer.SetPvP` method. The `sendMsg` parameter, which is responsible for sending a pvp mode change message, was not documented earlier. (@AgaSpace)
* Added methods `TSPlayer.KillPlayer` and `TSPlayer.DamagePlayer` for which you can specify the cause (`PlayerDeathReason`) in parameters. (@AgaSpace)
* Added an error when trying to change a `TSPlayer` team to, say, 9, when there are only 6. (@AgaSpace)
* Added an error when trying to call the `TSPlayer.SetTeam` method with an argument (team) greater than 5 or less than 0. (@AgaSpace)
* Added a method `TSPlayer.UpdateSection` with arguments `rectangle` and `isLoaded`, which will load some area from the server to the player. (@AgaSpace)
* Added a method `TSPlayer.GiveItem`, which has `TShockAPI.NetItem` structure in its arguments. (@AgaSpace)
* Added a property `TSPlayer.Hostile`, which gets pvp player mode. (@AgaSpace)
* Fixed bug where when the `UseSqlLogs` config property is true, an empty log file would still get created. (@ZakFahey)
* Fixed typo in `/gbuff`. (@sgkoishi, #2955)
* Added `PlayerHooks.PrePlayerCommand` hook, which fired before command execution. (@AgaSpace)
* Added `PlayerHooks.PostPlayerCommand` hook, which fired after command execution. (@AgaSpace)
## TShock 5.2
* An additional option `pvpwithnoteam` is added at `PvPMode` to enable PVP with no team. (@CelestialAnarchy, #2617, @ATFGK)
* Corrected and updated deserialization of the following packets (@ATFGK):
* `ProjectileNew`: Read the third `AI` value.
@ -105,8 +138,10 @@ Use past tense when adding new entries; sign your name off when you add or chang
* Initialized achievements and the `AchievementManager` on the server. This ensures that players cannot cause exceptions to be thrown, chat messages are always logged, and allows achievement names to be localized in the console. Also added a test case for this. (@drunderscore)
* Allowed multiple test cases to be in TShock's test suite. (@drunderscore)
* Fixed unable to use Purification/Evil Powder in jungle. (@sgkoishi)
* Detected invalid installations, by checking for a file named `TerrariaServer.exe`. (@drunderscore)
* This made the two most common installation mistakes (extracting into the Terraria client directory, and extracting TShock 5 or newer into a TShock 4 or older install) prompt the user with a more useful diagnostic, rather than (likely) crashing moments later.
* Set the `GetDataHandledEventArgs.Player` property for the `SyncTilePicking` data handler. (@drunderscore)
* Relaxed custom death message restrictions to allow Inferno potions in PvP. (@drunderscore)
* Allowed Flower Boots to place Ash Flowers on Ash Grass blocks. (@punchready)
* Removed unnecessary range check that artifically shortened quick stack reach. (@boddyn, #2885, @bcat)
## TShock 5.1.3
* Added support for Terraria 1.4.4.9 via OTAPI 3.1.20. (@SignatureBeef)

View file

@ -14,32 +14,27 @@ Open ports can also be passed through using `-p <host_port>:<container_port>`.
For Example:
```bash
# Building the image
docker build -t tshock:linux-amd64 --build-arg TARGETPLATFORM=linux/amd64 .
# Running the image
docker run -p 7777:7777 -p 7878:7878 \
-v /home/cider/tshock/:/tshock \
-v /home/cider/.local/share/Terraria/Worlds:/worlds \
-v /home/cider/tshock/plugins:/plugins \
--rm -it tshock:linux-amd64 \
--rm -it ghcr.io/pryaxis/tshock:latest \
-world /worlds/backflip.wld -motd "OMFG DOCKER"
```
## Building for Other Platforms
## Building custom images
Using `docker buildx`, you could build [multi-platform images](https://docs.docker.com/build/building/multi-platform/) for TShock.
Occasionally, it may be necessary to adjust TShock with customizations that are not included in the upstream project.
Therefore, these changes are also not available in the officially provided Docker images.
To build and load a Docker image from your local checkout, use the following `buildx` command:
For Example:
```bash
# Building the image using buildx and loading it into docker
sudo docker buildx build -t tshock:linux-arm64 --platform linux/arm64 --load .
# Running the image
docker run -p 7777:7777 -p 7878:7878 \
-v /home/cider/tshock/:/tshock \
-v /home/cider/.local/share/Terraria/Worlds:/worlds \
-v /home/cider/tshock/plugins:/plugins \
--rm -it tshock:linux-arm64 \
-world /worlds/backflip.wld -motd "ARM64 ftw"
docker buildx build -t tshock:latest --load .
```
It is also possible to build [multi-platform images](https://docs.docker.com/build/building/multi-platform/) for TShock (e.g. an image targeting `arm64`, on a host that is not `arm64`):
```bash
docker buildx build -t tshock:linux-arm64 --platform linux/arm64 --load .
```

View file

@ -11,12 +11,7 @@
<body>
<div id="app"></div>
<script>
window.$docsify = {
name: 'TShock for Terraria',
repo: 'pryaxis/tshock',
loadSidebar: true,
subMaxLevel: 9
}
window.location.replace("https://github.com/Pryaxis/TShock/wiki");
</script>
<!-- Docsify v4 -->
<script src="//cdn.jsdelivr.net/npm/docsify@4"></script>

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tshock\n"
"POT-Creation-Date: 2022-12-06 05:43:49+0000\n"
"PO-Revision-Date: 2022-12-06 05:52\n"
"PO-Revision-Date: 2022-12-30 01:02\n"
"Last-Translator: \n"
"Language-Team: Portuguese, Brazilian\n"
"MIME-Version: 1.0\n"
@ -1149,7 +1149,7 @@ msgstr "De {0} a {1}"
#: ../../TShockPluginManager/NugetCLI.cs:187
#, csharp-format
msgid "<green>{0} <black>from <blue>{1} <black>[{2}]"
msgstr ""
msgstr "<verde>{0} <preto>de <azul>{1} <preto>[{2}]"
#: ../../TShockPluginManager/NugetCLI.cs:178
#, csharp-format
@ -1166,15 +1166,15 @@ msgstr "<Para {0}> {1}"
#, csharp-format
msgid "=== Dependency ==="
msgid_plural "=== Dependencies ==="
msgstr[0] ""
msgstr[1] ""
msgstr[0] "=== Dependência ==="
msgstr[1] "=== Dependências ==="
#: ../../TShockPluginManager/NugetCLI.cs:133
#, csharp-format
msgid "=== Requested Plugin ==="
msgid_plural "=== Requested Plugins ==="
msgstr[0] ""
msgstr[1] ""
msgstr[0] "=== Plugin exigido ==="
msgstr[1] "=== Plugins exigidos ==="
#: ../../TShockAPI/Commands.cs:2818
msgid "a Deerclops"
@ -1325,7 +1325,7 @@ msgstr "todos os chefes"
#: ../../TShockPluginManager/NugetCLI.cs:169
msgid "All done! :)"
msgstr ""
msgstr "Concluído!"
#: ../../TShockAPI/Commands.cs:2104
msgid "All REST tokens have been destroyed."
@ -1847,7 +1847,7 @@ msgstr "Bouncer / OnLiquidSet rejeitou a verificação inválida de {0}"
#: ../../TShockAPI/Bouncer.cs:1731
#, csharp-format
msgid "Bouncer / OnLiquidSet rejected liquid type {0} from {1} holding {2}"
msgstr ""
msgstr "Segurador / OnLiquidSet rejeitou o tipo líquido {0} de {1} segurando {2}"
#: ../../TShockAPI/Bouncer.cs:1840
#, csharp-format
@ -2671,7 +2671,7 @@ msgstr "Configuração, permissões e regiões recarregadas completamente. Algum
#: ../../TShockPluginManager/NugetCLI.cs:100
msgid "Connect to the internet to figure out what to download?"
msgstr ""
msgstr "Conectar-se à internet para descobrir o que baixar?"
#: ../../TShockAPI/TShock.cs:1329
msgid "Connecting via a proxy is not allowed."
@ -2901,7 +2901,7 @@ msgstr "disallow <ID do bloco> <grupo> - Desautoriza um grupo de usar o bloco."
#: ../../TShockPluginManager/NugetCLI.cs:140
#: ../../TShockPluginManager/NugetCLI.cs:161
msgid "Download and install the given packages?"
msgstr ""
msgstr "Baixar e instalar os pacotes indicados?"
#: ../../TShockAPI/Commands.cs:2648
msgid "Duke Fishron"
@ -3739,11 +3739,11 @@ msgstr "Se você entendeu, por favor digite {0}login <nome de usuário> <senha>
#: ../../TShockPluginManager/NugetCLI.cs:142
msgid "If you want to know which plugins need which dependencies, press E."
msgstr ""
msgstr "Se você quiser saber quais plugins precisam de quais dependências, pressione E."
#: ../../TShockPluginManager/NugetCLI.cs:162
msgid "If you'd like to see which plugins need which dependencies again, press E."
msgstr ""
msgstr "Se você quiser ver quais plugins precisam de dependências novamente, pressione E."
#: ../../TShockAPI/Bouncer.cs:986
msgid "If you're seeing this message and you know what that player did, please report it to TShock for further investigation."
@ -3799,7 +3799,7 @@ msgstr "Falha ao inserir o banimento no banco de dados."
#: ../../TShockPluginManager/NugetCLI.cs:39
msgid "Install the plugins as specified in the plugins.json"
msgstr ""
msgstr "Instalar os plugins conforme especificado no plugins.json"
#: ../../TShockAPI/Rest/Rest.cs:426
msgid "Internal server error."
@ -4566,7 +4566,7 @@ msgstr "Nome da máquina: {0}"
#: ../../TShockPluginManager/NugetCLI.cs:141
msgid "Make sure that you trust the plugins you're installing."
msgstr ""
msgstr "Certifique-se de confiar nos plugins que você está instalando."
#: ../../TShockAPI/Bouncer.cs:2471
msgid "Malicious portal attempt."
@ -4574,7 +4574,7 @@ msgstr "Tentativa de portal malicioso."
#: ../../TShockPluginManager/NugetCLI.cs:35
msgid "Manage plugins and their requirements"
msgstr ""
msgstr "Gerenciar plugins e suas exigências"
#: ../../TShockAPI/Commands.cs:280
msgid "Manages groups."
@ -4614,7 +4614,7 @@ msgstr "Gerencia contas de usuários."
#: ../../TShockAPI/Bouncer.cs:1775
msgid "Manipulating unknown liquid type"
msgstr ""
msgstr "Manipulando tipo de líquido desconhecido"
#: ../../TShockAPI/Commands.cs:4721
#, csharp-format
@ -4816,7 +4816,7 @@ msgstr "Dano do NPC excedeu {0}."
#: ../../TShockPluginManager/NugetCLI.cs:103
msgid "One moment..."
msgstr ""
msgstr "Aguarde..."
#: ../../TShockAPI/DB/RegionManager.cs:102
#, csharp-format
@ -5141,7 +5141,7 @@ msgstr "Limite de TilePlace atingido."
#: ../../TShockPluginManager/NugetCLI.cs:128
msgid "Read the message below to find out more."
msgstr ""
msgstr "Leia a mensagem abaixo para saber mais."
#: ../../TShockAPI/Commands.cs:1495
#, csharp-format
@ -6041,7 +6041,7 @@ msgstr "O valor deve ser maior que zero."
#: ../../TShockPluginManager/NugetCLI.cs:127
msgid "The versions of plugins you requested aren't compatible with eachother."
msgstr ""
msgstr "As versões de plugins que você solicitou não são compatíveis uns com os outros."
#: ../../TShockAPI/Commands.cs:2722
msgid "the Wall of Flesh"
@ -6110,17 +6110,17 @@ msgstr "Ocorreu um erro ao processar seu login ou solicitação relacionada à a
#: ../../TShockPluginManager/NugetCLI.cs:121
msgid "There was an issue figuring out what to download."
msgstr ""
msgstr "Houve um problema ao descobrir o que baixar."
#: ../../TShockPluginManager/NugetCLI.cs:90
msgid "There was an issue reading the packages.json."
msgstr ""
msgstr "Houve um problema ao ler packages.json."
#: ../../TShockPluginManager/NugetCLI.cs:99
#, csharp-format
msgid "This is the plugin you requested to install."
msgid_plural "These are the plugins you requested to install"
msgstr[0] ""
msgstr[0] "Este é o plugin que você solicitou para instalar."
msgstr[1] ""
#: ../../TShockAPI/TShock.cs:1013
@ -6574,37 +6574,37 @@ msgstr "Usando {0} para implementação de bloco"
#: ../../TShockAPI/Bouncer.cs:1794
#, csharp-format
msgid "Using {0} on non-honey"
msgstr ""
msgstr "Usando {0} em não-mel"
#: ../../TShockAPI/Bouncer.cs:1803
#, csharp-format
msgid "Using {0} on non-lava"
msgstr ""
msgstr "Usando {0} em não-lava"
#: ../../TShockAPI/Bouncer.cs:1810
#, csharp-format
msgid "Using {0} on non-shimmer"
msgstr ""
msgstr "Usando {0} em não-cintilante"
#: ../../TShockAPI/Bouncer.cs:1785
#, csharp-format
msgid "Using {0} on non-water"
msgstr ""
msgstr "Usando {0} em não-água"
#: ../../TShockAPI/Bouncer.cs:1817
#, csharp-format
msgid "Using {0} on non-water or shimmer"
msgstr ""
msgstr "Usando {0} em não-água ou cintilante"
#: ../../TShockAPI/Bouncer.cs:1825
#, csharp-format
msgid "Using {0} to manipulate unknown liquid {1}"
msgstr ""
msgstr "Usando {0} para manipular líquido desconhecido {1}"
#: ../../TShockAPI/Bouncer.cs:1740
#, csharp-format
msgid "Using banned {0} to manipulate liquid"
msgstr ""
msgstr "Uso banido {0} para manipular líquido"
#: ../../TShockAPI/Bouncer.cs:1763
msgid "Using banned honey bucket without permissions"
@ -6616,7 +6616,7 @@ msgstr "Usando balde de lava banido sem permissões"
#: ../../TShockAPI/Bouncer.cs:1770
msgid "Using banned shimmering water bucket without permissions"
msgstr ""
msgstr "Usando balde de água cintilante banido sem permissões"
#: ../../TShockAPI/Bouncer.cs:1749
msgid "Using banned water bucket without permissions"
@ -6694,7 +6694,7 @@ msgstr "Árvore de salgueiro"
#: ../../TShockPluginManager/NugetCLI.cs:85
msgid "Without a list of plugins to install, no plugins can be installed."
msgstr ""
msgstr "Sem uma lista de plugins para instalar, nenhum plugin pode ser instalado."
#: ../../TShockAPI/BackupManager.cs:80
#, csharp-format
@ -7319,7 +7319,7 @@ msgstr "Não é permitido alterar blocos aqui!"
#: ../../TShockPluginManager/NugetCLI.cs:84
msgid "You're trying to sync, but you don't have a packages.json file."
msgstr ""
msgstr "Você está tentando sincronizar, mas não tem um arquivo packages.json."
#: ../../TShockAPI/Commands.cs:1987
msgid "Your account has been elevated to superadmin for 10 minutes."

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tshock\n"
"POT-Creation-Date: 2022-12-06 05:43:49+0000\n"
"PO-Revision-Date: 2022-12-06 05:52\n"
"PO-Revision-Date: 2023-01-11 13:30\n"
"Last-Translator: \n"
"Language-Team: Turkish\n"
"MIME-Version: 1.0\n"
@ -1028,12 +1028,12 @@ msgstr "{0} adlı oyuncunun son bilinen IP adresi {1}."
#: ../../TShockAPI/Commands.cs:1286
#, csharp-format
msgid "{0}'s last login occurred {1} {2} UTC{3}."
msgstr ""
msgstr "{0} adlı oyuncunun son girişi {1} {2} UTC {3}."
#: ../../TShockAPI/Commands.cs:1298
#, csharp-format
msgid "{0}'s register date is {1} {2} UTC{3}."
msgstr ""
msgstr "{0} adlı oyuncunun kayıt tarihi {1} {2} UTC{3}."
#: ../../TShockAPI/Commands.cs:5778
#, csharp-format
@ -1093,19 +1093,19 @@ msgstr ""
#: ../../TShockAPI/Permissions.cs:547
#, csharp-format
msgid "* **Commands**: `{0}`"
msgstr ""
msgstr "* **Komutlar**: `{0}`"
#: ../../TShockAPI/Configuration/ServerSideConfig.cs:123
#: ../../TShockAPI/Configuration/TShockConfig.cs:645
#, csharp-format
msgid "* **Default**: `{0}`"
msgstr ""
msgstr "* **Varsayılan**: `{0}`"
#: ../../TShockAPI/Configuration/ServerSideConfig.cs:122
#: ../../TShockAPI/Configuration/TShockConfig.cs:644
#, csharp-format
msgid "* **Field type**: `{0}`"
msgstr ""
msgstr "* **Alan türü**: `{0}`"
#: ../../TShockAPI/Rest/RestManager.cs:1220
#, csharp-format
@ -1167,14 +1167,14 @@ msgstr "<{0} hedefine> {1}"
msgid "=== Dependency ==="
msgid_plural "=== Dependencies ==="
msgstr[0] ""
msgstr[1] ""
msgstr[1] "=== Bağımlılıklar ==="
#: ../../TShockPluginManager/NugetCLI.cs:133
#, csharp-format
msgid "=== Requested Plugin ==="
msgid_plural "=== Requested Plugins ==="
msgstr[0] ""
msgstr[1] ""
msgstr[1] "=== İstenen Eklentiler ==="
#: ../../TShockAPI/Commands.cs:2818
msgid "a Deerclops"

View file

@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tshock\n"
"POT-Creation-Date: 2022-12-06 05:43:49+0000\n"
"PO-Revision-Date: 2022-12-06 17:49\n"
"PO-Revision-Date: 2023-01-04 07:35\n"
"Last-Translator: \n"
"Language-Team: Chinese Simplified\n"
"MIME-Version: 1.0\n"
@ -127,7 +127,7 @@ msgstr "- 根据用户名封禁一个不在线的玩家"
#: ../../TShockAPI/Commands.cs:1445
msgid "- Ban an offline player by IP address"
msgstr "- 封禁离线玩家的IP地址"
msgstr "- 通过IP地址封禁离线玩家"
#: ../../TShockAPI/Commands.cs:1448
msgid "- Ban an online player by index (Useful for hard to type names)"
@ -345,7 +345,7 @@ msgstr "{0} <{1}|{2}|{3}> [{4}]"
#: ../../TShockAPI/Commands.cs:1106
#, csharp-format
msgid "{0} added account {1} to group {2}."
msgstr "{0} 将账号 {1} 添加至组 {2}"
msgstr "{0} 将账号 {1} 添加至组 {2}!"
#: ../../TShockAPI/GetDataHandlers.cs:3546
#, csharp-format
@ -365,7 +365,7 @@ msgstr "{0}使用了游商背包([i:5343])。"
#: ../../TShockAPI/Commands.cs:1064
#, csharp-format
msgid "{0} attempted to register for the account {1} but it was already taken."
msgstr "{0}尝试注册账号“{1}” ,但它已被注册。"
msgstr "{0}试图注册账号“{1}” ,但它已被占用。"
#: ../../TShockAPI/GetDataHandlers.cs:2637
#: ../../TShockAPI/GetDataHandlers.cs:3212
@ -381,7 +381,7 @@ msgstr "{0}已成功登录账号{1}。"
#: ../../TShockAPI/TSPlayer.cs:1955
#, csharp-format
msgid "{0} banned {1} for '{2}'."
msgstr "{0} 以'{2}'为理由封禁了{1}"
msgstr "{0} 以'{2}'为理由封禁了'{1}'"
#: ../../TShockAPI/Commands.cs:6051
#, csharp-format
@ -553,7 +553,7 @@ msgstr "{0}已将你所属的用户组更改为{1}。"
#: ../../TShockAPI/Commands.cs:3026
#, csharp-format
msgid "{0} has disabled incoming teleports."
msgstr "{0} 禁止玩家对其使用传送"
msgstr "{0} 禁止玩家对其使用传送"
#: ../../TShockAPI/Commands.cs:2412
#, csharp-format
@ -608,22 +608,22 @@ msgstr "{0} 已将你复活。"
#: ../../TShockAPI/GetDataHandlers.cs:3555
#, csharp-format
msgid "{0} has sent a request to the bunny delivery service!"
msgstr "{0}联系了兔兔运送服务站。"
msgstr "{0}从递送站申领了新的兔兔!"
#: ../../TShockAPI/GetDataHandlers.cs:3561
#, csharp-format
msgid "{0} has sent a request to the cat delivery service!"
msgstr "{0}联系了猫咪运送服务站。"
msgstr "{0}从递送站申领了新的猫猫!"
#: ../../TShockAPI/GetDataHandlers.cs:3558
#, csharp-format
msgid "{0} has sent a request to the dog delivery service!"
msgstr "{0}联系了狗狗运送服务站。"
msgstr "{0}从递送站申领了新的狗狗!"
#: ../../TShockAPI/GetDataHandlers.cs:3552
#, csharp-format
msgid "{0} has sent a request to the slime delivery service!"
msgstr "{0}联系了史莱姆运送服务站。"
msgstr "{0}已向史莱姆递送服务发送请求!"
#: ../../TShockAPI/Commands.cs:2878
#, csharp-format
@ -684,7 +684,7 @@ msgstr "{0}为他自己恢复了{1}血量。"
#: ../../TShockAPI/Commands.cs:4250
#, csharp-format
msgid "{0} is already allowed to place tile {1}."
msgstr "{0} 已被允许放置方块 {1}。"
msgstr "{0} 已被允许放置图格 {1}。"
#: ../../TShockAPI/Commands.cs:3885
#, csharp-format
@ -719,12 +719,12 @@ msgstr "{0} 已被禁止使用射弹 {1}。"
#: ../../TShockAPI/ItemBans.cs:234
#, csharp-format
msgid "{0} is banned! Remove it!"
msgstr "{0} 已被封禁!请删除它!"
msgstr "{0} 已被禁用!请移除它!"
#: ../../TShockAPI/Commands.cs:6751
#, csharp-format
msgid "{0} is no longer in god mode."
msgstr "已关闭{0}的无敌模式。"
msgstr "已关闭{0}的上帝模式。"
#: ../../TShockAPI/Commands.cs:5546
#: ../../TShockAPI/Commands.cs:5577
@ -1253,7 +1253,7 @@ msgstr "成功移除账号。"
#: ../../TShockAPI/Commands.cs:2094
msgid "Active REST Users ({{0}}/{{1}}):"
msgstr "活跃REST用户({{0}}/{{1}}):"
msgstr "有效的临时REST用户({{0}}/{{1}}):"
#: ../../TShockAPI/Commands.cs:3971
msgid "add <item> - Adds an item ban."
@ -1307,7 +1307,7 @@ msgstr "{0}{1}的别名:{0}{2}"
#: ../../TShockAPI/Commands.cs:6013
msgid "All alive NPCs (excluding town NPCs) on the server will be killed if you do not input a name or ID."
msgstr "输入名称或序号可以消灭特定NPC否则将默认消灭所有非城镇NPC。"
msgstr "输入NPC名称或ID可以杀死特定NPC否则将默认杀死所有非城镇NPC。"
#: ../../TShockAPI/Commands.cs:2626
msgid "all bosses"
@ -1315,7 +1315,7 @@ msgstr "所有boss"
#: ../../TShockPluginManager/NugetCLI.cs:169
msgid "All done! :)"
msgstr "下载完毕!"
msgstr "下载完毕!: )"
#: ../../TShockAPI/Commands.cs:2104
msgid "All REST tokens have been destroyed."
@ -1328,15 +1328,15 @@ msgstr "已分配内存: {0}"
#: ../../TShockAPI/Commands.cs:3972
msgid "allow <item> <group> - Allows a group to use an item."
msgstr "allow <物品> <组名> - 允许指定组使用被禁用的物品"
msgstr "allow <物品> <用户组> - 给予用户组使用特定物品的豁免权。"
#: ../../TShockAPI/Commands.cs:4150
msgid "allow <projectile ID> <group> - Allows a group to use a projectile."
msgstr "allow <射弹> <用户组> - 给用户组使用特定射弹的豁免权。"
msgstr "allow <射弹> <用户组> - 给用户组使用特定射弹的豁免权。"
#: ../../TShockAPI/Commands.cs:4326
msgid "allow <tile ID> <group> - Allows a group to place a tile."
msgstr "allow <物块> <用户组> - 给用户组使用特定物块的豁免权。"
msgstr "allow <物块> <用户组> - 给用户组使用特定物块的豁免权。"
#: ../../TShockAPI/Commands.cs:5193
msgid "allow <user> <region> - Allows a user to a region."
@ -1374,20 +1374,20 @@ msgstr "执行指令时发生了异常。"
#: ../../TShockAPI/DB/BanManager.cs:644
msgid "An identifier for a character name."
msgstr "角色名字的标识。"
msgstr "可以匹配游戏内的角色名。"
#: ../../TShockAPI/DB/BanManager.cs:648
msgid "An identifier for a TShock User Account name."
msgstr "一个TShock用户名的标识符。"
msgstr "可以匹配TShock用户名。"
#: ../../TShockAPI/DB/BanManager.cs:640
msgid "An identifier for a UUID."
msgstr "UUID的标识。"
msgstr "可以匹配UUID。"
#: ../../TShockAPI/DB/BanManager.cs:636
#, csharp-format
msgid "An identifier for an IP Address in octet format. e.g., '{0}'."
msgstr "用句点分隔的十进制格式的IP地址,例如{0}。"
msgstr "可以匹配IP地址格式为用句点分隔的十进制,例如{0}。"
#: ../../TShockAPI/Commands.cs:2052
msgid "An update check has been queued. If an update is available, you will be notified shortly."
@ -1446,7 +1446,7 @@ msgstr "自动存档已开启。"
#: ../../TShockAPI/Rest/RestManager.cs:811
msgid "AutoSave has been disabled"
msgstr "自动存已关闭"
msgstr "自动存已关闭"
#: ../../TShockAPI/Rest/RestManager.cs:807
msgid "AutoSave has been enabled"
@ -1466,7 +1466,7 @@ msgstr "可用Ban指令:"
#: ../../TShockAPI/Commands.cs:1432
msgid "Available identifiers ({{0}}/{{1}}):"
msgstr "可用的标识符 ({{0}}/{{1}}):"
msgstr "可选的匹配代码 ({{0}}/{{1}}):"
#: ../../TShockAPI/Commands.cs:5208
msgid "Available Region Sub-Commands ({{0}}/{{1}}):"
@ -1474,7 +1474,7 @@ msgstr "可用的区域子命令 ({{0}}/{{1}}):"
#: ../../TShockAPI/Commands.cs:2109
msgid "Available REST Sub-Commands:"
msgstr "Rest命令使用帮助:"
msgstr "REST命令使用帮助:"
#: ../../TShockAPI/BackupManager.cs:75
msgid "Backing up world..."
@ -1684,7 +1684,7 @@ msgstr "Bouncer / OnFishOutNPC钓出NPC防护因没有召唤Boss的权限
#: ../../TShockAPI/Bouncer.cs:2781
#, csharp-format
msgid "Bouncer / OnFoodPlatterTryPlacing rejected disabled from {0}"
msgstr "Bouncer / OnFoodPlatterTryPlacing放置食物防护因玩家被拘束阻止了{0}"
msgstr "Bouncer / OnFoodPlatterTryPlacing放置食物防护因玩家被限制行动而阻止了{0}"
#: ../../TShockAPI/Bouncer.cs:2774
#, csharp-format
@ -1997,7 +1997,7 @@ msgstr "Bouncer / OnPlaceChest宝箱放置防护因超出范围而阻止
#: ../../TShockAPI/Bouncer.cs:1562
#, csharp-format
msgid "Bouncer / OnPlaceChest rejected from weird check from {0}"
msgstr "Bouncer / OnPlaceChest 拒绝了来自 {0} 的怪的检查"
msgstr "Bouncer / OnPlaceChest 拒绝了来自 {0} 的怪的检查"
#: ../../TShockAPI/Bouncer.cs:1573
#, csharp-format
@ -2998,7 +2998,7 @@ msgstr "检测到恶意攻击"
#: ../../TShockAPI/Commands.cs:1494
#, csharp-format
msgid "Failed to add ban for identifier: {0}."
msgstr "无法给{0}添加封禁标识符"
msgstr "无法添加封禁(匹配代码{0})。"
#: ../../TShockAPI/Rest/RestManager.cs:671
#, csharp-format
@ -3515,7 +3515,7 @@ msgstr "用户组{1}为{0}的父组,但也同时是它的子组。已删除此
#: ../../TShockAPI/DB/GroupManager.cs:578
msgid "Group \"superadmin\" is defined in the database even though it's a reserved group name."
msgstr "组 ”superadmin”(超级管理员)已存在于数据库中,即使这是一个保留的组名。"
msgstr "数据库中存在superadmin组但它已被预留不应存在于数据库中。"
#: ../../TShockAPI/DB/GroupManager.cs:708
#, csharp-format
@ -3573,7 +3573,7 @@ msgstr "用户组{0}的父组为{1},但该用户组不存在。已删除此父
#: ../../TShockAPI/DB/GroupManager.cs:637
#, csharp-format
msgid "Group {0} is referencing itself as parent group; parent reference was removed."
msgstr "组{0}试图将自己作为父组。父组的引用已被删除。"
msgstr "用户组{0}的父组为它自己。已删除此父子关系。"
#: ../../TShockAPI/Commands.cs:4862
#: ../../TShockAPI/Commands.cs:4897
@ -5849,7 +5849,7 @@ msgstr "此用户组不存在。"
#: ../../TShockAPI/DB/BanManager.cs:258
msgid "The ban is invalid because a current ban for this identifier already exists."
msgstr "禁令无效,因为当前禁止此标识符的禁令已经存在。"
msgstr "目前已经封禁了符合这个匹配代码的玩家,无法再次封禁。"
#: ../../TShockAPI/DB/BanManager.cs:295
msgid "The ban was not valid for an unknown reason."
@ -5986,7 +5986,7 @@ msgstr "史莱姆皇后"
#: ../../TShockAPI/Rest/RestManager.cs:158
msgid "The REST authentication token."
msgstr "REST 身份验证令牌。"
msgstr "REST 授权令牌"
#: ../../TShockAPI/UpdateManager.cs:150
msgid "The server is out of date. Latest version: "
@ -6047,7 +6047,7 @@ msgstr "当前没有任何有效的临时REST用户。"
#: ../../TShockAPI/Commands.cs:1434
msgid "There are currently no available identifiers."
msgstr "目前没有可的匹配代码。"
msgstr "目前没有可的匹配代码。"
#: ../../TShockAPI/Commands.cs:4001
msgid "There are currently no banned items."

View file

@ -1,17 +0,0 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
],
"git-submodules": {
"enabled": true
},
"packageRules": [
{
"matchPackageNames": ["OTAPI.Upcoming", "ModFramework", "TerrariaServerAPI"],
"ignoreUnstable": "false",
"bumpVersion": "prerelease",
"groupName": "OTAPI things"
}
]
}