Decompiled source of Flash v1.0.0
Mods/Flash.dll
Decompiled 4 days 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.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using FlashMod; using Il2CppFemur; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem.Collections.Generic; using MelonLoader; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(Flash), "Flash", "1.0.0", "Zooks", null)] [assembly: MelonGame("Boneloaf", "Gang Beasts")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("Flash")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Flash")] [assembly: AssemblyTitle("Flash")] [assembly: AssemblyVersion("1.0.0.0")] [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 FlashMod { public class Flash : MelonMod { private class Parts { public Rigidbody ball; public Rigidbody hips; public Rigidbody waist; public Rigidbody stomach; public Rigidbody chest; public Rigidbody head; public Rigidbody lArm; public Rigidbody lFore; public Rigidbody lHand; public Rigidbody rArm; public Rigidbody rFore; public Rigidbody rHand; public Rigidbody lThigh; public Rigidbody lLeg; public Rigidbody lFoot; public Rigidbody rThigh; public Rigidbody rLeg; public Rigidbody rFoot; public List<Rigidbody> all = new List<Rigidbody>(); } private class LightRec { public Light l; public Color c; } private class MatRec { public Material m; public int[] props; public Color[] origs; public bool hasEmis; public Color origEmis; public bool origEmisKw; public bool emisOn; } private class SkinRec { public Actor a; public Color o; } private class Seg { public GameObject core; public GameObject halo; public Renderer cr; public Renderer hr; } private class Trail { public Rigidbody rb; public Vector3[] hist = (Vector3[])(object)new Vector3[8]; public Seg[] segs = new Seg[7]; } private const float slowMoScale = 0.2f; private const float realTimeRunSpeed = 5.5f; private const float grabSpeedFactor = 0.9f; private const float throwSpeed = 9f; private const float throwLift = 3f; private const float fadeSpeed = 2.5f; private const float alignGain = 12f; private const float accelTime = 7f; private const float limbSpinDamp = 0.97f; private const float limbMaxSpin = 20f; private const float limbPull = 0.8f; private static readonly int wallRunKey = 0; private const float wallRunTime = 1.8f; private const float wallClimbSpeed = 4.5f; private const float wallCheckDist = 1.1f; private const float grayLight = 0.4f; private const float grayAmbient = 0.16f; private const float grayMat = 0.7f; private const float grayEnemy = 0.75f; private const float emissionLift = 0.03f; private const float chromaBase = 0.55f; private const float chromaRun = 1f; private const float bloomBase = 0.8f; private const float bloomRun = 1.6f; private const float bloomThreshold = 1.5f; private const float bloomScatter = 0.6f; private const float warpStrength = 1f; private const float warpNearRadius = 4f; private const float warpFarRadius = 9f; private const float warpFadeSpeed = 0.5f; private static readonly bool useTrails = true; private const float trailThickness = 0.07f; private const float haloScale = 4.5f; private bool active; private bool qWas; private bool spaceWas; private float grayFade; private float runBlend; private float speedRamp; private float warpBlend; private float runPhase; private float stopTimer; private float standHeight; private float lastJump = -10f; private float wallLockUntil; private float wallStart; private float jumpUntil; private float lastGroundT; private float nextRunLog; private float nextFind; private float nextScan; private float nextActors; private float nextSkin; private float nextVolTry; private float trailTimer; private float lastForceLog; private float lastErr; private float origFixed = 0.02f; private float baseFov = 60f; private float lastAppliedG = -1f; private bool wallRunning; private bool wallNeedGround; private bool hasInput; private bool holding; private bool grayApplied; private bool grayDirty; private bool vfxShown; private bool histInit; private bool leftHeld; private bool rightHeld; private Vector3 moveDir; private Vector3 wallN; private int dbgLocal; private int dbgAll; private Actor me; private Actor boosted; private Parts P; private float origGround; private float origPunchF; private float origPunchD; private Color playerOrig; private Rigidbody heldRb; private Actor heldActor; private Rigidbody lastLeftConn; private Rigidbody lastRightConn; private List<Actor> allActors = new List<Actor>(); private List<LightRec> lights = new List<LightRec>(); private List<MatRec> mats = new List<MatRec>(); private HashSet<int> seenMats = new HashSet<int>(); private HashSet<int> seenRenderers = new HashSet<int>(); private HashSet<int> seenLights = new HashSet<int>(); private Dictionary<int, SkinRec> skins = new Dictionary<int, SkinRec>(); private Color origAmb; private Color origSky; private Color origEq; private Color origGr; private Color origFog; private Volume vol; private VolumeProfile profile; private Bloom bloom; private ChromaticAberration chroma; private LensDistortion lens; private GameObject vfxRoot; private List<Trail> trails = new List<Trail>(); private Material[] coreMats = (Material[])(object)new Material[7]; private Material[] haloMats = (Material[])(object)new Material[7]; [DllImport("user32.dll")] private static extern short GetAsyncKeyState(int vKey); private static bool Down(int vk) { return (GetAsyncKeyState(vk) & 0x8000) != 0; } private static T Comp<T>(GameObject go) where T : Il2CppObjectBase { Component component = go.GetComponent(Il2CppType.Of<T>()); if ((Object)(object)component == (Object)null) { return default(T); } return ((Il2CppObjectBase)component).TryCast<T>(); } private static T AddComp<T>(GameObject go) where T : Il2CppObjectBase { return ((Il2CppObjectBase)go.AddComponent(Il2CppType.Of<T>())).TryCast<T>(); } private static float Smooth(float x) { x = Mathf.Clamp01(x); return x * x * (3f - 2f * x); } private static float Lum(Color c) { //IL_0005: 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_001e: Unknown result type (might be due to invalid IL or missing references) return 0.299f * c.r + 0.587f * c.g + 0.114f * c.b; } private static Color Gray(Color c, float mul, float blue = 1f) { //IL_0000: 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_0012: Unknown result type (might be due to invalid IL or missing references) float num = Lum(c) * mul; return new Color(num, num, num * blue, c.a); } private static Rigidbody RB(BodyPart p) { if (p == null) { return null; } return p.PartRigidbody; } private void Err(string where, Exception e) { if (Time.unscaledTime - lastErr > 3f) { lastErr = Time.unscaledTime; ((MelonBase)this).LoggerInstance.Error(where + ": " + e.Message); } } public override void OnInitializeMelon() { ((MelonBase)this).LoggerInstance.Msg("Flash 1.0.0 loaded. Press Q in a match."); } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { try { ResetAll(); } catch (Exception e) { Err("ResetAll", e); } } public override void OnUpdate() { try { UpdateMain(); } catch (Exception e) { Err("Update", e); } } public override void OnLateUpdate() { try { EnforceTime(); UpdateFov(); UpdateVfx(Time.unscaledDeltaTime); } catch (Exception e) { Err("LateUpdate", e); } } public override void OnFixedUpdate() { try { EnforceTime(); FixedWork(); } catch (Exception e) { Err("FixedUpdate", e); } } private void UpdateMain() { float unscaledDeltaTime = Time.unscaledDeltaTime; bool flag = Application.isFocused && Down(81); if (flag && !qWas) { Toggle(); } qWas = flag; if (active) { EnforceTime(); if ((Object)(object)me == (Object)null || !Usable(me)) { Actor val = FindLocal(force: false); if ((Object)(object)val != (Object)null) { AdoptPlayer(val); } } ReadInput(); MaintainStats(); if (Time.unscaledTime >= nextActors) { nextActors = Time.unscaledTime + 1f; RefreshActors(); } if (Time.unscaledTime >= nextScan) { nextScan = Time.unscaledTime + 2f; ScanWorld(); } EnsureVolume(); UpdateWarpBlend(unscaledDeltaTime); } else { hasInput = false; } grayFade = Mathf.MoveTowards(grayFade, active ? 1f : 0f, 2.5f * unscaledDeltaTime); float num = ((active && hasInput && speedRamp > 0.1f) ? 1f : 0f); runBlend = Mathf.MoveTowards(runBlend, num, 4f * unscaledDeltaTime); UpdateGrayscale(); UpdateVolume(); } private void EnforceTime() { if (!active || Time.timeScale == 0f) { return; } if (Mathf.Abs(Time.timeScale - 0.2f) > 0.001f) { if (Time.unscaledTime - lastForceLog > 2f) { lastForceLog = Time.unscaledTime; ((MelonBase)this).LoggerInstance.Msg("Game changed timeScale to " + Time.timeScale + ", forcing back"); } Time.timeScale = 0.2f; } float num = 0.004f; if (Mathf.Abs(Time.fixedDeltaTime - num) > 1E-05f) { Time.fixedDeltaTime = num; } } private void Toggle() { if (!active) { Actor val = FindLocal(force: true); if ((Object)(object)val == (Object)null) { ((MelonBase)this).LoggerInstance.Warning("No local player. LocalPlayers=" + dbgLocal + " CachedActors=" + dbgAll); return; } active = true; origFixed = ((Time.fixedDeltaTime > 0.0001f && Time.timeScale >= 0.99f) ? Time.fixedDeltaTime : 0.02f); Time.timeScale = 0.2f; Time.fixedDeltaTime = 0.004f; AdoptPlayer(val); RefreshActors(); ScanWorld(); EnsureVolume(); warpBlend = 0f; ((MelonBase)this).LoggerInstance.Msg("Flash ON"); } else { Deactivate(); ((MelonBase)this).LoggerInstance.Msg("Flash OFF"); } } private void Deactivate() { active = false; Time.timeScale = 1f; Time.fixedDeltaTime = origFixed; RestoreBoost(); wallRunning = false; speedRamp = 0f; heldRb = null; heldActor = null; hasInput = false; } private void ResetAll() { if (active) { Time.timeScale = 1f; Time.fixedDeltaTime = origFixed; } active = false; grayFade = 0f; runBlend = 0f; speedRamp = 0f; warpBlend = 0f; wallRunning = false; heldRb = null; heldActor = null; me = null; P = null; boosted = null; standHeight = 0f; lights.Clear(); mats.Clear(); seenMats.Clear(); seenRenderers.Clear(); seenLights.Clear(); skins.Clear(); allActors.Clear(); grayApplied = false; grayDirty = false; lastAppliedG = -1f; lastLeftConn = null; lastRightConn = null; nextScan = 0f; nextActors = 0f; nextFind = 0f; if ((Object)(object)vol != (Object)null) { vol.weight = 0f; ((Behaviour)vol).enabled = false; } if (vfxShown && (Object)(object)vfxRoot != (Object)null) { vfxRoot.SetActive(false); } vfxShown = false; histInit = false; foreach (Trail trail in trails) { trail.rb = null; } } private static bool Usable(Actor a) { if ((Object)(object)a == (Object)null) { return false; } BodyHandeler bodyHandeler = a.bodyHandeler; if ((Object)(object)bodyHandeler == (Object)null) { return false; } return bodyHandeler.Hips != null; } private Actor FindLocal(bool force) { if (!force && Time.unscaledTime < nextFind) { return null; } nextFind = Time.unscaledTime + 0.5f; dbgLocal = 0; dbgAll = 0; Actor val = null; try { List<Actor> localPlayers = Actor.LocalPlayers; if (localPlayers != null) { Enumerator<Actor> enumerator = localPlayers.GetEnumerator(); while (enumerator.MoveNext()) { Actor current = enumerator.Current; if (!((Object)(object)current == (Object)null)) { dbgLocal++; if ((Object)(object)val == (Object)null && !current.IsAI && Usable(current)) { val = current; } } } } } catch (Exception) { } if ((Object)(object)val == (Object)null) { try { foreach (Actor item in Object.FindObjectsOfType<Actor>()) { if (!((Object)(object)item == (Object)null)) { dbgAll++; if ((Object)(object)val == (Object)null && !item.IsAI && Usable(item)) { val = item; } } } } catch (Exception) { } } return val; } private Parts BuildParts(Actor a) { BodyHandeler bodyHandeler = a.bodyHandeler; Parts parts = new Parts(); parts.ball = RB(bodyHandeler.Ball); parts.hips = RB(bodyHandeler.Hips); parts.waist = RB(bodyHandeler.Waist); parts.stomach = RB(bodyHandeler.Stomach); parts.chest = RB(bodyHandeler.Chest); parts.head = RB(bodyHandeler.Head); parts.lArm = RB(bodyHandeler.LeftArm); parts.lFore = RB(bodyHandeler.LeftForarm); parts.lHand = RB(bodyHandeler.LeftHand); parts.rArm = RB(bodyHandeler.RightArm); parts.rFore = RB(bodyHandeler.RightForarm); parts.rHand = RB(bodyHandeler.RightHand); parts.lThigh = RB(bodyHandeler.LeftThigh); parts.lLeg = RB(bodyHandeler.LeftLeg); parts.lFoot = RB(bodyHandeler.LeftFoot); parts.rThigh = RB(bodyHandeler.RightThigh); parts.rLeg = RB(bodyHandeler.RightLeg); parts.rFoot = RB(bodyHandeler.RightFoot); Rigidbody[] array = (Rigidbody[])(object)new Rigidbody[18] { parts.ball, parts.hips, parts.waist, parts.stomach, parts.chest, parts.head, parts.lArm, parts.lFore, parts.lHand, parts.rArm, parts.rFore, parts.rHand, parts.lThigh, parts.lLeg, parts.lFoot, parts.rThigh, parts.rLeg, parts.rFoot }; foreach (Rigidbody val in array) { if ((Object)(object)val != (Object)null) { parts.all.Add(val); } } return parts; } private void AdoptPlayer(Actor a) { //IL_0058: 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_004a: 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) RestoreBoost(); me = a; P = BuildParts(a); standHeight = 0f; wallRunning = false; heldRb = null; heldActor = null; lastLeftConn = null; lastRightConn = null; try { playerOrig = a.primaryColor; } catch (Exception) { playerOrig = Color.white; } try { origGround = a.groundSpeed; origPunchF = a._punchForceModifer; origPunchD = a._punchDamageModifer; a.groundSpeed = origGround * 2.5f; a._punchForceModifer = origPunchF * 7f; a._punchDamageModifer = origPunchD * 5f; boosted = a; } catch (Exception e) { Err("Boost", e); } BuildVfx(); Rigidbody[] array = (Rigidbody[])(object)new Rigidbody[6] { P.chest, P.waist, P.lHand, P.rHand, P.lFoot, P.rFoot }; for (int i = 0; i < trails.Count && i < array.Length; i++) { trails[i].rb = array[i]; } histInit = false; } private void RestoreBoost() { if ((Object)(object)boosted != (Object)null) { try { boosted.groundSpeed = origGround; boosted._punchForceModifer = origPunchF; boosted._punchDamageModifer = origPunchD; } catch (Exception) { } } boosted = null; } private void MaintainStats() { if ((Object)(object)me == (Object)null) { return; } try { StatusHandeler statusHandeler = me.statusHandeler; if ((Object)(object)statusHandeler != (Object)null) { statusHandeler.stamina = statusHandeler.maxStamina; statusHandeler.health = statusHandeler.maxHealth; statusHandeler.unconsciousTime = 0f; } } catch (Exception) { } } private void RefreshActors() { allActors.Clear(); try { foreach (Actor item in Object.FindObjectsOfType<Actor>()) { if ((Object)(object)item != (Object)null) { allActors.Add(item); } } } catch (Exception) { } } private void ReadInput() { //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) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018f: 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_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_0149: 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_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_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: 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_0108: 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) float num = 0f; float num2 = 0f; if (Application.isFocused) { if (Down(68) || Down(39)) { num += 1f; } if (Down(65) || Down(37)) { num -= 1f; } if (Down(87) || Down(38)) { num2 += 1f; } if (Down(83) || Down(40)) { num2 -= 1f; } bool flag = Down(32); if (flag && !spaceWas) { jumpUntil = Time.unscaledTime + 0.15f; } spaceWas = flag; } if (num == 0f && num2 == 0f && (Object)(object)me != (Object)null) { try { Vector3 rawDirection = me.controlHandeler.rawDirection; float x = rawDirection.x; float num3 = ((Mathf.Abs(rawDirection.z) > Mathf.Abs(rawDirection.y)) ? rawDirection.z : rawDirection.y); if (x * x + num3 * num3 > 0.04f) { num = x; num2 = num3; } } catch (Exception) { } } Vector3 forward = Vector3.forward; Camera main = Camera.main; if ((Object)(object)main != (Object)null) { forward = ((Component)main).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 0.0001f) { forward = Vector3.forward; } ((Vector3)(ref forward)).Normalize(); } Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(forward.z, 0f, 0f - forward.x); Vector3 val2 = forward * num2 + val * num; if (((Vector3)(ref val2)).sqrMagnitude > 0.04f) { moveDir = ((Vector3)(ref val2)).normalized; hasInput = true; } else { hasInput = false; } } private bool JumpReq() { return Time.unscaledTime <= jumpUntil; } private bool IsOwnBody(Rigidbody rb) { if ((Object)(object)rb == (Object)null || P == null) { return false; } for (int i = 0; i < P.all.Count; i++) { if ((Object)(object)P.all[i] == (Object)(object)rb) { return true; } } return false; } private bool GroundBelow() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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) try { float num = ((standHeight > 0.2f) ? (standHeight * 1.35f) : 1.6f); Il2CppStructArray<RaycastHit> val = Physics.RaycastAll(P.hips.position, Vector3.down, num, -1, (QueryTriggerInteraction)1); if (val == null) { return false; } for (int i = 0; i < ((Il2CppArrayBase<RaycastHit>)(object)val).Length; i++) { RaycastHit val2 = ((Il2CppArrayBase<RaycastHit>)(object)val)[i]; Collider collider = ((RaycastHit)(ref val2)).collider; if (!((Object)(object)collider == (Object)null) && !collider.isTrigger) { Rigidbody attachedRigidbody = collider.attachedRigidbody; if (!((Object)(object)attachedRigidbody != (Object)null) || !IsOwnBody(attachedRigidbody)) { return true; } } } } catch (Exception) { } return false; } private void FixedWork() { //IL_0500: Unknown result type (might be due to invalid IL or missing references) //IL_0505: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_0514: Unknown result type (might be due to invalid IL or missing references) //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_0524: 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_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_032b: 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_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_044c: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) if (!active || (Object)(object)me == (Object)null || P == null || (Object)(object)P.hips == (Object)null) { return; } float num = Mathf.Max(Time.timeScale, 0.05f); float num2 = Time.fixedDeltaTime / num; float unscaledTime = Time.unscaledTime; ControlHandeler controlHandeler = me.controlHandeler; bool flag = controlHandeler != null && controlHandeler.onGround; bool flag2 = GroundBelow(); bool flag3 = flag || flag2; if (flag3) { wallNeedGround = false; lastGroundT = unscaledTime; } bool flag4 = (flag3 && unscaledTime - lastJump > 0.3f) || (unscaledTime - lastGroundT < 0.25f && unscaledTime - lastJump > 0.35f); try { GrabLogic(num); } catch (Exception e) { Err("GrabLogic", e); } holding = (Object)(object)heldRb != (Object)null; MeasureStand(flag3); if (!wallRunning) { TryStartWall(flag3); } if (hasInput && unscaledTime >= nextRunLog) { nextRunLog = unscaledTime + 2f; ((MelonBase)this).LoggerInstance.Msg("Run: flag=" + flag + " ray=" + flag2 + " runGround=" + flag4 + " anim=" + (hasInput && flag4 && !wallRunning) + " wall=" + wallRunning + " stand=" + standHeight); } if (wallRunning) { DriveWall(num, num2, flag3); return; } speedRamp = (hasInput ? Mathf.MoveTowards(speedRamp, 1f, 7f * num2) : 0f); if (hasInput) { stopTimer = 0.3f; float num3 = 5.5f * (holding ? 0.9f : 1f) * Mathf.Lerp(0.45f, 1f, speedRamp) / num; Vector3 val = moveDir * num3; foreach (Rigidbody item in P.all) { Vector3 velocity = item.velocity; Vector3 val2 = Vector3.Lerp(new Vector3(velocity.x, 0f, velocity.z), val, 0.45f); item.velocity = new Vector3(val2.x, velocity.y, val2.z); } } else if (stopTimer > 0f) { stopTimer -= num2; foreach (Rigidbody item2 in P.all) { Vector3 velocity2 = item2.velocity; item2.velocity = new Vector3(velocity2.x * 0.15f, velocity2.y, velocity2.z * 0.15f); } } if (JumpReq() && flag3 && unscaledTime - lastJump > 0.28f) { jumpUntil = 0f; lastJump = unscaledTime; foreach (Rigidbody item3 in P.all) { Vector3 velocity3 = item3.velocity; item3.velocity = new Vector3(velocity3.x, 5.5f / num, velocity3.z); } } if (!flag3) { float num4 = (0f - Physics.gravity.y) * (1f / (num * num) - 1f) * Time.fixedDeltaTime; foreach (Rigidbody item4 in P.all) { Vector3 velocity4 = item4.velocity; item4.velocity = new Vector3(velocity4.x, velocity4.y - num4, velocity4.z); } } if (!(hasInput && flag4)) { return; } runPhase += num2 * 16f; try { NarutoRun(moveDir, num); } catch (Exception e2) { Err("NarutoRun", e2); } DampLimbs(num); if (!(unscaledTime - lastJump > 0.4f)) { return; } float num5 = 3f / num; foreach (Rigidbody item5 in P.all) { Vector3 velocity5 = item5.velocity; if (velocity5.y > num5) { item5.velocity = new Vector3(velocity5.x, num5, velocity5.z); } } } private void MeasureStand(bool grounded) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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) if (!grounded || (Object)(object)P.lFoot == (Object)null || (Object)(object)P.rFoot == (Object)null) { return; } float num = P.hips.position.y - Mathf.Min(P.lFoot.position.y, P.rFoot.position.y); if (num < 0.25f || num > 3f) { return; } if (standHeight <= 0f) { standHeight = num; } else if (hasInput) { if (num > standHeight) { standHeight = Mathf.Lerp(standHeight, num, 0.05f); } } else if (num > standHeight * 0.85f) { standHeight = Mathf.Lerp(standHeight, num, 0.05f); } } private void Align(Rigidbody rb, Vector3 target, float ts) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_0017: Unknown result type (might be due to invalid IL or missing references) //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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0043: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)rb == (Object)null)) { Vector3 up = ((Component)rb).transform.up; Vector3 val = Vector3.Cross(up, target); float magnitude = ((Vector3)(ref val)).magnitude; if (!(magnitude < 0.0001f)) { float num = Mathf.Atan2(magnitude, Vector3.Dot(up, target)); val /= magnitude; float num2 = Mathf.Min(num * 12f / ts, 8f / ts); rb.angularVelocity = Vector3.Lerp(rb.angularVelocity, val * num2, 0.7f); } } } private void AlignW(Rigidbody rb, Vector3 dir, float wu, float wd, float ts) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.up * wu + dir * wd; Vector3 normalized = ((Vector3)(ref val)).normalized; Align(rb, normalized, ts); } private void PullTo(Rigidbody rb, Vector3 target, float gain, float ts, Vector3 bv) { //IL_000a: 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) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0057: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)rb == (Object)null)) { Vector3 val = (target - rb.position) * gain / ts; float magnitude = ((Vector3)(ref val)).magnitude; float num = 6f / ts; if (magnitude > num) { val *= num / magnitude; } rb.velocity = Vector3.Lerp(rb.velocity, bv + val, 0.8f); } } private void DampLimbs(float ts) { //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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_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) float num = 20f / ts; Rigidbody[] array = (Rigidbody[])(object)new Rigidbody[12] { P.lArm, P.lFore, P.lHand, P.rArm, P.rFore, P.rHand, P.lThigh, P.lLeg, P.lFoot, P.rThigh, P.rLeg, P.rFoot }; foreach (Rigidbody val in array) { if (!((Object)(object)val == (Object)null)) { Vector3 val2 = val.angularVelocity; float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude > num) { val2 *= num / magnitude; } val.angularVelocity = val2 * 0.97f; } } } private void NarutoRun(Vector3 dir, float ts) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0063: 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_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0268: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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_01c7: 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_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: 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) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01db: 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_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0358: 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) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0309: 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_030d: Unknown result type (might be due to invalid IL or missing references) AlignW(P.hips, dir, 0.92f, 0.38f, ts); AlignW(P.waist, dir, 0.82f, 0.57f, ts); AlignW(P.stomach, dir, 0.78f, 0.62f, ts); AlignW(P.chest, dir, 0.74f, 0.67f, ts); AlignW(P.head, dir, 0.9f, 0.2f, ts); float l = Mathf.Max(standHeight, 0.6f); if (standHeight > 0.2f && (Object)(object)P.lFoot != (Object)null && (Object)(object)P.rFoot != (Object)null) { float num = Mathf.Min(P.lFoot.position.y, P.rFoot.position.y); float num2 = standHeight * 0.97f - (P.hips.position.y - num); if (num2 > 0f) { float num3 = Mathf.Min(num2 * 8f / ts, 2.5f / ts); Rigidbody[] array = (Rigidbody[])(object)new Rigidbody[5] { P.hips, P.waist, P.stomach, P.chest, P.head }; foreach (Rigidbody val in array) { if (!((Object)(object)val == (Object)null)) { Vector3 velocity = val.velocity; if (velocity.y < num3) { val.velocity = new Vector3(velocity.x, Mathf.Lerp(velocity.y, num3, 0.5f), velocity.z); } } } } } Vector3 velocity2 = P.hips.velocity; Vector3 val2 = Vector3.Cross(Vector3.up, dir); Vector3 normalized = ((Vector3)(ref val2)).normalized; Vector3 cp = (((Object)(object)P.chest != (Object)null) ? P.chest.position : P.hips.position); ControlHandeler controlHandeler = me.controlHandeler; bool num4 = controlHandeler.leftPunch || controlHandeler.leftGrab || leftHeld; bool flag = controlHandeler.rightPunch || controlHandeler.rightGrab || rightHeld; if (!num4) { SweepArm(P.lArm, P.lFore, P.lHand, cp, dir, -normalized, l, ts, velocity2); } if (!flag) { SweepArm(P.rArm, P.rFore, P.rHand, cp, dir, normalized, l, ts, velocity2); } Vector3 position = P.hips.position; PullLeg(runPhase, -1f, P.lThigh, P.lLeg, P.lFoot, position, dir, normalized, l, ts, velocity2); PullLeg(runPhase + (float)Math.PI, 1f, P.rThigh, P.rLeg, P.rFoot, position, dir, normalized, l, ts, velocity2); } private void SweepArm(Rigidbody arm, Rigidbody fore, Rigidbody hand, Vector3 cp, Vector3 dir, Vector3 s, float L, float ts, Vector3 bv) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_0080: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_00a2: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00e4: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) PullTo(arm, cp + s * 0.22f * L - dir * 0.18f * L - Vector3.up * 0.05f * L, 10f, ts, bv); PullTo(fore, cp + s * 0.26f * L - dir * 0.36f * L - Vector3.up * 0.04f * L, 10f, ts, bv); PullTo(hand, cp + s * 0.28f * L - dir * 0.56f * L + Vector3.up * 0.02f * L, 10f, ts, bv); } private void PullLeg(float ph, float sgn, Rigidbody thigh, Rigidbody shin, Rigidbody foot, Vector3 hp, Vector3 dir, Vector3 side, float L, float ts, Vector3 bv) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0050: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_007a: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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_0123: 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_0130: 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_0143: 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_0156: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Sin(ph); float num2 = Mathf.Cos(ph); float num3 = num * 0.55f * L; float num4 = Mathf.Max(0f, num2); float num5 = num4 * 0.42f * L; Vector3 val = side * sgn * 0.12f * L; Vector3 target = new Vector3(hp.x, hp.y - L, hp.z) + dir * num3 + val + Vector3.up * num5; Vector3 target2 = hp + dir * (num3 * 0.6f + 0.1f * L * num4) + val + Vector3.down * (0.62f * L - num5 * 0.55f); Vector3 target3 = hp + dir * (0.12f * L + num3 * 0.35f + 0.12f * L * num4) + val + Vector3.down * (0.28f * L - num5 * 0.3f); PullTo(thigh, target3, 10f, ts, bv); PullTo(shin, target2, 10f, ts, bv); PullTo(foot, target, 10f, ts, bv); } private bool FindWall(Vector3 origin, Vector3 dir, float dist, out Vector3 n, out float d) { //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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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) n = Vector3.zero; d = 0f; Il2CppStructArray<RaycastHit> val = Physics.RaycastAll(origin, dir, dist, -1, (QueryTriggerInteraction)1); if (val == null) { return false; } float num = 1E+09f; bool result = false; for (int i = 0; i < ((Il2CppArrayBase<RaycastHit>)(object)val).Length; i++) { RaycastHit val2 = ((Il2CppArrayBase<RaycastHit>)(object)val)[i]; Collider collider = ((RaycastHit)(ref val2)).collider; if (!((Object)(object)collider == (Object)null) && !collider.isTrigger) { Rigidbody attachedRigidbody = collider.attachedRigidbody; if ((!((Object)(object)attachedRigidbody != (Object)null) || attachedRigidbody.isKinematic) && !(Mathf.Abs(((RaycastHit)(ref val2)).normal.y) > 0.35f) && ((RaycastHit)(ref val2)).distance < num) { num = ((RaycastHit)(ref val2)).distance; n = ((RaycastHit)(ref val2)).normal; d = ((RaycastHit)(ref val2)).distance; result = true; } } } return result; } private void TryStartWall(bool grounded) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_0072: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) if (!hasInput || (wallRunKey != 0 && !Down(wallRunKey))) { return; } float unscaledTime = Time.unscaledTime; if (unscaledTime < wallLockUntil || (wallNeedGround && !grounded)) { return; } Vector3 origin = (((Object)(object)P.chest != (Object)null) ? P.chest.position : P.hips.position); if (!FindWall(origin, moveDir, 1.1f, out var n, out var _)) { return; } n.y = 0f; if (!(((Vector3)(ref n)).sqrMagnitude < 0.0001f)) { ((Vector3)(ref n)).Normalize(); if (!(Vector3.Dot(moveDir, -n) < 0.6f)) { wallRunning = true; wallN = n; wallStart = unscaledTime; ((MelonBase)this).LoggerInstance.Msg("Wall run start"); } } } private void EndWall(float lockTime, bool needGround) { wallRunning = false; wallLockUntil = Time.unscaledTime + lockTime; wallNeedGround = needGround; } private void SetAllVel(Vector3 v) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) foreach (Rigidbody item in P.all) { item.velocity = v; } } private void DriveWall(float ts, float realDt, bool grounded) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_0032: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_0078: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_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_019e: 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_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_0152: 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_01b0: 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_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: 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_02d5: 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_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0319: 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_033c: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Unknown result type (might be due to invalid IL or missing references) //IL_04db: Unknown result type (might be due to invalid IL or missing references) //IL_04df: Unknown result type (might be due to invalid IL or missing references) float unscaledTime = Time.unscaledTime; Vector3 up = Vector3.up; if (JumpReq()) { jumpUntil = 0f; lastJump = unscaledTime; SetAllVel((wallN * 4.5f + up * 5.2f) / ts); EndWall(0.3f, needGround: false); ((MelonBase)this).LoggerInstance.Msg("Wall jump"); return; } if (!hasInput || Vector3.Dot(moveDir, -wallN) < 0f) { EndWall(0.3f, needGround: false); return; } if (unscaledTime - wallStart > 1.8f) { EndWall(0.6f, needGround: true); return; } float l = Mathf.Max(standHeight, 0.6f); float num = ((standHeight > 0.2f) ? (standHeight * 0.8f) : 0.7f); if (!FindWall(P.hips.position, -wallN, 1.98f, out var n, out var d)) { if (unscaledTime - wallStart > 0.15f) { lastJump = unscaledTime; SetAllVel((-wallN * 3.2f + up * 2.5f) / ts); EndWall(0.3f, needGround: false); return; } n = wallN; d = num; } else { n.y = 0f; if (((Vector3)(ref n)).sqrMagnitude > 0.0001f) { ((Vector3)(ref n)).Normalize(); wallN = n; } else { n = wallN; } } Vector3 val = moveDir - Vector3.Dot(moveDir, n) * n; val.y = 0f; float num2 = 0.6f + Mathf.Clamp((d - num) * 4f, -1.5f, 2.5f); Vector3 val2 = (up * 4.5f + val * 2.2f - n * num2) / ts; foreach (Rigidbody item in P.all) { item.velocity = Vector3.Lerp(item.velocity, val2, 0.6f); } Vector3 val3 = up * 0.85f + n * 0.45f; Vector3 normalized = ((Vector3)(ref val3)).normalized; Align(P.hips, normalized, ts); Align(P.waist, normalized, ts); Align(P.stomach, normalized, ts); Align(P.chest, normalized, ts); Rigidbody head = P.head; val3 = up * 0.9f + n * 0.2f; Align(head, ((Vector3)(ref val3)).normalized, ts); runPhase += realDt * 14f; val3 = Vector3.Cross(up, n); Vector3 normalized2 = ((Vector3)(ref val3)).normalized; Vector3 position = P.hips.position; Vector3 cp = (((Object)(object)P.chest != (Object)null) ? P.chest.position : position); Vector3 wallPt = position - n * d; Vector3 velocity = P.hips.velocity; WallLeg(runPhase, -1f, P.lThigh, P.lLeg, P.lFoot, position, wallPt, n, up, normalized2, l, ts, velocity); WallLeg(runPhase + (float)Math.PI, 1f, P.rThigh, P.rLeg, P.rFoot, position, wallPt, n, up, normalized2, l, ts, velocity); ControlHandeler controlHandeler = me.controlHandeler; bool num3 = controlHandeler.leftPunch || controlHandeler.leftGrab || leftHeld; bool flag = controlHandeler.rightPunch || controlHandeler.rightGrab || rightHeld; if (!num3) { WallArm(P.lArm, P.lFore, P.lHand, cp, n, up, -normalized2, l, ts, velocity); } if (!flag) { WallArm(P.rArm, P.rFore, P.rHand, cp, n, up, normalized2, l, ts, velocity); } DampLimbs(ts); } private void WallLeg(float ph, float sgn, Rigidbody thigh, Rigidbody shin, Rigidbody foot, Vector3 hp, Vector3 wallPt, Vector3 n, Vector3 up, Vector3 side, float L, float ts, Vector3 bv) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_005b: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_0083: 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_0086: 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_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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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) float num = Mathf.Sin(ph); Vector3 val = wallPt + n * 0.08f + up * (-0.45f * L + num * 0.2f * L) + side * sgn * 0.12f * L; Vector3 target = (hp + val) * 0.5f + n * 0.12f * L; Vector3 target2 = hp + (val - hp) * 0.3f + n * 0.08f * L; PullTo(thigh, target2, 10f, ts, bv); PullTo(shin, target, 10f, ts, bv); PullTo(foot, val, 10f, ts, bv); } private void WallArm(Rigidbody arm, Rigidbody fore, Rigidbody hand, Vector3 cp, Vector3 n, Vector3 up, Vector3 s, float L, float ts, Vector3 bv) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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) //IL_0076: 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_0084: 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_0095: 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_00a0: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_00de: 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_00ef: Unknown result type (might be due to invalid IL or missing references) PullTo(arm, cp - up * 0.15f * L + s * 0.22f * L, 10f, ts, bv); PullTo(fore, cp - up * 0.3f * L + n * 0.1f * L + s * 0.28f * L, 10f, ts, bv); PullTo(hand, cp - up * 0.45f * L + n * 0.12f * L + s * 0.3f * L, 10f, ts, bv); } private void Protect(ConfigurableJoint j, ref Rigidbody last) { Rigidbody connectedBody = ((Joint)j).connectedBody; if ((Object)(object)connectedBody != (Object)(object)last) { last = connectedBody; if ((Object)(object)connectedBody != (Object)null) { ((MelonBase)this).LoggerInstance.Msg("Grab joint original breakForce=" + ((Joint)j).breakForce + " breakTorque=" + ((Joint)j).breakTorque); } } ((Joint)j).breakForce = float.PositiveInfinity; ((Joint)j).breakTorque = float.PositiveInfinity; } private void GrabLogic(float ts) { BodyHandeler bodyHandeler = me.bodyHandeler; Rigidbody val = null; Rigidbody val2 = null; ConfigurableJoint leftGrabJoint = bodyHandeler.leftGrabJoint; ConfigurableJoint rightGrabJoint = bodyHandeler.rightGrabJoint; if ((Object)(object)leftGrabJoint != (Object)null) { Protect(leftGrabJoint, ref lastLeftConn); val = ((Joint)leftGrabJoint).connectedBody; } if ((Object)(object)rightGrabJoint != (Object)null) { Protect(rightGrabJoint, ref lastRightConn); val2 = ((Joint)rightGrabJoint).connectedBody; } leftHeld = (Object)(object)val != (Object)null; rightHeld = (Object)(object)val2 != (Object)null; Rigidbody val3 = (((Object)(object)val != (Object)null) ? val : val2); if ((Object)(object)val3 != (Object)null) { if ((Object)(object)heldRb != (Object)(object)val3) { heldRb = val3; heldActor = FindOwner(val3); } } else if ((Object)(object)heldRb != (Object)null) { if (hasInput) { ThrowBody(ts); } heldRb = null; heldActor = null; } } private Actor FindOwner(Rigidbody rb) { try { Component componentInParent = ((Component)rb).GetComponentInParent(Il2CppType.Of<Actor>()); if ((Object)(object)componentInParent != (Object)null) { Actor val = ((Il2CppObjectBase)componentInParent).TryCast<Actor>(); if ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)me) { return val; } } } catch (Exception) { } foreach (Actor allActor in allActors) { if ((Object)(object)allActor == (Object)null || (Object)(object)allActor == (Object)(object)me || !Usable(allActor)) { continue; } foreach (Rigidbody item in BuildParts(allActor).all) { if ((Object)(object)item == (Object)(object)rb) { return allActor; } } } return null; } private void ThrowBody(float ts) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_00af: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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) Vector3 val = (moveDir * 9f + Vector3.up * 3f) / ts; try { if ((Object)(object)heldActor != (Object)null && Usable(heldActor)) { foreach (Rigidbody item in BuildParts(heldActor).all) { item.velocity += val; } } else if ((Object)(object)heldRb != (Object)null) { heldRb.velocity += val; } ((MelonBase)this).LoggerInstance.Msg("Throw!"); } catch (Exception e) { Err("Throw", e); } } private void ScanWorld() { //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_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) try { foreach (Light item in Object.FindObjectsOfType<Light>()) { if (!((Object)(object)item == (Object)null) && seenLights.Add(((Object)item).GetInstanceID())) { lights.Add(new LightRec { l = item, c = item.color }); grayDirty = true; } } } catch (Exception e) { Err("ScanLights", e); } string[] array = new string[4] { "_Color", "_BaseColor", "_TintColor", "_MainColor" }; try { foreach (Renderer item2 in Object.FindObjectsOfType<Renderer>()) { if ((Object)(object)item2 == (Object)null || !seenRenderers.Add(((Object)item2).GetInstanceID()) || ((Object)(object)((Il2CppObjectBase)item2).TryCast<MeshRenderer>() == (Object)null && (Object)(object)((Il2CppObjectBase)item2).TryCast<SkinnedMeshRenderer>() == (Object)null) || ((Object)(object)vfxRoot != (Object)null && ((Component)item2).transform.IsChildOf(vfxRoot.transform)) || (Object)(object)((Component)item2).GetComponentInParent(Il2CppType.Of<Actor>()) != (Object)null) { continue; } Il2CppReferenceArray<Material> sharedMaterials = item2.sharedMaterials; if (sharedMaterials == null) { continue; } for (int i = 0; i < ((Il2CppArrayBase<Material>)(object)sharedMaterials).Length; i++) { Material val = ((Il2CppArrayBase<Material>)(object)sharedMaterials)[i]; if ((Object)(object)val == (Object)null || !seenMats.Add(((Object)val).GetInstanceID())) { continue; } List<int> list = new List<int>(); List<Color> list2 = new List<Color>(); string[] array2 = array; foreach (string text in array2) { if (val.HasProperty(text)) { list.Add(Shader.PropertyToID(text)); list2.Add(val.GetColor(text)); } } bool flag = val.HasProperty("_EmissionColor"); if (list.Count != 0 || flag) { MatRec matRec = new MatRec { m = val, props = list.ToArray(), origs = list2.ToArray(), hasEmis = flag }; if (flag) { matRec.origEmis = val.GetColor("_EmissionColor"); matRec.origEmisKw = val.IsKeywordEnabled("_EMISSION"); } mats.Add(matRec); grayDirty = true; } } } } catch (Exception e2) { Err("ScanRenderers", e2); } } private void CaptureEnv() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0017: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0032: Unknown result type (might be due to invalid IL or missing references) origAmb = RenderSettings.ambientLight; origSky = RenderSettings.ambientSkyColor; origEq = RenderSettings.ambientEquatorColor; origGr = RenderSettings.ambientGroundColor; origFog = RenderSettings.fogColor; } private void UpdateGrayscale() { //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: 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_03ac: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: 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_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: 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_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) float num = Smooth(grayFade); if (num <= 0.0001f) { if (grayApplied) { RestoreGray(); grayApplied = false; lastAppliedG = -1f; } return; } if (!grayApplied) { CaptureEnv(); grayApplied = true; grayDirty = true; } if (grayDirty || Mathf.Abs(num - lastAppliedG) > 0.0005f) { grayDirty = false; lastAppliedG = num; for (int i = 0; i < lights.Count; i++) { LightRec lightRec = lights[i]; if (!((Object)(object)lightRec.l == (Object)null)) { lightRec.l.color = Color.Lerp(lightRec.c, Gray(lightRec.c, 0.4f, 1.06f), num); } } Color val = default(Color); ((Color)(ref val))..ctor(0.16f, 0.16f, 0.176f, 1f); RenderSettings.ambientLight = Color.Lerp(origAmb, val, num); RenderSettings.ambientSkyColor = Color.Lerp(origSky, val, num); RenderSettings.ambientEquatorColor = Color.Lerp(origEq, val, num); RenderSettings.ambientGroundColor = Color.Lerp(origGr, val, num); RenderSettings.fogColor = Color.Lerp(origFog, val, num); int num2 = Shader.PropertyToID("_EmissionColor"); for (int j = 0; j < mats.Count; j++) { MatRec matRec = mats[j]; if ((Object)(object)matRec.m == (Object)null) { continue; } for (int k = 0; k < matRec.props.Length; k++) { Color val2 = matRec.origs[k]; matRec.m.SetColor(matRec.props[k], Color.Lerp(val2, Gray(val2, 0.7f), num)); } if (matRec.hasEmis) { Color origEmis = matRec.origEmis; Color val3 = (Color)((Lum(origEmis) > 0.02f) ? Gray(origEmis, 1f) : new Color(0.03f, 0.03f, 0.03f, 1f)); matRec.m.SetColor(num2, Color.Lerp(origEmis, val3, num)); if (!matRec.emisOn && !matRec.origEmisKw) { matRec.m.EnableKeyword("_EMISSION"); matRec.emisOn = true; } } } } if (!(Time.unscaledTime >= nextSkin)) { return; } nextSkin = Time.unscaledTime + 0.1f; foreach (Actor allActor in allActors) { if ((Object)(object)allActor == (Object)null || (Object)(object)allActor == (Object)(object)me || !Usable(allActor)) { continue; } try { int instanceID = ((Object)allActor).GetInstanceID(); if (!skins.TryGetValue(instanceID, out var value)) { value = new SkinRec { a = allActor, o = allActor.primaryColor }; skins[instanceID] = value; } allActor.bodyHandeler.SetSkinColor(Color.Lerp(value.o, Gray(value.o, 0.75f), num)); } catch (Exception) { } } if (!((Object)(object)me != (Object)null) || !Usable(me)) { return; } try { me.bodyHandeler.SetSkinColor(playerOrig); } catch (Exception) { } } private void RestoreGray() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_0078: 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_003a: 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_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < lights.Count; i++) { if ((Object)(object)lights[i].l != (Object)null) { lights[i].l.color = lights[i].c; } } RenderSettings.ambientLight = origAmb; RenderSettings.ambientSkyColor = origSky; RenderSettings.ambientEquatorColor = origEq; RenderSettings.ambientGroundColor = origGr; RenderSettings.fogColor = origFog; int num = Shader.PropertyToID("_EmissionColor"); for (int j = 0; j < mats.Count; j++) { MatRec matRec = mats[j]; if ((Object)(object)matRec.m == (Object)null) { continue; } for (int k = 0; k < matRec.props.Length; k++) { matRec.m.SetColor(matRec.props[k], matRec.origs[k]); } if (matRec.hasEmis) { matRec.m.SetColor(num, matRec.origEmis); if (matRec.emisOn) { matRec.m.DisableKeyword("_EMISSION"); matRec.emisOn = false; } } } foreach (KeyValuePair<int, SkinRec> skin in skins) { SkinRec value = skin.Value; if (!((Object)(object)value.a == (Object)null)) { try { value.a.bodyHandeler.SetSkinColor(value.o); } catch (Exception) { } } } skins.Clear(); if ((Object)(object)me != (Object)null && Usable(me)) { try { me.bodyHandeler.SetSkinColor(playerOrig); } catch (Exception) { } } } private void UpdateFov() { Camera main = Camera.main; if (!((Object)(object)main == (Object)null)) { float num = Smooth(grayFade); if (num <= 0.0005f && runBlend <= 0.0005f) { baseFov = main.fieldOfView; } else { main.fieldOfView = baseFov - 6.5f * num - 3.5f * runBlend; } } } private void EnsureVolume() { //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Expected O, but got Unknown //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Expected O, but got Unknown //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)vol != (Object)null || Time.unscaledTime < nextVolTry) { return; } nextVolTry = Time.unscaledTime + 3f; try { int num = -1; Il2CppArrayBase<Volume> val = Object.FindObjectsOfType<Volume>(); string text = "Volume diagnostics: " + val.Length + " existing"; for (int i = 0; i < val.Length; i++) { Volume val2 = val[i]; if (!((Object)(object)val2 == (Object)null)) { text = text + " | " + ((Object)val2).name + " global=" + val2.isGlobal + " prio=" + val2.priority + " w=" + val2.weight + " layer=" + ((Component)val2).gameObject.layer; if (num < 0) { num = ((Component)val2).gameObject.layer; } } } ((MelonBase)this).LoggerInstance.Msg(text); Camera main = Camera.main; if ((Object)(object)main != (Object)null) { UniversalAdditionalCameraData val3 = Comp<UniversalAdditionalCameraData>(((Component)main).gameObject); if ((Object)(object)val3 != (Object)null) { LayerMask volumeLayerMask = val3.volumeLayerMask; int value = ((LayerMask)(ref volumeLayerMask)).value; ((MelonBase)this).LoggerInstance.Msg("Camera data: renderPostProcessing=" + val3.renderPostProcessing + " volumeMask=" + value); val3.renderPostProcessing = true; if (num < 0 || (value & (1 << num)) == 0) { for (int j = 0; j < 32; j++) { if ((value & (1 << j)) != 0) { num = j; break; } } } } else { ((MelonBase)this).LoggerInstance.Msg("Camera data: none found"); } } GameObject val4 = new GameObject("FlashVFX_Volume"); Object.DontDestroyOnLoad((Object)val4); val4.layer = ((num >= 0) ? num : 0); Volume val5 = AddComp<Volume>(val4); val5.isGlobal = true; val5.priority = 1000f; val5.weight = 0f; VolumeProfile val6 = ((Il2CppObjectBase)ScriptableObject.CreateInstance(Il2CppType.Of<VolumeProfile>())).TryCast<VolumeProfile>(); Object.DontDestroyOnLoad((Object)(object)val6); chroma = ((Il2CppObjectBase)val6.Add(Il2CppType.Of<ChromaticAberration>(), true)).TryCast<ChromaticAberration>(); ((VolumeParameter)chroma.intensity).overrideState = true; ((VolumeParameter<float>)(object)chroma.intensity).value = 0f; bloom = ((Il2CppObjectBase)val6.Add(Il2CppType.Of<Bloom>(), true)).TryCast<Bloom>(); ((VolumeParameter)bloom.intensity).overrideState = true; ((VolumeParameter<float>)(object)bloom.intensity).value = 0.8f; ((VolumeParameter)bloom.threshold).overrideState = true; ((VolumeParameter<float>)(object)bloom.threshold).value = 1.5f; ((VolumeParameter)bloom.scatter).overrideState = true; ((VolumeParameter<float>)(object)bloom.scatter).value = 0.6f; ((VolumeParameter)bloom.tint).overrideState = true; ((VolumeParameter<Color>)(object)bloom.tint).value = new Color(1f, 0.9f, 0.6f, 1f); try { lens = ((Il2CppObjectBase)val6.Add(Il2CppType.Of<LensDistortion>(), true)).TryCast<LensDistortion>(); ((VolumeParameter)lens.intensity).overrideState = true; ((VolumeParameter<float>)(object)lens.intensity).value = 0f; ((VolumeParameter)lens.xMultiplier).overrideState = true; ((VolumeParameter<float>)(object)lens.xMultiplier).value = 1f; ((VolumeParameter)lens.yMultiplier).overrideState = true; ((VolumeParameter<float>)(object)lens.yMultiplier).value = 1f; ((VolumeParameter)lens.center).overrideState = true; ((VolumeParameter<Vector2>)(object)lens.center).value = new Vector2(0.5f, 0.5f); ((VolumeParameter)lens.scale).overrideState = true; ((VolumeParameter<float>)(object)lens.scale).value = 1f; ((MelonBase)this).LoggerInstance.Msg("Warp (lens distortion) created."); } catch (Exception ex) { lens = null; ((MelonBase)this).LoggerInstance.Warning("Warp setup failed: " + ex.Message); } val5.sharedProfile = val6; ((Behaviour)val5).enabled = false; vol = val5; profile = val6; } catch (Exception ex2) { ((MelonBase)this).LoggerInstance.Error("Volume setup failed: " + ex2.Message); } } private void UpdateWarpBlend(float udt) { //IL_0032: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) float num = 1E+09f; if (P != null && (Object)(object)P.hips != (Object)null) { Vector3 position = P.hips.position; foreach (Actor allActor in allActors) { if ((Object)(object)allActor == (Object)null || (Object)(object)allActor == (Object)(object)me || !Usable(allActor)) { continue; } Rigidbody val = RB(allActor.bodyHandeler.Hips); if (!((Object)(object)val == (Object)null)) { float num2 = Vector3.Distance(position, val.position); if (num2 < num) { num = num2; } } } } float num3 = ((num > 100000000f) ? 1f : Mathf.Clamp01((num - 4f) / 5f)); warpBlend = Mathf.MoveTowards(warpBlend, num3, 0.5f * udt); } private void UpdateVolume() { //IL_01de: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)vol == (Object)null) { return; } float num = Smooth(grayFade); bool flag = num > 0.001f; if (((Behaviour)vol).enabled != flag) { ((Behaviour)vol).enabled = flag; } if (flag) { vol.weight = num; float unscaledTime = Time.unscaledTime; if ((Object)(object)chroma != (Object)null) { ((VolumeParameter<float>)(object)chroma.intensity).value = Mathf.Clamp01(Mathf.Lerp(0.55f, 1f, runBlend) * (1f + 0.15f * Mathf.Sin(unscaledTime * 30f) * runBlend)); } if ((Object)(object)bloom != (Object)null) { ((VolumeParameter<float>)(object)bloom.intensity).value = Mathf.Lerp(0.8f, 1.6f, runBlend); } if ((Object)(object)lens != (Object)null) { float num2 = Mathf.Clamp01(warpBlend * 1f); ((VolumeParameter<float>)(object)lens.intensity).value = (0.28f * Mathf.Sin(unscaledTime * 1.5f) + 0.12f * Mathf.Sin(unscaledTime * 3.7f)) * num2; ((VolumeParameter<float>)(object)lens.xMultiplier).value = Mathf.Lerp(1f, 0.85f + 0.15f * Mathf.Sin(unscaledTime * 1.1f), num2); ((VolumeParameter<float>)(object)lens.yMultiplier).value = Mathf.Lerp(1f, 0.85f + 0.15f * Mathf.Cos(unscaledTime * 0.9f), num2); ((VolumeParameter<Vector2>)(object)lens.center).value = new Vector2(0.5f + 0.05f * Mathf.Sin(unscaledTime * 0.7f) * num2, 0.5f + 0.05f * Mathf.Cos(unscaledTime * 0.6f) * num2); ((VolumeParameter<float>)(object)lens.scale).value = 1f - 0.05f * num2 * (0.5f + 0.5f * Mathf.Sin(unscaledTime * 0.8f)); } } } private Material MakeMat(Shader sh, Color c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown return new Material(sh) { color = c, renderQueue = 3500 }; } private GameObject MakeCube(Material mat, out Renderer rend) { GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); Component component = val.GetComponent(Il2CppType.Of<Collider>()); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } val.transform.SetParent(vfxRoot.transform, false); rend = Comp<Renderer>(val); rend.sharedMaterial = mat; rend.shadowCastingMode = (ShadowCastingMode)0; rend.receiveShadows = false; return val; } private void BuildVfx() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_00d4: 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) if (!useTrails || (Object)(object)vfxRoot != (Object)null) { return; } try { Shader val = null; string[] array = new string[3] { "Sprites/Default", "Unlit/Color", "UI/Default" }; for (int i = 0; i < array.Length; i++) { val = Shader.Find(array[i]); if ((Object)(object)val != (Object)null) { break; } } if ((Object)(object)val == (Object)null) { ((MelonBase)this).LoggerInstance.Warning("No unlit shader found, trails disabled."); return; } vfxRoot = new GameObject("FlashVFX_Root"); Object.DontDestroyOnLoad((Object)(object)vfxRoot); vfxRoot.SetActive(false); for (int j = 0; j < 7; j++) { float num = Mathf.Lerp(1f, 0.15f, (float)j / 6f); coreMats[j] = MakeMat(val, new Color(4f, 3.4f, 1.4f, num)); haloMats[j] = MakeMat(val, new Color(1.6f, 0.9f, 0.15f, num * 0.35f)); } trails.Clear(); for (int k = 0; k < 6; k++) { Trail trail = new Trail(); for (int l = 0; l < 7; l++) { Seg seg = new Seg(); seg.core = MakeCube(coreMats[l], out var rend); seg.cr = rend; seg.halo = MakeCube(haloMats[l], out var rend2); seg.hr = rend2; rend.enabled = false; rend2.enabled = false; trail.segs[l] = seg; } trails.Add(trail); } } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Error("BuildVfx failed: " + ex.Message); vfxRoot = null; } } private void UpdateVfx(float udt) { //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_017a: 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_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might