Merge branch 'general-devel' into patch-1
This commit is contained in:
commit
05cb443a1a
25 changed files with 743 additions and 293 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -1,6 +1,6 @@
|
|||
# Sublime Text #
|
||||
*.sublime-*
|
||||
|
||||
releases/
|
||||
# Compiled source #
|
||||
###################
|
||||
*.com
|
||||
|
|
@ -67,4 +67,4 @@ _ReSharper.*
|
|||
packages/*
|
||||
|
||||
# Private key files #
|
||||
scripts/ssh_private_key
|
||||
scripts/ssh_private_key
|
||||
|
|
|
|||
|
|
@ -6,4 +6,6 @@ install:
|
|||
script: python ./scripts/create_release.py
|
||||
notifications:
|
||||
slack:
|
||||
secure: O4Nibe2fdaUa2ZxuETUg6WEoQKvNM2CotnfaIVgm3fjfe61dfE1P+EgTpbwDG8646jSmpTqMDw8Z6I/WJwGTlXV/ZQsbwu63Cps4MgOTvPHZ0Lsye5azySlJZs1iI4ItYSj2czXfcnJ+qAl1SOOkXJrjB5uyTMWtDpCrSCFB3MA=
|
||||
secure: O4Nibe2fdaUa2ZxuETUg6WEoQKvNM2CotnfaIVgm3fjfe61dfE1P+EgTpbwDG8646jSmpTqMDw8Z6I/WJwGTlXV/ZQsbwu63Cps4MgOTvPHZ0Lsye5azySlJZs1iI4ItYSj2czXfcnJ+qAl1SOOkXJrjB5uyTMWtDpCrSCFB3MA=
|
||||
webhooks:
|
||||
secure: dbTvcMtts5hSgV3DvlHPh36LTOvSPzQbVRUrgN9j0M/MlCm1QlBVt1vDLzN8VbkSYXiJYVWGMDpSHApL6SBu7sEQaXeC4zZyTMX76PeKw5a5xh0mIdDyg8Ls9WVA+QDVGes5DA1CZWbVRBDto3U0c+Ob8iza3o01sEFWpm7wQg4=
|
||||
10
CHANGELOG.md
10
CHANGELOG.md
|
|
@ -4,6 +4,16 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
|
|||
|
||||
## Upcoming Changes
|
||||
|
||||
* Updated OpenTerraria API to 1.3.5.3 (@DeathCradle)
|
||||
* Updated Terraria Server API to 1.3.5.3 (@WhiteXZ, @hakusaro)
|
||||
* Updated TShock core components to 1.3.5.3 (@hakusaro)
|
||||
* Terraria Server API version tick: 2.1
|
||||
* Added OnNpcKilled hook to Server API: 2.2 (@tylerjwatson)
|
||||
* Added CreateCombatTextExtended to PacketTypes. This packet allows for the same functionality that packet 82 (CreateCombatText) used to have. (@WhiteXZ)
|
||||
* Updated ServerBroadcast hook to provide a NetworkText object. (@tylerjwatson)
|
||||
* Fixed levers and things not updating properly. (@deathcradle)
|
||||
* Deprecated PacketTypes.ChatText. Chat is now handled using the NetTextModule and packet 82. (@WhiteXZ, @Hakusaro)
|
||||
* Removed the -lang command-line flag from TShock. It is now a vanilla feature. (@Hakusaro)
|
||||
|
||||
## TShock 4.3.23
|
||||
* Added evil type option during world creation (@mistzzt)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Note: This includes the API by default. If you need only the API, you need to cd
|
|||
- Run ```msbuild TShock.sln``` in the root of the cloned folder on Windows in a 'Developer Command Prompt' OR
|
||||
- Run ```xbuild TShock.sln``` in the root of the cloned folder on Unix.
|
||||
|
||||
Need help? Drop by Slack and we'll be happy to explain it with more words, step by step.
|
||||
Need help? Drop by Discord and we'll be happy to explain it with more words, step by step.
|
||||
|
||||
### TShock Additions
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ If something is better suited to be a plugin for TShock, rather than a TShock co
|
|||
|
||||
_If you are confused, make a suggestion. We will determine scope and relevance for you._
|
||||
|
||||
_If a person makes a suggestion in Slack, capture the suggestion as a Github issue. If a suggestion crops up on the forums, make a Github issue to capture it. If you want, direct the user to make a suggestion on Github, but set an alarm/timer/reminder so that if they don't know how to use Github or they don't have an account, an issue is still made and discussed. Make it clear that the issue is a surrogate issue for a suggestion from Slack/the forums too._
|
||||
_If a person makes a suggestion in Discord, capture the suggestion as a Github issue. If a suggestion crops up on the forums, make a Github issue to capture it. If you want, direct the user to make a suggestion on Github, but set an alarm/timer/reminder so that if they don't know how to use Github or they don't have an account, an issue is still made and discussed. Make it clear that the issue is a surrogate issue for a suggestion from Discord/the forums too._
|
||||
|
||||
### Pull Request Dev Guidelines
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<p align="center">
|
||||
<img src="https://tshock.co/newlogo.png" alt="TShock for Terraria"><br />
|
||||
<a href="https://travis-ci.org/NyxStudios/TShock"><img src="https://travis-ci.org/NyxStudios/TShock.png?branch=general-devel" alt="Build Status"></a><br />
|
||||
<a href="https://travis-ci.org/NyxStudios/TShock"><img src="https://travis-ci.org/NyxStudios/TShock.png?branch=general-devel" alt="Build Status"></a><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><br />
|
||||
<hr />
|
||||
</p>
|
||||
|
||||
|
|
@ -33,6 +33,12 @@ Feeling like helping out? Want to find an awesome server? Some awesome plugins?
|
|||
* [Contribute to our docs on readme.io](https://tshock.readme.io/)
|
||||
* [Join our Discord chat (supports Android, iOS, Web, Mac, and Windows)](https://discord.gg/XUJdH58)
|
||||
|
||||
### Code of Conduct
|
||||
|
||||
> 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).
|
||||
|
||||
Please see the contributing file before sending pull requests.
|
||||
|
||||
## Download
|
||||
|
|
|
|||
|
|
@ -27,12 +27,14 @@ using System.Text;
|
|||
using System.Threading;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using TShockAPI.DB;
|
||||
using TerrariaApi.Server;
|
||||
using TShockAPI.Hooks;
|
||||
using Terraria.GameContent.Events;
|
||||
using Microsoft.Xna.Framework;
|
||||
using OTAPI.Tile;
|
||||
using TShockAPI.Localization;
|
||||
|
||||
namespace TShockAPI
|
||||
{
|
||||
|
|
@ -2156,83 +2158,83 @@ namespace TShockAPI
|
|||
foreach (int i in npcIds)
|
||||
{
|
||||
npc.SetDefaults(i);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
|
||||
}
|
||||
TSPlayer.All.SendSuccessMessage("{0} has spawned all bosses {1} time(s).", args.Player.Name, amount);
|
||||
return;
|
||||
case "brain":
|
||||
case "brain of cthulhu":
|
||||
npc.SetDefaults(266);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.All.SendSuccessMessage("{0} has spawned the Brain of Cthulhu {1} time(s).", args.Player.Name, amount);
|
||||
return;
|
||||
case "destroyer":
|
||||
npc.SetDefaults(134);
|
||||
TSPlayer.Server.SetTime(false, 0.0);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.All.SendSuccessMessage("{0} has spawned the Destroyer {1} time(s).", args.Player.Name, amount);
|
||||
return;
|
||||
case "duke":
|
||||
case "duke fishron":
|
||||
case "fishron":
|
||||
npc.SetDefaults(370);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.All.SendSuccessMessage("{0} has spawned Duke Fishron {1} time(s).", args.Player.Name, amount);
|
||||
return;
|
||||
case "eater":
|
||||
case "eater of worlds":
|
||||
npc.SetDefaults(13);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.All.SendSuccessMessage("{0} has spawned the Eater of Worlds {1} time(s).", args.Player.Name, amount);
|
||||
return;
|
||||
case "eye":
|
||||
case "eye of cthulhu":
|
||||
npc.SetDefaults(4);
|
||||
TSPlayer.Server.SetTime(false, 0.0);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.All.SendSuccessMessage("{0} has spawned the Eye of Cthulhu {1} time(s).", args.Player.Name, amount);
|
||||
return;
|
||||
case "golem":
|
||||
npc.SetDefaults(245);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.All.SendSuccessMessage("{0} has spawned Golem {1} time(s).", args.Player.Name, amount);
|
||||
return;
|
||||
case "king":
|
||||
case "king slime":
|
||||
npc.SetDefaults(50);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.All.SendSuccessMessage("{0} has spawned King Slime {1} time(s).", args.Player.Name, amount);
|
||||
return;
|
||||
case "plantera":
|
||||
npc.SetDefaults(262);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.All.SendSuccessMessage("{0} has spawned Plantera {1} time(s).", args.Player.Name, amount);
|
||||
return;
|
||||
case "prime":
|
||||
case "skeletron prime":
|
||||
npc.SetDefaults(127);
|
||||
TSPlayer.Server.SetTime(false, 0.0);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.All.SendSuccessMessage("{0} has spawned Skeletron Prime {1} time(s).", args.Player.Name, amount);
|
||||
return;
|
||||
case "queen":
|
||||
case "queen bee":
|
||||
npc.SetDefaults(222);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.All.SendSuccessMessage("{0} has spawned Queen Bee {1} time(s).", args.Player.Name, amount);
|
||||
return;
|
||||
case "skeletron":
|
||||
npc.SetDefaults(35);
|
||||
TSPlayer.Server.SetTime(false, 0.0);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.All.SendSuccessMessage("{0} has spawned Skeletron {1} time(s).", args.Player.Name, amount);
|
||||
return;
|
||||
case "twins":
|
||||
TSPlayer.Server.SetTime(false, 0.0);
|
||||
npc.SetDefaults(125);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
|
||||
npc.SetDefaults(126);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.All.SendSuccessMessage("{0} has spawned the Twins {1} time(s).", args.Player.Name, amount);
|
||||
return;
|
||||
case "wof":
|
||||
|
|
@ -2253,7 +2255,7 @@ namespace TShockAPI
|
|||
case "moon":
|
||||
case "moon lord":
|
||||
npc.SetDefaults(398);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
|
||||
TSPlayer.All.SendSuccessMessage("{0} has spawned the Moon Lord {1} time(s).", args.Player.Name, amount);
|
||||
return;
|
||||
default:
|
||||
|
|
@ -2291,21 +2293,21 @@ namespace TShockAPI
|
|||
}
|
||||
else if (npcs.Count > 1)
|
||||
{
|
||||
TShock.Utils.SendMultipleMatchError(args.Player, npcs.Select(n => n.name));
|
||||
TShock.Utils.SendMultipleMatchError(args.Player, npcs.Select(n => $"{n.FullName}({n.type})"));
|
||||
}
|
||||
else
|
||||
{
|
||||
var npc = npcs[0];
|
||||
if (npc.type >= 1 && npc.type < Main.maxNPCTypes && npc.type != 113)
|
||||
{
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY, 50, 20);
|
||||
TSPlayer.Server.SpawnNPC(npc.netID, npc.FullName, amount, args.Player.TileX, args.Player.TileY, 50, 20);
|
||||
if (args.Silent)
|
||||
{
|
||||
args.Player.SendSuccessMessage("Spawned {0} {1} time(s).", npc.name, amount);
|
||||
args.Player.SendSuccessMessage("Spawned {0} {1} time(s).", npc.FullName, amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
TSPlayer.All.SendSuccessMessage("{0} has spawned {1} {2} time(s).", args.Player.Name, npc.name, amount);
|
||||
TSPlayer.All.SendSuccessMessage("{0} has spawned {1} {2} time(s).", args.Player.Name, npc.FullName, amount);
|
||||
}
|
||||
}
|
||||
else if (npc.type == 113)
|
||||
|
|
@ -2533,18 +2535,22 @@ namespace TShockAPI
|
|||
var matches = new List<NPC>();
|
||||
foreach (var npc in Main.npc.Where(npc => npc.active))
|
||||
{
|
||||
if (string.Equals(npc.name, npcStr, StringComparison.CurrentCultureIgnoreCase))
|
||||
var englishName = EnglishLanguage.GetNpcNameById(npc.netID);
|
||||
|
||||
if (string.Equals(npc.FullName, npcStr, StringComparison.InvariantCultureIgnoreCase) ||
|
||||
string.Equals(englishName, npcStr, StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
matches = new List<NPC> { npc };
|
||||
break;
|
||||
}
|
||||
if (npc.name.ToLower().StartsWith(npcStr.ToLower()))
|
||||
if (npc.FullName.ToLowerInvariant().StartsWith(npcStr.ToLowerInvariant()) ||
|
||||
englishName?.StartsWith(npcStr, StringComparison.InvariantCultureIgnoreCase) == true)
|
||||
matches.Add(npc);
|
||||
}
|
||||
|
||||
if (matches.Count > 1)
|
||||
{
|
||||
TShock.Utils.SendMultipleMatchError(args.Player, matches.Select(n => n.name));
|
||||
TShock.Utils.SendMultipleMatchError(args.Player, matches.Select(n => $"{n.FullName}({n.whoAmI})"));
|
||||
return;
|
||||
}
|
||||
if (matches.Count == 0)
|
||||
|
|
@ -2555,7 +2561,7 @@ namespace TShockAPI
|
|||
|
||||
var target = matches[0];
|
||||
args.Player.Teleport(target.position.X, target.position.Y);
|
||||
args.Player.SendSuccessMessage("Teleported to the '{0}'.", target.name);
|
||||
args.Player.SendSuccessMessage("Teleported to the '{0}'.", target.FullName);
|
||||
}
|
||||
|
||||
private static void GetPos(CommandArgs args)
|
||||
|
|
@ -3202,12 +3208,12 @@ namespace TShockAPI
|
|||
}
|
||||
else if (items.Count > 1)
|
||||
{
|
||||
TShock.Utils.SendMultipleMatchError(args.Player, items.Select(i => i.name));
|
||||
TShock.Utils.SendMultipleMatchError(args.Player, items.Select(i => $"{i.Name}({i.netID})"));
|
||||
}
|
||||
else
|
||||
{
|
||||
TShock.Itembans.AddNewBan(items[0].name);
|
||||
args.Player.SendSuccessMessage("Banned " + items[0].name + ".");
|
||||
TShock.Itembans.AddNewBan(EnglishLanguage.GetItemNameById(items[0].type));
|
||||
args.Player.SendSuccessMessage("Banned " + items[0].Name + ".");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
|
@ -3228,7 +3234,7 @@ namespace TShockAPI
|
|||
}
|
||||
else if (items.Count > 1)
|
||||
{
|
||||
TShock.Utils.SendMultipleMatchError(args.Player, items.Select(i => i.name));
|
||||
TShock.Utils.SendMultipleMatchError(args.Player, items.Select(i => $"{i.Name}({i.netID})"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3238,20 +3244,20 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
ItemBan ban = TShock.Itembans.GetItemBanByName(items[0].name);
|
||||
ItemBan ban = TShock.Itembans.GetItemBanByName(EnglishLanguage.GetItemNameById(items[0].type));
|
||||
if (ban == null)
|
||||
{
|
||||
args.Player.SendErrorMessage("{0} is not banned.", items[0].name);
|
||||
args.Player.SendErrorMessage("{0} is not banned.", items[0].Name);
|
||||
return;
|
||||
}
|
||||
if (!ban.AllowedGroups.Contains(args.Parameters[2]))
|
||||
{
|
||||
TShock.Itembans.AllowGroup(items[0].name, args.Parameters[2]);
|
||||
args.Player.SendSuccessMessage("{0} has been allowed to use {1}.", args.Parameters[2], items[0].name);
|
||||
TShock.Itembans.AllowGroup(EnglishLanguage.GetItemNameById(items[0].type), args.Parameters[2]);
|
||||
args.Player.SendSuccessMessage("{0} has been allowed to use {1}.", args.Parameters[2], items[0].Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
args.Player.SendWarningMessage("{0} is already allowed to use {1}.", args.Parameters[2], items[0].name);
|
||||
args.Player.SendWarningMessage("{0} is already allowed to use {1}.", args.Parameters[2], items[0].Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3273,12 +3279,12 @@ namespace TShockAPI
|
|||
}
|
||||
else if (items.Count > 1)
|
||||
{
|
||||
TShock.Utils.SendMultipleMatchError(args.Player, items.Select(i => i.name));
|
||||
TShock.Utils.SendMultipleMatchError(args.Player, items.Select(i => $"{i.Name}({i.netID})"));
|
||||
}
|
||||
else
|
||||
{
|
||||
TShock.Itembans.RemoveBan(items[0].name);
|
||||
args.Player.SendSuccessMessage("Unbanned " + items[0].name + ".");
|
||||
TShock.Itembans.RemoveBan(EnglishLanguage.GetItemNameById(items[0].type));
|
||||
args.Player.SendSuccessMessage("Unbanned " + items[0].Name + ".");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
|
@ -3299,7 +3305,7 @@ namespace TShockAPI
|
|||
}
|
||||
else if (items.Count > 1)
|
||||
{
|
||||
TShock.Utils.SendMultipleMatchError(args.Player, items.Select(i => i.name));
|
||||
TShock.Utils.SendMultipleMatchError(args.Player, items.Select(i => $"{i.Name}({i.netID})"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3309,20 +3315,20 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
ItemBan ban = TShock.Itembans.GetItemBanByName(items[0].name);
|
||||
ItemBan ban = TShock.Itembans.GetItemBanByName(EnglishLanguage.GetItemNameById(items[0].type));
|
||||
if (ban == null)
|
||||
{
|
||||
args.Player.SendErrorMessage("{0} is not banned.", items[0].name);
|
||||
args.Player.SendErrorMessage("{0} is not banned.", items[0].Name);
|
||||
return;
|
||||
}
|
||||
if (ban.AllowedGroups.Contains(args.Parameters[2]))
|
||||
{
|
||||
TShock.Itembans.RemoveGroup(items[0].name, args.Parameters[2]);
|
||||
args.Player.SendSuccessMessage("{0} has been disallowed to use {1}.", args.Parameters[2], items[0].name);
|
||||
TShock.Itembans.RemoveGroup(EnglishLanguage.GetItemNameById(items[0].type), args.Parameters[2]);
|
||||
args.Player.SendSuccessMessage("{0} has been disallowed to use {1}.", args.Parameters[2], items[0].Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
args.Player.SendWarningMessage("{0} is already disallowed to use {1}.", args.Parameters[2], items[0].name);
|
||||
args.Player.SendWarningMessage("{0} is already disallowed to use {1}.", args.Parameters[2], items[0].Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5187,7 +5193,7 @@ namespace TShockAPI
|
|||
}
|
||||
else if (npcs.Count > 1)
|
||||
{
|
||||
TShock.Utils.SendMultipleMatchError(args.Player, npcs.Select(n => n.name));
|
||||
TShock.Utils.SendMultipleMatchError(args.Player, npcs.Select(n => $"{n.FullName}({n.type})"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
|
@ -5201,7 +5207,7 @@ namespace TShockAPI
|
|||
{
|
||||
if (Main.npc[i].active && ((npcId == 0 && !Main.npc[i].townNPC && Main.npc[i].netID != NPCID.TargetDummy) || Main.npc[i].netID == npcId))
|
||||
{
|
||||
TSPlayer.Server.StrikeNPC(i, (int)(Main.npc[i].life + (Main.npc[i].defense * 0.5)), 0, 0);
|
||||
TSPlayer.Server.StrikeNPC(i, (int)(Main.npc[i].life + (Main.npc[i].defense * 0.6)), 0, 0);
|
||||
kills++;
|
||||
}
|
||||
}
|
||||
|
|
@ -5242,7 +5248,7 @@ namespace TShockAPI
|
|||
}
|
||||
else if (matchedItems.Count > 1)
|
||||
{
|
||||
TShock.Utils.SendMultipleMatchError(args.Player, matchedItems.Select(i => i.name));
|
||||
TShock.Utils.SendMultipleMatchError(args.Player, matchedItems.Select(i => $"{i.Name}({i.netID})"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
|
@ -5261,14 +5267,14 @@ namespace TShockAPI
|
|||
string prefixidOrName = args.Parameters[amountParamIndex + 1];
|
||||
var prefixIds = TShock.Utils.GetPrefixByIdOrName(prefixidOrName);
|
||||
|
||||
if (item.accessory && prefixIds.Contains(42))
|
||||
if (item.accessory && prefixIds.Contains(PrefixID.Quick))
|
||||
{
|
||||
prefixIds.Remove(42);
|
||||
prefixIds.Remove(76);
|
||||
prefixIds.Add(76);
|
||||
prefixIds.Remove(PrefixID.Quick);
|
||||
prefixIds.Remove(PrefixID.Quick2);
|
||||
prefixIds.Add(PrefixID.Quick2);
|
||||
}
|
||||
else if (!item.accessory && prefixIds.Contains(42))
|
||||
prefixIds.Remove(76);
|
||||
else if (!item.accessory && prefixIds.Contains(PrefixID.Quick))
|
||||
prefixIds.Remove(PrefixID.Quick2);
|
||||
|
||||
if (prefixIds.Count > 1)
|
||||
{
|
||||
|
|
@ -5291,7 +5297,7 @@ namespace TShockAPI
|
|||
if (itemAmount == 0 || itemAmount > item.maxStack)
|
||||
itemAmount = item.maxStack;
|
||||
|
||||
if (args.Player.GiveItemCheck(item.type, item.name, item.width, item.height, itemAmount, prefixId))
|
||||
if (args.Player.GiveItemCheck(item.type, EnglishLanguage.GetItemNameById(item.type), item.width, item.height, itemAmount, prefixId))
|
||||
{
|
||||
item.prefix = (byte)prefixId;
|
||||
args.Player.SendSuccessMessage("Gave {0} {1}(s).", itemAmount, item.AffixName());
|
||||
|
|
@ -5325,7 +5331,7 @@ namespace TShockAPI
|
|||
}
|
||||
else if (npcs.Count > 1)
|
||||
{
|
||||
TShock.Utils.SendMultipleMatchError(args.Player, npcs.Select(n => n.name));
|
||||
TShock.Utils.SendMultipleMatchError(args.Player, npcs.Select(n => $"{n.FullName}({n.type})"));
|
||||
return;
|
||||
}
|
||||
else if (args.Parameters[1].Length > 200)
|
||||
|
|
@ -5343,8 +5349,8 @@ namespace TShockAPI
|
|||
{
|
||||
if (Main.npc[i].active && ((npcId == 0 && !Main.npc[i].townNPC) || (Main.npc[i].netID == npcId && Main.npc[i].townNPC)))
|
||||
{
|
||||
Main.npc[i].displayName = args.Parameters[1];
|
||||
NetMessage.SendData(56, -1, -1, args.Parameters[1], i, 0f, 0f, 0f, 0);
|
||||
Main.npc[i].GivenName = args.Parameters[1];
|
||||
NetMessage.SendData(56, -1, -1, NetworkText.FromLiteral(args.Parameters[1]), i, 0f, 0f, 0f, 0);
|
||||
done++;
|
||||
}
|
||||
}
|
||||
|
|
@ -5390,7 +5396,7 @@ namespace TShockAPI
|
|||
}
|
||||
else if (items.Count > 1)
|
||||
{
|
||||
TShock.Utils.SendMultipleMatchError(args.Player, items.Select(i => i.name));
|
||||
TShock.Utils.SendMultipleMatchError(args.Player, items.Select(i => $"{i.Name}({i.netID})"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -5400,14 +5406,14 @@ namespace TShockAPI
|
|||
{
|
||||
int.TryParse(args.Parameters[0], out itemAmount);
|
||||
var prefixIds = TShock.Utils.GetPrefixByIdOrName(args.Parameters[1]);
|
||||
if (item.accessory && prefixIds.Contains(42))
|
||||
if (item.accessory && prefixIds.Contains(PrefixID.Quick))
|
||||
{
|
||||
prefixIds.Remove(42);
|
||||
prefixIds.Remove(76);
|
||||
prefixIds.Add(76);
|
||||
prefixIds.Remove(PrefixID.Quick);
|
||||
prefixIds.Remove(PrefixID.Quick2);
|
||||
prefixIds.Add(PrefixID.Quick2);
|
||||
}
|
||||
else if (!item.accessory && prefixIds.Contains(42))
|
||||
prefixIds.Remove(76);
|
||||
else if (!item.accessory && prefixIds.Contains(PrefixID.Quick))
|
||||
prefixIds.Remove(PrefixID.Quick2);
|
||||
if (prefixIds.Count == 1)
|
||||
prefix = prefixIds[0];
|
||||
}
|
||||
|
|
@ -5430,10 +5436,10 @@ namespace TShockAPI
|
|||
{
|
||||
if (itemAmount == 0 || itemAmount > item.maxStack)
|
||||
itemAmount = item.maxStack;
|
||||
if (plr.GiveItemCheck(item.type, item.name, item.width, item.height, itemAmount, prefix))
|
||||
if (plr.GiveItemCheck(item.type, EnglishLanguage.GetItemNameById(item.type), item.width, item.height, itemAmount, prefix))
|
||||
{
|
||||
args.Player.SendSuccessMessage(string.Format("Gave {0} {1} {2}(s).", plr.Name, itemAmount, item.name));
|
||||
plr.SendSuccessMessage(string.Format("{0} gave you {1} {2}(s).", args.Player.Name, itemAmount, item.name));
|
||||
args.Player.SendSuccessMessage(string.Format("Gave {0} {1} {2}(s).", plr.Name, itemAmount, item.Name));
|
||||
plr.SendSuccessMessage(string.Format("{0} gave you {1} {2}(s).", args.Player.Name, itemAmount, item.Name));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -5517,7 +5523,7 @@ namespace TShockAPI
|
|||
}
|
||||
else if (found.Count > 1)
|
||||
{
|
||||
TShock.Utils.SendMultipleMatchError(args.Player, found.Select(f => Main.buffName[f]));
|
||||
TShock.Utils.SendMultipleMatchError(args.Player, found.Select(f => Lang.GetBuffName(f)));
|
||||
return;
|
||||
}
|
||||
id = found[0];
|
||||
|
|
@ -5568,7 +5574,7 @@ namespace TShockAPI
|
|||
}
|
||||
else if (found.Count > 1)
|
||||
{
|
||||
TShock.Utils.SendMultipleMatchError(args.Player, found.Select(b => Main.buffName[b]));
|
||||
TShock.Utils.SendMultipleMatchError(args.Player, found.Select(b => Lang.GetBuffName(b)));
|
||||
return;
|
||||
}
|
||||
id = found[0];
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ using System.Collections.Generic;
|
|||
using System.Data;
|
||||
using System.Linq;
|
||||
using MySql.Data.MySqlClient;
|
||||
using TShockAPI.Hooks;
|
||||
|
||||
namespace TShockAPI.DB
|
||||
{
|
||||
|
|
@ -65,7 +66,7 @@ namespace TShockAPI.DB
|
|||
try
|
||||
{
|
||||
database.Query("INSERT INTO ItemBans (ItemName, AllowedGroups) VALUES (@0, @1);",
|
||||
TShock.Utils.GetItemByName(itemname)[0].name, "");
|
||||
itemname, "");
|
||||
if (!ItemIsBanned(itemname, null))
|
||||
ItemBans.Add(new ItemBan(itemname));
|
||||
}
|
||||
|
|
@ -81,7 +82,7 @@ namespace TShockAPI.DB
|
|||
return;
|
||||
try
|
||||
{
|
||||
database.Query("DELETE FROM ItemBans WHERE ItemName=@0;", TShock.Utils.GetItemByName(itemname)[0].name);
|
||||
database.Query("DELETE FROM ItemBans WHERE ItemName=@0;", itemname);
|
||||
ItemBans.Remove(new ItemBan(itemname));
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
@ -200,6 +201,9 @@ namespace TShockAPI.DB
|
|||
if (ply.HasPermission(Permissions.usebanneditem))
|
||||
return true;
|
||||
|
||||
if (PlayerHooks.OnPlayerItembanPermission(ply, this))
|
||||
return true;
|
||||
|
||||
var cur = ply.Group;
|
||||
var traversed = new List<Group>();
|
||||
while (cur != null)
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ using System.Collections.Generic;
|
|||
using System.Data;
|
||||
using System.Linq;
|
||||
using MySql.Data.MySqlClient;
|
||||
using TShockAPI.Hooks;
|
||||
|
||||
namespace TShockAPI.DB
|
||||
{
|
||||
|
|
@ -205,6 +206,9 @@ namespace TShockAPI.DB
|
|||
if (ply.HasPermission(Permissions.canusebannedprojectiles))
|
||||
return true;
|
||||
|
||||
if (PlayerHooks.OnPlayerProjbanPermission(ply, this))
|
||||
return true;
|
||||
|
||||
var cur = ply.Group;
|
||||
var traversed = new List<Group>();
|
||||
while (cur != null)
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ using System.Collections.Generic;
|
|||
using System.Data;
|
||||
using System.Linq;
|
||||
using MySql.Data.MySqlClient;
|
||||
using TShockAPI.Hooks;
|
||||
|
||||
namespace TShockAPI.DB
|
||||
{
|
||||
|
|
@ -205,6 +206,9 @@ namespace TShockAPI.DB
|
|||
if (ply.HasPermission(Permissions.canusebannedtiles))
|
||||
return true;
|
||||
|
||||
if (PlayerHooks.OnPlayerTilebanPermission(ply, this))
|
||||
return true;
|
||||
|
||||
var cur = ply.Group;
|
||||
var traversed = new List<Group>();
|
||||
while (cur != null)
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ namespace TShockAPI.DB
|
|||
/// <param name="x">The X position.</param>
|
||||
/// <param name="y">The Y position.</param>
|
||||
/// <param name="name">The name.</param>
|
||||
/// <returns>Whether the opration succeeded.</returns>
|
||||
/// <returns>Whether the operation succeeded.</returns>
|
||||
public bool Add(int x, int y, string name)
|
||||
{
|
||||
try
|
||||
|
|
|
|||
|
|
@ -32,8 +32,10 @@ using Terraria;
|
|||
using Terraria.ObjectData;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.GameContent.Tile_Entities;
|
||||
using Terraria.Localization;
|
||||
using Microsoft.Xna.Framework;
|
||||
using OTAPI.Tile;
|
||||
using TShockAPI.Localization;
|
||||
|
||||
namespace TShockAPI
|
||||
{
|
||||
|
|
@ -1494,7 +1496,7 @@ namespace TShockAPI
|
|||
args.Player.TPlayer.hideVisual[i] = hideVisual2[i];
|
||||
args.Player.TPlayer.hideMisc = hideMisc;
|
||||
args.Player.TPlayer.extraAccessory = extraSlot;
|
||||
NetMessage.SendData((int)PacketTypes.PlayerInfo, -1, args.Player.Index, args.Player.Name, args.Player.Index);
|
||||
NetMessage.SendData((int)PacketTypes.PlayerInfo, -1, args.Player.Index, NetworkText.FromLiteral(args.Player.Name), args.Player.Index);
|
||||
return true;
|
||||
}
|
||||
if (TShock.Config.MediumcoreOnly && difficulty < 1)
|
||||
|
|
@ -1678,7 +1680,7 @@ namespace TShockAPI
|
|||
return true;
|
||||
}
|
||||
|
||||
NetMessage.SendData((int)PacketTypes.TimeSet, -1, -1, "", Main.dayTime ? 1 : 0, (int)Main.time, Main.sunModY, Main.moonModY);
|
||||
NetMessage.SendData((int)PacketTypes.TimeSet, -1, -1, NetworkText.Empty, Main.dayTime ? 1 : 0, (int)Main.time, Main.sunModY, Main.moonModY);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1907,7 +1909,10 @@ namespace TShockAPI
|
|||
KillWire2,
|
||||
PlaceWire3,
|
||||
KillWire3,
|
||||
SlopeTile
|
||||
SlopeTile,
|
||||
FrameTrack,
|
||||
PlaceWire4,
|
||||
KillWire4
|
||||
}
|
||||
public enum EditType
|
||||
{
|
||||
|
|
@ -2149,7 +2154,7 @@ namespace TShockAPI
|
|||
args.Player.SendErrorMessage("You do not have permission to place actuators.");
|
||||
return true;
|
||||
}
|
||||
if (TShock.Itembans.ItemIsBanned(selectedItem.name, args.Player) || editData >= (action == EditAction.PlaceTile ? Main.maxTileSets : Main.maxWallTypes))
|
||||
if (TShock.Itembans.ItemIsBanned(EnglishLanguage.GetItemNameById(selectedItem.netID), args.Player) || editData >= (action == EditAction.PlaceTile ? Main.maxTileSets : Main.maxWallTypes))
|
||||
{
|
||||
args.Player.SendTileSquare(tileX, tileY, 4);
|
||||
return true;
|
||||
|
|
@ -2160,7 +2165,7 @@ namespace TShockAPI
|
|||
args.Player.SendTileSquare(tileX, tileY, 3);
|
||||
return true;
|
||||
}
|
||||
if (action == EditAction.PlaceTile && editData == TileID.Containers)
|
||||
if (action == EditAction.PlaceTile && (editData == TileID.Containers || editData == TileID.Containers2))
|
||||
{
|
||||
if (TShock.Utils.MaxChests())
|
||||
{
|
||||
|
|
@ -2608,27 +2613,27 @@ namespace TShockAPI
|
|||
|
||||
if (control[5])
|
||||
{
|
||||
string itemName = args.TPlayer.inventory[item].name;
|
||||
if (TShock.Itembans.ItemIsBanned(itemName, args.Player))
|
||||
string itemName = args.TPlayer.inventory[item].Name;
|
||||
if (TShock.Itembans.ItemIsBanned(EnglishLanguage.GetItemNameById(args.TPlayer.inventory[item].netID), args.Player))
|
||||
{
|
||||
control[5] = false;
|
||||
args.Player.Disable("using a banned item ({0})".SFormat(itemName), DisableFlags.WriteToLogAndConsole);
|
||||
args.Player.SendErrorMessage("You cannot use {0} on this server. Your actions are being ignored.", itemName);
|
||||
}
|
||||
|
||||
if (args.TPlayer.inventory[item].name == "Mana Crystal" && args.Player.TPlayer.statManaMax <= 180)
|
||||
if (args.TPlayer.inventory[item].Name == "Mana Crystal" && args.Player.TPlayer.statManaMax <= 180)
|
||||
{
|
||||
args.Player.TPlayer.statMana += 20;
|
||||
args.Player.TPlayer.statManaMax += 20;
|
||||
args.Player.PlayerData.maxMana += 20;
|
||||
}
|
||||
else if (args.TPlayer.inventory[item].name == "Life Crystal" && args.Player.TPlayer.statLifeMax <= 380)
|
||||
else if (args.TPlayer.inventory[item].Name == "Life Crystal" && args.Player.TPlayer.statLifeMax <= 380)
|
||||
{
|
||||
args.TPlayer.statLife += 20;
|
||||
args.TPlayer.statLifeMax += 20;
|
||||
args.Player.PlayerData.maxHealth += 20;
|
||||
}
|
||||
else if (args.TPlayer.inventory[item].name == "Life Fruit" && args.Player.TPlayer.statLifeMax >= 400 && args.Player.TPlayer.statLifeMax <= 495)
|
||||
else if (args.TPlayer.inventory[item].Name == "Life Fruit" && args.Player.TPlayer.statLifeMax >= 400 && args.Player.TPlayer.statLifeMax <= 495)
|
||||
{
|
||||
args.TPlayer.statLife += 5;
|
||||
args.TPlayer.statLifeMax += 5;
|
||||
|
|
@ -2719,13 +2724,11 @@ namespace TShockAPI
|
|||
|
||||
|
||||
args.TPlayer.Update(args.TPlayer.whoAmI);
|
||||
NetMessage.SendData((int)PacketTypes.PlayerUpdate, -1, -1, "", args.Player.Index);
|
||||
NetMessage.SendData((int)PacketTypes.PlayerUpdate, -1, -1, NetworkText.Empty, args.Player.Index);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NetMessage.SendData((int)PacketTypes.PlayerUpdate, -1, args.Player.Index, "", args.Player.Index);
|
||||
NetMessage.SendData((int)PacketTypes.PlayerUpdate, -1, args.Player.Index, NetworkText.Empty, args.Player.Index);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -2981,7 +2984,7 @@ namespace TShockAPI
|
|||
if (OnKillMe(id, direction, dmg, pvp))
|
||||
return true;
|
||||
|
||||
if (playerDeathReason.GetDeathText().Length > 500)
|
||||
if (playerDeathReason.GetDeathText(TShock.Players[id].Name).ToString().Length > 500)
|
||||
{
|
||||
TShock.Utils.Kick(TShock.Players[id], "Crash attempt", true);
|
||||
return true;
|
||||
|
|
@ -3167,9 +3170,10 @@ namespace TShockAPI
|
|||
return true;
|
||||
}
|
||||
|
||||
if (flag != 0
|
||||
if (flag != 0 && flag != 4 // if no container or container2 placement
|
||||
&& Main.tile[tileX, tileY].type != TileID.Containers
|
||||
&& Main.tile[tileX, tileY].type != TileID.Dressers
|
||||
&& Main.tile[tileX, tileY].type != TileID.Containers2
|
||||
&& (!TShock.Utils.MaxChests() && Main.tile[tileX, tileY].type != TileID.Dirt)) //Chest
|
||||
{
|
||||
args.Player.SendTileSquare(tileX, tileY, 3);
|
||||
|
|
@ -3330,7 +3334,7 @@ namespace TShockAPI
|
|||
|
||||
Item item = new Item();
|
||||
item.netDefaults(type);
|
||||
if (stacks > item.maxStack || TShock.Itembans.ItemIsBanned(item.name, args.Player))
|
||||
if (stacks > item.maxStack || TShock.Itembans.ItemIsBanned(EnglishLanguage.GetItemNameById(item.type), args.Player))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -3478,7 +3482,7 @@ namespace TShockAPI
|
|||
return true;
|
||||
}
|
||||
|
||||
if (prefix > Item.maxPrefixes) //make sure the prefix is a legit value
|
||||
if (prefix > PrefixID.Count) //make sure the prefix is a legit value
|
||||
{
|
||||
args.Player.SendData(PacketTypes.ItemDrop, "", id);
|
||||
return true;
|
||||
|
|
@ -3510,7 +3514,7 @@ namespace TShockAPI
|
|||
|
||||
Item item = new Item();
|
||||
item.netDefaults(type);
|
||||
if ((stacks > item.maxStack || stacks <= 0) || (TShock.Itembans.ItemIsBanned(item.name, args.Player) && !args.Player.HasPermission(Permissions.allowdroppingbanneditems)))
|
||||
if ((stacks > item.maxStack || stacks <= 0) || (TShock.Itembans.ItemIsBanned(EnglishLanguage.GetItemNameById(item.type), args.Player) && !args.Player.HasPermission(Permissions.allowdroppingbanneditems)))
|
||||
{
|
||||
args.Player.SendData(PacketTypes.ItemDrop, "", id);
|
||||
return true;
|
||||
|
|
@ -3518,7 +3522,7 @@ namespace TShockAPI
|
|||
if ((Main.ServerSideCharacter) && (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond - args.Player.LoginMS < TShock.ServerSideCharacterConfig.LogonDiscardThreshold))
|
||||
{
|
||||
//Player is probably trying to sneak items onto the server in their hands!!!
|
||||
TShock.Log.ConsoleInfo("Player {0} tried to sneak {1} onto the server!", args.Player.Name, item.name);
|
||||
TShock.Log.ConsoleInfo("Player {0} tried to sneak {1} onto the server!", args.Player.Name, item.Name);
|
||||
args.Player.SendData(PacketTypes.ItemDrop, "", id);
|
||||
return true;
|
||||
|
||||
|
|
@ -3830,7 +3834,7 @@ namespace TShockAPI
|
|||
}
|
||||
|
||||
|
||||
NetMessage.SendData((int)PacketTypes.PlayerBuff, -1, args.Player.Index, "", args.Player.Index);
|
||||
NetMessage.SendData((int)PacketTypes.PlayerBuff, -1, args.Player.Index, NetworkText.Empty, args.Player.Index);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -3932,7 +3936,7 @@ namespace TShockAPI
|
|||
boss = "a Goblin Invasion";
|
||||
break;
|
||||
default:
|
||||
boss = String.Format("the {0}", npc.name);
|
||||
boss = String.Format("the {0}", npc.FullName);
|
||||
break;
|
||||
}
|
||||
if (TShock.Config.AnonymousBossInvasions)
|
||||
|
|
@ -4259,7 +4263,7 @@ namespace TShockAPI
|
|||
if (Main.npc[npcID]?.catchItem == 0)
|
||||
{
|
||||
Main.npc[npcID].active = true;
|
||||
NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, "", npcID);
|
||||
NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, NetworkText.Empty, npcID);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -4276,13 +4280,13 @@ namespace TShockAPI
|
|||
|
||||
if (projectile == null || !projectile.active)
|
||||
{
|
||||
NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, "", npcIndex);
|
||||
NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, NetworkText.Empty, npcIndex);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (projectile.type != ProjectileID.PortalGunGate)
|
||||
{
|
||||
NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, "", npcIndex);
|
||||
NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, NetworkText.Empty, npcIndex);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -4347,25 +4351,25 @@ namespace TShockAPI
|
|||
|
||||
if (TShock.CheckIgnores(args.Player))
|
||||
{
|
||||
NetMessage.SendData((int)PacketTypes.UpdateTileEntity, -1, -1, "", itemFrame.ID, 0, 1);
|
||||
NetMessage.SendData((int)PacketTypes.UpdateTileEntity, -1, -1, NetworkText.Empty, itemFrame.ID, 0, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (TShock.CheckTilePermission(args.Player, x, y))
|
||||
{
|
||||
NetMessage.SendData((int)PacketTypes.UpdateTileEntity, -1, -1, "", itemFrame.ID, 0, 1);
|
||||
NetMessage.SendData((int)PacketTypes.UpdateTileEntity, -1, -1, NetworkText.Empty, itemFrame.ID, 0, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (TShock.CheckRangePermission(args.Player, x, y))
|
||||
{
|
||||
NetMessage.SendData((int)PacketTypes.UpdateTileEntity, -1, -1, "", itemFrame.ID, 0, 1);
|
||||
NetMessage.SendData((int)PacketTypes.UpdateTileEntity, -1, -1, NetworkText.Empty, itemFrame.ID, 0, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (itemFrame.item?.netID == args.TPlayer.inventory[args.TPlayer.selectedItem]?.netID)
|
||||
{
|
||||
NetMessage.SendData((int)PacketTypes.UpdateTileEntity, -1, -1, "", itemFrame.ID, 0, 1);
|
||||
NetMessage.SendData((int)PacketTypes.UpdateTileEntity, -1, -1, NetworkText.Empty, itemFrame.ID, 0, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -4419,7 +4423,7 @@ namespace TShockAPI
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (!args.Player.HasPermission(Permissions.startdd2))
|
||||
{
|
||||
args.Player.SendErrorMessage("You don't have permission to start the Old One's Army event.");
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using TShockAPI.DB;
|
||||
|
||||
namespace TShockAPI.Hooks
|
||||
{
|
||||
|
|
@ -166,6 +167,87 @@ namespace TShockAPI.Hooks
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// EventArgs used for the <see cref="PlayerHooks.PlayerItembanPermission"/> event.
|
||||
/// </summary>
|
||||
public class PlayerItembanPermissionEventArgs : HandledEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// The player who fired the event.
|
||||
/// </summary>
|
||||
public TSPlayer Player { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The banned item being checked.
|
||||
/// </summary>
|
||||
public ItemBan BannedItem { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the PlayerItembanPermissionEventArgs class.
|
||||
/// </summary>
|
||||
/// <param name="player">The player who fired the event.</param>
|
||||
/// <param name="permission">The permission being checked.</param>
|
||||
public PlayerItembanPermissionEventArgs(TSPlayer player, ItemBan bannedItem)
|
||||
{
|
||||
Player = player;
|
||||
BannedItem = bannedItem;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// EventArgs used for the <see cref="PlayerHooks.PlayerProjbanPermission"/> event.
|
||||
/// </summary>
|
||||
public class PlayerProjbanPermissionEventArgs : HandledEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// The player who fired the event.
|
||||
/// </summary>
|
||||
public TSPlayer Player { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The banned projectile being checked.
|
||||
/// </summary>
|
||||
public ProjectileBan BannedProjectile { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the PlayerProjbanPermissionEventArgs class.
|
||||
/// </summary>
|
||||
/// <param name="player">The player who fired the event.</param>
|
||||
/// <param name="checkedProjectile">The banned projectile being checked.</param>
|
||||
public PlayerProjbanPermissionEventArgs(TSPlayer player, ProjectileBan checkedProjectile)
|
||||
{
|
||||
Player = player;
|
||||
BannedProjectile = checkedProjectile;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// EventArgs used for the <see cref="PlayerHooks.PlayerTilebanPermission"/> event.
|
||||
/// </summary>
|
||||
public class PlayerTilebanPermissionEventArgs : HandledEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// The player who fired the event.
|
||||
/// </summary>
|
||||
public TSPlayer Player { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The banned tile being checked.
|
||||
/// </summary>
|
||||
public TileBan BannedTile { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the PlayerTilebanPermissionEventArgs class.
|
||||
/// </summary>
|
||||
/// <param name="player">The player who fired the event.</param>
|
||||
/// <param name="checkedTile">The banned tile being checked.</param>
|
||||
public PlayerTilebanPermissionEventArgs(TSPlayer player, TileBan checkedTile)
|
||||
{
|
||||
Player = player;
|
||||
BannedTile = checkedTile;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A collection of events fired by players that can be hooked to.
|
||||
/// </summary>
|
||||
|
|
@ -232,6 +314,37 @@ namespace TShockAPI.Hooks
|
|||
/// </summary>
|
||||
public static event PlayerPermissionD PlayerPermission;
|
||||
|
||||
/// <summary>
|
||||
/// The delegate of the <see cref="PlayerItembanPermission"/> event.
|
||||
/// </summary>
|
||||
/// <param name="e">The EventArgs for this event.</param>
|
||||
public delegate void PlayerItembanPermissionD(PlayerItembanPermissionEventArgs e);
|
||||
/// <summary>
|
||||
/// Fired by players every time a permission check on banned items involving them occurs.
|
||||
/// </summary>
|
||||
public static event PlayerItembanPermissionD PlayerItembanPermission;
|
||||
|
||||
/// <summary>
|
||||
/// The delegate of the <see cref="PlayerProjbanPermission"/> event.
|
||||
/// </summary>
|
||||
/// <param name="e">The EventArgs for this event.</param>
|
||||
public delegate void PlayerProjbanPermissionD(PlayerProjbanPermissionEventArgs e);
|
||||
/// <summary>
|
||||
/// Fired by players every time a permission check on banned projectiles involving them occurs.
|
||||
/// </summary>
|
||||
public static event PlayerProjbanPermissionD PlayerProjbanPermission;
|
||||
|
||||
/// <summary>
|
||||
/// The delegate of the <see cref="PlayerTilebanPermission"/> event.
|
||||
/// </summary>
|
||||
/// <param name="e">The EventArgs for this event.</param>
|
||||
public delegate void PlayerTilebanPermissionD(PlayerTilebanPermissionEventArgs e);
|
||||
/// <summary>
|
||||
/// Fired by players every time a permission check on banned tiles involving them occurs.
|
||||
/// </summary>
|
||||
public static event PlayerTilebanPermissionD PlayerTilebanPermission;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Fires the <see cref="PlayerPostLogin"/> event.
|
||||
/// </summary>
|
||||
|
|
@ -336,5 +449,50 @@ namespace TShockAPI.Hooks
|
|||
PlayerPermission(args);
|
||||
return args.Handled;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fires the <see cref="PlayerItembanPermission"/> event.
|
||||
/// </summary>
|
||||
/// <param name="player">The player firing the event.</param>
|
||||
/// <returns>True if the event has been handled.</returns>
|
||||
public static bool OnPlayerItembanPermission(TSPlayer player, ItemBan bannedItem)
|
||||
{
|
||||
if (PlayerItembanPermission == null)
|
||||
return false;
|
||||
|
||||
var args = new PlayerItembanPermissionEventArgs(player, bannedItem);
|
||||
PlayerItembanPermission(args);
|
||||
return args.Handled;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fires the <see cref="PlayerProjbanPermission"/> event.
|
||||
/// </summary>
|
||||
/// <param name="player">The player firing the event.</param>
|
||||
/// <returns>True if the event has been handled.</returns>
|
||||
public static bool OnPlayerProjbanPermission(TSPlayer player, ProjectileBan bannedProj)
|
||||
{
|
||||
if (PlayerProjbanPermission == null)
|
||||
return false;
|
||||
|
||||
var args = new PlayerProjbanPermissionEventArgs(player, bannedProj);
|
||||
PlayerProjbanPermission(args);
|
||||
return args.Handled;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fires the <see cref="PlayerTilebanPermission"/> event.
|
||||
/// </summary>
|
||||
/// <param name="player">The player firing the event.</param>
|
||||
/// <returns>True if the event has been handled.</returns>
|
||||
public static bool OnPlayerTilebanPermission(TSPlayer player, TileBan bannedTile)
|
||||
{
|
||||
if (PlayerTilebanPermission == null)
|
||||
return false;
|
||||
|
||||
var args = new PlayerTilebanPermissionEventArgs(player, bannedTile);
|
||||
PlayerTilebanPermission(args);
|
||||
return args.Handled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
100
TShockAPI/Localization/EnglishLanguage.cs
Normal file
100
TShockAPI/Localization/EnglishLanguage.cs
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Terraria;
|
||||
using Terraria.Localization;
|
||||
|
||||
namespace TShockAPI.Localization
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides a series of methods that give English texts
|
||||
/// </summary>
|
||||
public static class EnglishLanguage
|
||||
{
|
||||
private static readonly Dictionary<int, string> ItemNames = new Dictionary<int, string>();
|
||||
|
||||
private static readonly Dictionary<int, string> NpcNames = new Dictionary<int, string>();
|
||||
|
||||
private static readonly Dictionary<int, string> Prefixs = new Dictionary<int, string>();
|
||||
|
||||
internal static void Initialize()
|
||||
{
|
||||
var culture = Language.ActiveCulture;
|
||||
|
||||
var skip = culture == GameCulture.English;
|
||||
|
||||
try
|
||||
{
|
||||
if (!skip)
|
||||
{
|
||||
LanguageManager.Instance.SetLanguage(GameCulture.English);
|
||||
}
|
||||
|
||||
for (var i = -48; i < Main.maxItemTypes; i++)
|
||||
{
|
||||
ItemNames.Add(i, Lang.GetItemNameValue(i));
|
||||
}
|
||||
|
||||
for (var i = -17; i < Main.maxNPCTypes; i++)
|
||||
{
|
||||
NpcNames.Add(i, Lang.GetNPCNameValue(i));
|
||||
}
|
||||
|
||||
foreach (var field in typeof(Main).Assembly.GetType("Terraria.ID.PrefixID")
|
||||
.GetFields().Where(f => !f.Name.Equals("Count", StringComparison.Ordinal)))
|
||||
{
|
||||
Prefixs.Add((int) field.GetValue(null), field.Name);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (!skip)
|
||||
{
|
||||
LanguageManager.Instance.SetLanguage(culture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the english name of an item
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the item</param>
|
||||
/// <returns>Item name in English</returns>
|
||||
public static string GetItemNameById(int id)
|
||||
{
|
||||
string itemName;
|
||||
if (ItemNames.TryGetValue(id, out itemName))
|
||||
return itemName;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the english name of a npc
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the npc</param>
|
||||
/// <returns>Npc name in English</returns>
|
||||
public static string GetNpcNameById(int id)
|
||||
{
|
||||
string npcName;
|
||||
if (NpcNames.TryGetValue(id, out npcName))
|
||||
return npcName;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get prefix in English
|
||||
/// </summary>
|
||||
/// <param name="id">Prefix Id</param>
|
||||
/// <returns>Prefix in English</returns>
|
||||
public static string GetPrefixById(int id)
|
||||
{
|
||||
string prefix;
|
||||
if (Prefixs.TryGetValue(id, out prefix))
|
||||
return prefix;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using TShockAPI;
|
||||
using Terraria.Localization;
|
||||
|
||||
namespace TShockAPI
|
||||
{
|
||||
|
|
@ -340,99 +341,99 @@ namespace TShockAPI
|
|||
float slot = 0f;
|
||||
for (int k = 0; k < NetItem.InventorySlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].inventory[k].name, player.Index, slot, (float)Main.player[player.Index].inventory[k].prefix);
|
||||
NetMessage.SendData(5, -1, -1, NetworkText.FromLiteral(Main.player[player.Index].inventory[k].Name), player.Index, slot, (float)Main.player[player.Index].inventory[k].prefix);
|
||||
slot++;
|
||||
}
|
||||
for (int k = 0; k < NetItem.ArmorSlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[k].name, player.Index, slot, (float)Main.player[player.Index].armor[k].prefix);
|
||||
NetMessage.SendData(5, -1, -1, NetworkText.FromLiteral(Main.player[player.Index].armor[k].Name), player.Index, slot, (float)Main.player[player.Index].armor[k].prefix);
|
||||
slot++;
|
||||
}
|
||||
for (int k = 0; k < NetItem.DyeSlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[k].name, player.Index, slot, (float)Main.player[player.Index].dye[k].prefix);
|
||||
NetMessage.SendData(5, -1, -1, NetworkText.FromLiteral(Main.player[player.Index].dye[k].Name), player.Index, slot, (float)Main.player[player.Index].dye[k].prefix);
|
||||
slot++;
|
||||
}
|
||||
for (int k = 0; k < NetItem.MiscEquipSlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].miscEquips[k].name, player.Index, slot, (float)Main.player[player.Index].miscEquips[k].prefix);
|
||||
NetMessage.SendData(5, -1, -1, NetworkText.FromLiteral(Main.player[player.Index].miscEquips[k].Name), player.Index, slot, (float)Main.player[player.Index].miscEquips[k].prefix);
|
||||
slot++;
|
||||
}
|
||||
for (int k = 0; k < NetItem.MiscDyeSlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].miscDyes[k].name, player.Index, slot, (float)Main.player[player.Index].miscDyes[k].prefix);
|
||||
NetMessage.SendData(5, -1, -1, NetworkText.FromLiteral(Main.player[player.Index].miscDyes[k].Name), player.Index, slot, (float)Main.player[player.Index].miscDyes[k].prefix);
|
||||
slot++;
|
||||
}
|
||||
for (int k = 0; k < NetItem.PiggySlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].bank.item[k].name, player.Index, slot, (float)Main.player[player.Index].bank.item[k].prefix);
|
||||
NetMessage.SendData(5, -1, -1, NetworkText.FromLiteral(Main.player[player.Index].bank.item[k].Name), player.Index, slot, (float)Main.player[player.Index].bank.item[k].prefix);
|
||||
slot++;
|
||||
}
|
||||
for (int k = 0; k < NetItem.SafeSlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].bank2.item[k].name, player.Index, slot, (float)Main.player[player.Index].bank2.item[k].prefix);
|
||||
NetMessage.SendData(5, -1, -1, NetworkText.FromLiteral(Main.player[player.Index].bank2.item[k].Name), player.Index, slot, (float)Main.player[player.Index].bank2.item[k].prefix);
|
||||
slot++;
|
||||
}
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].trashItem.name, player.Index, slot++, (float)Main.player[player.Index].trashItem.prefix);
|
||||
NetMessage.SendData(5, -1, -1, NetworkText.FromLiteral(Main.player[player.Index].trashItem.Name), player.Index, slot++, (float)Main.player[player.Index].trashItem.prefix);
|
||||
for (int k = 0; k < NetItem.ForgeSlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].bank3.item[k].name, player.Index, slot, (float)Main.player[player.Index].bank3.item[k].prefix);
|
||||
NetMessage.SendData(5, -1, -1, NetworkText.FromLiteral(Main.player[player.Index].bank3.item[k].Name), player.Index, slot, (float)Main.player[player.Index].bank3.item[k].prefix);
|
||||
slot++;
|
||||
}
|
||||
|
||||
|
||||
NetMessage.SendData(4, -1, -1, player.Name, player.Index, 0f, 0f, 0f, 0);
|
||||
NetMessage.SendData(42, -1, -1, "", player.Index, 0f, 0f, 0f, 0);
|
||||
NetMessage.SendData(16, -1, -1, "", player.Index, 0f, 0f, 0f, 0);
|
||||
NetMessage.SendData(4, -1, -1, NetworkText.FromLiteral(player.Name), player.Index, 0f, 0f, 0f, 0);
|
||||
NetMessage.SendData(42, -1, -1, NetworkText.Empty, player.Index, 0f, 0f, 0f, 0);
|
||||
NetMessage.SendData(16, -1, -1, NetworkText.Empty, player.Index, 0f, 0f, 0f, 0);
|
||||
|
||||
slot = 0f;
|
||||
for (int k = 0; k < NetItem.InventorySlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].inventory[k].name, player.Index, slot, (float)Main.player[player.Index].inventory[k].prefix);
|
||||
NetMessage.SendData(5, player.Index, -1, NetworkText.FromLiteral(Main.player[player.Index].inventory[k].Name), player.Index, slot, (float)Main.player[player.Index].inventory[k].prefix);
|
||||
slot++;
|
||||
}
|
||||
for (int k = 0; k < NetItem.ArmorSlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[k].name, player.Index, slot, (float)Main.player[player.Index].armor[k].prefix);
|
||||
NetMessage.SendData(5, player.Index, -1, NetworkText.FromLiteral(Main.player[player.Index].armor[k].Name), player.Index, slot, (float)Main.player[player.Index].armor[k].prefix);
|
||||
slot++;
|
||||
}
|
||||
for (int k = 0; k < NetItem.DyeSlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[k].name, player.Index, slot, (float)Main.player[player.Index].dye[k].prefix);
|
||||
NetMessage.SendData(5, player.Index, -1, NetworkText.FromLiteral(Main.player[player.Index].dye[k].Name), player.Index, slot, (float)Main.player[player.Index].dye[k].prefix);
|
||||
slot++;
|
||||
}
|
||||
for (int k = 0; k < NetItem.MiscEquipSlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].miscEquips[k].name, player.Index, slot, (float)Main.player[player.Index].miscEquips[k].prefix);
|
||||
NetMessage.SendData(5, player.Index, -1, NetworkText.FromLiteral(Main.player[player.Index].miscEquips[k].Name), player.Index, slot, (float)Main.player[player.Index].miscEquips[k].prefix);
|
||||
slot++;
|
||||
}
|
||||
for (int k = 0; k < NetItem.MiscDyeSlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].miscDyes[k].name, player.Index, slot, (float)Main.player[player.Index].miscDyes[k].prefix);
|
||||
NetMessage.SendData(5, player.Index, -1, NetworkText.FromLiteral(Main.player[player.Index].miscDyes[k].Name), player.Index, slot, (float)Main.player[player.Index].miscDyes[k].prefix);
|
||||
slot++;
|
||||
}
|
||||
for (int k = 0; k < NetItem.PiggySlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].bank.item[k].name, player.Index, slot, (float)Main.player[player.Index].bank.item[k].prefix);
|
||||
NetMessage.SendData(5, player.Index, -1, NetworkText.FromLiteral(Main.player[player.Index].bank.item[k].Name), player.Index, slot, (float)Main.player[player.Index].bank.item[k].prefix);
|
||||
slot++;
|
||||
}
|
||||
for (int k = 0; k < NetItem.SafeSlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].bank2.item[k].name, player.Index, slot, (float)Main.player[player.Index].bank2.item[k].prefix);
|
||||
NetMessage.SendData(5, player.Index, -1, NetworkText.FromLiteral(Main.player[player.Index].bank2.item[k].Name), player.Index, slot, (float)Main.player[player.Index].bank2.item[k].prefix);
|
||||
slot++;
|
||||
}
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].trashItem.name, player.Index, slot++, (float)Main.player[player.Index].trashItem.prefix);
|
||||
NetMessage.SendData(5, player.Index, -1, NetworkText.FromLiteral(Main.player[player.Index].trashItem.Name), player.Index, slot++, (float)Main.player[player.Index].trashItem.prefix);
|
||||
for (int k = 0; k < NetItem.ForgeSlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].bank3.item[k].name, player.Index, slot, (float)Main.player[player.Index].bank3.item[k].prefix);
|
||||
NetMessage.SendData(5, player.Index, -1, NetworkText.FromLiteral(Main.player[player.Index].bank3.item[k].Name), player.Index, slot, (float)Main.player[player.Index].bank3.item[k].prefix);
|
||||
slot++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NetMessage.SendData(4, player.Index, -1, player.Name, player.Index, 0f, 0f, 0f, 0);
|
||||
NetMessage.SendData(42, player.Index, -1, "", player.Index, 0f, 0f, 0f, 0);
|
||||
NetMessage.SendData(16, player.Index, -1, "", player.Index, 0f, 0f, 0f, 0);
|
||||
NetMessage.SendData(4, player.Index, -1, NetworkText.FromLiteral(player.Name), player.Index, 0f, 0f, 0f, 0);
|
||||
NetMessage.SendData(42, player.Index, -1, NetworkText.Empty, player.Index, 0f, 0f, 0f, 0);
|
||||
NetMessage.SendData(16, player.Index, -1, NetworkText.Empty, player.Index, 0f, 0f, 0f, 0);
|
||||
|
||||
for (int k = 0; k < 22; k++)
|
||||
{
|
||||
|
|
@ -445,13 +446,13 @@ namespace TShockAPI
|
|||
* This is for when players login via uuid or serverpassword instead of via
|
||||
* the login command.
|
||||
*/
|
||||
NetMessage.SendData(50, -1, -1, "", player.Index, 0f, 0f, 0f, 0);
|
||||
NetMessage.SendData(50, player.Index, -1, "", player.Index, 0f, 0f, 0f, 0);
|
||||
NetMessage.SendData(50, -1, -1, NetworkText.Empty, player.Index, 0f, 0f, 0f, 0);
|
||||
NetMessage.SendData(50, player.Index, -1, NetworkText.Empty, player.Index, 0f, 0f, 0f, 0);
|
||||
|
||||
NetMessage.SendData(76, player.Index, -1, "", player.Index);
|
||||
NetMessage.SendData(76, -1, -1, "", player.Index);
|
||||
NetMessage.SendData(76, player.Index, -1, NetworkText.Empty, player.Index);
|
||||
NetMessage.SendData(76, -1, -1, NetworkText.Empty, player.Index);
|
||||
|
||||
NetMessage.SendData(39, player.Index, -1, "", 400);
|
||||
NetMessage.SendData(39, player.Index, -1, NetworkText.Empty, 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,5 +53,5 @@ using System.Runtime.InteropServices;
|
|||
// Also, be sure to release on github with the exact assembly version tag as below
|
||||
// so that the update manager works correctly (via the Github releases api and mimic)
|
||||
|
||||
[assembly: AssemblyVersion("4.3.23")]
|
||||
[assembly: AssemblyFileVersion("4.3.23")]
|
||||
[assembly: AssemblyVersion("4.3.24")]
|
||||
[assembly: AssemblyFileVersion("4.3.24")]
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ using HttpServer;
|
|||
using Rests;
|
||||
using Terraria;
|
||||
using TShockAPI.DB;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace TShockAPI
|
||||
{
|
||||
|
|
@ -196,6 +197,7 @@ namespace TShockAPI
|
|||
}
|
||||
|
||||
Rest.RegisterRedirect("/status", "/v2/server/status");
|
||||
Rest.RegisterRedirect("/token/create", "/v2/token/create");
|
||||
|
||||
//server commands
|
||||
Rest.RegisterRedirect("/server/motd", "/v3/server/motd");
|
||||
|
|
@ -227,7 +229,7 @@ namespace TShockAPI
|
|||
//player commands
|
||||
Rest.RegisterRedirect("/lists/players", "/lists/players", "/v2/players/list");
|
||||
Rest.RegisterRedirect("/players/list", "/v2/players/list");
|
||||
Rest.RegisterRedirect("/players/read", "/v3/players/read");
|
||||
Rest.RegisterRedirect("/players/read", "/v3/players/read", "v4/players/read");
|
||||
Rest.RegisterRedirect("/players/kick", "/v2/players/kick");
|
||||
Rest.RegisterRedirect("/players/ban", "/v2/players/ban");
|
||||
Rest.RegisterRedirect("/players/kill", "/v2/players/kill");
|
||||
|
|
@ -277,6 +279,7 @@ namespace TShockAPI
|
|||
Rest.Register(new SecureRestCommand("/lists/players", PlayerList));
|
||||
Rest.Register(new SecureRestCommand("/v2/players/list", PlayerListV2));
|
||||
Rest.Register(new SecureRestCommand("/v3/players/read", PlayerReadV3, RestPermissions.restuserinfo));
|
||||
Rest.Register(new SecureRestCommand("/v4/players/read", PlayerReadV4, RestPermissions.restuserinfo));
|
||||
Rest.Register(new SecureRestCommand("/v2/players/kick", PlayerKickV2, RestPermissions.restkick));
|
||||
Rest.Register(new SecureRestCommand("/v2/players/ban", PlayerBanV2, RestPermissions.restban, RestPermissions.restmanagebans));
|
||||
Rest.Register(new SecureRestCommand("/v2/players/kill", PlayerKill, RestPermissions.restkill));
|
||||
|
|
@ -940,9 +943,48 @@ namespace TShockAPI
|
|||
{"registered", player.User?.Registered},
|
||||
{"muted", player.mute },
|
||||
{"position", player.TileX + "," + player.TileY},
|
||||
{"inventory", string.Join(", ", inventory.Select(p => (p.name + ":" + p.stack)))},
|
||||
{"inventory", string.Join(", ", inventory.Select(p => (p.Name + ":" + p.stack)))},
|
||||
{"armor", string.Join(", ", equipment.Select(p => (p.netID + ":" + p.prefix)))},
|
||||
{"dyes", string.Join(", ", dyes.Select(p => (p.name)))},
|
||||
{"dyes", string.Join(", ", dyes.Select(p => (p.Name)))},
|
||||
{"buffs", string.Join(", ", player.TPlayer.buffType)}
|
||||
};
|
||||
}
|
||||
|
||||
[Description("Get information for a user.")]
|
||||
[Route("/v4/players/read")]
|
||||
[Permission(RestPermissions.restuserinfo)]
|
||||
[Noun("player", true, "The player to lookup", typeof(String))]
|
||||
[Token]
|
||||
private object PlayerReadV4(RestRequestArgs args)
|
||||
{
|
||||
var ret = PlayerFind(args.Parameters);
|
||||
if (ret is RestObject)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
TSPlayer player = (TSPlayer)ret;
|
||||
|
||||
object items = new
|
||||
{
|
||||
inventory = player.TPlayer.inventory.Where(i => i.active).Select(item => (NetItem)item),
|
||||
equipment = player.TPlayer.armor.Where(i => i.active).Select(item => (NetItem)item),
|
||||
dyes = player.TPlayer.dye.Where(i => i.active).Select(item => (NetItem)item),
|
||||
piggy = player.TPlayer.bank.item.Where(i => i.active).Select(item => (NetItem)item),
|
||||
safe = player.TPlayer.bank2.item.Where(i => i.active).Select(item => (NetItem)item),
|
||||
forge = player.TPlayer.bank3.item.Where(i => i.active).Select(item => (NetItem)item)
|
||||
};
|
||||
|
||||
return new RestObject
|
||||
{
|
||||
{"nickname", player.Name},
|
||||
{"username", player.User?.Name},
|
||||
{"ip", player.IP},
|
||||
{"group", player.Group.Name},
|
||||
{"registered", player.User?.Registered},
|
||||
{"muted", player.mute },
|
||||
{"position", player.TileX + "," + player.TileY},
|
||||
{"items", items},
|
||||
{"buffs", string.Join(", ", player.TPlayer.buffType)}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ using OTAPI.Tile;
|
|||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using TShockAPI.DB;
|
||||
using TShockAPI.Hooks;
|
||||
using TShockAPI.Net;
|
||||
|
|
@ -565,7 +566,7 @@ namespace TShockAPI
|
|||
{
|
||||
for (int i = 0; i < 50; i++) //51 is trash can, 52-55 is coins, 56-59 is ammo
|
||||
{
|
||||
if (TPlayer.inventory[i] == null || !TPlayer.inventory[i].active || TPlayer.inventory[i].name == "")
|
||||
if (TPlayer.inventory[i] == null || !TPlayer.inventory[i].active || TPlayer.inventory[i].Name == "")
|
||||
{
|
||||
flag = true;
|
||||
break;
|
||||
|
|
@ -745,7 +746,7 @@ namespace TShockAPI
|
|||
|
||||
SendTileSquare((int) (x/16), (int) (y/16), 15);
|
||||
TPlayer.Teleport(new Vector2(x, y), style);
|
||||
NetMessage.SendData((int)PacketTypes.Teleport, -1, -1, "", 0, TPlayer.whoAmI, x, y, style);
|
||||
NetMessage.SendData((int)PacketTypes.Teleport, -1, -1, NetworkText.Empty, 0, TPlayer.whoAmI, x, y, style);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -755,7 +756,7 @@ namespace TShockAPI
|
|||
/// <param name="health">Heal health amount.</param>
|
||||
public void Heal(int health = 600)
|
||||
{
|
||||
NetMessage.SendData((int)PacketTypes.PlayerHealOther, -1, -1, "", this.TPlayer.whoAmI, health);
|
||||
NetMessage.SendData((int)PacketTypes.PlayerHealOther, -1, -1, NetworkText.Empty, this.TPlayer.whoAmI, health);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -878,7 +879,7 @@ namespace TShockAPI
|
|||
(TShock.Itembans.ItemIsBanned(name, this) || !TShock.Config.AllowAllowedGroupsToSpawnBannedItems))
|
||||
return false;
|
||||
|
||||
GiveItem(type,name,width,height,stack,prefix);
|
||||
GiveItem(type, name, width, height, stack, prefix);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -905,8 +906,8 @@ namespace TShockAPI
|
|||
Main.item[itemid].prefix = (byte) prefix;
|
||||
Main.item[itemid].noGrabDelay = 1;
|
||||
Main.item[itemid].velocity = Main.player[this.Index].velocity;
|
||||
NetMessage.SendData((int)PacketTypes.ItemDrop, -1, -1, "", itemid, 0f, 0f, 0f);
|
||||
NetMessage.SendData((int)PacketTypes.ItemOwner, -1, -1, "", itemid, 0f, 0f, 0f);
|
||||
NetMessage.SendData((int)PacketTypes.ItemDrop, -1, -1, NetworkText.Empty, itemid, 0f, 0f, 0f);
|
||||
NetMessage.SendData((int)PacketTypes.ItemOwner, -1, -1, NetworkText.Empty, itemid, 0f, 0f, 0f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -1066,8 +1067,8 @@ namespace TShockAPI
|
|||
public virtual void SetTeam(int team)
|
||||
{
|
||||
Main.player[Index].team = team;
|
||||
NetMessage.SendData((int)PacketTypes.PlayerTeam, -1, -1, "", Index);
|
||||
NetMessage.SendData((int)PacketTypes.PlayerTeam, -1, Index, "", Index);
|
||||
NetMessage.SendData((int)PacketTypes.PlayerTeam, -1, -1, NetworkText.Empty, Index);
|
||||
NetMessage.SendData((int)PacketTypes.PlayerTeam, -1, Index, NetworkText.Empty, Index);
|
||||
}
|
||||
|
||||
private DateTime LastDisableNotification = DateTime.UtcNow;
|
||||
|
|
@ -1185,7 +1186,7 @@ namespace TShockAPI
|
|||
if (RealPlayer && !ConnectionAlive)
|
||||
return;
|
||||
|
||||
NetMessage.SendData((int) msgType, Index, -1, text, number, number2, number3, number4, number5);
|
||||
NetMessage.SendData((int) msgType, Index, -1, NetworkText.FromLiteral(text), number, number2, number3, number4, number5);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -1204,7 +1205,7 @@ namespace TShockAPI
|
|||
if (RealPlayer && !ConnectionAlive)
|
||||
return;
|
||||
|
||||
NetMessage.SendData((int) msgType, Index, -1, text, ply, number2, number3, number4, number5);
|
||||
NetMessage.SendData((int) msgType, Index, -1, NetworkText.FromFormattable(text), ply, number2, number3, number4, number5);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -1252,6 +1253,38 @@ namespace TShockAPI
|
|||
else
|
||||
return Group.HasPermission(permission);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks to see if a player has permission to use the specific banned item.
|
||||
/// Fires the <see cref="PlayerHooks.OnPlayerItembanPermission"/> hook which may be handled to override item ban permission checks.
|
||||
/// </summary>
|
||||
/// <param name="bannedItem">The <see cref="ItemBan" /> to check.</param>
|
||||
/// <returns>True if the player has permission to use the banned item.</returns>
|
||||
public bool HasPermission(ItemBan bannedItem)
|
||||
{
|
||||
return TShock.Itembans.ItemIsBanned(bannedItem.Name, this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks to see if a player has permission to use the specific banned projectile.
|
||||
/// Fires the <see cref="PlayerHooks.OnPlayerProjbanPermission"/> hook which may be handled to override projectile ban permission checks.
|
||||
/// </summary>
|
||||
/// <param name="bannedProj">The <see cref="ProjectileBan" /> to check.</param>
|
||||
/// <returns>True if the player has permission to use the banned projectile.</returns>
|
||||
public bool HasPermission(ProjectileBan bannedProj)
|
||||
{
|
||||
return TShock.ProjectileBans.ProjectileIsBanned(bannedProj.ID, this);
|
||||
}
|
||||
/// <summary>
|
||||
/// Checks to see if a player has permission to use the specific banned tile.
|
||||
/// Fires the <see cref="PlayerHooks.OnPlayerTilebanPermission"/> hook which may be handled to override tile ban permission checks.
|
||||
/// </summary>
|
||||
/// <param name="bannedTile">The <see cref="TileBan" /> to check.</param>
|
||||
/// <returns>True if the player has permission to use the banned tile.</returns>
|
||||
public bool HasPermission(TileBan bannedTile)
|
||||
{
|
||||
return TShock.TileBans.TileIsBanned(bannedTile.ID, this);
|
||||
}
|
||||
}
|
||||
|
||||
public class TSRestPlayer : TSPlayer
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ using Terraria;
|
|||
using Terraria.Utilities;
|
||||
using TShockAPI;
|
||||
using TShockAPI.DB;
|
||||
using Terraria.Localization;
|
||||
|
||||
namespace TShockAPI
|
||||
{
|
||||
|
|
@ -151,16 +152,7 @@ namespace TShockAPI
|
|||
int spawnTileY;
|
||||
TShock.Utils.GetRandomClearTileWithInRange(startTileX, startTileY, tileXRange, tileYRange, out spawnTileX,
|
||||
out spawnTileY);
|
||||
int npcid = NPC.NewNPC(spawnTileX * 16, spawnTileY * 16, type, 0);
|
||||
// This is for special slimes
|
||||
if (type == 1)
|
||||
{
|
||||
Main.npc[npcid].SetDefaults(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
Main.npc[npcid].netDefaults(type);
|
||||
}
|
||||
NPC.NewNPC(spawnTileX * 16, spawnTileY * 16, type);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -171,7 +163,7 @@ namespace TShockAPI
|
|||
Main.rand = new UnifiedRandom();
|
||||
|
||||
Main.npc[npcid].StrikeNPC(damage, knockBack, hitDirection);
|
||||
NetMessage.SendData((int)PacketTypes.NpcStrike, -1, -1, "", npcid, damage, knockBack, hitDirection);
|
||||
NetMessage.SendData((int)PacketTypes.NpcStrike, -1, -1, NetworkText.Empty, npcid, damage, knockBack, hitDirection);
|
||||
}
|
||||
|
||||
public void RevertTiles(Dictionary<Vector2, ITile> tiles)
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ using Newtonsoft.Json;
|
|||
using Rests;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using TerrariaApi.Server;
|
||||
using TShockAPI.DB;
|
||||
using TShockAPI.Hooks;
|
||||
|
|
@ -42,6 +43,7 @@ using Terraria.Utilities;
|
|||
using Microsoft.Xna.Framework;
|
||||
using TShockAPI.Sockets;
|
||||
using TShockAPI.CLI;
|
||||
using TShockAPI.Localization;
|
||||
|
||||
namespace TShockAPI
|
||||
{
|
||||
|
|
@ -49,7 +51,7 @@ namespace TShockAPI
|
|||
/// This is the TShock main class. TShock is a plugin on the TerrariaServerAPI, so it extends the base TerrariaPlugin.
|
||||
/// TShock also complies with the API versioning system, and defines its required API version here.
|
||||
/// </summary>
|
||||
[ApiVersion(2, 0)]
|
||||
[ApiVersion(2, 1)]
|
||||
public class TShock : TerrariaPlugin
|
||||
{
|
||||
/// <summary>VersionNum - The version number the TerrariaAPI will return back to the API. We just use the Assembly info.</summary>
|
||||
|
|
@ -347,6 +349,7 @@ namespace TShockAPI
|
|||
ServerApi.Hooks.WorldHalloweenCheck.Register(this, OnHalloweenCheck);
|
||||
ServerApi.Hooks.NetNameCollision.Register(this, NetHooks_NameCollision);
|
||||
ServerApi.Hooks.ItemForceIntoChest.Register(this, OnItemForceIntoChest);
|
||||
ServerApi.Hooks.WorldGrassSpread.Register(this, OnWorldGrassSpread);
|
||||
Hooks.PlayerHooks.PlayerPreLogin += OnPlayerPreLogin;
|
||||
Hooks.PlayerHooks.PlayerPostLogin += OnPlayerLogin;
|
||||
Hooks.AccountHooks.AccountDelete += OnAccountDelete;
|
||||
|
|
@ -355,6 +358,8 @@ namespace TShockAPI
|
|||
GetDataHandlers.InitGetDataHandler();
|
||||
Commands.InitCommands();
|
||||
|
||||
EnglishLanguage.Initialize();
|
||||
|
||||
if (Config.RestApiEnabled)
|
||||
RestApi.Start();
|
||||
|
||||
|
|
@ -415,6 +420,7 @@ namespace TShockAPI
|
|||
ServerApi.Hooks.WorldHalloweenCheck.Deregister(this, OnHalloweenCheck);
|
||||
ServerApi.Hooks.NetNameCollision.Deregister(this, NetHooks_NameCollision);
|
||||
ServerApi.Hooks.ItemForceIntoChest.Deregister(this, OnItemForceIntoChest);
|
||||
ServerApi.Hooks.WorldGrassSpread.Deregister(this, OnWorldGrassSpread);
|
||||
TShockAPI.Hooks.PlayerHooks.PlayerPostLogin -= OnPlayerLogin;
|
||||
|
||||
if (File.Exists(Path.Combine(SavePath, "tshock.pid")))
|
||||
|
|
@ -619,7 +625,7 @@ namespace TShockAPI
|
|||
string path = null;
|
||||
|
||||
//Generic method for doing a path sanity check
|
||||
Action<string> pathChecker = (p) =>
|
||||
Action<string> pathChecker = (p) =>
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(p) && p.IndexOfAny(Path.GetInvalidPathChars()) == -1)
|
||||
{
|
||||
|
|
@ -708,20 +714,6 @@ namespace TShockAPI
|
|||
}
|
||||
})
|
||||
|
||||
.AddFlag("-lang", (l) =>
|
||||
{
|
||||
int lang;
|
||||
if (int.TryParse(l, out lang))
|
||||
{
|
||||
Lang.lang = lang;
|
||||
ServerApi.LogWriter.PluginWriteLine(this, string.Format("Language index set to {0}.", lang), TraceLevel.Verbose);
|
||||
}
|
||||
else
|
||||
{
|
||||
ServerApi.LogWriter.PluginWriteLine(this, "Invalid value given for command line argument \"-lang\".", TraceLevel.Warning);
|
||||
}
|
||||
})
|
||||
|
||||
.AddFlag("-autocreate", (size) =>
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(size))
|
||||
|
|
@ -740,7 +732,7 @@ namespace TShockAPI
|
|||
.AddFlag("--no-restart", () => NoRestart = true);
|
||||
|
||||
CliParser.ParseFromSource(parms);
|
||||
|
||||
|
||||
/*"-connperip": Todo - Requires an OTAPI modification
|
||||
{
|
||||
int limit;
|
||||
|
|
@ -1094,10 +1086,10 @@ namespace TShockAPI
|
|||
{
|
||||
player.Disable(flags: flags);
|
||||
}
|
||||
else if (Itembans.ItemIsBanned(player.TPlayer.inventory[player.TPlayer.selectedItem].name, player))
|
||||
else if (Itembans.ItemIsBanned(EnglishLanguage.GetItemNameById(player.TPlayer.inventory[player.TPlayer.selectedItem].netID), player))
|
||||
{
|
||||
player.Disable($"holding banned item: {player.TPlayer.inventory[player.TPlayer.selectedItem].name}", flags);
|
||||
player.SendErrorMessage($"You are holding a banned item: {player.TPlayer.inventory[player.TPlayer.selectedItem].name}");
|
||||
player.Disable($"holding banned item: {player.TPlayer.inventory[player.TPlayer.selectedItem].Name}", flags);
|
||||
player.SendErrorMessage($"You are holding a banned item: {player.TPlayer.inventory[player.TPlayer.selectedItem].Name}");
|
||||
}
|
||||
}
|
||||
else if (!Main.ServerSideCharacter || (Main.ServerSideCharacter && player.IsLoggedIn))
|
||||
|
|
@ -1108,7 +1100,7 @@ namespace TShockAPI
|
|||
if (!player.HasPermission(Permissions.ignorestackhackdetection) && (item.stack > item.maxStack || item.stack < 0) &&
|
||||
item.type != 0)
|
||||
{
|
||||
check = "Remove item " + item.name + " (" + item.stack + ") exceeds max stack of " + item.maxStack;
|
||||
check = "Remove item " + item.Name + " (" + item.stack + ") exceeds max stack of " + item.maxStack;
|
||||
player.SendErrorMessage(check);
|
||||
break;
|
||||
}
|
||||
|
|
@ -1118,12 +1110,12 @@ namespace TShockAPI
|
|||
// Please don't remove this for the time being; without it, players wearing banned equipment will only get debuffed once
|
||||
foreach (Item item in player.TPlayer.armor)
|
||||
{
|
||||
if (Itembans.ItemIsBanned(item.name, player))
|
||||
if (Itembans.ItemIsBanned(EnglishLanguage.GetItemNameById(item.type), player))
|
||||
{
|
||||
player.SetBuff(BuffID.Frozen, 330, true);
|
||||
player.SetBuff(BuffID.Stoned, 330, true);
|
||||
player.SetBuff(BuffID.Webbed, 330, true);
|
||||
check = "Remove armor/accessory " + item.name;
|
||||
check = "Remove armor/accessory " + item.Name;
|
||||
|
||||
player.SendErrorMessage("You are wearing banned equipment. {0}", check);
|
||||
break;
|
||||
|
|
@ -1131,12 +1123,12 @@ namespace TShockAPI
|
|||
}
|
||||
foreach (Item item in player.TPlayer.dye)
|
||||
{
|
||||
if (Itembans.ItemIsBanned(item.name, player))
|
||||
if (Itembans.ItemIsBanned(EnglishLanguage.GetItemNameById(item.type), player))
|
||||
{
|
||||
player.SetBuff(BuffID.Frozen, 330, true);
|
||||
player.SetBuff(BuffID.Stoned, 330, true);
|
||||
player.SetBuff(BuffID.Webbed, 330, true);
|
||||
check = "Remove dye " + item.name;
|
||||
check = "Remove dye " + item.Name;
|
||||
|
||||
player.SendErrorMessage("You are wearing banned equipment. {0}", check);
|
||||
break;
|
||||
|
|
@ -1144,12 +1136,12 @@ namespace TShockAPI
|
|||
}
|
||||
foreach (Item item in player.TPlayer.miscEquips)
|
||||
{
|
||||
if (Itembans.ItemIsBanned(item.name, player))
|
||||
if (Itembans.ItemIsBanned(EnglishLanguage.GetItemNameById(item.type), player))
|
||||
{
|
||||
player.SetBuff(BuffID.Frozen, 330, true);
|
||||
player.SetBuff(BuffID.Stoned, 330, true);
|
||||
player.SetBuff(BuffID.Webbed, 330, true);
|
||||
check = "Remove misc equip " + item.name;
|
||||
check = "Remove misc equip " + item.Name;
|
||||
|
||||
player.SendErrorMessage("You are wearing banned equipment. {0}", check);
|
||||
break;
|
||||
|
|
@ -1157,12 +1149,12 @@ namespace TShockAPI
|
|||
}
|
||||
foreach (Item item in player.TPlayer.miscDyes)
|
||||
{
|
||||
if (Itembans.ItemIsBanned(item.name, player))
|
||||
if (Itembans.ItemIsBanned(EnglishLanguage.GetItemNameById(item.type), player))
|
||||
{
|
||||
player.SetBuff(BuffID.Frozen, 330, true);
|
||||
player.SetBuff(BuffID.Stoned, 330, true);
|
||||
player.SetBuff(BuffID.Webbed, 330, true);
|
||||
check = "Remove misc dye " + item.name;
|
||||
check = "Remove misc dye " + item.Name;
|
||||
|
||||
player.SendErrorMessage("You are wearing banned equipment. {0}", check);
|
||||
break;
|
||||
|
|
@ -1174,10 +1166,10 @@ namespace TShockAPI
|
|||
{
|
||||
player.Disable(flags: flags);
|
||||
}
|
||||
else if (Itembans.ItemIsBanned(player.TPlayer.inventory[player.TPlayer.selectedItem].name, player))
|
||||
else if (Itembans.ItemIsBanned(EnglishLanguage.GetItemNameById(player.TPlayer.inventory[player.TPlayer.selectedItem].netID), player))
|
||||
{
|
||||
player.Disable($"holding banned item: {player.TPlayer.inventory[player.TPlayer.selectedItem].name}", flags);
|
||||
player.SendErrorMessage($"You are holding a banned item: {player.TPlayer.inventory[player.TPlayer.selectedItem].name}");
|
||||
player.Disable($"holding banned item: {player.TPlayer.inventory[player.TPlayer.selectedItem].Name}", flags);
|
||||
player.SendErrorMessage($"You are holding a banned item: {player.TPlayer.inventory[player.TPlayer.selectedItem].Name}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1218,24 +1210,50 @@ namespace TShockAPI
|
|||
if (args.Handled)
|
||||
return;
|
||||
|
||||
if (!Config.AllowCrimsonCreep && (args.Type == TileID.Dirt || args.Type == TileID.FleshWeeds
|
||||
|| TileID.Sets.Crimson[args.Type]))
|
||||
if (!OnCreep(args.Type))
|
||||
{
|
||||
args.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>OnWorldGrassSpread - Fired when grass is attempting to spread.</summary>
|
||||
/// <param name="args">args - The GrassSpreadEventArgs object.</param>
|
||||
private void OnWorldGrassSpread(GrassSpreadEventArgs args)
|
||||
{
|
||||
if (args.Handled)
|
||||
return;
|
||||
|
||||
if(!OnCreep(args.Grass))
|
||||
{
|
||||
args.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the tile type is allowed to creep
|
||||
/// </summary>
|
||||
/// <param name="tileType">Tile id</param>
|
||||
/// <returns>True if allowed, otherwise false</returns>
|
||||
private bool OnCreep(int tileType)
|
||||
{
|
||||
if (!Config.AllowCrimsonCreep && (tileType == TileID.Dirt || tileType == TileID.FleshWeeds
|
||||
|| TileID.Sets.Crimson[tileType]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Config.AllowCorruptionCreep && (args.Type == TileID.Dirt || args.Type == TileID.CorruptThorns
|
||||
|| TileID.Sets.Corrupt[args.Type]))
|
||||
if (!Config.AllowCorruptionCreep && (tileType == TileID.Dirt || tileType == TileID.CorruptThorns
|
||||
|| TileID.Sets.Corrupt[tileType]))
|
||||
{
|
||||
args.Handled = true;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Config.AllowHallowCreep && (TileID.Sets.Hallow[args.Type]))
|
||||
if (!Config.AllowHallowCreep && (TileID.Sets.Hallow[tileType]))
|
||||
{
|
||||
args.Handled = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>OnStatueSpawn - Fired when a statue spawns.</summary>
|
||||
|
|
@ -1258,7 +1276,7 @@ namespace TShockAPI
|
|||
{
|
||||
if (ShuttingDown)
|
||||
{
|
||||
NetMessage.SendData((int)PacketTypes.Disconnect, args.Who, -1, "Server is shutting down...");
|
||||
NetMessage.SendData((int)PacketTypes.Disconnect, args.Who, -1, NetworkText.FromLiteral("Server is shutting down..."));
|
||||
args.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
|
@ -1387,9 +1405,14 @@ namespace TShockAPI
|
|||
}
|
||||
|
||||
var tsplr = Players[args.Who];
|
||||
if (tsplr == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Players[args.Who] = null;
|
||||
|
||||
if (tsplr != null && tsplr.ReceivedInfo)
|
||||
if (tsplr.ReceivedInfo)
|
||||
{
|
||||
if (!tsplr.SilentKickInProgress && tsplr.State >= 3)
|
||||
Utils.Broadcast(tsplr.Name + " has left.", Color.Yellow);
|
||||
|
|
@ -1413,7 +1436,7 @@ namespace TShockAPI
|
|||
}
|
||||
|
||||
// Fire the OnPlayerLogout hook too, if the player was logged in and they have a TSPlayer object.
|
||||
if (tsplr != null && tsplr.IsLoggedIn)
|
||||
if (tsplr.IsLoggedIn)
|
||||
{
|
||||
Hooks.PlayerHooks.OnPlayerLogout(tsplr);
|
||||
}
|
||||
|
|
@ -1448,17 +1471,38 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
if ((args.Text.StartsWith(Config.CommandSpecifier) || args.Text.StartsWith(Config.CommandSilentSpecifier))
|
||||
&& !string.IsNullOrWhiteSpace(args.Text.Substring(1)))
|
||||
string text = args.Text;
|
||||
|
||||
// Terraria now has chat commands on the client side.
|
||||
// These commands remove the commands prefix (e.g. /me /playing) and send the command id instead
|
||||
// In order for us to keep legacy code we must reverse this and get the prefix using the command id
|
||||
foreach (var item in Terraria.UI.Chat.ChatManager.Commands._localizedCommands)
|
||||
{
|
||||
if (item.Value._name == args.CommandId._name)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(text))
|
||||
{
|
||||
text = item.Key.Value + ' ' + text;
|
||||
}
|
||||
else
|
||||
{
|
||||
text = item.Key.Value;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((text.StartsWith(Config.CommandSpecifier) || text.StartsWith(Config.CommandSilentSpecifier))
|
||||
&& !string.IsNullOrWhiteSpace(text.Substring(1)))
|
||||
{
|
||||
try
|
||||
{
|
||||
args.Handled = true;
|
||||
if (!Commands.HandleCommand(tsplr, args.Text))
|
||||
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.");
|
||||
Log.ConsoleError("Unable to parse command '{0}' from player {1}.", args.Text, tsplr.Name);
|
||||
Log.ConsoleError("Unable to parse command '{0}' from player {1}.", text, tsplr.Name);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
@ -1480,7 +1524,7 @@ namespace TShockAPI
|
|||
}
|
||||
else if (!TShock.Config.EnableChatAboveHeads)
|
||||
{
|
||||
var text = String.Format(Config.ChatFormat, tsplr.Group.Name, tsplr.Group.Prefix, tsplr.Name, tsplr.Group.Suffix,
|
||||
text = String.Format(Config.ChatFormat, tsplr.Group.Name, tsplr.Group.Prefix, tsplr.Name, tsplr.Group.Suffix,
|
||||
args.Text);
|
||||
Hooks.PlayerHooks.OnPlayerChat(tsplr, args.Text, ref text);
|
||||
Utils.Broadcast(text, tsplr.Group.R, tsplr.Group.G, tsplr.Group.B);
|
||||
|
|
@ -1491,19 +1535,31 @@ namespace TShockAPI
|
|||
Player ply = Main.player[args.Who];
|
||||
string name = ply.name;
|
||||
ply.name = String.Format(Config.ChatAboveHeadsFormat, tsplr.Group.Name, tsplr.Group.Prefix, tsplr.Name, tsplr.Group.Suffix);
|
||||
NetMessage.SendData((int)PacketTypes.PlayerInfo, -1, -1, ply.name, args.Who, 0, 0, 0, 0);
|
||||
//Update the player's name to format text nicely. This needs to be done because Terraria automatically formats messages against our will
|
||||
NetMessage.SendData((int)PacketTypes.PlayerInfo, -1, -1, NetworkText.FromLiteral(ply.name), args.Who, 0, 0, 0, 0);
|
||||
|
||||
//Give that poor player their name back :'c
|
||||
ply.name = name;
|
||||
var text = args.Text;
|
||||
Hooks.PlayerHooks.OnPlayerChat(tsplr, args.Text, ref text);
|
||||
NetMessage.SendData((int)PacketTypes.ChatText, -1, args.Who, text, args.Who, tsplr.Group.R, tsplr.Group.G, tsplr.Group.B);
|
||||
NetMessage.SendData((int)PacketTypes.PlayerInfo, -1, -1, name, args.Who, 0, 0, 0, 0);
|
||||
PlayerHooks.OnPlayerChat(tsplr, args.Text, ref text);
|
||||
|
||||
//This netpacket is used to send chat text from the server to clients, in this case on behalf of a client
|
||||
Terraria.Net.NetPacket packet = Terraria.GameContent.NetModules.NetTextModule.SerializeServerMessage(
|
||||
NetworkText.FromLiteral(text), new Color(tsplr.Group.R, tsplr.Group.G, tsplr.Group.B), (byte)args.Who
|
||||
);
|
||||
//Broadcast to everyone except the player who sent the message.
|
||||
//This is so that we can send them the same nicely formatted message that everyone else gets
|
||||
Terraria.Net.NetManager.Instance.Broadcast(packet, args.Who);
|
||||
|
||||
//Reset their name
|
||||
NetMessage.SendData((int)PacketTypes.PlayerInfo, -1, -1, NetworkText.FromLiteral(name), args.Who, 0, 0, 0, 0);
|
||||
|
||||
string msg = String.Format("<{0}> {1}",
|
||||
String.Format(Config.ChatAboveHeadsFormat, tsplr.Group.Name, tsplr.Group.Prefix, tsplr.Name, tsplr.Group.Suffix),
|
||||
text);
|
||||
text
|
||||
);
|
||||
|
||||
//Send the original sender their nicely formatted message, and do all the loggy things
|
||||
tsplr.SendMessage(msg, tsplr.Group.R, tsplr.Group.G, tsplr.Group.B);
|
||||
|
||||
TSPlayer.Server.SendMessage(msg, tsplr.Group.R, tsplr.Group.G, tsplr.Group.B);
|
||||
Log.Info("Broadcast: {0}", msg);
|
||||
args.Handled = true;
|
||||
|
|
@ -1989,7 +2045,7 @@ namespace TShockAPI
|
|||
{
|
||||
check = true;
|
||||
player.SendMessage(
|
||||
String.Format("Stack cheat detected. Remove item {0} ({1}) and then rejoin", item.name, inventory[i].stack),
|
||||
String.Format("Stack cheat detected. Remove item {0} ({1}) and then rejoin", item.Name, inventory[i].stack),
|
||||
Color.Cyan);
|
||||
}
|
||||
}
|
||||
|
|
@ -2008,7 +2064,7 @@ namespace TShockAPI
|
|||
{
|
||||
check = true;
|
||||
player.SendMessage(
|
||||
String.Format("Stack cheat detected. Remove armor {0} ({1}) and then rejoin", item.name, armor[index].stack),
|
||||
String.Format("Stack cheat detected. Remove armor {0} ({1}) and then rejoin", item.Name, armor[index].stack),
|
||||
Color.Cyan);
|
||||
}
|
||||
}
|
||||
|
|
@ -2027,7 +2083,7 @@ namespace TShockAPI
|
|||
{
|
||||
check = true;
|
||||
player.SendMessage(
|
||||
String.Format("Stack cheat detected. Remove dye {0} ({1}) and then rejoin", item.name, dye[index].stack),
|
||||
String.Format("Stack cheat detected. Remove dye {0} ({1}) and then rejoin", item.Name, dye[index].stack),
|
||||
Color.Cyan);
|
||||
}
|
||||
}
|
||||
|
|
@ -2046,7 +2102,7 @@ namespace TShockAPI
|
|||
{
|
||||
check = true;
|
||||
player.SendMessage(
|
||||
String.Format("Stack cheat detected. Remove item {0} ({1}) and then rejoin", item.name, miscEquips[index].stack),
|
||||
String.Format("Stack cheat detected. Remove item {0} ({1}) and then rejoin", item.Name, miscEquips[index].stack),
|
||||
Color.Cyan);
|
||||
}
|
||||
}
|
||||
|
|
@ -2065,7 +2121,7 @@ namespace TShockAPI
|
|||
{
|
||||
check = true;
|
||||
player.SendMessage(
|
||||
String.Format("Stack cheat detected. Remove item dye {0} ({1}) and then rejoin", item.name, miscDyes[index].stack),
|
||||
String.Format("Stack cheat detected. Remove item dye {0} ({1}) and then rejoin", item.Name, miscDyes[index].stack),
|
||||
Color.Cyan);
|
||||
}
|
||||
}
|
||||
|
|
@ -2085,7 +2141,7 @@ namespace TShockAPI
|
|||
{
|
||||
check = true;
|
||||
player.SendMessage(
|
||||
String.Format("Stack cheat detected. Remove Piggy-bank item {0} ({1}) and then rejoin", item.name, piggy[index].stack),
|
||||
String.Format("Stack cheat detected. Remove Piggy-bank item {0} ({1}) and then rejoin", item.Name, piggy[index].stack),
|
||||
Color.Cyan);
|
||||
}
|
||||
}
|
||||
|
|
@ -2105,7 +2161,7 @@ namespace TShockAPI
|
|||
{
|
||||
check = true;
|
||||
player.SendMessage(
|
||||
String.Format("Stack cheat detected. Remove Safe item {0} ({1}) and then rejoin", item.name, safe[index].stack),
|
||||
String.Format("Stack cheat detected. Remove Safe item {0} ({1}) and then rejoin", item.Name, safe[index].stack),
|
||||
Color.Cyan);
|
||||
}
|
||||
}
|
||||
|
|
@ -2124,7 +2180,7 @@ namespace TShockAPI
|
|||
{
|
||||
check = true;
|
||||
player.SendMessage(
|
||||
String.Format("Stack cheat detected. Remove trash item {0} ({1}) and then rejoin", item.name, trash.stack),
|
||||
String.Format("Stack cheat detected. Remove trash item {0} ({1}) and then rejoin", item.Name, trash.stack),
|
||||
Color.Cyan);
|
||||
}
|
||||
}
|
||||
|
|
@ -2144,7 +2200,7 @@ namespace TShockAPI
|
|||
{
|
||||
check = true;
|
||||
player.SendMessage(
|
||||
String.Format("Stack cheat detected. Remove Defender's Forge item {0} ({1}) and then rejoin", item.name, forge[index].stack),
|
||||
String.Format("Stack cheat detected. Remove Defender's Forge item {0} ({1}) and then rejoin", item.Name, forge[index].stack),
|
||||
Color.Cyan);
|
||||
}
|
||||
}
|
||||
|
|
@ -2181,9 +2237,9 @@ namespace TShockAPI
|
|||
Netplay.ListenPort = file.ServerPort;
|
||||
}
|
||||
|
||||
if (file.MaxSlots > 235)
|
||||
file.MaxSlots = 235;
|
||||
Main.maxNetPlayers = file.MaxSlots + 20;
|
||||
if (file.MaxSlots > Main.maxPlayers - file.ReservedSlots)
|
||||
file.MaxSlots = Main.maxPlayers - file.ReservedSlots;
|
||||
Main.maxNetPlayers = file.MaxSlots + file.ReservedSlots;
|
||||
|
||||
Netplay.ServerPassword = "";
|
||||
if (!string.IsNullOrEmpty(_cliPassword))
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@
|
|||
<Compile Include="Hooks\PlayerHooks.cs" />
|
||||
<Compile Include="Hooks\RegionHooks.cs" />
|
||||
<Compile Include="ILog.cs" />
|
||||
<Compile Include="Localization\EnglishLanguage.cs" />
|
||||
<Compile Include="NetItem.cs" />
|
||||
<Compile Include="PlayerData.cs" />
|
||||
<Compile Include="Sockets\LinuxTcpSocket.cs" />
|
||||
|
|
|
|||
|
|
@ -17,21 +17,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.Utilities;
|
||||
using TShockAPI.DB;
|
||||
using BCrypt.Net;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria.Localization;
|
||||
using TShockAPI.Localization;
|
||||
|
||||
namespace TShockAPI
|
||||
{
|
||||
|
|
@ -344,16 +343,33 @@ namespace TShockAPI
|
|||
{
|
||||
var found = new List<Item>();
|
||||
Item item = new Item();
|
||||
string nameLower = name.ToLower();
|
||||
for (int i = -48; i < Main.maxItemTypes; i++)
|
||||
string nameLower = name.ToLowerInvariant();
|
||||
var checkEnglish = Language.ActiveCulture != GameCulture.English;
|
||||
|
||||
for (int i = 1; i < Main.maxItemTypes; i++)
|
||||
{
|
||||
item.netDefaults(i);
|
||||
if (String.IsNullOrWhiteSpace(item.name))
|
||||
if (!String.IsNullOrWhiteSpace(item.Name))
|
||||
{
|
||||
if (item.Name.ToLowerInvariant() == nameLower)
|
||||
return new List<Item> { item };
|
||||
if (item.Name.ToLowerInvariant().StartsWith(nameLower))
|
||||
found.Add(item.Clone());
|
||||
}
|
||||
|
||||
if (!checkEnglish)
|
||||
{
|
||||
continue;
|
||||
if (item.name.ToLower() == nameLower)
|
||||
return new List<Item> { item };
|
||||
if (item.name.ToLower().StartsWith(nameLower))
|
||||
found.Add(item.Clone());
|
||||
}
|
||||
|
||||
string englishName = EnglishLanguage.GetItemNameById(i).ToLowerInvariant();
|
||||
if (!String.IsNullOrEmpty(englishName))
|
||||
{
|
||||
if (englishName == nameLower)
|
||||
return new List<Item> { item };
|
||||
if (englishName.StartsWith(nameLower))
|
||||
found.Add(item.Clone());
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
|
@ -403,7 +419,7 @@ namespace TShockAPI
|
|||
public NPC GetNPCById(int id)
|
||||
{
|
||||
NPC npc = new NPC();
|
||||
npc.netDefaults(id);
|
||||
npc.SetDefaults(id);
|
||||
return npc;
|
||||
}
|
||||
|
||||
|
|
@ -416,13 +432,17 @@ namespace TShockAPI
|
|||
{
|
||||
var found = new List<NPC>();
|
||||
NPC npc = new NPC();
|
||||
string nameLower = name.ToLower();
|
||||
string nameLower = name.ToLowerInvariant();
|
||||
for (int i = -17; i < Main.maxNPCTypes; i++)
|
||||
{
|
||||
npc.netDefaults(i);
|
||||
if (npc.name.ToLower() == nameLower || npc.displayName.ToLower() == nameLower)
|
||||
string englishName = EnglishLanguage.GetNpcNameById(i).ToLowerInvariant();
|
||||
|
||||
npc.SetDefaults(i);
|
||||
if (npc.FullName.ToLowerInvariant() == nameLower || npc.TypeName.ToLowerInvariant() == nameLower
|
||||
|| nameLower == englishName)
|
||||
return new List<NPC> { npc };
|
||||
if (npc.name.ToLower().StartsWith(nameLower) || npc.displayName.ToLower().StartsWith(nameLower))
|
||||
if (npc.FullName.ToLowerInvariant().StartsWith(nameLower) || npc.TypeName.ToLowerInvariant().StartsWith(nameLower)
|
||||
|| englishName?.StartsWith(nameLower) == true)
|
||||
found.Add((NPC)npc.Clone());
|
||||
}
|
||||
return found;
|
||||
|
|
@ -435,7 +455,7 @@ namespace TShockAPI
|
|||
/// <returns>name</returns>
|
||||
public string GetBuffName(int id)
|
||||
{
|
||||
return (id > 0 && id < Main.maxBuffTypes) ? Main.buffName[id] : "null";
|
||||
return (id > 0 && id < Main.maxBuffTypes) ? Lang.GetBuffName(id) : "null";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -445,7 +465,7 @@ namespace TShockAPI
|
|||
/// <returns>description</returns>
|
||||
public string GetBuffDescription(int id)
|
||||
{
|
||||
return (id > 0 && id < Main.maxBuffTypes) ? Main.buffTip[id] : "null";
|
||||
return (id > 0 && id < Main.maxBuffTypes) ? Lang.GetBuffName(id) : "null";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -459,14 +479,14 @@ namespace TShockAPI
|
|||
string buffname;
|
||||
for (int i = 1; i < Main.maxBuffTypes; i++)
|
||||
{
|
||||
buffname = Main.buffName[i];
|
||||
buffname = Lang.GetBuffName(i);
|
||||
if (!String.IsNullOrWhiteSpace(buffname) && buffname.ToLower() == nameLower)
|
||||
return new List<int> {i};
|
||||
}
|
||||
var found = new List<int>();
|
||||
for (int i = 1; i < Main.maxBuffTypes; i++)
|
||||
{
|
||||
buffname = Main.buffName[i];
|
||||
buffname = Lang.GetBuffName(i);
|
||||
if (!String.IsNullOrWhiteSpace(buffname) && buffname.ToLower().StartsWith(nameLower))
|
||||
found.Add(i);
|
||||
}
|
||||
|
|
@ -480,7 +500,7 @@ namespace TShockAPI
|
|||
/// <returns>Prefix name</returns>
|
||||
public string GetPrefixById(int id)
|
||||
{
|
||||
return id < FirstItemPrefix || id > LastItemPrefix ? "" : Lang.prefix[id] ?? "";
|
||||
return id < FirstItemPrefix || id > LastItemPrefix ? "" : Lang.prefix[id].ToString() ?? "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -492,15 +512,16 @@ namespace TShockAPI
|
|||
{
|
||||
Item item = new Item();
|
||||
item.SetDefaults(0);
|
||||
string lowerName = name.ToLower();
|
||||
string lowerName = name.ToLowerInvariant();
|
||||
var found = new List<int>();
|
||||
for (int i = FirstItemPrefix; i <= LastItemPrefix; i++)
|
||||
{
|
||||
item.prefix = (byte)i;
|
||||
string prefixName = item.AffixName().Trim().ToLower();
|
||||
if (prefixName == lowerName)
|
||||
string prefixName = item.AffixName().Trim().ToLowerInvariant();
|
||||
string englishName = EnglishLanguage.GetPrefixById(i).ToLowerInvariant();
|
||||
if (prefixName == lowerName || englishName == lowerName)
|
||||
return new List<int>() { i };
|
||||
else if (prefixName.StartsWith(lowerName)) // Partial match
|
||||
else if (prefixName.StartsWith(lowerName) || englishName?.StartsWith(lowerName) == true) // Partial match
|
||||
found.Add(i);
|
||||
}
|
||||
return found;
|
||||
|
|
@ -848,8 +869,13 @@ namespace TShockAPI
|
|||
/// <param name="matches">An enumerable list with the matches</param>
|
||||
public void SendMultipleMatchError(TSPlayer ply, IEnumerable<object> matches)
|
||||
{
|
||||
ply.SendErrorMessage("More than one match found: {0}", string.Join(",", matches));
|
||||
ply.SendErrorMessage("Use \"my query\" for items with spaces");
|
||||
ply.SendErrorMessage("More than one match found: ");
|
||||
|
||||
var lines = PaginationTools.BuildLinesFromTerms(matches.ToArray());
|
||||
|
||||
lines.ForEach(ply.SendInfoMessage);
|
||||
|
||||
ply.SendErrorMessage("Use \"my query\" for items with spaces.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -1173,7 +1199,7 @@ namespace TShockAPI
|
|||
public void Dump(bool exit = true)
|
||||
{
|
||||
PrepareLangForDump();
|
||||
Lang.setLang(true);
|
||||
// Lang.setLang(true);
|
||||
ConfigFile.DumpDescriptions();
|
||||
Permissions.DumpDescriptions();
|
||||
ServerSideCharacters.ServerSideConfig.DumpDescriptions();
|
||||
|
|
@ -1209,9 +1235,9 @@ namespace TShockAPI
|
|||
List<object[]> elements = new List<object[]>();
|
||||
for (int i = 0; i < Main.maxBuffTypes; i++)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(Main.buffName[i]))
|
||||
if (!String.IsNullOrEmpty(Lang.GetBuffName(i)))
|
||||
{
|
||||
object[] element = new object[] { i, Main.buffName[i], Main.buffTip[i] };
|
||||
object[] element = new object[] { i, Lang.GetBuffName(i), Lang.GetBuffDescription(i) };
|
||||
elements.Add(element);
|
||||
}
|
||||
}
|
||||
|
|
@ -1241,19 +1267,22 @@ namespace TShockAPI
|
|||
buffer.AppendLine(" \"h-0\": \"ID\",");
|
||||
buffer.AppendLine(" \"h-1\": \"Name\",");
|
||||
buffer.AppendLine(" \"h-2\": \"Tooltip\",");
|
||||
buffer.AppendLine(" \"h-3\": \"Tooltip 2\",");
|
||||
|
||||
List<object[]> elements = new List<object[]>();
|
||||
for (int i = start; i < end; i++)
|
||||
{
|
||||
Item item = new Item();
|
||||
item.netDefaults(i);
|
||||
if (!String.IsNullOrEmpty(item.name))
|
||||
item.SetDefaults(i);
|
||||
|
||||
string tt = "";
|
||||
for (int x = 0; x < item.ToolTip.Lines; x++) {
|
||||
tt += item.ToolTip.GetLine(x) + "\n";
|
||||
}
|
||||
if (!String.IsNullOrEmpty(item.Name))
|
||||
{
|
||||
object[] element = new object[] { i,
|
||||
newLine.Replace(item.name, @" "),
|
||||
newLine.Replace(item.toolTip, @" "),
|
||||
newLine.Replace(item.toolTip2, @" ")
|
||||
newLine.Replace(item.Name, @" "),
|
||||
newLine.Replace(tt, @" "),
|
||||
};
|
||||
elements.Add(element);
|
||||
}
|
||||
|
|
@ -1280,17 +1309,17 @@ namespace TShockAPI
|
|||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.AppendLine("[block:parameters]").AppendLine("{").AppendLine(" \"data\": {");
|
||||
buffer.AppendLine(" \"h-0\": \"ID\",");
|
||||
buffer.AppendLine(" \"h-1\": \"Name\",");
|
||||
buffer.AppendLine(" \"h-2\": \"Display Name\",");
|
||||
buffer.AppendLine(" \"h-1\": \"Full Name\",");
|
||||
buffer.AppendLine(" \"h-2\": \"Type Name\",");
|
||||
|
||||
List<object[]> elements = new List<object[]>();
|
||||
for (int i = -65; i < Main.maxNPCTypes; i++)
|
||||
{
|
||||
NPC npc = new NPC();
|
||||
npc.netDefaults(i);
|
||||
if (!String.IsNullOrEmpty(npc.name))
|
||||
npc.SetDefaults(i);
|
||||
if (!String.IsNullOrEmpty(npc.FullName))
|
||||
{
|
||||
object[] element = new object[] { i, npc.name, npc.displayName };
|
||||
object[] element = new object[] { i, npc.FullName, npc.TypeName };
|
||||
elements.Add(element);
|
||||
}
|
||||
}
|
||||
|
|
@ -1324,9 +1353,9 @@ namespace TShockAPI
|
|||
{
|
||||
Projectile projectile = new Projectile();
|
||||
projectile.SetDefaults(i);
|
||||
if (!String.IsNullOrEmpty(projectile.name))
|
||||
if (!String.IsNullOrEmpty(projectile.Name))
|
||||
{
|
||||
object[] element = new object[] { i, projectile.name };
|
||||
object[] element = new object[] { i, projectile.Name };
|
||||
elements.Add(element);
|
||||
}
|
||||
}
|
||||
|
|
@ -1355,9 +1384,9 @@ namespace TShockAPI
|
|||
buffer.AppendLine(" \"h-1\": \"Name\",");
|
||||
|
||||
List<object[]> elements = new List<object[]>();
|
||||
for (int i = 0; i < Item.maxPrefixes; i++)
|
||||
for (int i = 0; i < PrefixID.Count; i++)
|
||||
{
|
||||
string prefix = Lang.prefix[i];
|
||||
string prefix = Lang.prefix[i].ToString();
|
||||
|
||||
if (!String.IsNullOrEmpty(prefix))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<system.data>
|
||||
<DbProviderFactories>
|
||||
<remove invariant="MySql.Data.MySqlClient"/>
|
||||
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
|
||||
<remove invariant="MySql.Data.MySqlClient" />
|
||||
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
|
||||
</DbProviderFactories>
|
||||
</system.data>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup></configuration>
|
||||
|
|
|
|||
9
TShockAPI/web.config
Normal file
9
TShockAPI/web.config
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<system.data>
|
||||
<DbProviderFactories>
|
||||
<remove invariant="MySql.Data.MySqlClient" />
|
||||
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
|
||||
</DbProviderFactories>
|
||||
</system.data>
|
||||
</configuration>
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 3b96d98a37c96c2a5969bfd4bf63a2fd4371ed46
|
||||
Subproject commit bc9f7c69becb60816fc1e4587bbca15991231317
|
||||
23
scripts/create_release.py
Normal file → Executable file
23
scripts/create_release.py
Normal file → Executable file
|
|
@ -36,7 +36,7 @@ sqlite_bin_name = "Mono.Data.Sqlite.dll"
|
|||
json_bin_name = "Newtonsoft.Json.dll"
|
||||
http_bin_name = "HttpServer.dll"
|
||||
tshock_bin_name = "TShockAPI.dll"
|
||||
tshock_symbols = "TShockAPI.dll.mdb"
|
||||
tshock_symbols = "TShockAPI.pdb"
|
||||
bcrypt_bin_name = "BCrypt.Net.dll"
|
||||
geoip_db_name = "GeoIP.dat"
|
||||
|
||||
|
|
@ -140,28 +140,17 @@ def upload_artifacts():
|
|||
def update_terraria_source():
|
||||
subprocess.check_call(['/usr/bin/git', 'submodule', 'init'])
|
||||
subprocess.check_call(['/usr/bin/git', 'submodule', 'update'])
|
||||
subprocess.check_call(['nuget', 'restore'])
|
||||
subprocess.check_call(['nuget', 'restore', 'TerrariaServerAPI/'])
|
||||
|
||||
def run_bootstrapper():
|
||||
for build_config in ['Debug','Release'] :
|
||||
mod_bootstrapper_proc = subprocess.Popen(['xbuild', './TerrariaServerAPI/TShock.Modifications.Bootstrapper/TShock.Modifications.Bootstrapper.csproj', '/p:Configuration=' + build_config])
|
||||
mod_clientuuid_proc = subprocess.Popen(['xbuild', './TerrariaServerAPI/TShock.Modifications.ClientUUID/TShock.Modifications.ClientUUID.csproj', '/p:Configuration=' + build_config])
|
||||
mod_explosives_proc = subprocess.Popen(['xbuild', './TerrariaServerAPI/TShock.Modifications.Explosives/TShock.Modifications.Explosives.csproj', '/p:Configuration=' + build_config])
|
||||
mod_ssc_proc = subprocess.Popen(['xbuild', './TerrariaServerAPI/TShock.Modifications.SSC/TShock.Modifications.SSC.csproj', '/p:Configuration=' + build_config])
|
||||
mintaka = subprocess.Popen(['xbuild', './TerrariaServerAPI/TShock.4.OTAPI.sln', '/p:Configuration=' + build_config])
|
||||
|
||||
mod_bootstrapper_proc.wait()
|
||||
mod_clientuuid_proc.wait()
|
||||
mod_explosives_proc.wait()
|
||||
mod_ssc_proc.wait()
|
||||
mintaka.wait()
|
||||
|
||||
if (mod_bootstrapper_proc.returncode != 0):
|
||||
raise CalledProcessError(mod_bootstrapper_proc.returncode)
|
||||
if (mod_clientuuid_proc.returncode != 0):
|
||||
raise CalledProcessError(mod_clientuuid_proc.returncode)
|
||||
if (mod_explosives_proc.returncode != 0):
|
||||
raise CalledProcessError(mod_explosives_proc.returncode)
|
||||
if (mod_ssc_proc.returncode != 0):
|
||||
raise CalledProcessError(mod_ssc_proc.returncode)
|
||||
if (mintaka.returncode != 0):
|
||||
raise CalledProcessError(mintaka.returncode)
|
||||
|
||||
# run the bootstrapper to generate the new OTAPI.dll
|
||||
os.chdir('./TerrariaServerAPI/TShock.Modifications.Bootstrapper/bin/' + build_config)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue