Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CheckModBuildVersionBeforeJIT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@ internal class CheckModBuildVersionBeforeJIT : PreJITFilter {
// The GetInstance singleton is only loaded after mod JITing was performed, hence the need for a variable
public static MagicStorageMod Mod;
public static bool versionChecked;
public static bool nPinyinLoaded;

public override bool ShouldJIT(MemberInfo member) {
if (!versionChecked) {
CheckBuildVersion();
versionChecked = true;
}

// 延迟 JIT ConvertToPinyin 方法,直到 NPinyin.Core.dll 加载完成
if (member is MethodInfo method &&
method.DeclaringType?.FullName == "MagicStorage.Common.Utils.PinyinHelper" &&
method.Name == "ConvertToPinyin") {
return nPinyinLoaded;
}

return base.ShouldJIT(member);
}

Expand Down
4 changes: 2 additions & 2 deletions Common/Systems/Auditing/AuditEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -543,14 +543,14 @@ public override void Serialize(BinaryWriter writer) {
protected override void Stringify(AuditFile source, StringBuilder builder) {
base.Stringify(source, builder);

int[] coins = Utils.CoinsSplit(TotalSellValue);
int[] coins = Terraria.Utils.CoinsSplit(TotalSellValue);
builder.Append($" on {SoldItemCount} items at price {coins[3]}p {coins[2]}g {coins[1]}s {coins[0]}c");
}

protected override void NetStringify(StringBuilder builder) {
base.NetStringify(builder);

int[] coins = Utils.CoinsSplit(TotalSellValue);
int[] coins = Terraria.Utils.CoinsSplit(TotalSellValue);
builder.Append($", count {SoldItemCount}, value {coins[3]}p {coins[2]}g {coins[1]}s {coins[0]}c");
}
}
Expand Down
2 changes: 1 addition & 1 deletion Common/Systems/Shimmering/ShimmerResultReports.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private readonly string GetCoinLuckAdjustment(LocalizedText text) {
Player player = Main.LocalPlayer;

float currentLuckValue = player.coinLuck;
float adjustedLuckValue = Utils.Clamp(player.coinLuck + coinValue, 0f, 1e6f);
float adjustedLuckValue = Terraria.Utils.Clamp(player.coinLuck + coinValue, 0f, 1e6f);

float luck = player.CalculateCoinLuck(currentLuckValue);
float adjustedLuck = player.CalculateCoinLuck(adjustedLuckValue);
Expand Down
12 changes: 10 additions & 2 deletions Common/Threading/Refreshing/StorageViewControls.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using MagicStorage.Common.Systems;
using MagicStorage.Common.Utils;
using MagicStorage.CrossMod;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -327,8 +328,15 @@ public bool ItemPassesTextFilter(Item item) {
}

if (!string.IsNullOrEmpty(itemNameSearchText)) {
if (!item.Name.Contains(itemNameSearchText, StringComparison.OrdinalIgnoreCase))
return false;
// 支持拼音搜索(仅在简体中文环境下启用)
if (PinyinHelper.ShouldEnablePinyinSearch()) {
if (!PinyinHelper.MatchesSearch(item, itemNameSearchText))
return false;
} else {
// 原有逻辑:直接字符串匹配
if (!item.Name.Contains(itemNameSearchText, StringComparison.OrdinalIgnoreCase))
return false;
}
}

if (!string.IsNullOrEmpty(itemTooltipSearchText)) {
Expand Down
Loading