Due to update 2.4.3, some mods may no longer function. FixedConfig may be necessary.
Decompiled source of BoplMapScale v1.2.2
BoplMapScale.dll
Decompiled 16 hours agousing System; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Logging; using BoplFixedMath; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] [BepInPlugin("local.bopl.mapscale", "Bopl Map Scale", "1.2.2")] public class MapScalePlugin : BaseUnityPlugin { internal const float FollowWeight = 5f; internal static float Multiplier = 1.5f; internal static ManualLogSource Log; private void Awake() { //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; Multiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Multiplier", 1.5f, "Scale factor for camera and blast zone bounds. Must be identical for every player in a lobby.").Value; if (Multiplier <= 0f) { ((BaseUnityPlugin)this).Logger.LogError((object)"Multiplier must be greater than zero. Bounds left unchanged."); return; } RuntimeHelpers.RunClassConstructor(typeof(SceneBounds).TypeHandle); ScaleField("Camera_XMin"); ScaleField("Camera_XMax"); ScaleField("Camera_YMin"); ScaleField("Camera_YMax"); ScaleField("BlastZone_XMin"); ScaleField("BlastZone_XMax"); ScaleField("BlastZone_YMax"); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Multiplier " + Multiplier + " applied. Camera X [" + (float)SceneBounds.Camera_XMin + ", " + (float)SceneBounds.Camera_XMax + "], Y [" + (float)SceneBounds.Camera_YMin + ", " + (float)SceneBounds.Camera_YMax + "], BlastZone X [" + (float)SceneBounds.BlastZone_XMin + ", " + (float)SceneBounds.BlastZone_XMax + "], Y max " + (float)SceneBounds.BlastZone_YMax)); try { new Harmony("local.bopl.mapscale").PatchAll(typeof(MapScalePlugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Harmony patched PlayerAverageCamera.LateUpdate"); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Harmony patch failed: " + ex)); } } private static void ScaleField(string name) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) FieldInfo field = typeof(SceneBounds).GetField(name, BindingFlags.Static | BindingFlags.Public); Fix val = (Fix)field.GetValue(null); field.SetValue(null, (Fix)((float)val * Multiplier)); } } [HarmonyPatch(typeof(PlayerAverageCamera), "LateUpdate")] internal static class CameraLateUpdatePatch { private static readonly ConditionalWeakTable<PlayerAverageCamera, object> Configured = new ConditionalWeakTable<PlayerAverageCamera, object>(); [HarmonyPrefix] private static void Prefix(PlayerAverageCamera __instance) { if (!Configured.TryGetValue(__instance, out var _)) { Configured.Add(__instance, null); bool updateY = __instance.UpdateY; float weight = __instance.weight; float mIN_ZOOM = __instance.MIN_ZOOM; float mAX_ZOOM = __instance.MAX_ZOOM; __instance.UpdateY = true; __instance.weight = 5f; __instance.MAX_ZOOM *= MapScalePlugin.Multiplier; MapScalePlugin.Log.LogInfo((object)("Camera hooked on " + ((Object)((Component)__instance).gameObject).name + ": UpdateY " + updateY + " -> true, weight " + weight + " -> " + 5f + ", MIN_ZOOM " + mIN_ZOOM + " -> " + __instance.MIN_ZOOM + ", MAX_ZOOM " + mAX_ZOOM + " -> " + __instance.MAX_ZOOM)); } } }