Decompiled source of GooberMenuLite v1.0.1
Mods/GooberMenuLite.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using GooberMenu; using Il2CppCinemachine; using Il2CppCoreNet.Contexts; using Il2CppFemur; using Il2CppGB.Platform.Lobby; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Reflection; using Il2CppTMPro; using MelonLoader; using MelonLoader.Utils; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(GooberMenuMod), "GooberMenu Lite", "1.0.1", "GooberMenu", null)] [assembly: MelonGame("Boneloaf", "Gang Beasts")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace GooberMenu { public class GooberMenuMod : MelonMod { private enum CamMode { Normal, First, Third } private class Mod { public string Name; public Func<bool> Get; public Action<bool> Set; public Action Click; public Func<string> Label; public bool Setting; public Scope Scope; } private class Category { public string Name; public Scope Scope; public List<Mod> Mods = new List<Mod>(); } private enum Scope { Gameplay, Visual, Cosmetic } private enum MatchKind { Local, OnlinePrivate, OnlinePublic } private class Row { public string Label; public int State; public Action Act; } private class Theme { public string Name; public Color Panel; public Color Border; public Color Button; public Color ButtonHover; public Color ButtonOn; public Color Text; public Color TextOn; public Color Accent; } private class SunRay { public GameObject Go; public Vector3 Offset; public float Phase; public float Speed; public float Width; } private class Elem { public GameObject Go; public RectTransform Rt; public Image Img; public TextMeshProUGUI Txt; public bool Active; public string LastText; public Sprite LastSprite; } private class UiLayer { public Canvas Canvas; public RectTransform Root; public TMP_FontAsset Font; public bool KeepOrder; private readonly List<Elem> imgs = new List<Elem>(); private readonly List<Elem> txts = new List<Elem>(); private int imgUsed; private int txtUsed; private int order; public bool Alive { get { if ((Object)(object)Canvas != (Object)null) { return (Object)(object)Root != (Object)null; } return false; } } public static UiLayer Create(string name, int sortingOrder, bool keepOrder, TMP_FontAsset font) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown GameObject val = new GameObject(name); Object.DontDestroyOnLoad((Object)(object)val); Canvas val2 = val.AddComponent<Canvas>(); val2.renderMode = (RenderMode)0; val2.sortingOrder = sortingOrder; val2.pixelPerfect = false; return new UiLayer { Canvas = val2, Root = val.GetComponent<RectTransform>(), Font = font, KeepOrder = keepOrder }; } public void Begin(float scale) { imgUsed = (txtUsed = (order = 0)); if (Mathf.Abs(Canvas.scaleFactor - scale) > 0.001f) { Canvas.scaleFactor = scale; } } public void End() { for (int i = imgUsed; i < imgs.Count; i++) { Hide(imgs[i]); } for (int j = txtUsed; j < txts.Count; j++) { Hide(txts[j]); } } private static void Hide(Elem e) { if (e.Active && !((Object)(object)e.Go == (Object)null)) { e.Go.SetActive(false); e.Active = false; } } private Elem NewElem(bool text) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(text ? "t" : "i"); val.transform.SetParent((Transform)(object)Root, false); Elem elem = new Elem { Go = val, Active = true }; elem.Rt = val.AddComponent<RectTransform>(); elem.Rt.anchorMin = new Vector2(0f, 1f); elem.Rt.anchorMax = new Vector2(0f, 1f); if (text) { elem.Txt = val.AddComponent<TextMeshProUGUI>(); if ((Object)(object)Font != (Object)null) { ((TMP_Text)elem.Txt).font = Font; } ((Graphic)elem.Txt).raycastTarget = false; ((TMP_Text)elem.Txt).enableWordWrapping = false; ((TMP_Text)elem.Txt).overflowMode = (TextOverflowModes)0; ((TMP_Text)elem.Txt).richText = true; } else { elem.Img = val.AddComponent<Image>(); ((Graphic)elem.Img).raycastTarget = false; } return elem; } private Elem Next(bool text) { List<Elem> list = (text ? txts : imgs); int num = (text ? txtUsed++ : imgUsed++); if (num >= list.Count) { list.Add(NewElem(text)); } Elem elem = list[num]; if ((Object)(object)elem.Go == (Object)null) { elem = (list[num] = NewElem(text)); } if (!elem.Active) { elem.Go.SetActive(true); elem.Active = true; } if (KeepOrder) { if (((Transform)elem.Rt).GetSiblingIndex() != order) { ((Transform)elem.Rt).SetSiblingIndex(order); } order++; } return elem; } private void SetSprite(Elem e, Sprite s) { if ((!((Object)(object)e.LastSprite == (Object)null) || !((Object)(object)s == (Object)null)) && (!((Object)(object)e.LastSprite != (Object)null) || !((Object)(object)s != (Object)null) || !(((Il2CppObjectBase)e.LastSprite).Pointer == ((Il2CppObjectBase)s).Pointer))) { e.Img.sprite = s; e.LastSprite = s; } } public void Sprite(Vector2 c, Vector2 size, Sprite s, Color col, float rotation = 0f) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) Elem elem = Next(text: false); SetSprite(elem, s); elem.Rt.pivot = new Vector2(0.5f, 0.5f); elem.Rt.anchoredPosition = new Vector2(c.x, 0f - c.y); elem.Rt.sizeDelta = size; ((Transform)elem.Rt).localEulerAngles = new Vector3(0f, 0f, rotation); ((Graphic)elem.Img).color = col; } public void Rect(Rect r, Color c) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) Elem elem = Next(text: false); SetSprite(elem, null); elem.Rt.pivot = new Vector2(0f, 1f); elem.Rt.anchoredPosition = new Vector2(((Rect)(ref r)).x, 0f - ((Rect)(ref r)).y); elem.Rt.sizeDelta = new Vector2(((Rect)(ref r)).width, ((Rect)(ref r)).height); ((Transform)elem.Rt).localEulerAngles = Vector3.zero; ((Graphic)elem.Img).color = c; } public void Line(Vector2 a, Vector2 b, Color c, float width) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) Vector2 val = b - a; float magnitude = ((Vector2)(ref val)).magnitude; if (!(magnitude < 0.5f)) { Elem elem = Next(text: false); SetSprite(elem, null); elem.Rt.pivot = new Vector2(0f, 0.5f); elem.Rt.anchoredPosition = new Vector2(a.x, 0f - a.y); elem.Rt.sizeDelta = new Vector2(magnitude, width); ((Transform)elem.Rt).localEulerAngles = new Vector3(0f, 0f, (0f - Mathf.Atan2(val.y, val.x)) * 57.29578f); ((Graphic)elem.Img).color = c; } } public void Text(Rect r, string s, float size, Color c, TextAlignmentOptions align, FontStyles style) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) Elem elem = Next(text: true); elem.Rt.pivot = new Vector2(0f, 1f); elem.Rt.anchoredPosition = new Vector2(((Rect)(ref r)).x, 0f - ((Rect)(ref r)).y); elem.Rt.sizeDelta = new Vector2(((Rect)(ref r)).width, ((Rect)(ref r)).height); if (elem.LastText != s) { ((TMP_Text)elem.Txt).text = s; elem.LastText = s; } if (Math.Abs(((TMP_Text)elem.Txt).fontSize - size) > 0.01f) { ((TMP_Text)elem.Txt).fontSize = size; } ((Graphic)elem.Txt).color = c; if (((TMP_Text)elem.Txt).alignment != align) { ((TMP_Text)elem.Txt).alignment = align; } if (((TMP_Text)elem.Txt).fontStyle != style) { ((TMP_Text)elem.Txt).fontStyle = style; } } public void Destroy() { if ((Object)(object)Canvas != (Object)null) { Object.Destroy((Object)(object)((Component)Canvas).gameObject); } } } private bool hitboxes; private bool fullbright; private bool noFog; private bool noPostFx; private bool ultraGraphics; private bool uncapFps; private CamMode camMode; private bool headSteer = true; private bool customFov; private bool notifications = true; private bool activeList = true; private static readonly float[] FlingSteps = new float[5] { 10f, 25f, 40f, 60f, 90f }; private static readonly float[] JumpSteps = new float[4] { 8f, 14f, 22f, 32f }; private static readonly float[] GravitySteps = new float[5] { 0.1f, 0.25f, 0.35f, 0.5f, 0.75f }; private static readonly float[] SpeedSteps = new float[3] { 20f, 35f, 55f }; private static readonly float[] FovSteps = new float[4] { 70f, 90f, 110f, 130f }; private static readonly float[] HeadFollowSteps = new float[5] { 0f, 0.25f, 0.5f, 0.75f, 1f }; private int flingIdx = 1; private int jumpIdx = 1; private int gravityIdx = 2; private int speedIdx = 1; private int fovIdx = 1; private int headFollowIdx = 2; private readonly List<Actor> actorCache = new List<Actor>(); private float actorCacheTime = -1f; private readonly Dictionary<IntPtr, Rigidbody[]> bodyCache = new Dictionary<IntPtr, Rigidbody[]>(); private readonly Dictionary<IntPtr, Collider[]> colliderCache = new Dictionary<IntPtr, Collider[]>(); private bool fullbrightApplied; private AmbientMode savedAmbientMode; private Color savedAmbientLight; private float savedAmbientIntensity; private bool fogApplied; private bool savedFog; private readonly List<Behaviour> postFxDisabled = new List<Behaviour>(); private bool postFxApplied; private bool ultraApplied; private float savedShadowDist; private float savedLodBias; private AnisotropicFiltering savedAniso; private int savedPixelLights; private bool uncapApplied; private int savedTargetFps; private int savedVsync; private readonly List<CinemachineVirtualCamera> vcamCache = new List<CinemachineVirtualCamera>(); private float vcamScanTimer; private bool fovApplied; private float savedCamFov = 60f; private bool camActive; private Camera cam; private Actor camActor; private Transform head; private Rigidbody headRb; private Quaternion faceOffset = Quaternion.identity; private float lookYaw; private float lookPitch; private float camOldFov; private float camOldNear; private float camResumeTimer; private float camRetryTimer; private string lastScene = ""; private readonly List<Behaviour> camDisabled = new List<Behaviour>(); private readonly List<Renderer> hiddenHead = new List<Renderer>(); private const float MouseSens = 0.15f; private const float StickSens = 140f; private float tpDistance = 5f; private Vector3 tpPan = Vector3.zero; private Vector3 tpSmoothedTarget; private static readonly string[] HeadWords = new string[16] { "head", "hat", "hair", "eye", "face", "helmet", "mask", "beard", "glasses", "goggle", "cap", "hood", "visor", "mouth", "nose", "ear" }; private bool fpStabilise; private Vector3 fpEyeSmoothed; private Quaternion fpTiltSmoothed = Quaternion.identity; private bool fpEyeInit; private bool dumpedThisScene; private float dumpTimer = 6f; private readonly List<Category> categories = new List<Category>(); private MatchKind matchKind; private float matchCheckTimer; private bool gameplayAllowed = true; private bool visualAllowed = true; private bool menuOpen; private float menuAnim; private int currentCategory = -1; private int page; private int selected; private float fps = 60f; private const int PerPage = 7; private static readonly Theme[] Themes = new Theme[6] { new Theme { Name = "Orange", Panel = C(255, 128, 24), Border = C(58, 26, 6), Button = C(158, 74, 10), ButtonHover = C(190, 92, 16), ButtonOn = C(255, 214, 92), Text = Color.white, TextOn = C(60, 28, 4), Accent = C(255, 170, 60) }, new Theme { Name = "Ocean", Panel = C(30, 136, 229), Border = C(8, 30, 60), Button = C(18, 82, 150), ButtonHover = C(26, 104, 186), ButtonOn = C(120, 220, 255), Text = Color.white, TextOn = C(6, 34, 60), Accent = C(90, 190, 255) }, new Theme { Name = "Grape", Panel = C(142, 68, 210), Border = C(36, 12, 60), Button = C(92, 38, 146), ButtonHover = C(112, 50, 176), ButtonOn = C(232, 180, 255), Text = Color.white, TextOn = C(46, 14, 74), Accent = C(200, 140, 255) }, new Theme { Name = "Lime", Panel = C(110, 200, 40), Border = C(24, 50, 8), Button = C(64, 128, 20), ButtonHover = C(80, 156, 28), ButtonOn = C(220, 255, 140), Text = Color.white, TextOn = C(30, 60, 8), Accent = C(170, 240, 90) }, new Theme { Name = "Cherry", Panel = C(226, 48, 72), Border = C(60, 8, 16), Button = C(146, 22, 40), ButtonHover = C(176, 32, 52), ButtonOn = C(255, 170, 180), Text = Color.white, TextOn = C(70, 8, 18), Accent = C(255, 110, 130) }, new Theme { Name = "Midnight", Panel = C(40, 44, 58), Border = C(10, 10, 16), Button = C(24, 26, 36), ButtonHover = C(36, 40, 54), ButtonOn = C(110, 140, 255), Text = Color.white, TextOn = Color.white, Accent = C(120, 150, 255) } }; private int themeIdx = 3; private bool betterLighting; private bool betterShadows; private bool volumetricLights; private bool lensFlare; private bool fxBloom; private bool fxAces; private bool fxVivid; private bool fxWarm; private bool fxVignette; private bool fxDof; private bool fxMotionBlur; private bool sharper; private bool antiAliasing; private readonly HashSet<string> gfxErrorsLogged = new HashSet<string>(); private UniversalRenderPipelineAsset urp; private bool urpShadowsApplied; private bool urpLightingApplied; private bool urpScaleApplied; private bool urpMsaaApplied; private float sv_shadowDist; private float sv_renderScale; private int sv_cascades; private int sv_msaa; private int sv_addLightLimit; private ShadowResolution sv_mainRes; private ShadowResolution sv_addRes; private bool sv_soft; private bool sv_addShadows; private bool sv_hdr; private LightRenderingMode sv_addMode; private bool sceneLightingApplied; private float sv_ambientIntensity; private float sv_reflectionIntensity; private readonly List<(Light light, float intensity, float strength, LightShadows shadows)> sunSaved = new List<(Light, float, float, LightShadows)>(); private bool hazeApplied; private bool sv_fog; private FogMode sv_fogMode; private float sv_fogDensity; private Color sv_fogColor; private Material shaftMat; private bool shaftShaderMissing; private readonly List<GameObject> shafts = new List<GameObject>(); private readonly HashSet<IntPtr> shaftLights = new HashSet<IntPtr>(); private float shaftScanTimer; private bool shaftAdditive; private readonly List<SunRay> sunRays = new List<SunRay>(); private Vector3 rayCenter; private const int RayCount = 18; private const float RayLength = 70f; private Light flareSun; private float flareSunTimer; private float flareVis; private Sprite flareGlow; private Sprite flareRing; private Sprite flareSoftDisc; private GameObject fxGo; private Volume fxVolume; private VolumeProfile fxProfile; private Bloom vBloom; private Tonemapping vTonemap; private ColorAdjustments vColor; private WhiteBalance vWhite; private Vignette vVignette; private DepthOfField vDof; private MotionBlur vMotion; private bool camPostSaved; private bool sv_camPost; private UniversalAdditionalCameraData fxCamData; private int uiErrors; private bool stylesDirty; private UiLayer flareLayer; private UiLayer lineLayer; private UiLayer labelLayer; private UiLayer menuLayer; private TMP_FontAsset uiFont; private float fontSearchTimer; private float uiScale = 1f; private int fontReportLogged; private Vector2 mouseUi; private bool mouseClicked; private readonly List<(string text, float time)> toasts = new List<(string, float)>(); private readonly Vector3[] corners = (Vector3[])(object)new Vector3[8]; private readonly Vector2[] screenPts = (Vector2[])(object)new Vector2[8]; private readonly bool[] visible = new bool[8]; private static readonly int[,] Edges = new int[12, 2] { { 0, 1 }, { 1, 3 }, { 3, 2 }, { 2, 0 }, { 4, 5 }, { 5, 7 }, { 7, 6 }, { 6, 4 }, { 0, 4 }, { 1, 5 }, { 2, 6 }, { 3, 7 } }; private float FlingPower => FlingSteps[flingIdx]; private float JumpPower => JumpSteps[jumpIdx]; private float GravityScale => GravitySteps[gravityIdx]; private float SpeedAccel => SpeedSteps[speedIdx]; private float CustomFov => FovSteps[fovIdx]; private float HeadFollow => HeadFollowSteps[headFollowIdx]; private Theme T => Themes[themeIdx]; private float ScreenW => (float)Screen.width / uiScale; private float ScreenH => (float)Screen.height / uiScale; public override void OnInitializeMelon() { BuildMenu(); if (File.Exists(Path.Combine(MelonEnvironment.UserDataDirectory, "GooberMenu_open.flag"))) { menuOpen = true; } if (File.Exists(Path.Combine(MelonEnvironment.UserDataDirectory, "GooberMenu_maxfx.flag"))) { betterLighting = (betterShadows = (volumetricLights = (lensFlare = (fxBloom = (fxAces = (fxVivid = (fxWarm = (fxVignette = (sharper = (antiAliasing = true)))))))))); } ((MelonBase)this).LoggerInstance.Msg("GooberMenu Lite loaded. Insert/F1 = menu, F5 = cycle camera."); } public override void OnSceneWasUnloaded(int buildIndex, string sceneName) { OnSceneChange(); } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { OnSceneChange(); } private void OnSceneChange() { ReleaseCamera(); camResumeTimer = 3f; actorCacheTime = -1f; actorCache.Clear(); bodyCache.Clear(); colliderCache.Clear(); fullbrightApplied = false; fogApplied = false; postFxDisabled.Clear(); postFxApplied = false; vcamCache.Clear(); dumpedThisScene = false; dumpTimer = 6f; OnSceneChangeGraphics(); } public override void OnUpdate() { try { fps = Mathf.Lerp(fps, 1f / Mathf.Max(Time.unscaledDeltaTime, 0.0001f), 0.05f); UpdateMatchKind(); HandleKeys(); ApplyFullbright(); ApplyFog(); ApplyPostFx(); ApplyUltra(); ApplyUncap(); ApplyLightingFx(); UpdateCameraMode(); UpdateCursor(); AutoDiagnostics(); } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Error("Update: " + ex); } } public override void OnFixedUpdate() { if (!gameplayAllowed) { return; } try { if (camMode == CamMode.First && camActive && headSteer) { SteerHeadTick(); } } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Error("FixedUpdate: " + ex); } } public override void OnLateUpdate() { try { if (camActive && camMode == CamMode.First) { FirstPersonTick(); } else if (camActive && camMode == CamMode.Third) { ThirdPersonTick(); } ApplyFov(); } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Error("LateUpdate: " + ex); } try { if (menuOpen) { UpdateCursor(); } DrawUI(); } catch (Exception ex2) { if (uiErrors++ < 5) { ((MelonBase)this).LoggerInstance.Error("UI: " + ex2); } } } private void HandleKeys() { Keyboard current = Keyboard.current; if (current == null) { return; } if (((ButtonControl)current.insertKey).wasPressedThisFrame || ((ButtonControl)current.f1Key).wasPressedThisFrame) { menuOpen = !menuOpen; if (menuOpen) { menuAnim = 0f; } } if (((ButtonControl)current.f5Key).wasPressedThisFrame) { camMode = (CamMode)((int)(camMode + 1) % 3); Notify("Camera: " + ((camMode == CamMode.Normal) ? "Normal" : ((camMode == CamMode.First) ? "First Person" : "Third Person"))); } if (((ButtonControl)current.f8Key).wasPressedThisFrame) { DumpDiagnostics("F8"); } if (menuOpen) { MenuKeyNav(current); } } private List<Actor> AllActors() { float unscaledTime = Time.unscaledTime; if (unscaledTime - actorCacheTime > 0.5f || unscaledTime < actorCacheTime) { actorCacheTime = unscaledTime; actorCache.Clear(); Il2CppArrayBase<Actor> val = Object.FindObjectsOfType<Actor>(); for (int i = 0; i < val.Length; i++) { if ((Object)(object)val[i] != (Object)null) { actorCache.Add(val[i]); } } } List<Actor> list = new List<Actor>(actorCache.Count); foreach (Actor item in actorCache) { if ((Object)(object)item != (Object)null && (Object)(object)item.bodyHandeler != (Object)null && ((Component)item).gameObject.activeInHierarchy) { list.Add(item); } } return list; } private static bool IsMine(Actor a) { if (a.IsLocal) { return !a.IsAI; } return false; } private Actor Me() { foreach (Actor item in AllActors()) { if (IsMine(item)) { return item; } } return null; } private IEnumerable<Actor> Others() { foreach (Actor item in AllActors()) { if (!IsMine(item)) { yield return item; } } } private Rigidbody[] Bodies(Actor a) { if (bodyCache.TryGetValue(((Il2CppObjectBase)a).Pointer, out var value) && value.Length != 0 && (Object)(object)value[0] != (Object)null) { return value; } Il2CppArrayBase<Rigidbody> componentsInChildren = ((Component)a).GetComponentsInChildren<Rigidbody>(true); Rigidbody[] array = (Rigidbody[])(object)new Rigidbody[componentsInChildren.Length]; for (int i = 0; i < componentsInChildren.Length; i++) { array[i] = componentsInChildren[i]; } bodyCache[((Il2CppObjectBase)a).Pointer] = array; return array; } private Collider[] Colliders(Actor a) { if (colliderCache.TryGetValue(((Il2CppObjectBase)a).Pointer, out var value) && value.Length != 0 && (Object)(object)value[0] != (Object)null) { return value; } Il2CppArrayBase<Collider> componentsInChildren = ((Component)a).GetComponentsInChildren<Collider>(false); List<Collider> list = new List<Collider>(); for (int i = 0; i < componentsInChildren.Length; i++) { if ((Object)(object)componentsInChildren[i] != (Object)null && !componentsInChildren[i].isTrigger) { list.Add(componentsInChildren[i]); } } Collider[] array = list.ToArray(); colliderCache[((Il2CppObjectBase)a).Pointer] = array; return array; } private static Rigidbody Part(BodyPart p) { if (p == null) { return null; } return p.PartRigidbody; } private static Vector3 Center(Actor a) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) BodyHandeler bodyHandeler = a.bodyHandeler; Rigidbody val = Part(bodyHandeler.Chest) ?? Part(bodyHandeler.Hips) ?? Part(bodyHandeler.Head); if (!((Object)(object)val != (Object)null)) { return ((Component)a).transform.position; } return val.worldCenterOfMass; } private void Fling(Actor a, Vector3 velocity) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) Rigidbody[] array = Bodies(a); foreach (Rigidbody val in array) { if ((Object)(object)val != (Object)null && !val.isKinematic) { val.AddForce(velocity, (ForceMode)2); } } } private void Accelerate(Actor a, Vector3 accel) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) Rigidbody[] array = Bodies(a); foreach (Rigidbody val in array) { if ((Object)(object)val != (Object)null && !val.isKinematic) { val.AddForce(accel, (ForceMode)5); } } } private void TeleportTo(Actor a, Vector3 target) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) Vector3 val = target - Center(a); Rigidbody[] array = Bodies(a); foreach (Rigidbody val2 in array) { if (!((Object)(object)val2 == (Object)null)) { val2.position += val; val2.velocity = Vector3.zero; } } } private bool HaveAuthority() { Actor val = Me(); if ((Object)(object)val == (Object)null) { return true; } try { return ((NetworkBehaviour)val).isServer; } catch { return true; } } private void ApplyFullbright() { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (fullbright) { if (!fullbrightApplied) { savedAmbientMode = RenderSettings.ambientMode; savedAmbientLight = RenderSettings.ambientLight; savedAmbientIntensity = RenderSettings.ambientIntensity; fullbrightApplied = true; } RenderSettings.ambientMode = (AmbientMode)3; RenderSettings.ambientLight = new Color(0.95f, 0.95f, 0.95f); RenderSettings.ambientIntensity = 1.5f; } else if (fullbrightApplied) { RenderSettings.ambientMode = savedAmbientMode; RenderSettings.ambientLight = savedAmbientLight; RenderSettings.ambientIntensity = savedAmbientIntensity; fullbrightApplied = false; } } private void ApplyFog() { if (noFog) { if (!fogApplied) { savedFog = RenderSettings.fog; fogApplied = true; } RenderSettings.fog = false; } else if (fogApplied) { RenderSettings.fog = savedFog; fogApplied = false; } } private void ApplyPostFx() { if (noPostFx && !postFxApplied) { Il2CppArrayBase<Behaviour> val = Object.FindObjectsOfType<Behaviour>(); for (int i = 0; i < val.Length; i++) { Behaviour val2 = val[i]; if (!((Object)(object)val2 == (Object)null) && val2.enabled && !((Object)((Component)val2).gameObject).name.StartsWith("GooberMenu")) { string name = ((MemberInfo)((Object)val2).GetIl2CppType()).Name; if (name == "Volume" || name.Contains("PostProcess")) { val2.enabled = false; postFxDisabled.Add(val2); } } } postFxApplied = true; } else { if (noPostFx || !postFxApplied) { return; } foreach (Behaviour item in postFxDisabled) { if ((Object)(object)item != (Object)null) { item.enabled = true; } } postFxDisabled.Clear(); postFxApplied = false; } } private void ApplyUltra() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) if (ultraGraphics && !ultraApplied) { savedShadowDist = QualitySettings.shadowDistance; savedLodBias = QualitySettings.lodBias; savedAniso = QualitySettings.anisotropicFiltering; savedPixelLights = QualitySettings.pixelLightCount; QualitySettings.shadowDistance = 250f; QualitySettings.lodBias = 4f; QualitySettings.anisotropicFiltering = (AnisotropicFiltering)2; QualitySettings.pixelLightCount = 8; ultraApplied = true; } else if (!ultraGraphics && ultraApplied) { QualitySettings.shadowDistance = savedShadowDist; QualitySettings.lodBias = savedLodBias; QualitySettings.anisotropicFiltering = savedAniso; QualitySettings.pixelLightCount = savedPixelLights; ultraApplied = false; } } private void ApplyUncap() { if (uncapFps && !uncapApplied) { savedTargetFps = Application.targetFrameRate; savedVsync = QualitySettings.vSyncCount; QualitySettings.vSyncCount = 0; Application.targetFrameRate = 300; uncapApplied = true; } else if (!uncapFps && uncapApplied) { QualitySettings.vSyncCount = savedVsync; Application.targetFrameRate = savedTargetFps; uncapApplied = false; } } private void ApplyFov() { //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return; } if (customFov && camMode != CamMode.First) { if (!fovApplied) { savedCamFov = main.fieldOfView; fovApplied = true; } vcamScanTimer -= Time.unscaledDeltaTime; if (vcamScanTimer <= 0f) { vcamScanTimer = 1f; vcamCache.Clear(); Il2CppArrayBase<CinemachineVirtualCamera> val = Object.FindObjectsOfType<CinemachineVirtualCamera>(); for (int i = 0; i < val.Length; i++) { if ((Object)(object)val[i] != (Object)null) { vcamCache.Add(val[i]); } } } foreach (CinemachineVirtualCamera item in vcamCache) { if (!((Object)(object)item == (Object)null)) { LensSettings lens = item.m_Lens; lens.FieldOfView = CustomFov; item.m_Lens = lens; } } main.fieldOfView = CustomFov; } else if (fovApplied && camMode != CamMode.First) { main.fieldOfView = savedCamFov; fovApplied = false; } } private void UpdateCameraMode() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; if (name != lastScene) { lastScene = name; ReleaseCamera(); camResumeTimer = 3f; } if (camResumeTimer > 0f) { camResumeTimer -= Time.unscaledDeltaTime; } camRetryTimer -= Time.unscaledDeltaTime; if (camMode == CamMode.Normal) { if (camActive) { ReleaseCamera(); } return; } if (camActive && ((Object)(object)head == (Object)null || (Object)(object)cam == (Object)null || (Object)(object)camActor == (Object)null || !((Component)head).gameObject.activeInHierarchy)) { ReleaseCamera(); } if (!camActive && camResumeTimer <= 0f && camRetryTimer <= 0f) { camRetryTimer = 0.5f; TakeCamera(); } if (camActive) { if (camMode == CamMode.First && hiddenHead.Count == 0) { HideHead(); } else if (camMode != CamMode.First && hiddenHead.Count > 0) { ShowHead(); } } } private void TakeCamera() { //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: 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_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: 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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) cam = Camera.main; if ((Object)(object)cam == (Object)null) { return; } camActor = Me(); if ((Object)(object)camActor == (Object)null || camActor.bodyHandeler.Head == null) { return; } head = camActor.bodyHandeler.Head.PartTransform; headRb = camActor.bodyHandeler.Head.PartRigidbody; if ((Object)(object)head == (Object)null) { return; } camDisabled.Clear(); int num = 0; Transform val = ((Component)cam).transform; while ((Object)(object)val != (Object)null && num < 3) { Il2CppArrayBase<Behaviour> components = ((Component)val).GetComponents<Behaviour>(); for (int i = 0; i < components.Length; i++) { Behaviour val2 = components[i]; if (!((Object)(object)val2 == (Object)null) && val2.enabled && ((MemberInfo)((Object)val2).GetIl2CppType()).Name.Contains("Cinemachine")) { val2.enabled = false; camDisabled.Add(val2); } } val = val.parent; num++; } Vector3 val3 = Vector3.zero; ControlHandeler controlHandeler = camActor.controlHandeler; if (controlHandeler != null) { val3 = controlHandeler.lookDirection; } val3.y = 0f; if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { val3 = head.forward; val3.y = 0f; } if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { val3 = Vector3.forward; } Quaternion val4 = Quaternion.LookRotation(((Vector3)(ref val3)).normalized, Vector3.up); faceOffset = Quaternion.Inverse(head.rotation) * val4; camOldFov = cam.fieldOfView; camOldNear = cam.nearClipPlane; lookYaw = ((Quaternion)(ref val4)).eulerAngles.y; lookPitch = ((camMode == CamMode.Third) ? 20f : 0f); tpPan = Vector3.zero; tpSmoothedTarget = Center(camActor); camActive = true; ((MelonBase)this).LoggerInstance.Msg("Camera takeover: " + camMode); } private void ReleaseCamera() { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) if (!camActive) { return; } camActive = false; foreach (Behaviour item in camDisabled) { if ((Object)(object)item != (Object)null) { item.enabled = true; } } camDisabled.Clear(); ShowHead(); if ((Object)(object)cam != (Object)null) { cam.fieldOfView = camOldFov; cam.nearClipPlane = camOldNear; } cam = null; head = null; headRb = null; camActor = null; fpEyeInit = false; fpTiltSmoothed = Quaternion.identity; } private void HideHead() { if ((Object)(object)camActor == (Object)null || (Object)(object)head == (Object)null) { return; } HashSet<IntPtr> set = new HashSet<IntPtr>(); BodyPart meshHead = camActor.bodyHandeler.MeshHead; if (meshHead != null) { Hide(meshHead.PartRenderer); } ControlHandeler_Human val = ((camActor.controlHandeler != null) ? ((Il2CppObjectBase)camActor.controlHandeler).TryCast<ControlHandeler_Human>() : null); if (val != null && val.CachedHeadSubObjects != null) { Il2CppReferenceArray<Transform> cachedHeadSubObjects = val.CachedHeadSubObjects; for (int i = 0; i < ((Il2CppArrayBase<Transform>)(object)cachedHeadSubObjects).Length; i++) { if (!((Object)(object)((Il2CppArrayBase<Transform>)(object)cachedHeadSubObjects)[i] == (Object)null)) { Il2CppArrayBase<Renderer> componentsInChildren = ((Component)((Il2CppArrayBase<Transform>)(object)cachedHeadSubObjects)[i]).GetComponentsInChildren<Renderer>(true); for (int j = 0; j < componentsInChildren.Length; j++) { Hide(componentsInChildren[j]); } } } } Il2CppArrayBase<Renderer> componentsInChildren2 = ((Component)head).GetComponentsInChildren<Renderer>(true); for (int k = 0; k < componentsInChildren2.Length; k++) { Hide(componentsInChildren2[k]); } Il2CppArrayBase<Renderer> componentsInChildren3 = ((Component)camActor).GetComponentsInChildren<Renderer>(true); for (int l = 0; l < componentsInChildren3.Length; l++) { Renderer val2 = componentsInChildren3[l]; if ((Object)(object)val2 == (Object)null) { continue; } string text = ((Object)((Component)val2).gameObject).name.ToLowerInvariant(); if (text.Contains("body")) { continue; } string[] headWords = HeadWords; foreach (string value in headWords) { if (text.Contains(value)) { Hide(val2); break; } } } void Hide(Renderer r) { if (!((Object)(object)r == (Object)null) && r.enabled && set.Add(((Il2CppObjectBase)r).Pointer)) { r.enabled = false; hiddenHead.Add(r); } } } private void ShowHead() { foreach (Renderer item in hiddenHead) { if ((Object)(object)item != (Object)null) { item.enabled = true; } } hiddenHead.Clear(); } private void ReadLookInput(float pitchMin, float pitchMax) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) if (menuOpen) { return; } Mouse current = Mouse.current; if (current != null) { Vector2 val = ((InputControl<Vector2>)(object)((Pointer)current).delta).ReadValue(); lookYaw += val.x * 0.15f; lookPitch -= val.y * 0.15f; } Gamepad current2 = Gamepad.current; if (current2 != null) { Vector2 val2 = ((InputControl<Vector2>)(object)current2.rightStick).ReadValue(); if (((Vector2)(ref val2)).sqrMagnitude > 0.01f) { lookYaw += val2.x * 140f * Time.unscaledDeltaTime; lookPitch -= val2.y * 140f * Time.unscaledDeltaTime; } } lookPitch = Mathf.Clamp(lookPitch, pitchMin, pitchMax); } private Quaternion FaceRotation() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) return head.rotation * faceOffset; } private void FirstPersonTick() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_016d: 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_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cam == (Object)null || (Object)(object)head == (Object)null) { return; } ReadLookInput(-80f, 80f); float unscaledDeltaTime = Time.unscaledDeltaTime; Quaternion val = Quaternion.Euler(lookPitch, lookYaw, 0f); Vector3 val2 = Quaternion.Euler(0f, lookYaw, 0f) * Vector3.forward; Vector3 val3 = head.rotation * faceOffset * Vector3.up; Quaternion val4 = Quaternion.identity; if (!fpStabilise && HeadFollow > 0f) { Quaternion val5 = Quaternion.FromToRotation(Vector3.up, val3); float num = default(float); Vector3 val6 = default(Vector3); ((Quaternion)(ref val5)).ToAngleAxis(ref num, ref val6); if (num > 180f) { num -= 360f; } if (!float.IsNaN(val6.x) && ((Vector3)(ref val6)).sqrMagnitude > 0.0001f) { val4 = Quaternion.AngleAxis(Mathf.Clamp(num * HeadFollow, -35f, 35f), val6); } } fpTiltSmoothed = Quaternion.Slerp(fpTiltSmoothed, val4, 1f - Mathf.Exp((0f - (fpStabilise ? 6f : 18f)) * unscaledDeltaTime)); Quaternion val7 = fpTiltSmoothed * val; Vector3 val8 = (fpStabilise ? Vector3.up : Vector3.Slerp(Vector3.up, val3, HeadFollow)); Vector3 val9 = head.position + val8 * 0.22f + val2 * 0.12f; if (!fpEyeInit) { fpEyeSmoothed = val9; fpEyeInit = true; } fpEyeSmoothed = Vector3.Lerp(fpEyeSmoothed, val9, 1f - Mathf.Exp((0f - (fpStabilise ? 9f : 35f)) * unscaledDeltaTime)); ((Component)cam).transform.SetPositionAndRotation(fpEyeSmoothed, val7); cam.fieldOfView = (customFov ? CustomFov : 95f); cam.nearClipPlane = 0.05f; } private void SteerHeadTick() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)headRb == (Object)null || headRb.isKinematic || (Object)(object)head == (Object)null) { return; } Vector3 val = FaceRotation() * Vector3.forward; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(val.x, 0f, val.z); if (!(((Vector3)(ref val2)).sqrMagnitude < 0.0001f)) { ((Vector3)(ref val2)).Normalize(); Vector3 val3 = Quaternion.Euler(0f, lookYaw, 0f) * Vector3.forward; float num = Mathf.Clamp(Vector3.SignedAngle(val2, val3, Vector3.up), -60f, 60f); float num2 = Mathf.Asin(Mathf.Clamp(val.y, -1f, 1f)) * 57.29578f; float num3 = Mathf.Clamp(0f - lookPitch - num2, -60f, 60f); Vector3 val4 = Vector3.Cross(Vector3.up, val2); Vector3 val5 = (Vector3.up * num - val4 * num3) * ((float)Math.PI * 2f / 45f); if (((Vector3)(ref val5)).magnitude > 12f) { val5 = ((Vector3)(ref val5)).normalized * 12f; } headRb.angularVelocity = Vector3.Lerp(headRb.angularVelocity, val5, 0.3f); } } private void ThirdPersonTick() { //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0186: 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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: 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_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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_00fe: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cam == (Object)null || (Object)(object)camActor == (Object)null) { return; } ReadLookInput(-30f, 80f); if (!menuOpen) { Mouse current = Mouse.current; if (current != null) { float y = ((InputControl<Vector2>)(object)current.scroll).ReadValue().y; if (Mathf.Abs(y) > 0.01f) { tpDistance = Mathf.Clamp(tpDistance - Mathf.Sign(y) * 0.6f, 1.5f, 20f); } if (current.middleButton.isPressed) { Vector2 val = ((InputControl<Vector2>)(object)((Pointer)current).delta).ReadValue() * 0.01f * tpDistance * 0.3f; tpPan -= ((Component)cam).transform.right * val.x + ((Component)cam).transform.up * val.y; } } Keyboard current2 = Keyboard.current; if (current2 != null && ((ButtonControl)current2.homeKey).wasPressedThisFrame) { tpPan = Vector3.zero; } } Vector3 val2 = Center(camActor) + Vector3.up * 0.6f; tpSmoothedTarget = Vector3.Lerp(tpSmoothedTarget, val2, 1f - Mathf.Exp(-12f * Time.unscaledDeltaTime)); Vector3 val3 = tpSmoothedTarget + tpPan; Quaternion val4 = Quaternion.Euler(lookPitch, lookYaw, 0f); Vector3 val5 = val3 - val4 * Vector3.forward * tpDistance; Vector3 val6 = val5 - val3; float magnitude = ((Vector3)(ref val6)).magnitude; if (magnitude > 0.01f) { Il2CppStructArray<RaycastHit> obj = Physics.RaycastAll(val3, val6 / magnitude, magnitude); Collider[] array = Colliders(camActor); float num = magnitude; foreach (RaycastHit item in (Il2CppArrayBase<RaycastHit>)(object)obj) { RaycastHit current3 = item; if ((Object)(object)((RaycastHit)(ref current3)).collider == (Object)null || ((RaycastHit)(ref current3)).collider.isTrigger) { continue; } bool flag = false; Collider[] array2 = array; foreach (Collider val7 in array2) { if ((Object)(object)val7 != (Object)null && ((Il2CppObjectBase)val7).Pointer == ((Il2CppObjectBase)((RaycastHit)(ref current3)).collider).Pointer) { flag = true; break; } } if (!flag) { num = Mathf.Min(num, ((RaycastHit)(ref current3)).distance - 0.2f); } } val5 = val3 + val6 / magnitude * Mathf.Max(num, 0.8f); } ((Component)cam).transform.SetPositionAndRotation(val5, val4); cam.fieldOfView = (customFov ? CustomFov : 70f); cam.nearClipPlane = 0.1f; } private void UpdateCursor() { if (menuOpen) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } else if (camActive) { Cursor.lockState = (CursorLockMode)1; Cursor.visible = false; } } private void AutoDiagnostics() { if (dumpedThisScene) { return; } dumpTimer -= Time.unscaledDeltaTime; if (!(dumpTimer > 0f)) { dumpTimer = 3f; if (!((Object)(object)Me() == (Object)null)) { dumpedThisScene = true; DumpDiagnostics("auto"); } } } private void DumpDiagnostics(string why) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) try { Instance loggerInstance = ((MelonBase)this).LoggerInstance; DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(51, 5); defaultInterpolatedStringHandler.AppendLiteral("===== DIAG ("); defaultInterpolatedStringHandler.AppendFormatted(why); defaultInterpolatedStringHandler.AppendLiteral(") scene='"); Scene activeScene = SceneManager.GetActiveScene(); defaultInterpolatedStringHandler.AppendFormatted(((Scene)(ref activeScene)).name); defaultInterpolatedStringHandler.AppendLiteral("' gravity="); defaultInterpolatedStringHandler.AppendFormatted<Vector3>(Physics.gravity); defaultInterpolatedStringHandler.AppendLiteral(" timeScale="); defaultInterpolatedStringHandler.AppendFormatted(Time.timeScale); defaultInterpolatedStringHandler.AppendLiteral(" fixedDt="); defaultInterpolatedStringHandler.AppendFormatted(Time.fixedDeltaTime); loggerInstance.Msg(defaultInterpolatedStringHandler.ToStringAndClear()); foreach (Actor item in AllActors()) { Rigidbody[] array = Bodies(item); int num = 0; int num2 = 0; Rigidbody[] array2 = array; foreach (Rigidbody val in array2) { if (!((Object)(object)val == (Object)null)) { if (val.isKinematic) { num++; } if (val.useGravity) { num2++; } } } ControlHandeler controlHandeler = item.controlHandeler; string value = ((controlHandeler == null) ? "no ctrl" : $"ctrlType={((MemberInfo)((Object)controlHandeler).GetIl2CppType()).Name} leftPunch={controlHandeler.leftPunch} rightPunch={controlHandeler.rightPunch} jump={controlHandeler.jump} onGround={controlHandeler.onGround} dir={controlHandeler.direction}"); bool value2 = false; bool value3 = false; bool value4 = false; try { value2 = ((NetworkBehaviour)item).isServer; value3 = ((NetworkBehaviour)item).isLocalPlayer; value4 = ((NetworkBehaviour)item).hasAuthority; } catch { } loggerInstance.Msg($" actor '{((Object)((Component)item).gameObject).name}' IsLocal={item.IsLocal} IsAI={item.IsAI} isServer={value2} isLocalPlayer={value3} hasAuthority={value4} playerID={item.playerID} rbs={array.Length} kinematic={num} useGravity={num2} colliders={Colliders(item).Length} punchForce={item._punchForceModifer} {value}"); } loggerInstance.Msg("===== END DIAG"); } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Error("Diag: " + ex); } } private Mod Toggle(string name, Func<bool> get, Action<bool> set) { return new Mod { Name = name, Get = get, Set = set }; } private Mod Button(string name, Action click) { return new Mod { Name = name, Click = click }; } private Mod Cycle(Func<string> label, Action click) { return new Mod { Name = "", Label = label, Click = click }; } private void BuildMenu() { categories.Clear(); categories.Add(new Category { Name = "Camera Mods", Scope = Scope.Cosmetic, Mods = { Toggle("First Person", () => camMode == CamMode.First, delegate(bool v) { camMode = (v ? CamMode.First : CamMode.Normal); }), Toggle("Third Person (orbit)", () => camMode == CamMode.Third, delegate(bool v) { camMode = (v ? CamMode.Third : CamMode.Normal); }), new Mod { Name = "Mouse Turns Head", Get = () => headSteer, Set = delegate(bool v) { headSteer = v; }, Setting = true }, Toggle("Stabilise First Person", () => fpStabilise, delegate(bool v) { fpStabilise = v; }), Cycle(() => $"Head Shake: {HeadFollow * 100f:0}%", delegate { headFollowIdx = (headFollowIdx + 1) % HeadFollowSteps.Length; }), Toggle("Custom FOV", () => customFov, delegate(bool v) { customFov = v; }), Cycle(() => $"FOV: {CustomFov:0}", delegate { fovIdx = (fovIdx + 1) % FovSteps.Length; }) } }); categories.Add(new Category { Name = "Visual Mods", Scope = Scope.Cosmetic, Mods = { Toggle("Hitboxes", () => hitboxes, delegate(bool v) { hitboxes = v; }) } }); categories.Add(new Category { Name = "Graphics Mods", Scope = Scope.Cosmetic, Mods = { Toggle("Fullbright", () => fullbright, delegate(bool v) { fullbright = v; }), Toggle("No Fog", () => noFog, delegate(bool v) { noFog = v; }), Toggle("No Post-Processing", () => noPostFx, delegate(bool v) { noPostFx = v; }), Toggle("Ultra Graphics", () => ultraGraphics, delegate(bool v) { ultraGraphics = v; }), Toggle("Uncap FPS", () => uncapFps, delegate(bool v) { uncapFps = v; }) } }); categories.Add(LightingCategory()); foreach (Category category in categories) { foreach (Mod mod in category.Mods) { mod.Scope = category.Scope; } } } private void UpdateMatchKind() { matchCheckTimer -= Time.unscaledDeltaTime; if (matchCheckTimer > 0f) { return; } matchCheckTimer = 1f; matchKind = DetectMatch(); gameplayAllowed = matchKind == MatchKind.Local; visualAllowed = matchKind != MatchKind.OnlinePublic; bool flag = false; foreach (Category category in categories) { foreach (Mod mod in category.Mods) { if (mod.Get != null && mod.Get() && !Allowed(mod.Scope)) { mod.Set(obj: false); flag = true; } } } if (flag) { Notify((matchKind == MatchKind.OnlinePublic) ? "Mods off: public match" : "Gameplay mods off: online match"); } } private MatchKind DetectMatch() { try { if (NetMemberContext.LocalHostedGame) { return MatchKind.Local; } } catch { } Actor val = Me(); if ((Object)(object)val == (Object)null) { return MatchKind.Local; } bool flag = false; try { flag = ((NetworkBehaviour)val).isServer; } catch { } if (flag) { return MatchKind.Local; } try { LobbyManager instance = LobbyManager.Instance; LobbyState val2 = (((Object)(object)instance != (Object)null) ? instance.LobbyStates : null); if ((Object)(object)val2 != (Object)null && val2.Private) { return MatchKind.OnlinePrivate; } } catch { } return MatchKind.OnlinePublic; } private bool Allowed(Scope s) { return s switch { Scope.Gameplay => gameplayAllowed, Scope.Visual => visualAllowed, _ => true, }; } private string BlockedReason(Scope s) { if (matchKind != MatchKind.OnlinePublic) { return "local games only"; } return "off in public"; } private string MatchLabel() { return matchKind switch { MatchKind.Local => "LOCAL", MatchKind.OnlinePrivate => "<color=#d0ffd0>PRIVATE</color>", _ => "<color=#ffd0d0>PUBLIC</color>", }; } private void TurnOffAll() { foreach (Category category in categories) { foreach (Mod mod in category.Mods) { if (mod.Get != null && mod.Get()) { mod.Set(obj: false); } } } Notify("All mods off"); } private void Activate(Mod m) { if (!Allowed(m.Scope) && (m.Get == null || !m.Get())) { Notify(m.Name + ": " + BlockedReason(m.Scope)); return; } if (m.Get != null) { bool flag = !m.Get(); m.Set(flag); Notify(m.Name + " " + (flag ? "ON" : "OFF")); return; } m.Click?.Invoke(); if (m.Label == null) { Notify(m.Name); } } private List<Row> BuildRows(out int pageCount) { List<Row> list = new List<Row>(); int num = ((currentCategory < 0) ? categories.Count : categories[currentCategory].Mods.Count); pageCount = Mathf.Max(1, (num + 7 - 1) / 7); page = Mathf.Clamp(page, 0, pageCount - 1); int pc = pageCount; list.Add(new Row { Label = "<", Act = delegate { page = (page - 1 + pc) % pc; } }); list.Add(new Row { Label = ">", Act = delegate { page = (page + 1) % pc; } }); if (currentCategory < 0) { for (int num2 = page * 7; num2 < Mathf.Min(num, (page + 1) * 7); num2++) { int idx = num2; list.Add(new Row { Label = categories[num2].Name, Act = delegate { currentCategory = idx; page = 0; selected = 2; } }); } } else { list.Add(new Row { Label = "Return to Home", Act = GoHome }); List<Mod> mods = categories[currentCategory].Mods; for (int num3 = page * 7; num3 < Mathf.Min(num, (page + 1) * 7); num3++) { Mod m = mods[num3]; bool flag = !Allowed(m.Scope); list.Add(new Row { Label = (flag ? (m.Name + " <size=70%>(" + BlockedReason(m.Scope) + ")</size>") : ((m.Label != null) ? m.Label() : m.Name)), State = (flag ? 3 : ((m.Get != null) ? ((!m.Get()) ? 1 : 2) : 0)), Act = delegate { Activate(m); } }); } } return list; } private void GoHome() { currentCategory = -1; page = 0; selected = 2; } private void MenuKeyNav(Keyboard kb) { int pageCount; List<Row> list = BuildRows(out pageCount); if (((ButtonControl)kb.downArrowKey).wasPressedThisFrame || ((ButtonControl)kb.numpad2Key).wasPressedThisFrame) { selected = (selected + 1) % list.Count; } if (((ButtonControl)kb.upArrowKey).wasPressedThisFrame || ((ButtonControl)kb.numpad8Key).wasPressedThisFrame) { selected = (selected - 1 + list.Count) % list.Count; } if (((ButtonControl)kb.rightArrowKey).wasPressedThisFrame || ((ButtonControl)kb.numpad6Key).wasPressedThisFrame) { page++; } if (((ButtonControl)kb.leftArrowKey).wasPressedThisFrame || ((ButtonControl)kb.numpad4Key).wasPressedThisFrame) { page--; } if (((ButtonControl)kb.backspaceKey).wasPressedThisFrame) { GoHome(); } if (((ButtonControl)kb.enterKey).wasPressedThisFrame || ((ButtonControl)kb.numpadEnterKey).wasPressedThisFrame || ((ButtonControl)kb.numpad5Key).wasPressedThisFrame) { selected = Mathf.Clamp(selected, 0, list.Count - 1); list[selected].Act(); } if (page < 0) { page = 999; } } private static Color C(int r, int g, int b) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return new Color((float)r / 255f, (float)g / 255f, (float)b / 255f); } private Category LightingCategory() { return new Category { Name = "Lighting & FX", Scope = Scope.Cosmetic, Mods = { Toggle("Better Lighting", () => betterLighting, delegate(bool v) { betterLighting = v; }), Toggle("Better Shadows", () => betterShadows, delegate(bool v) { betterShadows = v; }), Toggle("Volumetric Lights", () => volumetricLights, delegate(bool v) { volumetricLights = v; }), Toggle("Lens Flare", () => lensFlare, delegate(bool v) { lensFlare = v; }), Toggle("Bloom Glow", () => fxBloom, delegate(bool v) { fxBloom = v; }), Toggle("Cinematic Tonemap (ACES)", () => fxAces, delegate(bool v) { fxAces = v; }), Toggle("Vivid Colours", () => fxVivid, delegate(bool v) { fxVivid = v; }), Toggle("Warm Sunset Tone", () => fxWarm, delegate(bool v) { fxWarm = v; }), Toggle("Vignette", () => fxVignette, delegate(bool v) { fxVignette = v; }), Toggle("Depth of Field", () => fxDof, delegate(bool v) { fxDof = v; }), Toggle("Motion Blur", () => fxMotionBlur, delegate(bool v) { fxMotionBlur = v; }), Toggle("Sharper (150% Render Scale)", () => sharper, delegate(bool v) { sharper = v; }), Toggle("Anti-Aliasing (MSAA 4x)", () => antiAliasing, delegate(bool v) { antiAliasing = v; }), Button("Max Everything", delegate { betterLighting = (betterShadows = (volumetricLights = (lensFlare = (fxBloom = (fxAces = (fxVivid = (fxVignette = (antiAliasing = true)))))))); }) } }; } private void OnSceneChangeGraphics() { sceneLightingApplied = false; sunSaved.Clear(); hazeApplied = false; shafts.Clear(); shaftLights.Clear(); sunRays.Clear(); flareSun = null; } private void ApplyLightingFx() { try { ApplyUrpAsset(); } catch (Exception e) { GfxError("urp", e); } try { ApplySceneLighting(); } catch (Exception e2) { GfxError("lighting", e2); } try { ApplyVolumetrics(); } catch (Exception e3) { GfxError("volumetric", e3); } try { ApplyVolumeFx(); } catch (Exception e4) { GfxError("fx", e4); } } private void GfxError(string what, Exception e) { if (gfxErrorsLogged.Add(what)) { ((MelonBase)this).LoggerInstance.Error($"Graphics ({what}): {e}"); } } private UniversalRenderPipelineAsset Urp() { if ((Object)(object)urp != (Object)null) { return urp; } RenderPipelineAsset val = QualitySettings.renderPipeline ?? GraphicsSettings.currentRenderPipeline; urp = (((Object)(object)val != (Object)null) ? ((Il2CppObjectBase)val).TryCast<UniversalRenderPipelineAsset>() : null); return urp; } private void ApplyUrpAsset() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_0188: Unknown result type (might be due to invalid IL or missing references) UniversalRenderPipelineAsset val = Urp(); if (!((Object)(object)val == (Object)null)) { if (betterShadows && !urpShadowsApplied) { sv_shadowDist = val.shadowDistance; sv_cascades = val.shadowCascadeCount; sv_mainRes = val.m_MainLightShadowmapResolution; sv_soft = val.m_SoftShadowsSupported; sv_addShadows = val.m_AdditionalLightShadowsSupported; sv_addRes = val.m_AdditionalLightsShadowmapResolution; val.shadowDistance = Mathf.Max(sv_shadowDist, 120f); val.shadowCascadeCount = 4; val.m_MainLightShadowmapResolution = (ShadowResolution)4096; val.m_SoftShadowsSupported = true; val.m_AdditionalLightShadowsSupported = true; val.m_AdditionalLightsShadowmapResolution = (ShadowResolution)2048; urpShadowsApplied = true; } else if (!betterShadows && urpShadowsApplied) { val.shadowDistance = sv_shadowDist; val.shadowCascadeCount = sv_cascades; val.m_MainLightShadowmapResolution = sv_mainRes; val.m_SoftShadowsSupported = sv_soft; val.m_AdditionalLightShadowsSupported = sv_addShadows; val.m_AdditionalLightsShadowmapResolution = sv_addRes; urpShadowsApplied = false; } if (betterLighting && !urpLightingApplied) { sv_hdr = val.m_SupportsHDR; sv_addMode = val.m_AdditionalLightsRenderingMode; sv_addLightLimit = val.m_AdditionalLightsPerObjectLimit; val.m_SupportsHDR = true; val.m_AdditionalLightsRenderingMode = (LightRenderingMode)1; val.m_AdditionalLightsPerObjectLimit = 8; urpLightingApplied = true; } else if (!betterLighting && urpLightingApplied) { val.m_SupportsHDR = sv_hdr; val.m_AdditionalLightsRenderingMode = sv_addMode; val.m_AdditionalLightsPerObjectLimit = sv_addLightLimit; urpLightingApplied = false; } if (sharper && !urpScaleApplied) { sv_renderScale = val.renderScale; val.renderScale = 1.5f; urpScaleApplied = true; } else if (!sharper && urpScaleApplied) { val.renderScale = sv_renderScale; urpScaleApplied = false; } if (antiAliasing && !urpMsaaApplied) { sv_msaa = val.msaaSampleCount; val.msaaSampleCount = 4; urpMsaaApplied = true; } else if (!antiAliasing && urpMsaaApplied) { val.msaaSampleCount = sv_msaa; urpMsaaApplied = false; } } } private void ApplySceneLighting() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Invalid comparison between Unknown and I4 //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) bool flag = betterLighting || betterShadows; if (flag && !sceneLightingApplied) { sv_ambientIntensity = RenderSettings.ambientIntensity; sv_reflectionIntensity = RenderSettings.reflectionIntensity; sunSaved.Clear(); Il2CppArrayBase<Light> val = Object.FindObjectsOfType<Light>(); for (int i = 0; i < val.Length; i++) { Light val2 = val[i]; if (!((Object)(object)val2 == (Object)null) && (int)val2.type == 1) { sunSaved.Add((val2, val2.intensity, val2.shadowStrength, val2.shadows)); } } sceneLightingApplied = true; } if (sceneLightingApplied) { RenderSettings.ambientIntensity = (betterLighting ? (sv_ambientIntensity * 1.15f) : sv_ambientIntensity); RenderSettings.reflectionIntensity = (betterLighting ? Mathf.Max(sv_reflectionIntensity, 1f) : sv_reflectionIntensity); foreach (var item in sunSaved) { if (!((Object)(object)item.light == (Object)null)) { item.light.intensity = (betterLighting ? (item.intensity * 1.15f) : item.intensity); item.light.shadowStrength = (betterLighting ? Mathf.Max(item.strength, 0.9f) : item.strength); item.light.shadows = (LightShadows)(betterShadows ? 2 : ((int)item.shadows)); } } } if (flag || !sceneLightingApplied) { return; } RenderSettings.ambientIntensity = sv_ambientIntensity; RenderSettings.reflectionIntensity = sv_reflectionIntensity; foreach (var item2 in sunSaved) { if (!((Object)(object)item2.light == (Object)null)) { item2.light.intensity = item2.intensity; item2.light.shadowStrength = item2.strength; item2.light.shadows = item2.shadows; } } sunSaved.Clear(); sceneLightingApplied = false; } private void ApplyVolumetrics() { //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) if (volumetricLights) { if (!hazeApplied) { sv_fog = RenderSettings.fog; sv_fogMode = RenderSettings.fogMode; sv_fogDensity = RenderSettings.fogDensity; sv_fogColor = RenderSettings.fogColor; hazeApplied = true; } Light val = FindSun(); Color source = (Color)(((Object)(object)val != (Object)null) ? val.color : new Color(1f, 0.9f, 0.75f)); RenderSettings.fog = true; RenderSettings.fogMode = (FogMode)3; RenderSettings.fogDensity = 0.006f; RenderSettings.fogColor = Color.Lerp(new Color(0.42f, 0.44f, 0.5f), WarmLight(source) * 0.75f, 0.5f); shaftScanTimer -= Time.unscaledDeltaTime; if (shaftScanTimer <= 0f) { shaftScanTimer = 3f; BuildShafts(); } UpdateSunRays(val); return; } if (hazeApplied) { RenderSettings.fog = sv_fog; RenderSettings.fogMode = sv_fogMode; RenderSettings.fogDensity = sv_fogDensity; RenderSettings.fogColor = sv_fogColor; hazeApplied = false; } if (shafts.Count > 0) { foreach (GameObject shaft in shafts) { if ((Object)(object)shaft != (Object)null) { Object.Destroy((Object)(object)shaft); } } shafts.Clear(); shaftLights.Clear(); } DestroySunRays(); } private bool EnsureShaftMaterial() { //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Expected O, but got Unknown //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Expected O, but got Unknown //IL_0390: Unknown result type (might be due to invalid IL or missing references) if (shaftShaderMissing) { return false; } if ((Object)(object)shaftMat != (Object)null) { return true; } Shader val = Shader.Find("Universal Render Pipeline/Particles/Unlit"); Shader val2 = null; Il2CppArrayBase<Shader> val3 = Resources.FindObjectsOfTypeAll<Shader>(); List<string> list = new List<string>(); for (int i = 0; i < val3.Length; i++) { Shader val4 = val3[i]; if (!((Object)(object)val4 == (Object)null) && val4.isSupported) { string name = ((Object)val4).name; string text = name.ToLowerInvariant(); if (text.Contains("particle") || text.Contains("additive") || text.Contains("unlit") || text.Contains("glow") || text.Contains("beam")) { list.Add(name); } if ((Object)(object)val == (Object)null && name == "Universal Render Pipeline/Particles/Unlit") { val = val4; } if ((Object)(object)val2 == (Object)null && text.Contains("additive")) { val2 = val4; } } } ((MelonBase)this).LoggerInstance.Msg("Volumetric Lights candidate shaders: " + ((list.Count == 0) ? "(none)" : string.Join(", ", list))); if ((Object)(object)val == (Object)null && (Object)(object)val2 != (Object)null) { Material val5 = new Material(val2) { renderQueue = 3100 }; ((Object)val5).hideFlags = (HideFlags)61; if (val5.HasProperty("_TintColor")) { val5.SetColor("_TintColor", new Color(0.5f, 0.5f, 0.5f, 0.5f)); } shaftMat = val5; shaftAdditive = true; ((MelonBase)this).LoggerInstance.Msg("Volumetric Lights shader: " + ((Object)val2).name + " (loaded additive)"); return true; } if ((Object)(object)val != (Object)null && val.isSupported) { Material val6 = new Material(val); val6.SetFloat("_Surface", 1f); val6.SetFloat("_Blend", 2f); val6.SetFloat("_SrcBlend", 5f); val6.SetFloat("_DstBlend", 1f); val6.SetFloat("_ZWrite", 0f); val6.SetFloat("_Cull", 0f); val6.EnableKeyword("_SURFACE_TYPE_TRANSPARENT"); val6.SetColor("_BaseColor", Color.white); val6.renderQueue = 3100; ((Object)val6).hideFlags = (HideFlags)61; shaftMat = val6; shaftAdditive = true; ((MelonBase)this).LoggerInstance.Msg("Volumetric Lights shader: URP Particles/Unlit (additive)"); return true; } string[] obj = new string[3] { "Legacy Shaders/Particles/Additive", "Mobile/Particles/Additive", "Particles/Additive" }; Shader val7 = null; string[] array = obj; for (int j = 0; j < array.Length; j++) { val7 = Shader.Find(array[j]); if ((Object)(object)val7 != (Object)null) { shaftAdditive = true; break; } } if ((Object)(object)val7 == (Object)null) { val7 = Shader.Find("Sprites/Default"); } if ((Object)(object)val7 == (Object)null) { shaftShaderMissing = true; ((MelonBase)this).LoggerInstance.Warning("Volumetric Lights: no transparent shader found, using haze only."); return false; } shaftMat = new Material(val7) { renderQueue = 3100 }; ((Object)shaftMat).hideFlags = (HideFlags)61; if (shaftAdditive && shaftMat.HasProperty("_TintColor")) { shaftMat.SetColor("_TintColor", new Color(0.5f, 0.5f, 0.5f, 0.5f)); } ((MelonBase)this).LoggerInstance.Msg("Volumetric Lights shader: " + ((Object)val7).name); return true; } private static Color WarmLight(Color source) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) Color val = default(Color); ((Color)(ref val))..ctor(1f, 0.72f, 0.38f); float num = default(float); float num2 = default(float); float num3 = default(float); Color.RGBToHSV(Color.Lerp(source, val, 0.6f), ref num, ref num2, ref num3); return Color.HSVToRGB(num, Mathf.Max(num2, 0.45f), 1f); } private Light FindSun() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 Light val = null; Il2CppArrayBase<Light> val2 = Object.FindObjectsOfType<Light>(); for (int i = 0; i < val2.Length; i++) { Light val3 = val2[i]; if (!((Object)(object)val3 == (Object)null) && ((Behaviour)val3).enabled && (int)val3.type == 1 && ((Object)(object)val == (Object)null || val3.intensity > val.intensity)) { val = val3; } } return val; } private void UpdateSunRays(Light sun) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_00eb: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014e: 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_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Expected O, but got Unknown //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: 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) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) if (!EnsureShaftMaterial()) { return; } Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return; } Vector3 val = ((Component)main).transform.position; List<Actor> list = AllActors(); if (list.Count > 0) { val = Vector3.zero; foreach (Actor item in list) { val += Center(item); } val /= (float)list.Count; } Vector3 val2 = (Vector3)(((Object)(object)sun != (Object)null) ? ((Component)sun).transform.forward : new Vector3(0.3f, -1f, 0.2f)); Vector3 val3 = ((Vector3)(ref val2)).normalized + Vector3.down * 0.6f; val2 = ((Vector3)(ref val3)).normalized; if (val2.y > -0.4f) { val3 = new Vector3(val2.x, -0.4f, val2.z); val2 = ((Vector3)(ref val3)).normalized; } Color color = WarmLight(((Object)(object)sun != (Object)null) ? sun.color : Color.white); if (sunRays.Count == 0 || (Object)(object)sunRays[0].Go == (Object)null) { DestroySunRays(); rayCenter = val; Mesh sharedMesh = RayMesh(70f, color, shaftAdditive ? 0.16f : 0.09f); for (int i = 0; i < 18; i++) { GameObject val4 = new GameObject("GooberMenu_SunRay"); val4.AddComponent<MeshFilter>().sharedMesh = sharedMesh; MeshRenderer obj = val4.AddComponent<MeshRenderer>(); ((Renderer)obj).sharedMaterial = shaftMat; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)obj).receiveShadows = false; Vector2 val5 = Random.insideUnitCircle * 30f; sunRays.Add(new SunRay { Go = val4, Offset = new Vector3(val5.x, Random.Range(-6f, 2f), val5.y), Phase = Random.Range(0f, 100f), Speed = Random.Range(0.15f, 0.45f), Width = Random.Range(0.6f, 2.4f) }); } } rayCenter = Vector3.Lerp(rayCenter, val, 1f - Mathf.Exp(-0.3f * Time.unscaledDeltaTime)); Quaternion val6 = Quaternion.LookRotation(val2, Vector3.up); float unscaledTime = Time.unscaledTime; foreach (SunRay sunRay in sunRays) { if (!((Object)(object)sunRay.Go == (Object)null)) { Vector3 val7 = new Vector3(Mathf.Sin(unscaledTime * sunRay.Speed + sunRay.Phase), 0f, Mathf.Cos(unscaledTime * sunRay.Speed * 0.8f + sunRay.Phase)) * 1.5f; Vector3 val8 = rayCenter + sunRay.Offset + val7 - val2 * 70f; float num = sunRay.Width * (0.75f + 0.25f * Mathf.Sin(unscaledTime * sunRay.Speed * 2f + sunRay.Phase)); sunRay.Go.transform.SetPositionAndRotation(val8, val6); sunRay.Go.transform.localScale = new Vector3(num, num, 1f); } } } private void DestroySunRays() { foreach (SunRay sunRay in sunRays) { if ((Object)(object)sunRay.Go != (Object)null) { Object.Destroy((Object)(object)sunRay.Go); } } sunRays.Clear(); } private static Mesh RayMesh(float length, Color color, float maxAlpha) { //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_018e: 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_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00c9: Unknown result type (might be due to invalid IL or missing references) List<Vector3> list = new List<Vector3>(); List<Color> list2 = new List<Color>(); List<int> list3 = new List<int>(); Vector3 val = default(Vector3); for (int i = 0; i < 3; i++) { float num = (float)i * (float)Math.PI / 3f; ((Vector3)(ref val))..ctor(Mathf.Cos(num), Mathf.Sin(num), 0f); int count = list.Count; for (int j = 0; j <= 12; j++) { float num2 = (float)j / 12f; float num3 = 1f + num2 * 0.6f; float num4 = maxAlpha * Profile(num2); for (int k = -1; k <= 1; k++) { list.Add(val * ((float)k * num3) + new Vector3(0f, 0f, length * num2)); list2.Add(new Color(color.r, color.g, color.b, (k == 0) ? num4 : 0f)); } } for (int l = 0; l < 12; l++) { for (int m = 0; m < 2; m++) { int num5 = count + l * 3 + m; int item = num5 + 1; int num6 = num5 + 3; int item2 = num6 + 1; list3.Add(num5); list3.Add(num6); list3.Add(item2); list3.Add(num5); list3.Add(item2); list3.Add(item); } } } Mesh val2 = new Mesh { vertices = Il2CppStructArray<Vector3>.op_Implicit(list.ToArray()), colors = Il2CppStructArray<Color>.op_Implicit(list2.ToArray()), triangles = Il2CppStructArray<int>.op_Implicit(list3.ToArray()) }; val2.RecalculateBounds(); ((Object)val2).hideFlags = (HideFlags)61; return val2; static float Profile(float t) { if (t < 0.1f) { return t / 0.1f; } float num7 = 1f - (t - 0.1f) / 0.9f; return num7 * num7; } } private void BuildShafts() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Invalid comparison between Unknown and I4 //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL