Merge pull request #2760 from sgkoishi/patch-3

Update i18n
This commit is contained in:
Lucas Nicodemus 2022-10-27 15:52:59 -06:00 committed by GitHub
commit aa0e45de8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 573 additions and 526 deletions

View file

@ -452,7 +452,7 @@ namespace TShockAPI
byte plr = args.PlayerId;
ControlSet control = args.Control;
MiscDataSet1 miscData1 = args.MiscData1;
byte item = args.SelectedItem ;
byte item = args.SelectedItem;
var pos = args.Position;
var vel = args.Velocity;
@ -699,11 +699,11 @@ namespace TShockAPI
// also add an exception for snake coils, they can be removed when the player places a new one or after x amount of time
// If the tile is part of the breakable when placing set, it might be getting broken by a placement.
else if (tile.type != TileID.ItemFrame && tile.type != TileID.MysticSnakeRope
&& !Main.tileAxe[tile.type] && !Main.tileHammer[tile.type] && tile.wall == 0 &&
args.Player.TPlayer.mount.Type != MountID.Drill && selectedItem.pick == 0 &&
selectedItem.type != ItemID.GravediggerShovel &&
!ItemID.Sets.Explosives[selectedItem.netID] && args.Player.RecentFuse == 0
&& !TileID.Sets.BreakableWhenPlacing[tile.type])
&& !Main.tileAxe[tile.type] && !Main.tileHammer[tile.type] && tile.wall == 0 &&
args.Player.TPlayer.mount.Type != MountID.Drill && selectedItem.pick == 0 &&
selectedItem.type != ItemID.GravediggerShovel &&
!ItemID.Sets.Explosives[selectedItem.netID] && args.Player.RecentFuse == 0
&& !TileID.Sets.BreakableWhenPlacing[tile.type])
{
TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from (pick) {0} {1} {2}", args.Player.Name, action,
editData));
@ -932,7 +932,7 @@ namespace TShockAPI
if (args.Player.IsBouncerThrottled())
{
TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from throttled from {0} {1} {2}"), args.Player.Name, action, editData);
TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from throttled from {0} {1} {2}", args.Player.Name, action, editData));
args.Player.SendTileSquareCentered(tileX, tileY, 4);
args.Handled = true;
return;
@ -1665,7 +1665,7 @@ namespace TShockAPI
{
if (TShock.Config.Settings.KickOnTileLiquidThresholdBroken)
{
args.Player.Kick(string.Format("Reached TileLiquid threshold {0}.", TShock.Config.Settings.TileLiquidThreshold));
args.Player.Kick(GetString("Reached TileLiquid threshold {0}.", TShock.Config.Settings.TileLiquidThreshold));
}
else
{
@ -1822,7 +1822,7 @@ namespace TShockAPI
}
if (!wasThereABombNearby && type == LiquidType.Shimmer &&
TShock.ItemBans.DataModel.ItemIsBanned("Bottomless Shimmer Bucket", args.Player))
TShock.ItemBans.DataModel.ItemIsBanned("Bottomless Shimmer Bucket", args.Player))
{
TShock.Log.ConsoleDebug(GetString("Bouncer / OnLiquidSet rejected bucket check 7 from {0}", args.Player.Name));
args.Player.SendErrorMessage(GetString("You do not have permission to perform this action."));
@ -2269,7 +2269,7 @@ namespace TShockAPI
if (args.Player.SelectedItem.type is ItemID.RubblemakerSmall or ItemID.RubblemakerMedium or ItemID.RubblemakerLarge)
{
if (type != TileID.LargePilesEcho && type != TileID.LargePiles2Echo && type != TileID.SmallPiles2x1Echo &&
type != TileID.SmallPiles1x1Echo && type != TileID.PlantDetritus3x2Echo && type != TileID.PlantDetritus2x2Echo)
type != TileID.SmallPiles1x1Echo && type != TileID.PlantDetritus3x2Echo && type != TileID.PlantDetritus2x2Echo)
{
TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceObject rejected rubblemaker I can't believe it's not rubble! from {0}",
args.Player.Name));
@ -2278,7 +2278,7 @@ namespace TShockAPI
return;
}
}
else if(args.Player.SelectedItem.type == ItemID.AcornAxe)
else if (args.Player.SelectedItem.type == ItemID.AcornAxe)
{
if (type != TileID.Saplings)
{
@ -2457,7 +2457,7 @@ namespace TShockAPI
if (args.NewPosition.X > Main.maxTilesX || args.NewPosition.X < 0
|| args.NewPosition.Y > Main.maxTilesY || args.NewPosition.Y < 0)
{
TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerPortalTeleport rejected teleport out of bounds from {0}"), args.Player.Name);
TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerPortalTeleport rejected teleport out of bounds from {0}", args.Player.Name));
args.Handled = true;
return;
}
@ -2465,7 +2465,7 @@ namespace TShockAPI
//May as well reject teleport attempts if the player is being throttled
if (args.Player.IsBeingDisabled() || args.Player.IsBouncerThrottled())
{
TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerPortalTeleport rejected disabled/throttled from {0}"), args.Player.Name);
TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerPortalTeleport rejected disabled/throttled from {0}", args.Player.Name));
args.Handled = true;
return;
}

File diff suppressed because it is too large Load diff

View file

@ -1066,7 +1066,7 @@ namespace TShockAPI
/// The Terraria ID of the player talking to the NPC
/// </summary>
public byte PlayerId { get; set; }
/// <summary>
/// The NPC ID of the NPC the player is talking to
/// </summary>
@ -1089,8 +1089,8 @@ namespace TShockAPI
};
NpcTalk.Invoke(null, args);
return args.Handled;
}
}
/// <summary>
/// For use with a PlayerAnimation event
/// </summary>
@ -1304,7 +1304,7 @@ namespace TShockAPI
TileX = tilex,
TileY = tiley,
Amount = amount,
Type = (LiquidType) type,
Type = (LiquidType)type,
};
LiquidSet.Invoke(null, args);
return args.Handled;
@ -1496,7 +1496,7 @@ namespace TShockAPI
ID = id,
X = x,
Y = y,
HouseholdStatus = (HouseholdStatus) houseHoldStatus,
HouseholdStatus = (HouseholdStatus)houseHoldStatus,
};
NPCHome.Invoke(null, args);
return args.Handled;
@ -1706,7 +1706,7 @@ namespace TShockAPI
var args = new ReleaseNpcEventArgs
{
Player = player,
Data = data,
Data = data,
X = _x,
Y = _y,
Type = _type,
@ -1714,8 +1714,8 @@ namespace TShockAPI
};
ReleaseNPC.Invoke(null, args);
return args.Handled;
}
}
/// <summary>The arguments to the PlaceObject hook.</summary>
public class PlaceObjectEventArgs : GetDataHandledEventArgs
{
@ -2254,7 +2254,7 @@ namespace TShockAPI
/// Called when a player lands a golf ball in a cup.
/// </summary>
public static HandlerList<LandGolfBallInCupEventArgs> LandGolfBallInCup = new HandlerList<LandGolfBallInCupEventArgs>();
private static bool OnLandGolfBallInCup(TSPlayer player, MemoryStream data, byte playerIndex, ushort tileX, ushort tileY, ushort hits, ushort projectileType )
private static bool OnLandGolfBallInCup(TSPlayer player, MemoryStream data, byte playerIndex, ushort tileX, ushort tileY, ushort hits, ushort projectileType)
{
if (LandGolfBallInCup == null)
return false;
@ -2476,7 +2476,7 @@ namespace TShockAPI
for (int i = 0; i < 8; i++)
args.Player.TPlayer.hideVisibleAccessory[i] = hideVisual[i];
for (int i = 0; i < 2; i++)
args.Player.TPlayer.hideVisibleAccessory[i+8] = hideVisual2[i];
args.Player.TPlayer.hideVisibleAccessory[i + 8] = hideVisual2[i];
args.Player.TPlayer.hideMisc = hideMisc;
args.Player.TPlayer.extraAccessory = extraSlot;
args.Player.TPlayer.UsingBiomeTorches = usingBiomeTorches;
@ -2528,7 +2528,7 @@ namespace TShockAPI
}
if (OnPlayerSlot(args.Player, args.Data, plr, slot, stack, prefix, type) || plr != args.Player.Index || slot < 0 ||
slot > NetItem.MaxInventory)
slot > NetItem.MaxInventory)
return true;
if (args.Player.IgnoreSSCPackets)
{
@ -2547,7 +2547,7 @@ namespace TShockAPI
args.Player.PlayerData.StoreSlot(slot, type, prefix, stack);
}
else if (Main.ServerSideCharacter && TShock.Config.Settings.DisableLoginBeforeJoin && !bypassTrashCanCheck &&
args.Player.HasSentInventory && !args.Player.HasPermission(Permissions.bypassssc))
args.Player.HasSentInventory && !args.Player.HasPermission(Permissions.bypassssc))
{
// The player might have moved an item to their trash can before they performed a single login attempt yet.
args.Player.IsDisabledPendingTrashRemoval = true;
@ -2597,7 +2597,7 @@ namespace TShockAPI
{
if (args.Player.PlayerData.exists && TShock.ServerSideCharacterConfig.Settings.WarnPlayersAboutBypassPermission)
{
args.Player.SendWarningMessage("Bypass SSC is enabled for your account. SSC data will not be loaded or saved.");
args.Player.SendWarningMessage(GetString("Bypass SSC is enabled for your account. SSC data will not be loaded or saved."));
TShock.Log.ConsoleInfo(args.Player.Name + " has SSC data in the database, but has the tshock.ignore.ssc permission. This means their SSC data is being ignored.");
TShock.Log.ConsoleInfo("You may wish to consider removing the tshock.ignore.ssc permission or negating it for this player.");
}
@ -2614,8 +2614,8 @@ namespace TShockAPI
if (args.Player.HasPermission(Permissions.usebanneditem))
args.Player.IsDisabledForBannedWearable = false;
args.Player.SendSuccessMessage("Authenticated as " + account.Name + " successfully.");
TShock.Log.ConsoleInfo(args.Player.Name + " authenticated successfully as user " + args.Player.Name + ".");
args.Player.SendSuccessMessage(GetString($"Authenticated as {account.Name} successfully."));
TShock.Log.ConsoleInfo($"{args.Player.Name} authenticated successfully as user {args.Player.Name}.");
Hooks.PlayerHooks.OnPlayerPostLogin(args.Player);
return true;
}
@ -2645,7 +2645,7 @@ namespace TShockAPI
return true;
if (TShock.Utils.GetActivePlayerCount() + 1 > TShock.Config.Settings.MaxSlots &&
!args.Player.HasPermission(Permissions.reservedslot))
!args.Player.HasPermission(Permissions.reservedslot))
{
TShock.Log.ConsoleDebug("GetDataHandlers / HandleGetSection rejected reserve slot");
args.Player.Kick(TShock.Config.Settings.ServerFullReason, true, true);
@ -2777,7 +2777,7 @@ namespace TShockAPI
short tileY = args.Data.ReadInt16();
short editData = args.Data.ReadInt16();
EditType type = (action == EditAction.KillTile || action == EditAction.KillWall ||
action == EditAction.KillTileNoItem || action == EditAction.TryKillTile)
action == EditAction.KillTileNoItem || action == EditAction.TryKillTile)
? EditType.Fail
: (action == EditAction.PlaceTile || action == EditAction.PlaceWall || action == EditAction.ReplaceTile || action == EditAction.ReplaceWall)
? EditType.Type
@ -2819,8 +2819,8 @@ namespace TShockAPI
if (tileType != TileID.ClosedDoor && tileType != TileID.OpenDoor
&& tileType != TileID.TallGateClosed && tileType != TileID.TallGateOpen
&& tileType != TileID.TrapdoorClosed && tileType != TileID.TrapdoorOpen)
&& tileType != TileID.TallGateClosed && tileType != TileID.TallGateOpen
&& tileType != TileID.TrapdoorClosed && tileType != TileID.TrapdoorOpen)
{
TShock.Log.ConsoleDebug("GetDataHandlers / HandleDoorUse rejected door gap check {0}", args.Player.Name);
return true;
@ -2938,34 +2938,34 @@ namespace TShockAPI
if (Main.npc[id].townNPC && !args.Player.HasPermission(Permissions.hurttownnpc))
{
args.Player.SendErrorMessage("You do not have permission to hurt Town NPCs.");
args.Player.SendErrorMessage(GetString("You do not have permission to hurt Town NPCs."));
args.Player.SendData(PacketTypes.NpcUpdate, "", id);
TShock.Log.ConsoleDebug($"GetDataHandlers / HandleNpcStrike rejected npc strike {args.Player.Name}");
return true;
}
if (Main.npc[id].netID == NPCID.EmpressButterfly)
{
if (!args.Player.HasPermission(Permissions.summonboss))
{
args.Player.SendErrorMessage("You do not have permission to summon the Empress of Light.");
args.Player.SendErrorMessage(GetString("You do not have permission to summon the Empress of Light."));
args.Player.SendData(PacketTypes.NpcUpdate, "", id);
TShock.Log.ConsoleDebug($"GetDataHandlers / HandleNpcStrike rejected EoL summon from {args.Player.Name}");
return true;
}
else if (!TShock.Config.Settings.AnonymousBossInvasions)
{
TShock.Utils.Broadcast(string.Format($"{args.Player.Name} summoned the Empress of Light!"), 175, 75, 255);
TShock.Utils.Broadcast(GetString($"{args.Player.Name} summoned the Empress of Light!"), 175, 75, 255);
}
else
TShock.Utils.SendLogs(string.Format($"{args.Player.Name} summoned the Empress of Light!"), Color.PaleVioletRed, args.Player);
TShock.Utils.SendLogs(GetString($"{args.Player.Name} summoned the Empress of Light!"), Color.PaleVioletRed, args.Player);
}
if (Main.npc[id].netID == NPCID.CultistDevote || Main.npc[id].netID == NPCID.CultistArcherBlue)
{
if (!args.Player.HasPermission(Permissions.summonboss))
{
args.Player.SendErrorMessage("You do not have permission to summon the Lunatic Cultist!");
args.Player.SendErrorMessage(GetString("You do not have permission to summon the Lunatic Cultist!"));
args.Player.SendData(PacketTypes.NpcUpdate, "", id);
TShock.Log.ConsoleDebug($"GetDataHandlers / HandleNpcStrike rejected Cultist summon from {args.Player.Name}");
return true;
@ -2986,7 +2986,7 @@ namespace TShockAPI
return true;
}
short type = (short) Main.projectile[index].type;
short type = (short)Main.projectile[index].type;
// TODO: This needs to be moved somewhere else.
@ -3189,7 +3189,7 @@ namespace TShockAPI
args.Player.IsDisabledForBannedWearable = false;
args.Player.SendMessage("Authenticated as " + args.Player.Name + " successfully.", Color.LimeGreen);
args.Player.SendMessage(GetString("Authenticated as " + args.Player.Name + " successfully."), Color.LimeGreen);
TShock.Log.ConsoleInfo(args.Player.Name + " authenticated successfully as user " + args.Player.Name + ".");
TShock.UserAccounts.SetUserAccountUUID(account, args.Player.UUID);
Hooks.PlayerHooks.OnPlayerPostLogin(args.Player);
@ -3224,7 +3224,7 @@ namespace TShockAPI
if (OnNpcTalk(args.Player, args.Data, plr, npc))
return true;
//Rejecting player who trying to talk to a npc if player were disabled, mainly for unregistered and logged out players. Preventing smuggling or duplicating their items if player put it in a npc's item slot
if (args.Player.IsBeingDisabled())
{
@ -3405,7 +3405,7 @@ namespace TShockAPI
if (type == 1 && TShock.Config.Settings.DisableDungeonGuardian)
{
TShock.Log.ConsoleDebug("GetDataHandlers / HandleSpecial rejected type 1 for {0}", args.Player.Name);
args.Player.SendMessage("The Dungeon Guardian returned you to your spawn point.", Color.Purple);
args.Player.SendMessage(GetString("The Dungeon Guardian returned you to your spawn point."), Color.Purple);
args.Player.Spawn(PlayerSpawnContext.RecallFromItem);
return true;
}
@ -3415,7 +3415,7 @@ namespace TShockAPI
if (!args.Player.HasPermission(Permissions.usesundial))
{
TShock.Log.ConsoleDebug($"GetDataHandlers / HandleSpecial rejected enchanted sundial permission {args.Player.Name}");
args.Player.SendErrorMessage("You do not have permission to use the Enchanted Sundial.");
args.Player.SendErrorMessage(GetString("You do not have permission to use the Enchanted Sundial."));
return true;
}
else if (TShock.Config.Settings.ForceTime != "normal")
@ -3423,10 +3423,10 @@ namespace TShockAPI
TShock.Log.ConsoleDebug($"GetDataHandlers / HandleSpecial rejected enchanted sundial permission (ForceTime) {args.Player.Name}");
if (!args.Player.HasPermission(Permissions.cfgreload))
{
args.Player.SendErrorMessage("You cannot use the Enchanted Sundial because time is stopped.");
args.Player.SendErrorMessage(GetString("You cannot use the Enchanted Sundial because time is stopped."));
}
else
args.Player.SendErrorMessage("You must set ForceTime to normal via config to use the Enchanted Sundial.");
args.Player.SendErrorMessage(GetString("You must set ForceTime to normal via config to use the Enchanted Sundial."));
return true;
}
}
@ -3471,7 +3471,7 @@ namespace TShockAPI
if (!args.Player.HasPermission(Permissions.movenpc))
{
TShock.Log.ConsoleDebug("GetDataHandlers / UpdateNPCHome rejected no permission {0}", args.Player.Name);
args.Player.SendErrorMessage("You do not have permission to relocate Town NPCs.");
args.Player.SendErrorMessage(GetString("You do not have permission to relocate Town NPCs."));
args.Player.SendData(PacketTypes.UpdateNPCHome, "", id, Main.npc[id].homeTileX, Main.npc[id].homeTileY,
Convert.ToByte(Main.npc[id].homeless));
return true;
@ -3498,21 +3498,21 @@ namespace TShockAPI
if (bosses.Contains(thingType) && !args.Player.HasPermission(Permissions.summonboss))
{
TShock.Log.ConsoleDebug("GetDataHandlers / HandleSpawnBoss rejected boss {0} {1}", args.Player.Name, thingType);
args.Player.SendErrorMessage("You do not have permission to summon bosses.");
args.Player.SendErrorMessage(GetString("You do not have permission to summon bosses."));
return true;
}
if (invasions.Contains(thingType) && !args.Player.HasPermission(Permissions.startinvasion))
{
TShock.Log.ConsoleDebug("GetDataHandlers / HandleSpawnBoss rejected invasion {0} {1}", args.Player.Name, thingType);
args.Player.SendErrorMessage("You do not have permission to start invasions.");
args.Player.SendErrorMessage(GetString("You do not have permission to start invasions."));
return true;
}
if (pets.Contains(thingType) && !args.Player.HasPermission(Permissions.spawnpets))
{
TShock.Log.ConsoleDebug("GetDataHandlers / HandleSpawnBoss rejected pet {0} {1}", args.Player.Name, thingType);
args.Player.SendErrorMessage("You do not have permission to spawn pets.");
args.Player.SendErrorMessage(GetString("You do not have permission to spawn pets."));
return true;
}
@ -3523,52 +3523,52 @@ namespace TShockAPI
switch (thingType)
{
case -14:
thing = "has sent a request to the bunny delivery service";
thing = GetString("{0} has sent a request to the bunny delivery service!", args.Player.Name);
break;
case -13:
thing = "has sent a request to the dog delivery service";
thing = GetString("{0} has sent a request to the dog delivery service!", args.Player.Name);
break;
case -12:
thing = "has sent a request to the cat delivery service";
thing = GetString("{0} has sent a request to the cat delivery service!", args.Player.Name);
break;
case -11:
thing = "applied advanced combat techniques";
thing = GetString("{0} applied advanced combat techniques!", args.Player.Name);
break;
case -10:
thing = "summoned a Blood Moon";
thing = GetString("{0} summoned a Blood Moon!", args.Player.Name);
break;
case -8:
thing = "summoned a Moon Lord";
thing = GetString("{0} summoned a Moon Lord!", args.Player.Name);
break;
case -7:
thing = "summoned a Martian invasion";
thing = GetString("{0} summoned a Martian invasion!", args.Player.Name);
break;
case -6:
thing = "summoned an eclipse";
thing = GetString("{0} summoned an eclipse!", args.Player.Name);
break;
case -5:
thing = "summoned a frost moon";
thing = GetString("{0} summoned a frost moon!", args.Player.Name);
break;
case -4:
thing = "summoned a pumpkin moon";
thing = GetString("{0} summoned a pumpkin moon!", args.Player.Name);
break;
case -3:
thing = "summoned the Pirates";
thing = GetString("{0} summoned the Pirates!", args.Player.Name);
break;
case -2:
thing = "summoned the Snow Legion";
thing = GetString("{0} summoned the Snow Legion!", args.Player.Name);
break;
case -1:
thing = "summoned a Goblin Invasion";
thing = GetString("{0} summoned a Goblin Invasion!", args.Player.Name);
break;
default:
thing = String.Format("summoned the {0}", npc.FullName);
thing = GetString("{0} summoned the {1}!", args.Player.Name, npc.FullName);
break;
}
if (TShock.Config.Settings.AnonymousBossInvasions)
TShock.Utils.SendLogs(string.Format("{0} {1}!", args.Player.Name, thing), Color.PaleVioletRed, args.Player);
TShock.Utils.SendLogs(thing, Color.PaleVioletRed, args.Player);
else
TShock.Utils.Broadcast(String.Format("{0} {1}!", args.Player.Name, thing), 175, 75, 255);
TShock.Utils.Broadcast(thing, 175, 75, 255);
return false;
}
@ -3709,7 +3709,7 @@ namespace TShockAPI
if (type == 0 && !args.Player.HasPermission(Permissions.rod))
{
TShock.Log.ConsoleDebug("GetDataHandlers / HandleTeleport rejected rod type {0} {1}", args.Player.Name, type);
args.Player.SendErrorMessage("You do not have permission to teleport using items."); // Was going to write using RoD but Hook of Disonnance and Potion of Return both use the same teleport packet as RoD.
args.Player.SendErrorMessage(GetString("You do not have permission to teleport using items.")); // Was going to write using RoD but Hook of Disonnance and Potion of Return both use the same teleport packet as RoD.
args.Player.Teleport(args.TPlayer.position.X, args.TPlayer.position.Y); // Suggest renaming rod permission unless someone plans to add separate perms for the other 2 tp items.
return true;
}
@ -3733,7 +3733,7 @@ namespace TShockAPI
if (!args.Player.HasPermission(Permissions.wormhole))
{
TShock.Log.ConsoleDebug("GetDataHandlers / HandleTeleport rejected p2p wormhole permission {0} {1}", args.Player.Name, type);
args.Player.SendErrorMessage("You do not have permission to teleport using Wormhole Potions.");
args.Player.SendErrorMessage(GetString("You do not have permission to teleport using Wormhole Potions."));
args.Player.Teleport(args.TPlayer.position.X, args.TPlayer.position.Y);
return true;
}
@ -3765,8 +3765,8 @@ namespace TShockAPI
NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, NetworkText.Empty, npcID);
return true;
}
if(args.Player.IsBeingDisabled())
if (args.Player.IsBeingDisabled())
{
TShock.Log.ConsoleDebug("GetDataHandlers / HandleCatchNpc rejected catch npc {0}", args.Player.Name);
return true;
@ -3781,15 +3781,15 @@ namespace TShockAPI
var y = args.Data.ReadInt32();
var type = args.Data.ReadInt16();
var style = args.Data.ReadInt8();
if (OnReleaseNpc(args.Player, args.Data, x, y, type, style))
{
return true;
}
return false;
}
}
private static bool HandleTeleportationPotion(GetDataHandlerArgs args)
{
var type = args.Data.ReadByte();
@ -3797,14 +3797,14 @@ namespace TShockAPI
void Fail(string tpItem)
{
TShock.Log.ConsoleDebug("GetDataHandlers / HandleTeleportationPotion rejected permissions {0} {1}", args.Player.Name, type);
args.Player.SendErrorMessage("You do not have permission to teleport using {0}.", tpItem);
args.Player.SendErrorMessage(GetString("You do not have permission to teleport using {0}.", tpItem));
}
switch (type)
{
case 0: // Teleportation Potion
if (args.Player.ItemInHand.type != ItemID.TeleportationPotion &&
args.Player.SelectedItem.type != ItemID.TeleportationPotion)
args.Player.SelectedItem.type != ItemID.TeleportationPotion)
{
TShock.Log.ConsoleDebug("GetDataHandlers / HandleTeleportationPotion rejected not holding the correct item {0} {1}", args.Player.Name, type);
return true;
@ -3931,7 +3931,7 @@ namespace TShockAPI
if (TShock.TileBans.TileIsBanned((short)TileID.LogicSensor, args.Player))
{
args.Player.SendTileSquareCentered(x, y, 1);
args.Player.SendErrorMessage("You do not have permission to place Logic Sensors.");
args.Player.SendErrorMessage(GetString("You do not have permission to place Logic Sensors."));
return true;
}
@ -3987,7 +3987,7 @@ namespace TShockAPI
}
var distanceFromCoinPacketToNpc = Utils.Distance(position, npc.position);
if (distanceFromCoinPacketToNpc >= (5*16f)) //5 tile range
if (distanceFromCoinPacketToNpc >= (5 * 16f)) //5 tile range
{
TShock.Log.ConsoleDebug("GetDataHandlers / HandleSyncExtraValue rejected range check {0},{1} vs {2},{3} which is {4}", npc.position.X, npc.position.Y, position.X, position.Y, distanceFromCoinPacketToNpc);
return true;
@ -4043,7 +4043,7 @@ namespace TShockAPI
if (projectile == null || !projectile.active)
{
TShock.Log.ConsoleDebug("GetDataHandlers / HandleNpcTeleportPortal rejected null check {0}", args.Player.Name);
TShock.Log.ConsoleDebug("GetDataHandlers / HandleNpcTeleportPortal rejected null check {0}", args.Player.Name);
NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, NetworkText.Empty, npcIndex);
return true;
}
@ -4091,7 +4091,7 @@ namespace TShockAPI
if (args.Player != null && !args.Player.HasPermission(Permissions.toggleparty))
{
TShock.Log.ConsoleDebug("GetDataHandlers / HandleToggleParty rejected no party {0}", args.Player.Name);
args.Player.SendErrorMessage("You do not have permission to start a party.");
args.Player.SendErrorMessage(GetString("You do not have permission to start a party."));
return true;
}
@ -4109,14 +4109,14 @@ namespace TShockAPI
if (!args.Player.HasPermission(Permissions.startdd2))
{
TShock.Log.ConsoleDebug("GetDataHandlers / HandleOldOnesArmy rejected permissions {0}", args.Player.Name);
args.Player.SendErrorMessage("You do not have permission to start the Old One's Army.");
args.Player.SendErrorMessage(GetString("You do not have permission to start the Old One's Army."));
return true;
}
if (TShock.Config.Settings.AnonymousBossInvasions)
TShock.Utils.SendLogs(string.Format("{0} started the Old One's Army event!", args.Player.Name), Color.PaleVioletRed, args.Player);
TShock.Utils.SendLogs(GetString("{0} started the Old One's Army event!", args.Player.Name), Color.PaleVioletRed, args.Player);
else
TShock.Utils.Broadcast(string.Format("{0} started the Old One's Army event!", args.Player.Name), 175, 75, 255);
TShock.Utils.Broadcast(GetString("{0} started the Old One's Army event!", args.Player.Name), 175, 75, 255);
return false;
}
@ -4190,14 +4190,14 @@ namespace TShockAPI
if (TShock.CharacterDB.RemovePlayer(args.Player.Account.ID))
{
TShock.Log.ConsoleDebug("GetDataHandlers / HandlePlayerKillMeV2 ssc delete {0} {1}", args.Player.Name, args.TPlayer.difficulty);
args.Player.SendErrorMessage("You have fallen in hardcore mode, and your items have been lost forever.");
args.Player.SendErrorMessage(GetString("You have fallen in hardcore mode, and your items have been lost forever."));
TShock.CharacterDB.SeedInitialData(args.Player.Account);
}
}
return false;
}
private static bool HandleEmoji(GetDataHandlerArgs args)
{
byte playerIndex = args.Data.ReadInt8();
@ -4289,7 +4289,7 @@ namespace TShockAPI
int coinsValue = args.Data.ReadInt32();
float baseValue = args.Data.ReadSingle();
bool spawnedFromStatus = args.Data.ReadBoolean();
return false;
}
@ -4594,7 +4594,7 @@ namespace TShockAPI
{TileID.Crystals, 17},
{TileID.MinecartTrack, 3}
};
/// <summary>
/// Contains brief information about a projectile
/// </summary>

View file

@ -199,7 +199,7 @@ namespace TShockAPI
if (args.Player.TPlayer.autoActuator && DataModel.ItemIsBanned("Actuator", args.Player))
{
args.Player.SendTileSquareCentered(args.X, args.Y, 1);
args.Player.SendErrorMessage("You do not have permission to place actuators.");
args.Player.SendErrorMessage(GetString("You do not have permission to place actuators."));
args.Handled = true;
return;
}
@ -231,7 +231,7 @@ namespace TShockAPI
private void SendCorrectiveMessage(TSPlayer player, string itemName)
{
player.SendErrorMessage("{0} is banned! Remove it!", itemName);
player.SendErrorMessage(GetString("{0} is banned! Remove it!", itemName));
}
}
}

View file

@ -102,10 +102,10 @@ namespace TShockAPI
public Settings()
{
this.IncludeHeader = true;
this.headerFormat = "Page {0} of {1}";
this.headerFormat = GetString("Page {{0}} of {{1}}");
this.HeaderTextColor = Color.Green;
this.IncludeFooter = true;
this.footerFormat = "Type /<command> {0} for more.";
this.footerFormat = GetString("Type /<command> {{0}} for more.");
this.FooterTextColor = Color.Yellow;
this.NothingToDisplayString = null;
this.LineFormatter = null;

View file

@ -151,12 +151,12 @@ namespace TShockAPI
if (output.Count == 0)
{
player.SendInfoMessage(includeUnprotected
? "There are no regions at this point."
: "There are no regions at this point, or they are not protected.");
? GetString("There are no regions at this point.")
: GetString("There are no regions at this point, or they are not protected."));
}
else
{
player.SendInfoMessage(includeUnprotected ? "Regions at this point: " : "Protected regions at this point: ");
player.SendInfoMessage(includeUnprotected ? GetString("Regions at this point: ") : GetString("Protected regions at this point: "));
foreach (string line in PaginationTools.BuildLinesFromTerms(output))
{
@ -184,7 +184,7 @@ namespace TShockAPI
// Set temp point coordinates to current tile coordinates
player.TempPoints[player.AwaitingTempPoint - 1].X = e.X;
player.TempPoints[player.AwaitingTempPoint - 1].Y = e.Y;
player.SendInfoMessage($"Set temp point {player.AwaitingTempPoint}.");
player.SendInfoMessage(GetString($"Set temp point {player.AwaitingTempPoint}."));
// Reset the awaiting temp point
player.AwaitingTempPoint = 0;

View file

@ -844,7 +844,7 @@ namespace TShockAPI
}
}
return RestResponse(GetPluralString($"{killcount} NPC has been killed.", "{killcount} NPCs have been killed.", killcount));
return RestResponse(GetPluralString("{0} NPC has been killed.", "{0} NPCs have been killed.", killcount, killcount));
}
[Description("Get information regarding the world.")]

View file

@ -55,7 +55,7 @@ namespace TShockAPI
// These can be caused by an unexpected error such as a bad or out of date plugin
try
{
TShock.Utils.Broadcast("Saving world...", Color.Yellow);
TShock.Utils.Broadcast(GetString("Saving world..."), Color.Yellow);
}
catch (Exception ex)
{
@ -132,9 +132,9 @@ namespace TShockAPI
WorldFile.SaveWorld(task.resetTime);
if (TShock.Config.Settings.AnnounceSave)
TShock.Utils.Broadcast("World saved.", Color.Yellow);
TShock.Utils.Broadcast(GetString("World saved."), Color.Yellow);
TShock.Log.Info(string.Format("World saved at ({0})", Main.worldPathName));
TShock.Log.Info(GetString("World saved at ({0})", Main.worldPathName));
}
catch (Exception e)
{
@ -160,7 +160,7 @@ namespace TShockAPI
public override string ToString()
{
return string.Format("resetTime {0}, direct {1}", resetTime, direct);
return GetString("resetTime {0}, direct {1}", resetTime, direct);
}
}
}

View file

@ -36,7 +36,7 @@ namespace TShockAPI
public override string ToString()
{
return string.Format("Message: {0}: {1}: {2}",
return GetString("Message: {0}: {1}: {2}",
caller, logLevel.ToString().ToUpper(), message);
}
}
@ -314,7 +314,7 @@ namespace TShockAPI
{
caller = "TShock",
logLevel = TraceLevel.Error,
message = string.Format("SQL Log insert query failed: {0}", ex),
message = GetString("SQL Log insert query failed: {0}", ex),
timestamp = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture)
});
}
@ -343,7 +343,7 @@ namespace TShockAPI
foreach (var logInfo in _failures)
{
_backupLog.Write(string.Format("SQL log failed at: {0}. {1}", logInfo.timestamp, logInfo),
_backupLog.Write(GetString("SQL log failed at: {0}. {1}", logInfo.timestamp, logInfo),
TraceLevel.Error);
}
_failures.Clear();

View file

@ -981,7 +981,7 @@ namespace TShockAPI
get
{
return RealPlayer
&& (Netplay.Clients[Index] != null && Netplay.Clients[Index].IsActive && !Netplay.Clients[Index].PendingTermination);
&& (Netplay.Clients[Index] != null && Netplay.Clients[Index].IsActive && !Netplay.Clients[Index].PendingTermination);
}
}
@ -1722,7 +1722,7 @@ namespace TShockAPI
Main.player[Index].team = team;
NetMessage.SendData((int)PacketTypes.PlayerTeam, -1, -1, NetworkText.Empty, Index);
}
/// <summary>
/// Sets the player's pvp.
/// </summary>
@ -1838,12 +1838,12 @@ namespace TShockAPI
TShock.Bans.InsertBan($"{Identifier.Account}{Account.Name}", reason, adminUserName, DateTime.UtcNow, DateTime.MaxValue);
}
Disconnect(string.Format("Banned: {0}", reason));
Disconnect(GetString("Banned: {0}", reason));
if (string.IsNullOrWhiteSpace(adminUserName))
TSPlayer.All.SendInfoMessage("{0} was banned for '{1}'.", Name, reason);
TSPlayer.All.SendInfoMessage(GetString("{0} was banned for '{1}'.", Name, reason));
else
TSPlayer.All.SendInfoMessage("{0} banned {1} for '{2}'.", adminUserName, Name, reason);
TSPlayer.All.SendInfoMessage(GetString("{0} banned {1} for '{2}'.", adminUserName, Name, reason));
return true;
}

View file

@ -443,8 +443,8 @@ namespace TShockAPI
if(Log is not null) Log.ConsoleError(message);
else Console.WriteLine(message);
};
SafeError("TShock encountered a problem from which it cannot recover. The following message may help diagnose the problem.");
SafeError("Until the problem is resolved, TShock will not be able to start (and will crash on startup).");
SafeError(GetString("TShock encountered a problem from which it cannot recover. The following message may help diagnose the problem."));
SafeError(GetString("Until the problem is resolved, TShock will not be able to start (and will crash on startup)."));
SafeError(ex.ToString());
Environment.Exit(1);
}
@ -780,7 +780,7 @@ namespace TShockAPI
{
if (!string.IsNullOrWhiteSpace(cfg))
{
ServerApi.LogWriter.PluginWriteLine(this, string.Format("Loading dedicated config file: {0}", cfg), TraceLevel.Verbose);
ServerApi.LogWriter.PluginWriteLine(this, GetString("Loading dedicated config file: {0}", cfg), TraceLevel.Verbose);
Main.instance.LoadDedConfig(cfg);
}
})
@ -791,7 +791,7 @@ namespace TShockAPI
if (int.TryParse(p, out port))
{
Netplay.ListenPort = port;
ServerApi.LogWriter.PluginWriteLine(this, string.Format("Listening on port {0}.", port), TraceLevel.Verbose);
ServerApi.LogWriter.PluginWriteLine(this, GetString("Listening on port {0}.", port), TraceLevel.Verbose);
}
})
@ -800,7 +800,7 @@ namespace TShockAPI
if (!string.IsNullOrWhiteSpace(world))
{
Main.instance.SetWorldName(world);
ServerApi.LogWriter.PluginWriteLine(this, string.Format("World name will be overridden by: {0}", world), TraceLevel.Verbose);
ServerApi.LogWriter.PluginWriteLine(this, GetString("World name will be overridden by: {0}", world), TraceLevel.Verbose);
}
})
@ -810,7 +810,7 @@ namespace TShockAPI
if (IPAddress.TryParse(ip, out addr))
{
Netplay.ServerIP = addr;
ServerApi.LogWriter.PluginWriteLine(this, string.Format("Listening on IP {0}.", addr), TraceLevel.Verbose);
ServerApi.LogWriter.PluginWriteLine(this, GetString("Listening on IP {0}.", addr), TraceLevel.Verbose);
}
else
{
@ -846,7 +846,7 @@ namespace TShockAPI
throw new InvalidOperationException("Invalid value given for command line argument \"-worldevil\".");
}
ServerApi.LogWriter.PluginWriteLine(this, String.Format("New worlds will be generated with the {0} world evil type!", value), TraceLevel.Verbose);
ServerApi.LogWriter.PluginWriteLine(this, GetString("New worlds will be generated with the {0} world evil type!", value), TraceLevel.Verbose);
WorldGen.WorldGenParam_Evil = worldEvil;
})
@ -978,8 +978,8 @@ namespace TShockAPI
if (File.Exists(Path.Combine(SavePath, "setup-code.txt")))
{
Log.ConsoleInfo("An account has been detected in the user database, but setup-code.txt is still present.");
Log.ConsoleInfo("TShock will now disable the initial setup system and remove setup-code.txt as it is no longer needed.");
Log.ConsoleInfo(GetString("An account has been detected in the user database, but setup-code.txt is still present."));
Log.ConsoleInfo(GetString("TShock will now disable the initial setup system and remove setup-code.txt as it is no longer needed."));
File.Delete(Path.Combine(SavePath, "setup-code.txt"));
}
@ -994,8 +994,8 @@ namespace TShockAPI
var r = new Random((int)DateTime.Now.ToBinary());
SetupToken = r.Next(100000, 10000000);
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("To setup the server, join the game and type {0}setup {1}", Commands.Specifier, SetupToken);
Console.WriteLine("This token will display until disabled by verification. ({0}setup)", Commands.Specifier);
Console.WriteLine(GetString("To setup the server, join the game and type {0}setup {1}", Commands.Specifier, SetupToken));
Console.WriteLine(GetString("This token will display until disabled by verification. ({0}setup)", Commands.Specifier));
Console.ResetColor();
File.WriteAllText(Path.Combine(SavePath, "setup-code.txt"), SetupToken.ToString());
}
@ -1003,9 +1003,9 @@ namespace TShockAPI
{
SetupToken = Convert.ToInt32(File.ReadAllText(Path.Combine(SavePath, "setup-code.txt")));
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("TShock Notice: setup-code.txt is still present, and the code located in that file will be used.");
Console.WriteLine("To setup the server, join the game and type {0}setup {1}", Commands.Specifier, SetupToken);
Console.WriteLine("This token will display until disabled by verification. ({0}setup)", Commands.Specifier);
Console.WriteLine(GetString("TShock Notice: setup-code.txt is still present, and the code located in that file will be used."));
Console.WriteLine(GetString("To setup the server, join the game and type {0}setup {1}", Commands.Specifier, SetupToken));
Console.WriteLine(GetString("This token will display until disabled by verification. ({0}setup)", Commands.Specifier));
Console.ResetColor();
}
@ -1465,7 +1465,7 @@ namespace TShockAPI
if (!Commands.HandleCommand(tsplr, text))
{
// This is required in case anyone makes HandleCommand return false again
tsplr.SendErrorMessage("Unable to parse command. Please contact an administrator for assistance.");
tsplr.SendErrorMessage(GetString("Unable to parse command. Please contact an administrator for assistance."));
Log.ConsoleError("Unable to parse command '{0}' from player {1}.", text, tsplr.Name);
}
}
@ -1483,7 +1483,7 @@ namespace TShockAPI
}
else if (tsplr.mute)
{
tsplr.SendErrorMessage("You are muted!");
tsplr.SendErrorMessage(GetString("You are muted!"));
args.Handled = true;
}
else if (!TShock.Config.Settings.EnableChatAboveHeads)
@ -1638,22 +1638,22 @@ namespace TShockAPI
if (Config.Settings.EnableGeoIP && TShock.Geo != null)
{
Log.Info("{0} ({1}) from '{2}' group from '{3}' joined. ({4}/{5})", player.Name, player.IP,
Log.Info(GetString("{0} ({1}) from '{2}' group from '{3}' joined. ({4}/{5})", player.Name, player.IP,
player.Group.Name, player.Country, TShock.Utils.GetActivePlayerCount(),
TShock.Config.Settings.MaxSlots);
TShock.Config.Settings.MaxSlots));
if (!player.SilentJoinInProgress)
Utils.Broadcast(string.Format("{0} ({1}) has joined.", player.Name, player.Country), Color.Yellow);
Utils.Broadcast(GetString("{0} ({1}) has joined.", player.Name, player.Country), Color.Yellow);
}
else
{
Log.Info("{0} ({1}) from '{2}' group joined. ({3}/{4})", player.Name, player.IP,
player.Group.Name, TShock.Utils.GetActivePlayerCount(), TShock.Config.Settings.MaxSlots);
Log.Info(GetString("{0} ({1}) from '{2}' group joined. ({3}/{4})", player.Name, player.IP,
player.Group.Name, TShock.Utils.GetActivePlayerCount(), TShock.Config.Settings.MaxSlots));
if (!player.SilentJoinInProgress)
Utils.Broadcast(player.Name + " has joined.", Color.Yellow);
Utils.Broadcast(GetString("{0} has joined.", player.Name), Color.Yellow);
}
if (Config.Settings.DisplayIPToAdmins)
Utils.SendLogs(string.Format("{0} has joined. IP: {1}", player.Name, player.IP), Color.Blue);
Utils.SendLogs(GetString("{0} has joined. IP: {1}", player.Name, player.IP), Color.Blue);
player.SendFileTextAsMessage(FileTools.MotdPath);
@ -1670,12 +1670,12 @@ namespace TShockAPI
if (Main.ServerSideCharacter)
{
player.IsDisabledForSSC = true;
player.SendErrorMessage(String.Format("Server side characters is enabled! Please {0}register or {0}login to play!", Commands.Specifier));
player.SendErrorMessage(GetString("Server side characters is enabled! Please {0}register or {0}login to play!", Commands.Specifier));
player.LoginHarassed = true;
}
else if (Config.Settings.RequireLogin)
{
player.SendErrorMessage("Please {0}register or {0}login to play!", Commands.Specifier);
player.SendErrorMessage(GetString("Please {0}register or {0}login to play!", Commands.Specifier));
player.LoginHarassed = true;
}
}
@ -1685,7 +1685,7 @@ namespace TShockAPI
if (Config.Settings.RememberLeavePos && (RememberedPos.GetLeavePos(player.Name, player.IP) != Vector2.Zero) && !player.LoginHarassed)
{
player.RPPending = 3;
player.SendInfoMessage("You will be teleported to your last known location...");
player.SendInfoMessage(GetString("You will be teleported to your last known location..."));
}
args.Handled = true;

View file

@ -129,13 +129,13 @@ namespace TShockAPI
{
return update;
}
return null;
}
private void NotifyAdministrators(Dictionary<string, string> update)
{
var changes = update["changes"].Split(new[] {'\n'}, StringSplitOptions.RemoveEmptyEntries);
var changes = update["changes"].Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
NotifyAdministrator(TSPlayer.Server, changes);
foreach (TSPlayer player in TShock.Players)
{
@ -148,7 +148,7 @@ namespace TShockAPI
private void NotifyAdministrator(TSPlayer player, string[] changes)
{
player.SendMessage("The server is out of date. Latest version: ", Color.Red);
player.SendMessage(GetString("The server is out of date. Latest version: "), Color.Red);
for (int j = 0; j < changes.Length; j++)
{
player.SendMessage(changes[j], Color.Red);

View file

@ -133,7 +133,7 @@ namespace TShockAPI
{
TSPlayer.All.SendMessage(msg, red, green, blue);
TSPlayer.Server.SendMessage(msg, red, green, blue);
TShock.Log.Info(string.Format("Broadcast: {0}", msg));
TShock.Log.Info(GetString("Broadcast: {0}", msg));
}
/// <summary>>Broadcast - Broadcasts a message to all players on the server, as well as the server console, and the logs.</summary>
@ -156,7 +156,7 @@ namespace TShockAPI
{
TSPlayer.All.SendMessageFromPlayer(msg, red, green, blue, ply);
TSPlayer.Server.SendMessage(Main.player[ply].name + ": " + msg, red, green, blue);
TShock.Log.Info(string.Format("Broadcast: {0}", Main.player[ply].name + ": " + msg));
TShock.Log.Info(GetString("Broadcast: {0}: {1}", Main.player[ply].name, msg));
}
/// <summary>
@ -1063,7 +1063,7 @@ 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)
{
Console.Title = string.Format("{0}{1}/{2} on {3} @ {4}:{5} (TShock for Terraria v{6})",
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);