2024-05-21 19:10:17 +01:00
|
|
|
using SPT.Reflection.Patching;
|
2023-03-03 18:52:31 +00:00
|
|
|
using EFT.UI;
|
|
|
|
using System.IO;
|
|
|
|
using System.Reflection;
|
2024-01-13 22:08:29 +00:00
|
|
|
using EFT;
|
|
|
|
using HarmonyLib;
|
2023-03-03 18:52:31 +00:00
|
|
|
using UnityEngine;
|
|
|
|
|
2024-05-21 19:10:17 +01:00
|
|
|
namespace SPT.Custom.Patches
|
2023-03-03 18:52:31 +00:00
|
|
|
{
|
|
|
|
public class SessionIdPatch : ModulePatch
|
|
|
|
{
|
|
|
|
private static PreloaderUI _preloader;
|
|
|
|
|
|
|
|
protected override MethodBase GetTargetMethod()
|
|
|
|
{
|
2024-04-03 15:38:14 +01:00
|
|
|
return AccessTools.Method(typeof(BaseLocalGame<EftGamePlayerOwner>), nameof(BaseLocalGame<EftGamePlayerOwner>.method_5));
|
2024-01-13 22:08:29 +00:00
|
|
|
}
|
2023-03-03 18:52:31 +00:00
|
|
|
|
|
|
|
[PatchPostfix]
|
|
|
|
private static void PatchPostfix()
|
|
|
|
{
|
|
|
|
if (_preloader == null)
|
|
|
|
{
|
|
|
|
_preloader = Object.FindObjectOfType<PreloaderUI>();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_preloader != null)
|
|
|
|
{
|
|
|
|
var raidID = Path.GetRandomFileName().Replace(".", string.Empty).Substring(0, 6).ToUpperInvariant();
|
|
|
|
_preloader.SetSessionId(raidID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|