2024-05-21 19:10:17 +01:00
|
|
|
|
using SPT.Reflection.Patching;
|
2024-03-05 20:21:31 +00:00
|
|
|
|
using EFT.UI;
|
2024-03-11 08:44:50 +00:00
|
|
|
|
using EFT;
|
2024-03-05 20:21:31 +00:00
|
|
|
|
using HarmonyLib;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using TMPro;
|
2024-03-06 08:49:49 +00:00
|
|
|
|
using UnityEngine;
|
2024-06-15 15:59:09 +00:00
|
|
|
|
using System.Threading.Tasks;
|
2024-07-12 15:20:47 +01:00
|
|
|
|
using SPT.Custom.Utils;
|
2024-03-05 20:21:31 +00:00
|
|
|
|
|
2024-07-12 15:20:47 +01:00
|
|
|
|
namespace SPT.Custom.Patches
|
2024-03-05 20:21:31 +00:00
|
|
|
|
{
|
2024-03-11 08:44:50 +00:00
|
|
|
|
public class BetaLogoPatch : ModulePatch
|
2024-03-05 20:21:31 +00:00
|
|
|
|
{
|
|
|
|
|
protected override MethodBase GetTargetMethod()
|
|
|
|
|
{
|
2024-06-15 15:59:09 +00:00
|
|
|
|
return AccessTools.FirstMethod(typeof(TarkovApplication), IsTargetMethod);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool IsTargetMethod(MethodInfo method)
|
|
|
|
|
{
|
|
|
|
|
ParameterInfo[] parameters = method.GetParameters();
|
|
|
|
|
|
|
|
|
|
return method.ReturnType == typeof(Task)
|
2024-10-13 11:17:12 +01:00
|
|
|
|
&& parameters.Length == 4
|
2024-06-15 15:59:09 +00:00
|
|
|
|
&& parameters[0].ParameterType == typeof(Profile)
|
|
|
|
|
&& parameters[1].ParameterType == typeof(ProfileStatusClass);
|
2024-03-05 20:21:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[PatchPrefix]
|
2024-08-02 16:57:59 +01:00
|
|
|
|
public static void PatchPrefix(Profile profile)
|
2024-03-05 20:21:31 +00:00
|
|
|
|
{
|
|
|
|
|
MonoBehaviourSingleton<PreloaderUI>.Instance.SetWatermarkStatus(profile, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-11 08:44:50 +00:00
|
|
|
|
public class BetaLogoPatch2 : ModulePatch
|
2024-03-05 20:21:31 +00:00
|
|
|
|
{
|
|
|
|
|
protected override MethodBase GetTargetMethod()
|
|
|
|
|
{
|
|
|
|
|
return AccessTools.Method(typeof(ClientWatermark), nameof(ClientWatermark.method_0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[PatchPostfix]
|
2024-08-02 16:57:59 +01:00
|
|
|
|
public static void PatchPostfix(ref TextMeshProUGUI ____label, Profile ___profile_0)
|
2024-03-05 20:21:31 +00:00
|
|
|
|
{
|
2024-03-11 08:44:50 +00:00
|
|
|
|
____label.text = $"{MenuNotificationManager.commitHash}";
|
2024-03-05 20:21:31 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-03-06 08:49:49 +00:00
|
|
|
|
|
2024-03-11 08:44:50 +00:00
|
|
|
|
public class BetaLogoPatch3 : ModulePatch
|
2024-03-06 08:49:49 +00:00
|
|
|
|
{
|
|
|
|
|
protected override MethodBase GetTargetMethod()
|
|
|
|
|
{
|
|
|
|
|
return AccessTools.Method(typeof(ClientWatermark), nameof(ClientWatermark.smethod_0));
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-11 08:44:50 +00:00
|
|
|
|
// Prefix so the logic isn't being duplicated.
|
2024-03-06 08:49:49 +00:00
|
|
|
|
[PatchPrefix]
|
2024-08-02 16:57:59 +01:00
|
|
|
|
public static bool PatchPrefix(int screenHeight, int screenWidth, int rectHeight, int rectWidth, ref Vector2 __result)
|
2024-03-11 08:44:50 +00:00
|
|
|
|
{
|
2024-03-06 08:49:49 +00:00
|
|
|
|
System.Random random = new System.Random();
|
2024-03-11 08:44:50 +00:00
|
|
|
|
|
2024-03-06 08:49:49 +00:00
|
|
|
|
int maxX = (screenWidth / 4) - (rectWidth / 2);
|
|
|
|
|
int maxY = (screenHeight / 4) - (rectHeight / 2);
|
|
|
|
|
int newX = random.Next(-maxX, maxX);
|
|
|
|
|
int newY = random.Next(-maxY, maxY);
|
|
|
|
|
|
|
|
|
|
__result = new Vector2(newX, newY);
|
2024-03-11 08:44:50 +00:00
|
|
|
|
|
2024-10-03 10:28:48 +01:00
|
|
|
|
return false; // Skip original
|
2024-03-06 08:49:49 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-03-05 20:21:31 +00:00
|
|
|
|
}
|