fix:修复迁移商店时的一些小问题;修复装备数值未正确迁移的问题
This commit is contained in:
1 parent
a96b7ad67e
commit
98693412f1
5 files changed
+89
-4
No files matched your search
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace H5MotaUpdate.ViewModels.Utils
|
||||
{
|
||||
internal static class MotaEventParser
|
||||
{
|
||||
public static void parseOneMotaEvent(JObject motaEvent)
|
||||
{
|
||||
// 如果type为openShop,添加一个open:true的键
|
||||
if (motaEvent["type"] is JValue typeValue && typeValue.Value is string typeString && typeString == "openShop")
|
||||
{
|
||||
motaEvent["open"] = true;
|
||||
}
|
||||
}
|
||||
|
||||
static void parseMotaEventArr(JArray motaEventArr)
|
||||
{
|
||||
foreach (JToken motaEventToken in motaEventArr)
|
||||
{
|
||||
// 只处理对象事件 字符串不计
|
||||
if (motaEventToken.Type == JTokenType.Object)
|
||||
{
|
||||
JObject motaEvent = (JObject)motaEventToken;
|
||||
parseOneMotaEvent(motaEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void parseMotaEvent(JToken motaEvent)
|
||||
{
|
||||
if (motaEvent is JArray motaEventArr)
|
||||
{
|
||||
parseMotaEventArr(motaEventArr);
|
||||
}
|
||||
else if (motaEvent is JObject motaEventObj)
|
||||
{ // 说明有覆盖触发器等,data中才是真正的事件
|
||||
if (motaEvent["data"] is JArray dataArr)
|
||||
{
|
||||
parseMotaEventArr(dataArr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,7 @@ namespace H5MotaUpdate.ViewModels
|
||||
// 获取匹配的内容,去掉 ${ 和 }
|
||||
string content = match.Groups[1].Value;
|
||||
// 在匹配的内容中替换 oldWord 为 newWord
|
||||
string modifiedContent = content.Replace(oldWord, newWord);
|
||||
string modifiedContent = "(" + content.Replace(oldWord, newWord) + ")";
|
||||
// 返回替换后的完整匹配字符串,包含 ${ 和 }
|
||||
return "${" + modifiedContent + "}";
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user