0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 09:50:43 -05:00

Cache version result in patch

This commit is contained in:
Dev 2024-03-05 20:28:51 +00:00
parent a4fd3aa42c
commit 26263cb848

View File

@ -26,6 +26,8 @@ namespace Aki.Debugging.Patches
public class DebugLogoPatch2 : ModulePatch
{
private static string sptVersion;
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(ClientWatermark), nameof(ClientWatermark.method_0));
@ -34,10 +36,13 @@ namespace Aki.Debugging.Patches
[PatchPostfix]
private static void patchPostfix(ref TextMeshProUGUI ____label, Profile ___profile_0)
{
var json = RequestHandler.GetJson("/singleplayer/settings/version");
var result = Json.Deserialize<VersionResponse>(json).Version;
if (sptVersion is null)
{
var json = RequestHandler.GetJson("/singleplayer/settings/version");
sptVersion = Json.Deserialize<VersionResponse>(json).Version;
}
____label.text = $"SPT BLEEDINGEDGE \n {result} \n {___profile_0.Nickname} \n {GClass1296.Now.ToString("HH:mm:ss")}";
____label.text = $"SPT BLEEDINGEDGE \n {sptVersion} \n {___profile_0.Nickname} \n {GClass1296.Now.ToString("HH:mm:ss")}";
}
}
}