From 8bb1a552cc8a19afb4c939529aef796e809df3e6 Mon Sep 17 00:00:00 2001 From: ShakeFlower Date: Tue, 22 Oct 2024 23:05:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=B9itemEffectTip?= =?UTF-8?q?=E7=9A=84=E6=A0=BC=E5=BC=8F=E8=BD=AC=E5=86=99=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=BB=91=E5=86=B0=E8=BD=AC=E5=86=99bug=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=B9hero.equipment=E7=9A=84=E6=A3=80?= =?UTF-8?q?=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ViewModels/Migrator/DataJSMigrator.cs | 18 ++++++++++++------ ViewModels/Migrator/FloorsMigrator.cs | 11 +++++++++-- ViewModels/Migrator/ItemsJSMigrator.cs | 4 ++++ 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/ViewModels/Migrator/DataJSMigrator.cs b/ViewModels/Migrator/DataJSMigrator.cs index e7511e2..9e72dd6 100644 --- a/ViewModels/Migrator/DataJSMigrator.cs +++ b/ViewModels/Migrator/DataJSMigrator.cs @@ -159,7 +159,14 @@ namespace H5MotaUpdate.ViewModels heroItemData = (JObject)heroData["items"]; heroData["image"] = "hero.png"; heroData["followers"] = new JArray(); - if (heroData["exp"] == null) heroData["exp"] = heroData["experience"]; + if (heroData["exp"] == null) + { + heroData["exp"] = heroData["experience"]; + } + if (heroData["equipment"] == null) + { + heroData["equipment"] = new JArray(); // 预防某些超级老样板没有hero.equipment} + } heroData.Remove("experience"); JObject heroToolsData = (JObject)heroItemData["tools"]; @@ -299,13 +306,12 @@ namespace H5MotaUpdate.ViewModels { statusBarItemsArr.Add(status); } - else if (new string[] { "enableHP", "enableAtk", "enableDef" }.Contains(status)) // hp,atk,def为2.7前默认显示的变量,必须显示 - - { + else if (new string[] { "enableHP", "enableAtk", "enableDef" }.Contains(status)) + {// hp,atk,def为2.7前默认显示的变量,必须显示 statusBarItemsArr.Add(status); } - else if (status == "enableExp" && flagsData["enableExperience"].Value() == true) // experience更新为exp - { + else if (status == "enableExp" && flagsData["enableExperience"].Value() == true) + {// experience更新为exp statusBarItemsArr.Add(status); } } diff --git a/ViewModels/Migrator/FloorsMigrator.cs b/ViewModels/Migrator/FloorsMigrator.cs index 2661a55..6e53c4c 100644 --- a/ViewModels/Migrator/FloorsMigrator.cs +++ b/ViewModels/Migrator/FloorsMigrator.cs @@ -154,11 +154,18 @@ namespace H5MotaUpdate.ViewModels if (onePoint == 167 && version.CompareTo(new Version(2, 6)) < 0) { // 2.6以后,滑冰转移到背景层 - JArray bgMatrix = (JArray)jsonObject["bgmap"].DeepClone(); - if (bgMatrix == null || bgMatrix.Count == 0) + if (jsonObject["bgmap"] == null) { jsonObject["bgmap"] = zeroBgMatrix.DeepClone(); } + else + { + JArray bgMatrix = (JArray)jsonObject["bgmap"]; + if (bgMatrix.Count == 0) + { + jsonObject["bgmap"] = zeroBgMatrix.DeepClone(); + } + } jsonObject["bgmap"][i][j] = 167; mapMatrix[i][j] = 0; } diff --git a/ViewModels/Migrator/ItemsJSMigrator.cs b/ViewModels/Migrator/ItemsJSMigrator.cs index 4e5b38e..475e82a 100644 --- a/ViewModels/Migrator/ItemsJSMigrator.cs +++ b/ViewModels/Migrator/ItemsJSMigrator.cs @@ -92,6 +92,10 @@ namespace H5MotaUpdate.ViewModels if (newItemDatas.ContainsKey(key)) { JObject itemData = (JObject)newItemDatas[key]; + if (ele== "itemEffectTip") + { + valueString = "${" + valueString + "}"; + } itemData[ele] = valueString; } }