using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("UltimateZooM")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UltimateZooM")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("80e4ff79-cc79-4b33-b3d7-24239e5284c5")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace UltimateZooM;
[BepInPlugin("Maras.UltimateZooM", "Ultimate ZooM", "12.0.0")]
public class ZoomMod : BaseUnityPlugin
{
public static int CurrentMode;
private float timePressedQ = 0f;
private float timePressedE = 0f;
private bool actionTaken = false;
private void Awake()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Expected O, but got Unknown
((BaseUnityPlugin)this).Logger.LogInfo((object)"Ultimate ZooM 12.0 (Strict Sync) - START!");
Camera.onPreCull = (CameraCallback)Delegate.Combine((Delegate?)(object)Camera.onPreCull, (Delegate?)new CameraCallback(ApplyMatrixZoom));
Harmony.CreateAndPatchAll(typeof(LocalizationPatch), (string)null);
}
private void OnDestroy()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
Camera.onPreCull = (CameraCallback)Delegate.Remove((Delegate?)(object)Camera.onPreCull, (Delegate?)new CameraCallback(ApplyMatrixZoom));
}
private void Update()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name == "MainMenu")
{
CurrentMode = 0;
return;
}
if (Input.GetKeyDown((KeyCode)113))
{
timePressedQ = Time.time;
}
if (Input.GetKeyDown((KeyCode)101))
{
timePressedE = Time.time;
}
bool key = Input.GetKey((KeyCode)113);
bool key2 = Input.GetKey((KeyCode)101);
if (key && key2)
{
float num = Mathf.Abs(timePressedQ - timePressedE);
if (num < 0.3f && !actionTaken)
{
CurrentMode++;
if (CurrentMode > 3)
{
CurrentMode = 0;
}
actionTaken = true;
}
}
else
{
actionTaken = false;
}
}
private void ApplyMatrixZoom(Camera cam)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
if (((Object)cam).name.Contains("Ui") || ((Object)cam).name.Contains("UI"))
{
return;
}
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name == "MainMenu")
{
return;
}
if (cam.farClipPlane < 10000f)
{
cam.farClipPlane = 10000f;
}
cam.useOcclusionCulling = false;
try
{
MonoBehaviour[] components = ((Component)cam).gameObject.GetComponents<MonoBehaviour>();
MonoBehaviour[] array = components;
foreach (MonoBehaviour val in array)
{
if (!((Object)(object)val == (Object)null))
{
string name = ((object)val).GetType().Name;
if ((name.Contains("Blur") || name.Contains("Depth") || name.Contains("DoF")) && ((Behaviour)val).enabled)
{
((Behaviour)val).enabled = false;
}
}
}
}
catch
{
}
float num = 1f;
if (CurrentMode == 2)
{
num = 0.666f;
}
if (CurrentMode == 3)
{
num = 0.5f;
}
if (num == 1f)
{
cam.ResetProjectionMatrix();
return;
}
cam.ResetProjectionMatrix();
Matrix4x4 projectionMatrix = cam.projectionMatrix;
projectionMatrix.m00 *= num;
projectionMatrix.m11 *= num;
cam.projectionMatrix = projectionMatrix;
}
}
[HarmonyPatch]
public class LocalizationPatch
{
private static MethodBase TargetMethod()
{
Type type = AccessTools.TypeByName("I2.Loc.LocalizationManager");
if (type == null)
{
return null;
}
return AccessTools.Method(type, "GetTranslation", (Type[])null, (Type[])null);
}
private static void Postfix(string Term, ref string __result)
{
if (!string.IsNullOrEmpty(__result) && ZoomMod.CurrentMode >= 2)
{
if (ZoomMod.CurrentMode == 2 && (Term.Contains("AllPlayers") || Term.Contains("Everyone")))
{
__result += " +50%";
}
if (ZoomMod.CurrentMode == 3 && (Term.Contains("LocalOnly") || Term.Contains("Local")))
{
__result += " +100%";
}
}
}
}