From d071e6f6921b9c36f85c91b0cb32308a3f1540c2 Mon Sep 17 00:00:00 2001 From: sin365 <353374337@qq.com> Date: Sat, 8 Apr 2023 17:48:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=9F=90=E4=BA=9B=E7=89=A9?= =?UTF-8?q?=E5=93=81=EF=BC=8C=E8=BF=87=E6=BB=A4=E9=81=97=E6=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MHHelper.cs | 7 +++- ModifyQuest.cs | 38 +++++++++++-------- README.md | 5 ++- ...CoreApp,Version=v7.0.AssemblyAttributes.cs | 4 ++ .../net7.0/MHFQuestToMH2Dos.AssemblyInfo.cs | 23 +++++++++++ .../net7.0/MHFQuestToMH2Dos.GlobalUsings.g.cs | 8 ++++ 6 files changed, 66 insertions(+), 19 deletions(-) create mode 100644 obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs create mode 100644 obj/Debug/net7.0/MHFQuestToMH2Dos.AssemblyInfo.cs create mode 100644 obj/Debug/net7.0/MHFQuestToMH2Dos.GlobalUsings.g.cs diff --git a/MHHelper.cs b/MHHelper.cs index af0a3fd..5d624f7 100644 --- a/MHHelper.cs +++ b/MHHelper.cs @@ -22,7 +22,12 @@ namespace MHFQuestToMH2Dos public static bool CheckEnd(byte[] data, int Ptr) { - return HexHelper.bytesToUInt(data, 2, Ptr) == 0xFFFF || HexHelper.bytesToUInt(data, 1, Ptr) == 0xFF; + return HexHelper.bytesToUInt(data, 2, Ptr) == 0xFFFF; + } + + public static bool CheckEndWith1Byte(byte[] data, int Ptr) + { + return HexHelper.bytesToUInt(data, 1, Ptr) == 0xFF; } diff --git a/ModifyQuest.cs b/ModifyQuest.cs index 82921ab..49ad849 100644 --- a/ModifyQuest.cs +++ b/ModifyQuest.cs @@ -782,7 +782,7 @@ namespace MHFQuestToMH2Dos //若遇到结束符或无数据 if (MHHelper.CheckEnd(target, _SuppliesItem_CurrPtr) || - HexHelper.bytesToInt(target, 1, _SuppliesItem_CurrPtr) == 0 + HexHelper.bytesToInt(target, 4, _SuppliesItem_CurrPtr) == 0 ) { Log.HexInfo(_SuppliesItem_CurrPtr, "主线支援道具,结束符"); @@ -812,7 +812,7 @@ namespace MHFQuestToMH2Dos //若遇到结束符或无数据 if (MHHelper.CheckEnd(target, _SuppliesItem_Zhi_1_CurrPtr) || - HexHelper.bytesToInt(target, 1, _SuppliesItem_Zhi_1_CurrPtr) == 0 + HexHelper.bytesToInt(target, 4, _SuppliesItem_Zhi_1_CurrPtr) == 0 ) { Log.HexInfo(_SuppliesItem_Zhi_1_CurrPtr, "支线1支援道具,结束符"); @@ -842,7 +842,7 @@ namespace MHFQuestToMH2Dos //若遇到结束符或无数据 if (MHHelper.CheckEnd(target, _SuppliesItem_Zhi_2_CurrPtr) || - HexHelper.bytesToInt(target, 1, _SuppliesItem_Zhi_2_CurrPtr) == 0 + HexHelper.bytesToInt(target, 4, _SuppliesItem_Zhi_2_CurrPtr) == 0 ) { Log.HexInfo(_SuppliesItem_Zhi_2_CurrPtr, "支线2支援道具,结束符"); @@ -889,10 +889,14 @@ namespace MHFQuestToMH2Dos for (int i = 0; i < 90; i++) { + if (i == 44) + { + + } //若遇到结束符或无数据 if (MHHelper.CheckEnd(target, _ItemPoint_CurrPtr) - || - HexHelper.bytesToInt(target, 1, _ItemPoint_CurrPtr) == 0 + //|| + //HexHelper.bytesToInt(target, 1, _ItemPoint_CurrPtr) == 0 // 不能判断头部为0 否则当前道具概率为0时,会跳过 ) { Log.HexInfo(_ItemPoint_CurrPtr, "采集点结束"); @@ -909,11 +913,11 @@ namespace MHFQuestToMH2Dos { //若遇到结束符或无数据 if (MHHelper.CheckEnd(target, ItemCurrPtr) - || - HexHelper.bytesToInt(target, 1, ItemCurrPtr) == 0 + //|| + //HexHelper.bytesToInt(target, 1, ItemCurrPtr) == 0 // 不能判断值为0 否则当前道具概率为0时,会跳过 ) { - Log.HexInfo(ItemCurrPtr, "第" + i + "个采集点,第" + setCount + "个素材 结束符"); + Log.HexInfo(ItemCurrPtr, "第{0}个采集代号,第" + setCount + "个素材 结束符",i); break; } int Pr = HexHelper.bytesToInt(target, 2, ItemCurrPtr);//概率 @@ -922,12 +926,14 @@ namespace MHFQuestToMH2Dos //判断道具ID是否超限 if (ItemID > cMax_ItemID) { - Log.HexWar(ItemCurrPtr, "第" + i + "个采集点,第" + setCount + "个素材,ID->{0}道具ID超出最大可能{1},属于MHF道具【" + MHHelper.Get2MHFItemName(ItemID) + "】,将其修正为【不可燃烧的废物】ID->{2}", ItemID, cMax_ItemID, cModify_OutOfItemID); + Log.HexWar(ItemCurrPtr, "第{0}个采集代号,第" + setCount + "个素材,ID->{1}道具ID超出最大可能{2},属于MHF道具【" + MHHelper.Get2MHFItemName(ItemID) + "】,将其修正为【不可燃烧的废物】ID->{3}", i,ItemID, cMax_ItemID, cModify_OutOfItemID); HexHelper.ModifyIntHexToBytes(target, cModify_OutOfItemID, ItemCurrPtr + 0x02, 2); + ItemID = HexHelper.bytesToInt(target, 2, ItemCurrPtr + 0x02);//道具ID + Log.HexTips(ItemCurrPtr, "重新读取 第{0}个采集代号,第" + setCount + "个素材,道具ID->{1} 【" + MHHelper.Get2DosItemName(ItemID) + "】 概率->{2}", i,ItemID, Pr); } else { - Log.HexColor(ConsoleColor.Green, ItemCurrPtr, "第" + i + "个采集点,第" + setCount + "个素材,道具ID->{0} 【" + MHHelper.Get2DosItemName(ItemID) + "】 概率->{1}", ItemID, Pr); + Log.HexColor(ConsoleColor.Green, ItemCurrPtr, "第{0}个采集代号,第" + setCount + "个素材,道具ID->{1} 【" + MHHelper.Get2DosItemName(ItemID) + "】 概率->{2}", i,ItemID, Pr); } setCount++; ItemCurrPtr += 0x04; @@ -965,7 +971,7 @@ namespace MHFQuestToMH2Dos || MHHelper.CheckEnd(target, _FishGroup_CurrPtr) || - HexHelper.bytesToInt(target, 1, _FishGroup_CurrPtr) == 0 + HexHelper.bytesToInt(target, 4, _FishGroup_CurrPtr) == 0 ) { Log.HexInfo(_FishGroup_CurrPtr, $"第{setFishGroup}鱼群代号 结束符"); @@ -980,7 +986,7 @@ namespace MHFQuestToMH2Dos //鱼群季节循环 for (int i = 0; i < 6; i++) { - //鱼群代号结束符 + //鱼群季节结束符 if ( _FishSeason_CurrPtr >= target.Length || @@ -999,13 +1005,13 @@ namespace MHFQuestToMH2Dos int setFish = 0; while (true) { - //鱼群代号结束符 + //鱼结束符 if ( _FishStart_CurrPtr >= target.Length || - MHHelper.CheckEnd(target, _FishStart_CurrPtr) - || - HexHelper.bytesToInt(target, 1, _FishStart_CurrPtr) == 0 + MHHelper.CheckEndWith1Byte(target, _FishStart_CurrPtr) + //|| + //HexHelper.bytesToInt(target, 1, _FishStart_CurrPtr) == 0 ) { Log.HexInfo(_FishStart_CurrPtr, $"第{setFishGroup}鱼群代号 第{i}个季节昼夜 第" + setFish + "个鱼 结束符"); diff --git a/README.md b/README.md index 92c5a49..43458b0 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ 关联 皓月PS2 联机服务器,和 皓月MHF 怪物猎人边境服务器。 + ### 大致描述 ### 通过一系列,数据处理,指针处理。 @@ -15,11 +16,11 @@ YouTuBe: - + Bilibili: - + ### 使用前提 ### diff --git a/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs b/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs new file mode 100644 index 0000000..4257f4b --- /dev/null +++ b/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v7.0", FrameworkDisplayName = ".NET 7.0")] diff --git a/obj/Debug/net7.0/MHFQuestToMH2Dos.AssemblyInfo.cs b/obj/Debug/net7.0/MHFQuestToMH2Dos.AssemblyInfo.cs new file mode 100644 index 0000000..fc9dd95 --- /dev/null +++ b/obj/Debug/net7.0/MHFQuestToMH2Dos.AssemblyInfo.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("MHFQuestToMH2Dos")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] +[assembly: System.Reflection.AssemblyProductAttribute("MHFQuestToMH2Dos")] +[assembly: System.Reflection.AssemblyTitleAttribute("MHFQuestToMH2Dos")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// 由 MSBuild WriteCodeFragment 类生成。 + diff --git a/obj/Debug/net7.0/MHFQuestToMH2Dos.GlobalUsings.g.cs b/obj/Debug/net7.0/MHFQuestToMH2Dos.GlobalUsings.g.cs new file mode 100644 index 0000000..8578f3d --- /dev/null +++ b/obj/Debug/net7.0/MHFQuestToMH2Dos.GlobalUsings.g.cs @@ -0,0 +1,8 @@ +// +global using global::System; +global using global::System.Collections.Generic; +global using global::System.IO; +global using global::System.Linq; +global using global::System.Net.Http; +global using global::System.Threading; +global using global::System.Threading.Tasks;