Due to update 2.4.3, some mods may no longer function. FixedConfig may be necessary.
Decompiled source of CameraPlus v1.0.0
CameraPlus.dll
Decompiled 6 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BoplFixedMath; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")] [assembly: AssemblyCompany("CameraPlus")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Allows more customization for the camera")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CameraPlus")] [assembly: AssemblyTitle("CameraPlus")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace CameraPlus; [BepInPlugin("com.PizzaMan730.CameraPlus", "CameraPlus", "1.0.0")] public class Plugin : BaseUnityPlugin { public static ConfigFile config; public static ConfigEntry<int> cameraType; private void Awake() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown config = ((BaseUnityPlugin)this).Config; cameraType = config.Bind<int>("Camera Plus", "Type", 1, "Camera type to use. 1 = Normal, 2 = Static, 3 = Custom, 4 = Custom (No Vertical), 5 = Follow Local (Custom), 6 = Follow Local (Custom, No Vertical)"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"CameraPlus has loaded!"); Harmony val = new Harmony("com.PizzaMan730.CameraPlus"); MethodInfo methodInfo = AccessTools.Method(typeof(PlayerAverageCamera), "UpdateCamera", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(Patches), "UpdateCamera", (Type[])null, (Type[])null); if (cameraType.Value != 1) { val.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } } [HarmonyPatch] public class Patches { public static bool UpdateCamera(ref PlayerAverageCamera __instance, ref Camera ___camera) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: 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_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) int value = Plugin.cameraType.Value; if (value == 2) { return false; } List<Player> list = PlayerHandler.Get().PlayerList(); int num = 0; Vec2 val = default(Vec2); Vec2 val2 = default(Vec2); foreach (Player item in list) { if (item.IsAlive) { val += item.Position; num++; if (item.IsLocalPlayer) { val2 = item.Position; } } } if (value == 5 || value == 6) { val = val2; num = 1; } ref Fix x = ref val.x; x /= (Fix)(long)num; ref Fix y = ref val.y; y /= (Fix)(long)num; Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor((float)val.x, (float)val.y, ((Component)__instance).transform.position.z); val3 = ((Component)__instance).transform.position + (val3 - ((Component)__instance).transform.position) * (1f - Mathf.Pow(0.995f, 2f)); val3.y = Mathf.Max(__instance.MinHeightAboveFloor - 15f, val3.y); val3.x = __instance.RoundToNearestPixel(val3.x); val3.y = __instance.RoundToNearestPixel(val3.y); if (value == 4 || value == 6) { val3.y = __instance.MinHeightAboveFloor - 7.5f; } ((Component)__instance).transform.position = val3; return false; } } public static class PluginInfo { public const string PLUGIN_GUID = "CameraPlus"; public const string PLUGIN_NAME = "CameraPlus"; public const string PLUGIN_VERSION = "1.0.0"; }