diff --git a/.vs/MHFQuestToMH2Dos/DesignTimeBuild/.dtbcache.v2 b/.vs/MHFQuestToMH2Dos/DesignTimeBuild/.dtbcache.v2 index 00f3550..74268ee 100644 Binary files a/.vs/MHFQuestToMH2Dos/DesignTimeBuild/.dtbcache.v2 and b/.vs/MHFQuestToMH2Dos/DesignTimeBuild/.dtbcache.v2 differ diff --git a/.vs/MHFQuestToMH2Dos/FileContentIndex/1446f568-fcb4-4105-aefb-6e03de63516c.vsidx b/.vs/MHFQuestToMH2Dos/FileContentIndex/1446f568-fcb4-4105-aefb-6e03de63516c.vsidx new file mode 100644 index 0000000..4daeeee Binary files /dev/null and b/.vs/MHFQuestToMH2Dos/FileContentIndex/1446f568-fcb4-4105-aefb-6e03de63516c.vsidx differ diff --git a/.vs/MHFQuestToMH2Dos/FileContentIndex/2575814c-44db-46bf-857c-64960e0ae5e8.vsidx b/.vs/MHFQuestToMH2Dos/FileContentIndex/2575814c-44db-46bf-857c-64960e0ae5e8.vsidx new file mode 100644 index 0000000..92a9388 Binary files /dev/null and b/.vs/MHFQuestToMH2Dos/FileContentIndex/2575814c-44db-46bf-857c-64960e0ae5e8.vsidx differ diff --git a/.vs/MHFQuestToMH2Dos/FileContentIndex/3284967d-6071-4dce-8a37-bb81980194da.vsidx b/.vs/MHFQuestToMH2Dos/FileContentIndex/3284967d-6071-4dce-8a37-bb81980194da.vsidx deleted file mode 100644 index ef555a8..0000000 Binary files a/.vs/MHFQuestToMH2Dos/FileContentIndex/3284967d-6071-4dce-8a37-bb81980194da.vsidx and /dev/null differ diff --git a/.vs/MHFQuestToMH2Dos/FileContentIndex/9d94dbfa-a993-4367-abee-57a9b76f4098.vsidx b/.vs/MHFQuestToMH2Dos/FileContentIndex/4d3e0c15-4fbf-4582-a51d-f464d16d7d28.vsidx similarity index 58% rename from .vs/MHFQuestToMH2Dos/FileContentIndex/9d94dbfa-a993-4367-abee-57a9b76f4098.vsidx rename to .vs/MHFQuestToMH2Dos/FileContentIndex/4d3e0c15-4fbf-4582-a51d-f464d16d7d28.vsidx index 61d37f9..59a68f2 100644 Binary files a/.vs/MHFQuestToMH2Dos/FileContentIndex/9d94dbfa-a993-4367-abee-57a9b76f4098.vsidx and b/.vs/MHFQuestToMH2Dos/FileContentIndex/4d3e0c15-4fbf-4582-a51d-f464d16d7d28.vsidx differ diff --git a/.vs/MHFQuestToMH2Dos/FileContentIndex/cbcd4b64-9e65-45f3-b9bf-9063f0b80429.vsidx b/.vs/MHFQuestToMH2Dos/FileContentIndex/cbcd4b64-9e65-45f3-b9bf-9063f0b80429.vsidx deleted file mode 100644 index fee0132..0000000 Binary files a/.vs/MHFQuestToMH2Dos/FileContentIndex/cbcd4b64-9e65-45f3-b9bf-9063f0b80429.vsidx and /dev/null differ diff --git a/.vs/MHFQuestToMH2Dos/FileContentIndex/d8d9b7ff-4e6f-464e-8a59-7e6512070410.vsidx b/.vs/MHFQuestToMH2Dos/FileContentIndex/d8d9b7ff-4e6f-464e-8a59-7e6512070410.vsidx new file mode 100644 index 0000000..4daeeee Binary files /dev/null and b/.vs/MHFQuestToMH2Dos/FileContentIndex/d8d9b7ff-4e6f-464e-8a59-7e6512070410.vsidx differ diff --git a/.vs/MHFQuestToMH2Dos/FileContentIndex/edadf074-166a-4b49-a1e9-4b8fc3d8b234.vsidx b/.vs/MHFQuestToMH2Dos/FileContentIndex/edadf074-166a-4b49-a1e9-4b8fc3d8b234.vsidx deleted file mode 100644 index f5cd397..0000000 Binary files a/.vs/MHFQuestToMH2Dos/FileContentIndex/edadf074-166a-4b49-a1e9-4b8fc3d8b234.vsidx and /dev/null differ diff --git a/.vs/MHFQuestToMH2Dos/v17/.futdcache.v2 b/.vs/MHFQuestToMH2Dos/v17/.futdcache.v2 index d7a8cbe..651b785 100644 Binary files a/.vs/MHFQuestToMH2Dos/v17/.futdcache.v2 and b/.vs/MHFQuestToMH2Dos/v17/.futdcache.v2 differ diff --git a/.vs/MHFQuestToMH2Dos/v17/.suo b/.vs/MHFQuestToMH2Dos/v17/.suo index d8ad53a..772cfdb 100644 Binary files a/.vs/MHFQuestToMH2Dos/v17/.suo and b/.vs/MHFQuestToMH2Dos/v17/.suo differ diff --git a/.vs/ProjectEvaluation/mhfquesttomh2dos.metadata.v5.2 b/.vs/ProjectEvaluation/mhfquesttomh2dos.metadata.v5.2 index 0d7c7a1..239a399 100644 Binary files a/.vs/ProjectEvaluation/mhfquesttomh2dos.metadata.v5.2 and b/.vs/ProjectEvaluation/mhfquesttomh2dos.metadata.v5.2 differ diff --git a/.vs/ProjectEvaluation/mhfquesttomh2dos.projects.v5.2 b/.vs/ProjectEvaluation/mhfquesttomh2dos.projects.v5.2 index 1fa1437..5aa1a90 100644 Binary files a/.vs/ProjectEvaluation/mhfquesttomh2dos.projects.v5.2 and b/.vs/ProjectEvaluation/mhfquesttomh2dos.projects.v5.2 differ diff --git a/MHHelper.cs b/MHHelper.cs index b54344b..ae6cdcc 100644 --- a/MHHelper.cs +++ b/MHHelper.cs @@ -15,6 +15,464 @@ namespace MHFQuestToMH2Dos /// static List MapAreaCount = new List { 0, 7, 13, 12, 11, 10, 11, 2, 2, 2, 2, 10, 4, 9, 0, 11, 13, 12, 11, 10, 11, 10, 4, 7, 2, 2 }; + public static List UnUseQuestID = new List + {60054, +60100, +60117, +60118, +60119, +60120, +60121, +60144, +60145, +60146, +60147, +60148, +60149, +60150, +60151, +60152, +60153, +60154, +60155, +60156, +60157, +60158, +60159, +60160, +60161, +60162, +60163, +60164, +60165, +60166, +60167, +60168, +60169, +60170, +60171, +60172, +60173, +60174, +60175, +60176, +60177, +60178, +60179, +60180, +60181, +60182, +60183, +60184, +60185, +60186, +60187, +60188, +60189, +60190, +60191, +60192, +60193, +60194, +60195, +60196, +60197, +60198, +60199, +60200, +60205, +60206, +60209, +60210, +60224, +60225, +60226, +60227, +60228, +60229, +60250, +60251, +60252, +60253, +60254, +60255, +60256, +60257, +60258, +60259, +60260, +60261, +60262, +60263, +60264, +60265, +60266, +60267, +60268, +60269, +60270, +60271, +60272, +60273, +60274, +60275, +60276, +60277, +60278, +60279, +60280, +60281, +60282, +60283, +60284, +60285, +60286, +60287, +60288, +60289, +60290, +60291, +60292, +60293, +60294, +60295, +60296, +60297, +60298, +60299, +60300, +60329, +60330, +60331, +60332, +60333, +60334, +60335, +60336, +60337, +60338, +60339, +60340, +60341, +60342, +60343, +60344, +60345, +60346, +60347, +60348, +60349, +60350, +60351, +60352, +60353, +60354, +60355, +60356, +60357, +60358, +60359, +60360, +60361, +60362, +60363, +60364, +60365, +60366, +60367, +60368, +60369, +60370, +60371, +60372, +60373, +60374, +60375, +60376, +60377, +60378, +60379, +60380, +60381, +60382, +60383, +60384, +60385, +60386, +60387, +60388, +60389, +60390, +60391, +60392, +60393, +60394, +60395, +60396, +60397, +60398, +60399, +60400, +60450, +60451, +60452, +60453, +60454, +60455, +60456, +60457, +60458, +60459, +60460, +60461, +60462, +60463, +60464, +60465, +60466, +60467, +60468, +60469, +60470, +60471, +60472, +60473, +60474, +60475, +60476, +60477, +60478, +60479, +60480, +60481, +60482, +60483, +60484, +60485, +60486, +60487, +60488, +60489, +60490, +60491, +60492, +60500, +60536, +60537, +60538, +60539, +60600, +60666, +60692, +60693, +60694, +60695, +60696, +60697, +60698, +60699, +60700, +60729, +60730, +60731, +60732, +60733, +60734, +60735, +60736, +60737, +60738, +60739, +60740, +60741, +60742, +60743, +60744, +60745, +60746, +60747, +60748, +60749, +60750, +60751, +60752, +60753, +60754, +60755, +60756, +60757, +60758, +60759, +60760, +60761, +60762, +60763, +60764, +60765, +60766, +60767, +60768, +60769, +60770, +60771, +60772, +60773, +60774, +60775, +60776, +60777, +60778, +60779, +60780, +60781, +60782, +60783, +60784, +60785, +60786, +60787, +60788, +60789, +60790, +60791, +60792, +60793, +60794, +60795, +60796, +60797, +60798, +60799, +60800, +60811, +60813, +60825, +60826, +60827, +60828, +60829, +60830, +60831, +60832, +60833, +60834, +60835, +60836, +60837, +60838, +60839, +60840, +60841, +60842, +60843, +60844, +60845, +60846, +60847, +60848, +60849, +60850, +60851, +60852, +60853, +60854, +60855, +60856, +60857, +60858, +60859, +60860, +60861, +60862, +60863, +60864, +60865, +60866, +60867, +60868, +60869, +60870, +60871, +60872, +60873, +60874, +60875, +60876, +60877, +60878, +60879, +60880, +60881, +60882, +60883, +60884, +60885, +60886, +60887, +60888, +60889, +60890, +60891, +60892, +60893, +60894, +60895, +60896, +60897, +60898, +60899, +60900, +60946, +60951, +60952, +60953, +60954, +60955, +60956, +60957, +60958, +60959, +60960, +60961, +60962, +60963, +60964, +60965, +60966, +60967, +60968, +60969, +60970, +60971, +60972, +60973, +60974, +60975, +60976, +60977, +60978, +60979, +60980, +60981, +60982, +60983, +60984, +60985, +60986, +60987, +60988, +60989, +60990, +60991, +60992, +60993, +60994, +60995, +60996, +60997, +60998, +60999,}; + public static int GetMapAreaCount(int MapId) { return MapAreaCount[MapId]; diff --git a/ModifyQuest.cs b/ModifyQuest.cs index 09a5d9d..b03206c 100644 --- a/ModifyQuest.cs +++ b/ModifyQuest.cs @@ -17,7 +17,8 @@ namespace MHFQuestToMH2Dos public const int cMax_GuTi = 0x16; public const int cMax_QuestStar = 8; - public const int cModify_QuestID = 0xEA74; + //public const int cModify_QuestID = 0xEA74; + public static int cModify_QuestID = 0xEA60; /// /// 道具ID超出最大限制时,修改为【不可燃烧的废物】 @@ -110,8 +111,9 @@ namespace MHFQuestToMH2Dos /// public const int cQuestInfo_QuestID_Lenght = 2; - public static bool ModifyQuset(byte[] src, out byte[] target) + public static bool ModifyQuset(byte[] src, out byte[] target, out int targetQuestID) { + targetQuestID = 0; target = HexHelper.CopyByteArr(src);//加载数据 if (ModifyFileOffset(target, out byte[] out_ModifyFileOffset)) @@ -122,9 +124,10 @@ namespace MHFQuestToMH2Dos target = out_ModifyTextOffset; else { return false; } - if (ModifyQuestMap(target, out byte[] out_ModifyQuestMap)) + if (ModifyQuestMap(target, out byte[] out_ModifyQuestMap, out int _targetQuestID)) target = out_ModifyQuestMap; else { return false; } + targetQuestID = _targetQuestID; if (ModifyQuestBOSS(target, out byte[] out_ModifyQuestBOSS)) target = out_ModifyQuestBOSS; @@ -153,6 +156,22 @@ namespace MHFQuestToMH2Dos return true; } + public static Dictionary SrcQuestID2FixID = new Dictionary(); + public static int UnUseQuestID_Index = 0; + public static int GetNextFixQuestID(int Id) + { + if (!SrcQuestID2FixID.ContainsKey(Id)) + { + int idx = ++UnUseQuestID_Index; + if (idx > MHHelper.UnUseQuestID.Count - 1) + { + idx = UnUseQuestID_Index = 0; + } + SrcQuestID2FixID[Id] = MHHelper.UnUseQuestID[idx]; + } + return SrcQuestID2FixID[Id]; + } + public static bool ModifyFileOffset(byte[] src, out byte[] target) { try @@ -387,7 +406,7 @@ namespace MHFQuestToMH2Dos } } - public static bool ModifyQuestMap(byte[] src, out byte[] target) + public static bool ModifyQuestMap(byte[] src, out byte[] target,out int targetQuestID) { try { @@ -472,11 +491,14 @@ namespace MHFQuestToMH2Dos uint _QuestID = HexHelper.bytesToUInt(target, cQuestInfo_QuestID_Lenght, _QuestInfoPtr + cQuestInfo_QuestID_Offset); + targetQuestID = (int)_QuestID; Log.HexTips(_QuestInfoPtr + cQuestInfo_QuestID_Offset, "任务编号【{0}】", _QuestID); if (_QuestID < 60000) { - HexHelper.ModifyIntHexToBytes(target, cModify_QuestID, _QuestInfoPtr + cQuestInfo_QuestID_Offset, cQuestInfo_QuestID_Lenght); - Log.HexTips(_QuestInfoPtr + cQuestInfo_QuestID_Offset, "任务编号【{0}】小于60000,修正为【{1}】,使其可下载", _QuestID, cModify_QuestID); + int targetID = GetNextFixQuestID((int)_QuestID); + targetQuestID = targetID; + HexHelper.ModifyIntHexToBytes(target, targetID, _QuestInfoPtr + cQuestInfo_QuestID_Offset, cQuestInfo_QuestID_Lenght); + Log.HexTips(_QuestInfoPtr + cQuestInfo_QuestID_Offset, "任务编号【{0}】小于60000,修正为【{1}】,使其可下载", _QuestID, targetID); } //从前4字节取出指针 定位任务信息位置 @@ -508,6 +530,7 @@ namespace MHFQuestToMH2Dos { Console.WriteLine(ex); target = null; + targetQuestID = 0; return false; } } diff --git a/Program.cs b/Program.cs index 1d5d72f..8197a66 100644 --- a/Program.cs +++ b/Program.cs @@ -10,7 +10,7 @@ namespace MHFQuestToMH2Dos const string InDir = "Input"; const string OutDir = "Out"; const string PosFile2DosDir = "PosFile2Dos"; - const string Ver = "0.3.1"; + const string Ver = "0.3.2"; static void Main(string[] args) { @@ -110,9 +110,9 @@ namespace MHFQuestToMH2Dos Console.WriteLine($">>>>>>>>>>>>>>开始处理 第{index}个文件 {FileName}<<<<<<<<<<<<<<<<<<<"); FileHelper.LoadFile(files[i], out byte[] data); - if (ModifyQuest.ModifyQuset(data, out byte[] targetdata)) + if (ModifyQuest.ModifyQuset(data, out byte[] targetdata, out int targetQuestID)) { - string newfileName = FileName + "_fix"; + string newfileName = FileName + "_fix_toid_"+ targetQuestID; string outstring = loc + OutDir + "\\" + newfileName; //LoadToSaveTemplate.GetModeType(targetdata, FileName); diff --git a/obj/Debug/net7.0/MHFQuestToMH2Dos.AssemblyInfo.cs b/obj/Debug/net7.0/MHFQuestToMH2Dos.AssemblyInfo.cs deleted file mode 100644 index fc9dd95..0000000 --- a/obj/Debug/net7.0/MHFQuestToMH2Dos.AssemblyInfo.cs +++ /dev/null @@ -1,23 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 此代码由工具生成。 -// 运行时版本: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 类生成。 -