using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using RoR2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace KonaltSizeChanger; [BepInPlugin("Konalt.KonaltSizeChanger", "Exponential Size", "2.5.3")] public sealed class KonaltSizeChangerPlugin : BaseUnityPlugin { private const string PluginGuid = "Konalt.KonaltSizeChanger"; private const string PluginName = "Exponential Size"; private const string PluginVersion = "2.5.3"; private const float GrowthPerStage = 1.2f; private const float CameraDistancePerStage = 0.15f; private const float CameraHeightCorrection = 0.5f; private int pendingGrowth; private int growthStages; private float growthFactor = 1f; private CameraTargetParams cachedCameraTargetParams; private Vector3 baseCameraPosition; private float baseCameraPivotOffset; private void Awake() { Stage.onStageStartGlobal += OnStageStart; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Stage growth is enabled."); } private void OnDestroy() { Stage.onStageStartGlobal -= OnStageStart; } private void OnStageStart(Stage stage) { growthFactor *= 1.2f; growthStages++; pendingGrowth++; } private void Update() { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_018c: 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_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) if (growthStages == 0) { return; } foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { CharacterBody body = instance.master.GetBody(); if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.modelLocator) && Object.op_Implicit((Object)(object)body.modelLocator.modelTransform)) { body.modelLocator.modelTransform.localScale = Vector3.one * growthFactor; } } if (pendingGrowth == 0) { return; } LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); CharacterBody val = ((firstLocalUser != null) ? firstLocalUser.cachedBody : null); if (!Object.op_Implicit((Object)(object)val)) { return; } CameraTargetParams component = ((Component)val).GetComponent(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.cameraParams)) { if ((Object)(object)component != (Object)(object)cachedCameraTargetParams) { cachedCameraTargetParams = component; baseCameraPosition = component.cameraParams.data.idealLocalCameraPos.value; baseCameraPivotOffset = component.cameraParams.data.pivotVerticalOffset.value; } Vector3 val2 = ((((Vector3)(ref baseCameraPosition)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref baseCameraPosition)).normalized : Vector3.back); component.cameraParams.data.idealLocalCameraPos.value = baseCameraPosition + val2 * 0.15f * (float)growthStages; float num = (Object.op_Implicit((Object)(object)val.aimOriginTransform) ? Mathf.Abs(val.aimOriginTransform.localPosition.y) : 1.5f); component.cameraParams.data.pivotVerticalOffset.value = baseCameraPivotOffset + num * (growthFactor - 1f) * 0.5f; pendingGrowth--; ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Applied multiplayer stage growth: {growthFactor:0.###}x; camera offset: {0.15f * (float)growthStages:0.##}"); } } }