修正某些物品,过滤遗漏

This commit is contained in:
sin365 2023-04-08 17:48:08 +08:00
parent 7068f96961
commit d071e6f692
6 changed files with 66 additions and 19 deletions

View File

@ -22,7 +22,12 @@ namespace MHFQuestToMH2Dos
public static bool CheckEnd(byte[] data, int Ptr) 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;
} }

View File

@ -782,7 +782,7 @@ namespace MHFQuestToMH2Dos
//若遇到结束符或无数据 //若遇到结束符或无数据
if (MHHelper.CheckEnd(target, _SuppliesItem_CurrPtr) if (MHHelper.CheckEnd(target, _SuppliesItem_CurrPtr)
|| ||
HexHelper.bytesToInt(target, 1, _SuppliesItem_CurrPtr) == 0 HexHelper.bytesToInt(target, 4, _SuppliesItem_CurrPtr) == 0
) )
{ {
Log.HexInfo(_SuppliesItem_CurrPtr, "主线支援道具,结束符"); Log.HexInfo(_SuppliesItem_CurrPtr, "主线支援道具,结束符");
@ -812,7 +812,7 @@ namespace MHFQuestToMH2Dos
//若遇到结束符或无数据 //若遇到结束符或无数据
if (MHHelper.CheckEnd(target, _SuppliesItem_Zhi_1_CurrPtr) 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支援道具结束符"); Log.HexInfo(_SuppliesItem_Zhi_1_CurrPtr, "支线1支援道具结束符");
@ -842,7 +842,7 @@ namespace MHFQuestToMH2Dos
//若遇到结束符或无数据 //若遇到结束符或无数据
if (MHHelper.CheckEnd(target, _SuppliesItem_Zhi_2_CurrPtr) 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支援道具结束符"); Log.HexInfo(_SuppliesItem_Zhi_2_CurrPtr, "支线2支援道具结束符");
@ -889,10 +889,14 @@ namespace MHFQuestToMH2Dos
for (int i = 0; i < 90; i++) for (int i = 0; i < 90; i++)
{ {
if (i == 44)
{
}
//若遇到结束符或无数据 //若遇到结束符或无数据
if (MHHelper.CheckEnd(target, _ItemPoint_CurrPtr) 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, "采集点结束"); Log.HexInfo(_ItemPoint_CurrPtr, "采集点结束");
@ -909,11 +913,11 @@ namespace MHFQuestToMH2Dos
{ {
//若遇到结束符或无数据 //若遇到结束符或无数据
if (MHHelper.CheckEnd(target, ItemCurrPtr) 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; break;
} }
int Pr = HexHelper.bytesToInt(target, 2, ItemCurrPtr);//概率 int Pr = HexHelper.bytesToInt(target, 2, ItemCurrPtr);//概率
@ -922,12 +926,14 @@ namespace MHFQuestToMH2Dos
//判断道具ID是否超限 //判断道具ID是否超限
if (ItemID > cMax_ItemID) 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); 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 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++; setCount++;
ItemCurrPtr += 0x04; ItemCurrPtr += 0x04;
@ -965,7 +971,7 @@ namespace MHFQuestToMH2Dos
|| ||
MHHelper.CheckEnd(target, _FishGroup_CurrPtr) MHHelper.CheckEnd(target, _FishGroup_CurrPtr)
|| ||
HexHelper.bytesToInt(target, 1, _FishGroup_CurrPtr) == 0 HexHelper.bytesToInt(target, 4, _FishGroup_CurrPtr) == 0
) )
{ {
Log.HexInfo(_FishGroup_CurrPtr, $"第{setFishGroup}鱼群代号 结束符"); Log.HexInfo(_FishGroup_CurrPtr, $"第{setFishGroup}鱼群代号 结束符");
@ -980,7 +986,7 @@ namespace MHFQuestToMH2Dos
//鱼群季节循环 //鱼群季节循环
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
{ {
//鱼群代号结束符 //鱼群季节结束符
if ( if (
_FishSeason_CurrPtr >= target.Length _FishSeason_CurrPtr >= target.Length
|| ||
@ -999,13 +1005,13 @@ namespace MHFQuestToMH2Dos
int setFish = 0; int setFish = 0;
while (true) while (true)
{ {
//鱼群代号结束符 //鱼结束符
if ( if (
_FishStart_CurrPtr >= target.Length _FishStart_CurrPtr >= target.Length
|| ||
MHHelper.CheckEnd(target, _FishStart_CurrPtr) MHHelper.CheckEndWith1Byte(target, _FishStart_CurrPtr)
|| //||
HexHelper.bytesToInt(target, 1, _FishStart_CurrPtr) == 0 //HexHelper.bytesToInt(target, 1, _FishStart_CurrPtr) == 0
) )
{ {
Log.HexInfo(_FishStart_CurrPtr, $"第{setFishGroup}鱼群代号 第{i}个季节昼夜 第" + setFish + "个鱼 结束符"); Log.HexInfo(_FishStart_CurrPtr, $"第{setFishGroup}鱼群代号 第{i}个季节昼夜 第" + setFish + "个鱼 结束符");

View File

@ -4,6 +4,7 @@
关联 皓月PS2 联机服务器,和 皓月MHF 怪物猎人边境服务器。 关联 皓月PS2 联机服务器,和 皓月MHF 怪物猎人边境服务器。
### 大致描述 ### ### 大致描述 ###
通过一系列,数据处理,指针处理。 通过一系列,数据处理,指针处理。
@ -15,11 +16,11 @@
YouTuBe YouTuBe
<a href="https://www.youtube.com/watch?v=rTiA-OwAVTs" title=""><img width = "320" height = "240" src="https://res.cloudinary.com/marcomontalbano/image/upload/v1680856711/video_to_markdown/images/youtube--rTiA-OwAVTs-c05b58ac6eb4c4700831b2b3070cd403.jpg" alt="" /></a> <a href="https://www.youtube.com/watch?v=rTiA-OwAVTs" title=""><img width = "672" height = "378" src="https://res.cloudinary.com/marcomontalbano/image/upload/v1680856711/video_to_markdown/images/youtube--rTiA-OwAVTs-c05b58ac6eb4c4700831b2b3070cd403.jpg" alt="" /></a>
Bilibili: Bilibili:
<a href="https://www.bilibili.com/video/BV1dc411L7eZ/" title=""><img width = "320" height = "240" src="http://i1.hdslb.com/bfs/archive/2e49f2ff60765db2d2948bff37c9bc2926e6600a.jpg" alt="" /></a> <a href="https://www.bilibili.com/video/BV1dc411L7eZ/" title=""><img width = "672" height = "378" src="http://i1.hdslb.com/bfs/archive/2e49f2ff60765db2d2948bff37c9bc2926e6600a.jpg" alt="" /></a>
### 使用前提 ### ### 使用前提 ###

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v7.0", FrameworkDisplayName = ".NET 7.0")]

View File

@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
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 类生成。

View File

@ -0,0 +1,8 @@
// <auto-generated/>
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;