try to convert data

This commit is contained in:
NguyenVanDat
2025-10-09 18:04:19 +07:00
parent 9f7bd68db8
commit c542d99ac8
+24 -7
View File
@@ -2457,10 +2457,22 @@ namespace PerfectWorld.Scripts.Task
}
private bool LoadFixedDataFromBinFile(FileStream fp)
{
for (int i = 1; i <= 8; i++)
{
for (int j = 1; j <= 8; j++)
{
Debug.LogError($"==== {i},{j} ===");
ConvertFixedData(fp, i, j);
Debug.LogError($"==========");
}
}
return true;
}
private void ConvertFixedData(FileStream fp, int x1, int x2)
{
long readBytes = 0;
BMLogger.Log($"LoadFixedDataFromBinFile: {fp.Length}");
ATaskTemplFixedData fixedData;
// Task ID
@@ -2468,17 +2480,26 @@ namespace PerfectWorld.Scripts.Task
BMLogger.Log($"LoadFixedDataFromBinFile: {fixedData.m_ID}");
// Task Name (task_char m_szName[MAX_TASK_NAME_LEN];)
fixedData.m_szName = AAssit.ReadArrayFromBinary<ushort>(fp, TaskTemplConstants.MAX_TASK_NAME_LEN, ref readBytes);
fixedData.m_szName = AAssit.ReadArrayFromBinary<ushort>(fp, x1*TaskTemplConstants.MAX_TASK_NAME_LEN, ref readBytes);
// Debug.LogError($"m_szName: {fixedData.m_szName}");
// Has Signature (bool m_bHasSign;)
fixedData.m_bHasSign = AAssit.ReadFromBinaryOf<bool>(fp, ref readBytes);
Debug.LogError($"m_bHasSign: {fixedData.m_bHasSign}");
// Signature pointer (task_char* m_pszSignature;)
// Only the pointer address is stored in the binary (skip 4 bytes)
fp.Seek(2, SeekOrigin.Current);
fp.Seek(x2, SeekOrigin.Current);
// Task Type (unsigned long m_ulType;)
fixedData.m_ulType = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
// Debug.LogError($"Type: {fixedData.m_ulType}");
if (fixedData.m_ulType == 103)
{
//fixedData.m_bHasSign ==0 &&
Debug.LogError("Catch it!");
}
// Time Limit (unsigned long m_ulTimeLimit;)
fixedData.m_ulTimeLimit = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
@@ -2525,11 +2546,7 @@ namespace PerfectWorld.Scripts.Task
// Random one subtask (bool m_bRandOne;)
fixedData.m_bRandOne = AAssit.ReadFromBinaryOf<bool>(fp, ref readBytes);
return true;
}
#region convert from c++ to cs