mirror of
https://github.com/MikuLeaks/KianaBH3.git
synced 2025-12-14 05:44:34 +01:00
update to 8.5.0
This commit is contained in:
@@ -52,7 +52,7 @@ public class AudioData
|
||||
|
||||
public class AudioPreDownloadData
|
||||
{
|
||||
[JsonPropertyName("enable_time")] public long EnableTime { get; set; }
|
||||
[JsonPropertyName("enable_time")] public double EnableTime { get; set; }
|
||||
[JsonPropertyName("platform")] public Dictionary<string, string> Platform { get; set; } = new();
|
||||
[JsonPropertyName("revision")] public int Revision { get; set; }
|
||||
}
|
||||
@@ -64,7 +64,7 @@ public class VideoEncryptData
|
||||
|
||||
public class PlatformInfo
|
||||
{
|
||||
[JsonPropertyName("enable_time")] public long EnableTime { get; set; }
|
||||
[JsonPropertyName("enable_time")] public double EnableTime { get; set; }
|
||||
[JsonPropertyName("revision")] public string Revision { get; set; } = "";
|
||||
[JsonPropertyName("suffix")] public string Suffix { get; set; } = "";
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using KianaBH.Internationalization;
|
||||
using Newtonsoft.Json;
|
||||
using KianaBH.Util.Extensions;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace KianaBH.Util;
|
||||
|
||||
@@ -77,6 +78,40 @@ public static class ConfigManager
|
||||
SaveData(Hotfix, HotfixFilePath);
|
||||
}
|
||||
|
||||
public static void SaveHotfixData(string version, string decryptedText)
|
||||
{
|
||||
LoadHotfixData();
|
||||
|
||||
try
|
||||
{
|
||||
using var doc = JsonDocument.Parse(decryptedText);
|
||||
if (!doc.RootElement.TryGetProperty("manifest", out var manifestElement))
|
||||
{
|
||||
Logger.Warn($"[AUTO-HOTFIX] Manifest not found in decrypted hotfix for version {version}");
|
||||
return;
|
||||
}
|
||||
|
||||
var manifestJson = manifestElement.GetRawText();
|
||||
var manifestData = System.Text.Json.JsonSerializer.Deserialize<HotfixManfiset>(manifestJson);
|
||||
|
||||
if (manifestData == null)
|
||||
{
|
||||
Logger.Warn($"[AUTO-HOTFIX] Failed to parse manifest for version {version}");
|
||||
return;
|
||||
}
|
||||
|
||||
Hotfix.Hotfixes[version] = manifestData;
|
||||
|
||||
SaveData(Hotfix, HotfixFilePath);
|
||||
|
||||
Logger.Info($"[AUTO-HOTFIX] Saved hotfix manifest for version {version}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error($"[AUTO-HOTFIX] Failed to save hotfix data: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private static void SaveData(object data, string path)
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(data, Formatting.Indented);
|
||||
|
||||
@@ -32,4 +32,25 @@ public static class DispatchEncryption
|
||||
|
||||
return Convert.ToBase64String(encryptedBytes);
|
||||
}
|
||||
|
||||
public static string? DecryptDispatchContent(string version, string base64Data)
|
||||
{
|
||||
if (!ConfigManager.Hotfix.AesKeys.TryGetValue(version, out var aesKey))
|
||||
return null;
|
||||
|
||||
var keyBytes = aesKey.Split(' ')
|
||||
.Select(b => Convert.ToByte(b, 16))
|
||||
.ToArray();
|
||||
|
||||
using var aes = Aes.Create();
|
||||
aes.Mode = CipherMode.ECB;
|
||||
aes.Padding = PaddingMode.PKCS7;
|
||||
aes.Key = keyBytes;
|
||||
|
||||
var decryptor = aes.CreateDecryptor();
|
||||
var dataBytes = Convert.FromBase64String(base64Data);
|
||||
var decryptedBytes = decryptor.TransformFinalBlock(dataBytes, 0, dataBytes.Length);
|
||||
|
||||
return Encoding.UTF8.GetString(decryptedBytes);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
public static class GameConstants
|
||||
{
|
||||
public const string GAME_VERSION = "8.2.0";
|
||||
public const string GAME_VERSION = "8.5.0";
|
||||
public const int MAX_STAMINA = 300;
|
||||
public const int STAMINA_RECOVERY_TIME = 360; // 6 minutes
|
||||
public const int STAMINA_RESERVE_RECOVERY_TIME = 1080; // 18 minutes
|
||||
|
||||
Reference in New Issue
Block a user