fixed Item Pouch
This commit is contained in:
parent
596fdd459c
commit
cd7399e2c0
@ -411,7 +411,34 @@ namespace Axibug.MHFSaveAutoConverter.DataStruct
|
||||
public class s_pGardenData花园 : s_base_Bytesarray { }
|
||||
public class s_pRP : s_2byte_Int16_Base { }
|
||||
public class s_pKQF : s_base_Bytesarray { }
|
||||
public class s_ItemPouch背包 : s_base_BytesarrayGroup { }
|
||||
public class ExtraBox背包 : s_base_BytesarrayGroup { }
|
||||
public class s_ItemPouch背包 : s_base_BytesarrayGroup {
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string str = string.Empty;
|
||||
|
||||
byte[] itemiddata = new byte[2];
|
||||
byte[] countdata = new byte[2];
|
||||
|
||||
List<(int, int)> itemdata = new List<(int, int)>();
|
||||
for (int block = 0; block < SrcCfg.block_count; block++)
|
||||
{
|
||||
int startptr = (block * SrcCfg.block_single_len);
|
||||
for (int i = 0; i < SrcCfg.block_single_len; i++)
|
||||
{
|
||||
if (i == 0) itemiddata[0] = data[startptr + i];
|
||||
if (i == 1) itemiddata[1] = data[startptr + i];
|
||||
if (i == 2) countdata[0] = data[startptr + i];
|
||||
if (i == 3) countdata[1] = data[startptr + i];
|
||||
}
|
||||
itemdata.Add((HexHelper.bytesToInt(itemiddata, 2, 0), HexHelper.bytesToInt(countdata, 2, 0)));
|
||||
}
|
||||
foreach (var item in itemdata)
|
||||
str += $"{MHHelper.Get2MHFItemName(item.Item1)}:{item.Item2}\r\n";
|
||||
return str;
|
||||
}
|
||||
}
|
||||
public class s_Keyquestflag : s_base_Bytesarray { }
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,13 +68,13 @@ namespace Axibug.MHFSaveAutoConverter.DataStruct
|
||||
{nameof(s_SR_重弩_Status2),s_SR_重弩_Status2.CreateCfg(0xF65B+(1*9))},
|
||||
{nameof(s_SR_弓_Status2),s_SR_弓_Status2.CreateCfg(0xF65B+(1*10)) },
|
||||
|
||||
{nameof(s_ItemPresets_counts),s_ItemPresets_counts.CreateCfg(0xF960,1,30)},
|
||||
{nameof(s_pToreData),s_pToreData.CreateCfg(0xF314,240)},
|
||||
{nameof(s_pHR),s_pHR.CreateCfg(0xF456)},
|
||||
{nameof(s_pGRP),s_pGRP.CreateCfg(-1)},
|
||||
{nameof(s_pHouseData),s_pHouseData.CreateCfg(0xF461,195)},
|
||||
{nameof(s_Gzenn) ,s_Gzenn.CreateCfg(-1)},
|
||||
{nameof(s_Stylevouchers) ,s_Stylevouchers.CreateCfg(-1)},
|
||||
{nameof(s_ItemPresets_counts),s_ItemPresets_counts.CreateCfg(0xF960,1,30)},
|
||||
{nameof(s_Socialize) ,s_Socialize.CreateCfg(0x1084C,0x10E30 - 0x1084C)},//社交数据
|
||||
{nameof(s_CP) ,s_CP.CreateCfg(0x10944)},
|
||||
{nameof(s_知名度) ,s_知名度.CreateCfg(0x10948)},
|
||||
@ -85,7 +85,7 @@ namespace Axibug.MHFSaveAutoConverter.DataStruct
|
||||
{nameof(s_pRP),s_pRP.CreateCfg(0x12376)},
|
||||
{nameof(s_pKQF),s_pKQF.CreateCfg(-1,8)},
|
||||
/*单个道具长度8byte,前20个是item/道具 后10个是ammo/弹药*/
|
||||
{nameof(s_ItemPouch背包),s_ItemPouch背包.CreateCfg(-1,8,20+10)},
|
||||
{nameof(s_ItemPouch背包),s_ItemPouch背包.CreateCfg(0xEBC8,8,20/*+10*/)},
|
||||
{nameof(s_Keyquestflag),s_Keyquestflag.CreateCfg(-1,8) },
|
||||
}
|
||||
},
|
||||
@ -150,7 +150,6 @@ namespace Axibug.MHFSaveAutoConverter.DataStruct
|
||||
{nameof(s_SR_重弩_Status2),s_SR_重弩_Status2.CreateCfg(0x1A3B0+(1*10))},
|
||||
{nameof(s_SR_弓_Status2),s_SR_弓_Status2.CreateCfg(0x1A3B0+(1*11)) },
|
||||
|
||||
{nameof(s_ItemPresets_counts),s_ItemPresets_counts.CreateCfg(0x17660,1,30)},
|
||||
{nameof(s_pToreData),s_pToreData.CreateCfg(0x17014,240)},
|
||||
{nameof(s_pHR),s_pHR.CreateCfg(0x17156)},
|
||||
{nameof(s_pGRP),s_pGRP.CreateCfg(0x1715C)},
|
||||
@ -158,6 +157,7 @@ namespace Axibug.MHFSaveAutoConverter.DataStruct
|
||||
{nameof(s_Gzenn) ,s_Gzenn.CreateCfg(0x172C4)},
|
||||
{nameof(s_Stylevouchers) ,s_Stylevouchers.CreateCfg(-1)},
|
||||
{nameof(s_Socialize) ,s_Socialize.CreateCfg(0x1854C,0x18B30 - 0x1854C)},//社交数据
|
||||
{nameof(s_ItemPresets_counts),s_ItemPresets_counts.CreateCfg(0x17660,1,30)},
|
||||
{nameof(s_CP) ,s_CP.CreateCfg(0x18644)},
|
||||
{nameof(s_知名度) ,s_知名度.CreateCfg(0x18648)},
|
||||
{nameof(s_知名度称号) ,s_知名度称号.CreateCfg(0x1864C)},
|
||||
@ -167,7 +167,7 @@ namespace Axibug.MHFSaveAutoConverter.DataStruct
|
||||
{nameof(s_pRP),s_pRP.CreateCfg(0x1A076)},
|
||||
{nameof(s_pKQF),s_pKQF.CreateCfg(0x1B080,8)},
|
||||
/*单个道具长度8byte,前20个是item/道具 后10个是ammo/弹药*/
|
||||
{nameof(s_ItemPouch背包),s_ItemPouch背包.CreateCfg(-1,8,20+10)},
|
||||
{nameof(s_ItemPouch背包),s_ItemPouch背包.CreateCfg(0x168C8,8,20/*+10*/)},
|
||||
{nameof(s_Keyquestflag),s_Keyquestflag.CreateCfg(-1,8) },
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,13 +39,13 @@ namespace Axibug.MHFSaveAutoConverter.Data
|
||||
byte[] decdata = MHFCompression.Decompress(src);
|
||||
System.IO.File.WriteAllBytes(path, decdata);
|
||||
Console.WriteLine($"{from}_{srccid}_角色数据{name},已保存数据到:{path}");
|
||||
SaveDataEntity se = new SaveDataEntity(from, target, decdata);
|
||||
if (onlydumpsrc)
|
||||
{
|
||||
err = default;
|
||||
targetdata = default;
|
||||
return true;
|
||||
}
|
||||
SaveDataEntity se = new SaveDataEntity(from, target, decdata);
|
||||
string updateoutpath = $"update_{target}_cid_{srccid}_{DateTime.Now.ToString("yyyyMMddHHmmss")}" + "_fixed.bin";
|
||||
targetdata = se.DoConvert();
|
||||
System.IO.File.WriteAllBytes(updateoutpath, targetdata);
|
||||
|
||||
10
Program.cs
10
Program.cs
@ -111,6 +111,7 @@ namespace Axibug.MHFSaveAutoConverter
|
||||
continue;
|
||||
}
|
||||
|
||||
//if (!UpdateTargetDB(targetuserid, is_female, name, targetdata))
|
||||
if (!InsertTargetDB(targetuserid, is_female, name, targetdata))
|
||||
{
|
||||
Console.WriteLine($"写入目标{target}数据库失败");
|
||||
@ -132,6 +133,15 @@ namespace Axibug.MHFSaveAutoConverter
|
||||
return SQLRUN_TARGET_DB.ExcuteSQL(str,new List<NpgsqlParameter> { savedataparam });
|
||||
}
|
||||
|
||||
|
||||
public static bool UpdateTargetDB(long cid, bool is_female, string name, byte[] targetdata)
|
||||
{
|
||||
string str = $"UPDATE \"characters\" set savedata = @savedata where \"id\" = {cid};";
|
||||
var savedataparam = new NpgsqlParameter("@savedata", NpgsqlDbType.Bytea);
|
||||
savedataparam.Value = targetdata;
|
||||
return SQLRUN_TARGET_DB.ExcuteSQL(str, new List<NpgsqlParameter> { savedataparam });
|
||||
}
|
||||
|
||||
//public static SaveDataEntity SetData(long cid, string name, byte[] srcdata)
|
||||
//{
|
||||
// string path = $"savedata_cid_{cid}_{DateTime.Now.ToString("yyyyMMddHHmmss")}" + "_解密.bin";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user