Merge pull request #1429 from mistzzt/t-1.3.5
Fix duplicate items shown in Utils.GetItemByName and a client crash
This commit is contained in:
commit
a674b42ff3
1 changed files with 15 additions and 5 deletions
|
|
@ -17,21 +17,19 @@ 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
|
||||
|
|
@ -346,6 +344,8 @@ namespace TShockAPI
|
|||
var found = new List<Item>();
|
||||
Item item = new Item();
|
||||
string nameLower = name.ToLowerInvariant();
|
||||
var checkEnglish = Language.ActiveCulture != GameCulture.English;
|
||||
|
||||
for (int i = -48; i < Main.maxItemTypes; i++)
|
||||
{
|
||||
item.netDefaults(i);
|
||||
|
|
@ -357,6 +357,11 @@ namespace TShockAPI
|
|||
found.Add(item.Clone());
|
||||
}
|
||||
|
||||
if (!checkEnglish)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
string englishName = EnglishLanguage.GetItemNameById(i).ToLowerInvariant();
|
||||
if (!String.IsNullOrEmpty(englishName))
|
||||
{
|
||||
|
|
@ -864,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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue