Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Chamber v0.2.0
ChamberMod.dll
Decompiled 2 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ChamberMod.Skills; using ChamberMod.Skills.States; using EntityStates; using EntityStates.Commando.CommandoWeapon; using EntityStates.Engi.Mine; using EntityStates.Huntress; using EntityStates.Merc; using EntityStates.Railgunner.Scope; using HarmonyLib; using R2API; using R2API.Networking; using R2API.Networking.Interfaces; using RoR2; using RoR2.ConVar; using RoR2.ContentManagement; using RoR2.HudOverlay; using RoR2.Items; using RoR2.Projectile; using RoR2.Skills; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.Rendering.PostProcessing; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ChamberMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+339f84ae79a5e3d05e484c21520f9eb37a833c66")] [assembly: AssemblyProduct("ChamberMod")] [assembly: AssemblyTitle("ChamberMod")] [assembly: AssemblyVersion("1.0.0.0")] namespace ChamberMod { internal static class ChamberAnchorFile { [Serializable] internal class Anchor { public string name; public string bone; public Vector3 pos; public Vector3 forward; public Vector3 up; public float scale; } [Serializable] internal class BonePos { public string name; public Vector3 pos; } [Serializable] internal class Data { public List<Anchor> anchors = new List<Anchor>(); public List<BonePos> bones = new List<BonePos>(); } [Serializable] internal class ItemBox { public string item; public string name; public string child; public Vector3 pos; public Vector3 forward; public Vector3 up; public Vector3 scale; public Vector3 center; public Vector3 size; public bool placed; public string origChild; public Vector3 origPos; public Vector3 origForward; public Vector3 origUp; public Vector3 origScale; } [Serializable] internal class ItemData { public List<Anchor> anchors = new List<Anchor>(); public List<ItemBox> items = new List<ItemBox>(); } internal static readonly List<Anchor> Effective = new List<Anchor>(); internal static readonly Dictionary<string, Matrix4x4> Change = new Dictionary<string, Matrix4x4>(); private static string Dir => Path.Combine(ChamberFiles.Root, "Anchors"); internal static void WriteItems(ItemData data, ManualLogSource log) { try { if (Directory.Exists(Dir)) { data.anchors = Effective; File.WriteAllText(Path.Combine(Dir, "ChamberItemRules.json"), JsonUtility.ToJson((object)data, true)); } } catch (Exception ex) { log.LogWarning((object)("[Chamber] could not write the item rule file: " + ex.Message)); } } internal static Bounds? PrefabBounds(GameObject prefab) { //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_007c: 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_008e: 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_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_00d0: 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_00df: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)prefab)) { return null; } Matrix4x4 worldToLocalMatrix = prefab.transform.worldToLocalMatrix; Bounds? result = null; Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { MeshFilter component = ((Component)val).GetComponent<MeshFilter>(); SkinnedMeshRenderer val2 = (SkinnedMeshRenderer)(object)((val is SkinnedMeshRenderer) ? val : null); Mesh val3 = ((val2 != null) ? val2.sharedMesh : (Object.op_Implicit((Object)(object)component) ? component.sharedMesh : null)); if (!Object.op_Implicit((Object)(object)val3)) { continue; } Matrix4x4 val4 = worldToLocalMatrix * ((Component)val).transform.localToWorldMatrix; Bounds bounds = val3.bounds; for (int j = 0; j < 8; j++) { Vector3 val5 = ((Bounds)(ref bounds)).center + Vector3.Scale(((Bounds)(ref bounds)).extents, new Vector3((float)(((j & 1) != 0) ? 1 : (-1)), (float)(((j & 2) != 0) ? 1 : (-1)), (float)(((j & 4) != 0) ? 1 : (-1)))); Vector3 val6 = ((Matrix4x4)(ref val4)).MultiplyPoint3x4(val5); if (result.HasValue) { Bounds value = result.Value; ((Bounds)(ref value)).Encapsulate(val6); result = value; } else { result = new Bounds(val6, Vector3.zero); } } } return result; } internal static Anchor Describe(string name, string bone, Transform modelRoot, Transform t) { //IL_0016: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_003f: 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_004b: 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) return new Anchor { name = name, bone = bone, pos = modelRoot.InverseTransformPoint(t.position), forward = modelRoot.InverseTransformDirection(t.forward), up = modelRoot.InverseTransformDirection(t.up), scale = t.lossyScale.x / modelRoot.lossyScale.x }; } internal static Matrix4x4 ModelMatrix(Anchor a) { //IL_0001: 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_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_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) return Matrix4x4.TRS(a.pos, Quaternion.LookRotation(a.forward, a.up), Vector3.one * a.scale); } internal static void WriteCurrent(Data data, ManualLogSource log) { try { if (Directory.Exists(Dir)) { File.WriteAllText(Path.Combine(Dir, "ChamberAnchors.current.json"), JsonUtility.ToJson((object)data, true)); } } catch (Exception ex) { log.LogWarning((object)("[Chamber] could not write the anchor file: " + ex.Message)); } } internal static Dictionary<string, Anchor> ReadUser(ManualLogSource log) { string path = Path.Combine(Dir, "ChamberAnchors.json"); if (!File.Exists(path)) { return null; } try { Dictionary<string, Anchor> dictionary = new Dictionary<string, Anchor>(); foreach (Anchor anchor in JsonUtility.FromJson<Data>(File.ReadAllText(path)).anchors) { if (anchor != null && !string.IsNullOrEmpty(anchor.name) && ((Vector3)(ref anchor.forward)).sqrMagnitude > 1E-08f && ((Vector3)(ref anchor.up)).sqrMagnitude > 1E-08f && anchor.scale > 0f) { dictionary[anchor.name] = anchor; } } return dictionary; } catch (Exception ex) { log.LogWarning((object)("[Chamber] anchor file unreadable, using the computed anchors: " + ex.Message)); return null; } } internal static void Place(Transform modelRoot, Transform t, Anchor a) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_001a: 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_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_003b: 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_0054: 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_0071: 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) t.position = modelRoot.TransformPoint(a.pos); t.rotation = modelRoot.rotation * Quaternion.LookRotation(a.forward, a.up); float num = a.scale * modelRoot.lossyScale.x; Vector3 val = (Object.op_Implicit((Object)(object)t.parent) ? t.parent.lossyScale : Vector3.one); t.localScale = new Vector3(num / val.x, num / val.y, num / val.z); } internal static void Convert(Matrix4x4 change, ref Vector3 pos, ref Vector3 angles, ref Vector3 scale) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_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_001d: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_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_003e: 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_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) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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) Matrix4x4 val = change * Matrix4x4.TRS(pos, Quaternion.Euler(angles), scale); Vector3 val2 = Vector4.op_Implicit(((Matrix4x4)(ref val)).GetColumn(0)); Vector3 val3 = Vector4.op_Implicit(((Matrix4x4)(ref val)).GetColumn(1)); Vector3 val4 = Vector4.op_Implicit(((Matrix4x4)(ref val)).GetColumn(2)); pos = Vector4.op_Implicit(((Matrix4x4)(ref val)).GetColumn(3)); scale = new Vector3(((Vector3)(ref val2)).magnitude, ((Vector3)(ref val3)).magnitude, ((Vector3)(ref val4)).magnitude); Quaternion val5 = Quaternion.LookRotation(val4 / scale.z, val3 / scale.y); angles = ((Quaternion)(ref val5)).eulerAngles; } } [DefaultExecutionOrder(1000)] internal sealed class ChamberAnimationDriver : MonoBehaviour { private const string GestureLayer = "Gesture, Override"; private const float FadeSeconds = 0.15f; private static readonly int EmptyHash = Animator.StringToHash("Empty"); private Animator animator; private int layer = -1; private int upperLayer = -1; private int aimLayer = -1; private float upperWeight = 1f; private const float UpperFadeSeconds = 0.15f; private static readonly bool ProceduralSprintArms = false; private static readonly bool ProceduralRunLean = false; private const float ArmFadeSeconds = 0.15f; private static readonly int SprintHash = Animator.StringToHash("isSprinting"); private static readonly int GroundedHash = Animator.StringToHash("isGrounded"); private const float RemoteGroundedHold = 0.15f; private bool remoteGrounded = true; private bool lastRawGrounded = true; private float groundedChangeAge; private float groundedLogAt; private int groundedFlips; private static readonly int MovingHash = Animator.StringToHash("isMoving"); private static readonly int RifleHash = Animator.StringToHash("rifleEquipped"); private static readonly int ScopedHash = Animator.StringToHash("rifleScoped"); private static readonly int ArriveHash = Animator.StringToHash("TeleportArrive"); private static readonly int TrapCardHash = Animator.StringToHash("TrapCard"); private static readonly int AnchorCardHash = Animator.StringToHash("AnchorCard"); private static readonly int TrapThrowHash = Animator.StringToHash("ThrowTrademark"); private static readonly int AnchorThrowHash = Animator.StringToHash("PlaceAnchor"); private GameObject trapCard; private GameObject teleportCard; private Transform lShoulder; private Transform lElbow; private Transform lHand; private Transform rShoulder; private Transform rElbow; private Transform rHand; private Transform lFoot; private Transform rFoot; private Transform weaponPoint; private bool lobby; private const float AimYawLimit = 45f; private const float AimPitchLimit = 89f; private const float AimFadeSeconds = 0.2f; private const float SprintLookLimit = 20f; private static readonly int AimYawHash = Animator.StringToHash("aimYaw"); private static readonly int AimPitchHash = Animator.StringToHash("aimPitch"); private static readonly int TurnDirectionHash = Animator.StringToHash("turnDirection"); private readonly Transform[] spine = (Transform[])(object)new Transform[3]; private CharacterModel characterModel; private float aimWeight; private float smoothYaw; private float smoothYawVelocity; private float smoothPitch; private float smoothPitchVelocity; private const float AimSmoothSeconds = 0.1f; private const float ArmAimSmooth = 0.05f; private const float TurnBlendPerSecond = 4f; private Vector3 smoothArmAim; private float turnDirection; private Vector3 aimForward; private const float ArmAimIn = 0.15f; private const float ArmAimOut = 0.35f; private const float ArmYawLeft = 15f; private const float ArmYawRight = 70f; private Transform pistolGrip; private Transform pistolMuzzle; private Vector3 pistolBarrelLocal; private float armAimWeight; private bool rifleCorrected; private bool rifleWasVisible; private Vector3[] rifleRestPos; private Quaternion[] rifleRestRot; private const float LeanMaxDegrees = 4f; private const float LeanFullSpeed = 7f; private Transform spineBase; private Vector3 lastPosition; private float lean; private bool hasSprint; private bool hasRifle; private bool hasTurning; private static readonly int TurningHash = Animator.StringToHash("isTurning"); private float lastYaw; private float turnHold; private const float RifleDownDegrees = 5f; private Transform rifleGrip; private readonly List<Transform> rifleParts = new List<Transform>(); private Vector3 rifleBarrelLocal; private Vector3 rifleUpLocal; private float armWeight; private Vector3[] rifleFixPos; private Quaternion[] rifleFixRot; private string rifleFixTune; private Renderer[] rifleRenderers; private Renderer[] weaponRenderers; private bool weaponsHidden; private const float RestStraightenDegrees = 25f; private const float KickFlipDegrees = 11.5f; private const float KickPeakSeconds = 0.1f; private const float KickDecaySeconds = 0.11f; private const float KickLength = 0.6f; private float kickAge = -1f; private void Awake() { //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_0440: 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_044a: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_0468: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Unknown result type (might be due to invalid IL or missing references) //IL_0508: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Invalid comparison between Unknown and I4 //IL_0530: Unknown result type (might be due to invalid IL or missing references) //IL_0536: Invalid comparison between Unknown and I4 //IL_0558: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Invalid comparison between Unknown and I4 animator = ((Component)this).GetComponent<Animator>(); layer = (Object.op_Implicit((Object)(object)animator) ? animator.GetLayerIndex("Gesture, Override") : (-1)); if (layer >= 0) { animator.SetLayerWeight(layer, 0f); } lobby = Object.op_Implicit((Object)(object)animator) && Object.op_Implicit((Object)(object)animator.runtimeAnimatorController) && ((Object)animator.runtimeAnimatorController).name == "ChamberLobby"; upperLayer = (Object.op_Implicit((Object)(object)animator) ? animator.GetLayerIndex("UpperBody") : (-1)); aimLayer = (Object.op_Implicit((Object)(object)animator) ? animator.GetLayerIndex("AimPitch") : (-1)); Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { switch (((Object)val).name) { case "L_Shoulder": lShoulder = val; break; case "L_Elbow": lElbow = val; break; case "L_Hand": lHand = val; break; case "R_Shoulder": rShoulder = val; break; case "R_Elbow": rElbow = val; break; case "R_Hand": rHand = val; break; case "R_WeaponPoint": weaponPoint = val; break; case "L_Foot": lFoot = val; break; case "R_Foot": rFoot = val; break; case "Spine1": spineBase = val; break; case "Spine2": spine[0] = val; break; case "Spine3": spine[1] = val; break; case "Spine4": spine[2] = val; break; } if (((Object)val).name == "ChamberCardTrap") { trapCard = ((Component)val).gameObject; } if (((Object)val).name == "ChamberCardTeleport") { teleportCard = ((Component)val).gameObject; } if (((Object)val).name == "ChamberHeadhunter") { pistolGrip = val; } if (((Object)val).name == "MuzzleHeadhunter") { pistolMuzzle = val; } if (((Object)val).name.StartsWith("ChamberTourDeForce", StringComparison.Ordinal) || ((Object)val).name == "MuzzleTourDeForce") { rifleParts.Add(val); if (((Object)val).name == "ChamberTourDeForce") { rifleGrip = val; } } } Transform val2 = rifleParts.Find((Transform p) => ((Object)p).name == "MuzzleTourDeForce"); if (Object.op_Implicit((Object)(object)rifleGrip) && Object.op_Implicit((Object)(object)val2)) { Vector3 val3 = rifleGrip.InverseTransformPoint(val2.position); rifleBarrelLocal = DominantAxis(val3); Vector3 val4 = val3 - Vector3.Project(val3, rifleBarrelLocal); rifleUpLocal = ((Vector3)(ref val4)).normalized; } if (Object.op_Implicit((Object)(object)pistolGrip) && Object.op_Implicit((Object)(object)pistolMuzzle)) { pistolBarrelLocal = DominantAxis(Quaternion.Inverse(pistolGrip.rotation) * (pistolMuzzle.position - pistolGrip.position)); } if (Object.op_Implicit((Object)(object)animator)) { AnimatorControllerParameter[] parameters = animator.parameters; foreach (AnimatorControllerParameter val5 in parameters) { hasSprint |= val5.nameHash == SprintHash && (int)val5.type == 4; hasRifle |= val5.nameHash == RifleHash && (int)val5.type == 4; hasTurning |= val5.nameHash == TurningHash && (int)val5.type == 4; } } } private static Vector3 DominantAxis(Vector3 m) { //IL_0000: 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_0030: 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_0018: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) int num = ((!(Mathf.Abs(m.x) >= Mathf.Abs(m.y)) || !(Mathf.Abs(m.x) >= Mathf.Abs(m.z))) ? ((Mathf.Abs(m.y) >= Mathf.Abs(m.z)) ? 1 : 2) : 0); Vector3 zero = Vector3.zero; ((Vector3)(ref zero))[num] = Mathf.Sign(((Vector3)(ref m))[num]); return zero; } private void LateUpdate() { //IL_013f: 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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0173: 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_017d: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: 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_01c4: 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_01c6: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)animator) && !((Behaviour)animator).enabled) { return; } if (Object.op_Implicit((Object)(object)animator)) { if (ProceduralRunLean) { RunLife(); } AimSpine(); AimPistolArm(); HoldRifle(); } if (ProceduralSprintArms && Object.op_Implicit((Object)(object)animator) && hasSprint && Object.op_Implicit((Object)(object)lShoulder) && Object.op_Implicit((Object)(object)lElbow) && Object.op_Implicit((Object)(object)lHand) && Object.op_Implicit((Object)(object)rShoulder) && Object.op_Implicit((Object)(object)rElbow) && Object.op_Implicit((Object)(object)rHand) && Object.op_Implicit((Object)(object)lFoot) && Object.op_Implicit((Object)(object)rFoot)) { bool flag = animator.GetBool(SprintHash) && (!hasRifle || !animator.GetBool(RifleHash)); armWeight = Mathf.MoveTowards(armWeight, flag ? 1f : 0f, Time.deltaTime / 0.15f); if (!(armWeight <= 0f)) { Vector3 forward = ((Component)this).transform.forward; Vector3 right = ((Component)this).transform.right; Vector3 down = -((Component)this).transform.up; float num = ChamberKit.ArmSwing(Vector3.Dot(rFoot.position - lFoot.position, forward)); PoseArm(lShoulder, lElbow, lHand, num, -right, forward, right, down); PoseArm(rShoulder, rElbow, rHand, 0f - num, right, forward, right, down); } } } private void RunLife() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)spineBase) && !(Time.deltaTime <= 0f)) { Vector3 val = (((Component)this).transform.position - lastPosition) / Time.deltaTime; lastPosition = ((Component)this).transform.position; float num = Vector3.Dot(Vector3.ProjectOnPlane(val, ((Component)this).transform.up), ((Component)this).transform.forward); if (((Vector3)(ref val)).sqrMagnitude > 400f) { num = 0f; } float num2 = Mathf.Clamp01(num / 7f) * 4f; lean = Mathf.MoveTowards(lean, num2, 40f * Time.deltaTime); spineBase.rotation = Quaternion.AngleAxis(lean, ((Component)this).transform.right) * spineBase.rotation; } } private void AimSpine() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0110: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: 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_0223: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: 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) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) aimForward = ((Component)this).transform.forward; if (!Object.op_Implicit((Object)(object)characterModel)) { characterModel = ((Component)this).GetComponent<CharacterModel>(); } CharacterBody val = (Object.op_Implicit((Object)(object)characterModel) ? characterModel.body : null); bool num = hasSprint && animator.GetBool(SprintHash); bool flag = Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.inputBank) && Object.op_Implicit((Object)(object)spine[0]) && Object.op_Implicit((Object)(object)spine[1]) && Object.op_Implicit((Object)(object)spine[2]); bool flag2 = num && Object.op_Implicit((Object)(object)val) && !val.shouldAim; aimWeight = Mathf.MoveTowards(aimWeight, flag ? 1f : 0f, Time.deltaTime / 0.2f); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.inputBank) && !(aimWeight <= 0f)) { Vector3 up = ((Component)this).transform.up; Vector3 aimDirection = val.inputBank.aimDirection; Vector3 val2 = Vector3.ProjectOnPlane(aimDirection, up); if (!(((Vector3)(ref val2)).sqrMagnitude < 1E-06f)) { float num2 = (flag2 ? 20f : 45f); float num3 = (flag2 ? 20f : 89f); float num4 = Mathf.Clamp(Vector3.SignedAngle(((Component)this).transform.forward, val2, up), 0f - num2, num2); smoothYaw = Mathf.SmoothDamp(smoothYaw, num4, ref smoothYawVelocity, 0.1f); float num5 = smoothYaw; float num6 = Mathf.Clamp(Vector3.SignedAngle(val2, aimDirection, Vector3.Cross(val2, up)), 0f - num3, num3); smoothPitch = Mathf.SmoothDamp(smoothPitch, num6, ref smoothPitchVelocity, 0.1f); float num7 = smoothPitch; animator.SetFloat(AimYawHash, num5); animator.SetFloat(AimPitchHash, num7); num5 *= aimWeight; num7 *= aimWeight; Vector3 val3 = Quaternion.AngleAxis(num5, up) * ((Component)this).transform.right; aimForward = Quaternion.AngleAxis(0f - num7, val3) * (Quaternion.AngleAxis(num5, up) * ((Component)this).transform.forward); } } } private void HoldRifle() { //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) if (lobby) { SetRifleRenderers(on: true); return; } bool flag = Object.op_Implicit((Object)(object)rifleGrip) && ((Component)rifleGrip).gameObject.activeInHierarchy; if (flag && !rifleWasVisible && rifleRestPos != null) { string text = RifleTuneKey(); bool flag2 = rifleFixPos != null && text == rifleFixTune; for (int i = 0; i < rifleParts.Count; i++) { rifleParts[i].localPosition = (flag2 ? rifleFixPos[i] : rifleRestPos[i]); rifleParts[i].localRotation = (flag2 ? rifleFixRot[i] : rifleRestRot[i]); } rifleCorrected = flag2; } if (flag && rifleFixPos == null && rifleUpLocal != Vector3.zero) { PrecomputeRifleFix(); } CharacterBody val = (Object.op_Implicit((Object)(object)characterModel) ? characterModel.body : null); bool flag3 = hasRifle && animator.GetBool(ScopedHash) && Object.op_Implicit((Object)(object)val) && val.hasEffectiveAuthority; SetRifleRenderers((!flag || rifleCorrected || rifleUpLocal == Vector3.zero) && !flag3); rifleWasVisible = flag; if (rifleCorrected || !flag || rifleUpLocal == Vector3.zero) { return; } int layerIndex = animator.GetLayerIndex("UpperBody"); if (layerIndex < 0 || animator.IsInTransition(layerIndex)) { return; } AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(layerIndex); if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("RifleIdle")) { currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(layerIndex); if (!(((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime < 0.2f)) { ApplyRifleFix(); } } } private void ApplyRifleFix() { //IL_00c0: 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_00c6: 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_00d6: 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_00dc: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_0104: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) if (rifleRestPos == null) { rifleRestPos = rifleParts.ConvertAll((Transform t) => t.localPosition).ToArray(); rifleRestRot = rifleParts.ConvertAll((Transform t) => t.localRotation).ToArray(); } rifleCorrected = true; float num = ChamberKitConfig.RifleYaw?.Value ?? 0f; float num2 = ChamberKitConfig.RiflePitch?.Value ?? 0f; float num3 = ChamberKitConfig.RifleRoll?.Value ?? 0f; Vector3 up = ((Component)this).transform.up; Vector3 val = Vector3.Cross(up, aimForward); Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = Quaternion.AngleAxis(num, up) * Quaternion.AngleAxis(5f + num2, normalized) * aimForward; Quaternion val3 = Quaternion.LookRotation(val2, Quaternion.AngleAxis(num3, val2) * up); Quaternion val4 = Quaternion.LookRotation(rifleGrip.TransformDirection(rifleBarrelLocal), rifleGrip.TransformDirection(rifleUpLocal)); Quaternion val5 = val3 * Quaternion.Inverse(val4); Vector3 position = rifleGrip.position; foreach (Transform riflePart in rifleParts) { riflePart.SetPositionAndRotation(position + val5 * (riflePart.position - position), val5 * riflePart.rotation); } rifleFixPos = rifleParts.ConvertAll((Transform t) => t.localPosition).ToArray(); rifleFixRot = rifleParts.ConvertAll((Transform t) => t.localRotation).ToArray(); rifleFixTune = RifleTuneKey(); SetRifleRenderers(on: true); } private void PrecomputeRifleFix() { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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) AnimationClip val = null; AnimationClip[] animationClips = animator.runtimeAnimatorController.animationClips; foreach (AnimationClip val2 in animationClips) { if (Object.op_Implicit((Object)(object)val2) && ((Object)val2).name == "XIdle") { val = val2; break; } } if (!Object.op_Implicit((Object)(object)val)) { return; } if (rifleRestPos != null) { for (int j = 0; j < rifleParts.Count; j++) { rifleParts[j].localPosition = rifleRestPos[j]; rifleParts[j].localRotation = rifleRestRot[j]; } } Vector3 val3 = aimForward; aimForward = ((Component)this).transform.forward; val.SampleAnimation(((Component)this).gameObject, val.length * 0.3f); ApplyRifleFix(); aimForward = val3; } private static string RifleTuneKey() { return (ChamberKitConfig.RifleYaw?.Value ?? 0f) + "/" + (ChamberKitConfig.RiflePitch?.Value ?? 0f) + "/" + (ChamberKitConfig.RifleRoll?.Value ?? 0f); } private void HideWeapons(bool hide) { if (hide == weaponsHidden) { return; } FindWeaponRenderers(); Renderer[] array = weaponRenderers; foreach (Renderer val in array) { if (Object.op_Implicit((Object)(object)val)) { val.forceRenderingOff = hide; } } weaponsHidden = hide; } private void FindWeaponRenderers() { if (weaponRenderers == null) { weaponRenderers = Array.FindAll(((Component)this).GetComponentsInChildren<Renderer>(true), (Renderer r) => ((Object)r).name.StartsWith("ChamberHeadhunter", StringComparison.Ordinal) || ((Object)r).name.StartsWith("ChamberTourDeForce", StringComparison.Ordinal)); } } private void SetRifleRenderers(bool on) { if (rifleRenderers == null) { List<Renderer> list = new List<Renderer>(); foreach (Transform riflePart in rifleParts) { list.AddRange(((Component)riflePart).GetComponentsInChildren<Renderer>(true)); } rifleRenderers = list.ToArray(); } Renderer[] array = rifleRenderers; foreach (Renderer val in array) { if (Object.op_Implicit((Object)(object)val) && val.enabled != on) { val.enabled = on; } } } private void AimPistolArm() { //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0160: 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_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_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: 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_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01be: 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_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: 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_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_025f: 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_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: 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_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0317: 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_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_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) CharacterBody val = (Object.op_Implicit((Object)(object)characterModel) ? characterModel.body : null); bool flag = Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.inputBank) && val.shouldAim && Object.op_Implicit((Object)(object)rShoulder) && Object.op_Implicit((Object)(object)pistolGrip) && Object.op_Implicit((Object)(object)pistolMuzzle) && ((Component)pistolGrip).gameObject.activeInHierarchy; armAimWeight = Mathf.MoveTowards(armAimWeight, flag ? 1f : 0f, Time.deltaTime / (flag ? 0.15f : 0.35f)); StraightenPistolAtRest(val); if (armAimWeight <= 0f || !Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.inputBank) || !Object.op_Implicit((Object)(object)pistolGrip) || !Object.op_Implicit((Object)(object)pistolMuzzle)) { return; } Vector3 val2 = pistolGrip.TransformDirection(pistolBarrelLocal); if (((Vector3)(ref val2)).sqrMagnitude < 1E-08f) { return; } float num = 1f - (1f - armAimWeight) * (1f - armAimWeight); if (layer >= 0) { num *= 1f - animator.GetLayerWeight(layer); } if (num <= 0f) { return; } Vector3 aimDirection = val.inputBank.aimDirection; smoothArmAim = ((smoothArmAim == Vector3.zero) ? aimDirection : Vector3.Slerp(smoothArmAim, aimDirection, 1f - Mathf.Exp((0f - Time.deltaTime) / 0.05f))); Vector3 val3 = smoothArmAim; Vector3 up = ((Component)this).transform.up; Vector3 val4 = Vector3.ProjectOnPlane(val3, up); Vector3 val5 = Vector3.ProjectOnPlane(((Component)this).transform.forward, up); if (((Vector3)(ref val4)).sqrMagnitude > 1E-06f && ((Vector3)(ref val5)).sqrMagnitude > 1E-06f) { float num2 = Vector3.SignedAngle(val5, val4, up); float num3 = Mathf.Clamp(num2, -15f, 70f); if (num3 != num2) { val3 = Quaternion.AngleAxis(num3 - num2, up) * val3; } } if (Object.op_Implicit((Object)(object)rHand)) { Quaternion val6 = Quaternion.FromToRotation(rHand.position - rShoulder.position, val3); rShoulder.rotation = Quaternion.Slerp(rShoulder.rotation, val6 * rShoulder.rotation, num); Quaternion val7 = Quaternion.FromToRotation(pistolGrip.TransformDirection(pistolBarrelLocal), val3); rHand.rotation = Quaternion.Slerp(rHand.rotation, val7 * rHand.rotation, num); } else { Quaternion val8 = Quaternion.FromToRotation(val2, val3); rShoulder.rotation = Quaternion.Slerp(rShoulder.rotation, val8 * rShoulder.rotation, num); } ApplyKick(val3); } private void StraightenPistolAtRest(CharacterBody body) { //IL_0081: 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_008b: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_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_00f6: 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_0102: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.inputBank) && Object.op_Implicit((Object)(object)rHand) && Object.op_Implicit((Object)(object)pistolGrip) && ((Component)pistolGrip).gameObject.activeInHierarchy && !weaponsHidden) { float num = 1f - armAimWeight; if (layer >= 0) { num *= 1f - animator.GetLayerWeight(layer); } Vector3 val = pistolGrip.TransformDirection(pistolBarrelLocal); Vector3 aimDirection = body.inputBank.aimDirection; float num2 = Vector3.Angle(val, aimDirection); if (!(num <= 0f) && !(num2 < 0.1f) && !(((Vector3)(ref val)).sqrMagnitude < 1E-08f)) { Quaternion val2 = Quaternion.FromToRotation(val, aimDirection); float num3 = Mathf.Min(1f, 25f / num2) * num; rHand.rotation = Quaternion.Slerp(rHand.rotation, val2 * rHand.rotation, num3); } } } public void Kick() { kickAge = 0f; armAimWeight = 1f; } private void ApplyKick(Vector3 aim) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00cf: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) if (kickAge < 0f || !Object.op_Implicit((Object)(object)rHand)) { return; } kickAge += Time.deltaTime; if (kickAge > 0.6f) { kickAge = -1f; return; } float num = ((kickAge < 0.1f) ? Mathf.Sin(MathF.PI / 2f * kickAge / 0.1f) : Mathf.Exp((0f - (kickAge - 0.1f)) / 0.11f)); Vector3 val = Vector3.Cross(Vector3.up, aim); if (!(((Vector3)(ref val)).sqrMagnitude < 1E-06f)) { ((Vector3)(ref val)).Normalize(); float num2 = -11.5f * num * armAimWeight; rShoulder.rotation = Quaternion.AngleAxis(num2 * 0.6f, val) * rShoulder.rotation; rHand.rotation = Quaternion.AngleAxis(num2 * 0.4f, val) * rHand.rotation; } } private void SmoothRemoteGrounded() { if (!Object.op_Implicit((Object)(object)characterModel)) { characterModel = ((Component)this).GetComponent<CharacterModel>(); } CharacterBody val = (Object.op_Implicit((Object)(object)characterModel) ? characterModel.body : null); if (!Object.op_Implicit((Object)(object)val) || val.hasEffectiveAuthority || !Object.op_Implicit((Object)(object)val.characterMotor) || !Object.op_Implicit((Object)(object)animator) || !((Behaviour)animator).isActiveAndEnabled) { return; } bool isGrounded = val.characterMotor.isGrounded; if (isGrounded != lastRawGrounded) { groundedFlips++; lastRawGrounded = isGrounded; } groundedChangeAge = ((isGrounded == remoteGrounded) ? 0f : (groundedChangeAge + Time.deltaTime)); if (groundedChangeAge >= 0.15f) { remoteGrounded = isGrounded; groundedChangeAge = 0f; } animator.SetBool(GroundedHash, remoteGrounded); if (!(Time.time >= groundedLogAt)) { return; } if (groundedFlips > 0 && groundedLogAt > 0f) { CharacterMaster master = val.master; ManualLogSource log = ChamberSkills.Log; if (log != null) { log.LogInfo((object)("[Chamber] remote Chamber " + (Object.op_Implicit((Object)(object)master) ? ((Object)master).name : ((Object)val).name) + ": isGrounded flipped " + $"{groundedFlips} times in 10 s (smoothed for the animator)")); } } groundedFlips = 0; groundedLogAt = Time.time + 10f; } private void PoseArm(Transform shoulder, Transform elbow, Transform hand, float swing, Vector3 outward, Vector3 forward, Vector3 right, Vector3 down) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //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_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_0022: 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_002e: 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_003e: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_0074: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Quaternion.AngleAxis(0f - swing, right) * down + outward * 0.12f; Vector3 normalized = ((Vector3)(ref val)).normalized; Aim(shoulder, elbow.position - shoulder.position, normalized); float num = 80f + Mathf.Max(0f, swing) * 0.5f; Vector3 target = Quaternion.AngleAxis(0f - (swing + num), right) * down; Aim(elbow, hand.position - elbow.position, target); } private void Aim(Transform bone, Vector3 current, Vector3 target) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Aim(bone, current, target, armWeight); } private static void Aim(Transform bone, Vector3 current, Vector3 target, float weight) { //IL_000f: 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_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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (!(((Vector3)(ref current)).sqrMagnitude < 1E-08f)) { Quaternion val = Quaternion.FromToRotation(current, target) * bone.rotation; bone.rotation = Quaternion.Slerp(bone.rotation, val, weight); } } private void Update() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) if (lobby) { return; } SmoothRemoteGrounded(); AnimatorStateInfo val; int num; if (Object.op_Implicit((Object)(object)animator) && ((Behaviour)animator).isActiveAndEnabled) { val = animator.GetCurrentAnimatorStateInfo(0); num = ((((AnimatorStateInfo)(ref val)).shortNameHash == ArriveHash) ? 1 : 0); } else { num = 0; } bool flag = (byte)num != 0; int num2; float num3; if (layer < 0 || !Object.op_Implicit((Object)(object)animator) || !((Behaviour)animator).isActiveAndEnabled) { num2 = 0; } else { val = animator.GetCurrentAnimatorStateInfo(layer); num2 = ((AnimatorStateInfo)(ref val)).shortNameHash; if (num2 != 0) { val = animator.GetCurrentAnimatorStateInfo(layer); num3 = ((AnimatorStateInfo)(ref val)).normalizedTime; goto IL_00ad; } } num3 = 0f; goto IL_00ad; IL_00ad: float num4 = num3; bool flag2 = num2 == TrapThrowHash; bool flag3 = num2 == AnchorThrowHash; bool flag4 = num2 == TrapCardHash || (flag2 && num4 < 0.15f); bool flag5 = num2 == AnchorCardHash || (flag3 && num4 < 0.07f); if (Object.op_Implicit((Object)(object)trapCard) && trapCard.activeSelf != flag4) { trapCard.SetActive(flag4); } if (Object.op_Implicit((Object)(object)teleportCard) && teleportCard.activeSelf != flag5) { teleportCard.SetActive(flag5); } HideWeapons(flag || flag4 || flag5 || flag2 || flag3); if (upperLayer >= 0 && Object.op_Implicit((Object)(object)animator) && ((Behaviour)animator).isActiveAndEnabled) { upperWeight = Mathf.MoveTowards(upperWeight, flag ? 0f : 1f, Time.deltaTime / 0.15f); animator.SetLayerWeight(upperLayer, upperWeight); if (aimLayer >= 0) { animator.SetLayerWeight(aimLayer, aimWeight * upperWeight); } } if (layer < 0 || !Object.op_Implicit((Object)(object)animator) || !((Behaviour)animator).isActiveAndEnabled) { return; } val = animator.GetCurrentAnimatorStateInfo(layer); bool flag6 = ((AnimatorStateInfo)(ref val)).shortNameHash == EmptyHash; if (animator.IsInTransition(layer)) { val = animator.GetNextAnimatorStateInfo(layer); flag6 = ((AnimatorStateInfo)(ref val)).shortNameHash == EmptyHash; } if (hasTurning && Time.deltaTime > 0f) { float y = ((Component)this).transform.eulerAngles.y; float num5 = Mathf.DeltaAngle(lastYaw, y) / Time.deltaTime; float num6 = Mathf.Abs(num5); lastYaw = y; if (num6 > 90f) { turnDirection = ((turnHold > 0f) ? Mathf.MoveTowards(turnDirection, Mathf.Sign(num5), 4f * Time.deltaTime) : Mathf.Sign(num5)); } turnHold = ((num6 > 90f) ? 0.25f : Mathf.Max(0f, turnHold - Time.deltaTime)); animator.SetFloat(TurnDirectionHash, turnDirection); animator.SetBool(TurningHash, turnHold > 0f); } float layerWeight = animator.GetLayerWeight(layer); layerWeight = (((flag6 ? 0f : 1f) > layerWeight) ? 1f : Mathf.MoveTowards(layerWeight, 0f, Time.deltaTime / 0.15f)); animator.SetLayerWeight(layer, layerWeight); } } internal sealed class ChamberContentProvider : IContentPackProvider { private readonly ManualLogSource logger; private readonly string bundlePath; private readonly Action<GameObject> onModelLoaded; private readonly Action<string, GameObject> onKitPrefabLoaded; internal static readonly string[] KitPrefabs = new string[5] { "ChamberTrap", "ChamberAnchor", "ChamberAnchorMarker", "ChamberRangeRing", "ChamberSlowFieldVisual" }; private AssetBundle loadedBundle; internal static RuntimeAnimatorController LobbyController; internal static readonly Dictionary<string, GameObject> Vfx = new Dictionary<string, GameObject>(); public string identifier => "serge.chamber.assetbundle"; internal ChamberContentProvider(ManualLogSource logger, string bundlePath, Action<GameObject> onModelLoaded, Action<string, GameObject> onKitPrefabLoaded = null) { this.logger = logger; this.bundlePath = bundlePath; this.onModelLoaded = onModelLoaded; this.onKitPrefabLoaded = onKitPrefabLoaded; } public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { string path = bundlePath; try { path = ChamberFiles.Extracted("chamberassets") ?? bundlePath; } catch (Exception ex) { logger.LogError((object)("[Chamber] could not unpack the embedded AssetBundle into BepInEx/cache: " + ex.Message)); } if (!File.Exists(path)) { logger.LogError((object)("[Chamber] Unity AssetBundle missing: " + path + "; using Commando fallback visuals")); args.ReportProgress(1f); yield break; } AssetBundleCreateRequest loadBundle = null; Exception ex2 = null; try { loadBundle = AssetBundle.LoadFromFileAsync(path); } catch (Exception ex3) { ex2 = ex3; } if (ex2 != null || loadBundle == null) { logger.LogError((object)$"[Chamber] could not start AssetBundle load: {ex2}"); args.ReportProgress(1f); yield break; } while (!((AsyncOperation)loadBundle).isDone) { args.ReportProgress(Mathf.Clamp01(((AsyncOperation)loadBundle).progress * 0.45f)); yield return null; } loadedBundle = loadBundle.assetBundle; if (!Object.op_Implicit((Object)(object)loadedBundle)) { logger.LogError((object)("[Chamber] Unity could not open the AssetBundle at " + path)); args.ReportProgress(1f); yield break; } AssetBundleRequest loadPrefab = null; Exception ex4 = null; try { loadPrefab = loadedBundle.LoadAssetAsync<GameObject>("ChamberModel"); } catch (Exception ex5) { ex4 = ex5; } if (ex4 != null || loadPrefab == null) { logger.LogError((object)$"[Chamber] could not start ChamberModel prefab load: {ex4}"); args.ReportProgress(1f); yield break; } while (!((AsyncOperation)loadPrefab).isDone) { args.ReportProgress(0.45f + Mathf.Clamp01(((AsyncOperation)loadPrefab).progress) * 0.45f); yield return null; } Object asset = loadPrefab.asset; GameObject val = (GameObject)(object)((asset is GameObject) ? asset : null); Animator val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponent<Animator>() : null); SkinnedMeshRenderer[] array = (Object.op_Implicit((Object)(object)val) ? val.GetComponentsInChildren<SkinnedMeshRenderer>(true) : Array.Empty<SkinnedMeshRenderer>()); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2) || !Object.op_Implicit((Object)(object)val2.avatar) || array.Length != 4 || !Object.op_Implicit((Object)(object)val2.runtimeAnimatorController)) { logger.LogError((object)($"[Chamber] AssetBundle prefab validation failed: model={Object.op_Implicit((Object)(object)val)}, " + string.Format("animator={0}, avatar={1}, ", Object.op_Implicit((Object)(object)val2), (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.avatar)) ? ((Object)val2.avatar).name : "none") + "controller=" + ((Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.runtimeAnimatorController)) ? ((Object)val2.runtimeAnimatorController).name : "none") + ", " + $"skinnedRenderers={array.Length}")); args.ReportProgress(1f); yield break; } Exception ex6 = null; try { LobbyController = loadedBundle.LoadAsset<RuntimeAnimatorController>("ChamberLobby"); string[] allAssetNames = loadedBundle.GetAllAssetNames(); foreach (string text in allAssetNames) { if (text.EndsWith(".prefab", StringComparison.Ordinal) && Path.GetFileName(text).StartsWith("vfx_", StringComparison.Ordinal)) { GameObject val3 = loadedBundle.LoadAsset<GameObject>(text); if (Object.op_Implicit((Object)(object)val3)) { Vfx[((Object)val3).name] = val3; } } } logger.LogInfo((object)$"[Chamber] VALORANT effects in the bundle: {Vfx.Count}"); onModelLoaded(val); if (onKitPrefabLoaded != null) { allAssetNames = KitPrefabs; foreach (string text2 in allAssetNames) { GameObject val4 = loadedBundle.LoadAsset<GameObject>(text2); if (Object.op_Implicit((Object)(object)val4)) { onKitPrefabLoaded(text2, val4); } else { logger.LogWarning((object)("[Chamber] kit prefab " + text2 + " not in the bundle; the kit uses its placeholder")); } } } } catch (Exception ex7) { ex6 = ex7; } if (ex6 != null) { logger.LogError((object)$"[Chamber] could not attach AssetBundle prefab to survivor definitions: {ex6}"); args.ReportProgress(1f); yield break; } logger.LogInfo((object)("[Chamber] Unity AssetBundle loaded: prefab=" + ((Object)val).name + ", avatar=" + ((Object)val2.avatar).name + ", " + $"controller={((Object)val2.runtimeAnimatorController).name}, skinnedRenderers={array.Length}")); args.ReportProgress(1f); } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { args.ReportProgress(1f); yield break; } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { args.ReportProgress(1f); yield break; } } internal static class ChamberDeadeyeLock { private static ManualLogSource _log; private static ItemDef _deadeye; private static bool _looked; private static int _depth; private static bool _wasRemovable; private static ItemDef Deadeye { get { //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (!_looked && ItemCatalog.itemCount > 0) { _looked = true; _deadeye = ItemCatalog.GetItemDef(ItemCatalog.FindItemIndex("Deadeye")); } return _deadeye; } } internal static void Apply(ManualLogSource log) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown _log = log; Harmony harmony = new Harmony("serge.chamber.deadeyelock"); Around(AccessTools.Method(typeof(LunarSunBehavior), "TransformItem", (Type[])null, (Type[])null), "LockForBehavior"); Around(AccessTools.Method(typeof(CostTypeDef), "IsAffordable", new Type[2] { typeof(int), typeof(Interactor) }, (Type[])null), "LockForActivator"); Around(AccessTools.Method(typeof(CostTypeDef), "PayCost", new Type[5] { typeof(int), typeof(Interactor), typeof(GameObject), typeof(Xoroshiro128Plus), typeof(ItemIndex) }, (Type[])null), "LockForActivator"); Type[] array = new Type[3] { typeof(PickupPickerController), typeof(CraftingController), typeof(AcolyteUnlockPickerController) }; for (int i = 0; i < array.Length; i++) { Around(AccessTools.DeclaredMethod(array[i], "GetGeneratedOptionsFromInteractor", (Type[])null, (Type[])null), "LockForActivator"); } Around(AccessTools.Method(typeof(Inventory), "ShrineRestackInventory", (Type[])null, (Type[])null), "LockForInventory"); Around(AccessTools.Method(typeof(Inventory), "UpdateEffectiveItemStacks", new Type[1] { typeof(ItemIndex) }, (Type[])null), "LockForItemCount"); Patch(AccessTools.Method(typeof(RoamingItemDisableBehavior), "CanDisableItem", (Type[])null, (Type[])null), "RefuseRoam", unlockAfter: false); Type type = AccessTools.Inner(typeof(ItemStealController), "StolenInventoryInfo"); Patch((type != null) ? AccessTools.Method(type, "StealItem", (Type[])null, (Type[])null) : null, "RefuseSteal", unlockAfter: false); Patch(AccessTools.Method(typeof(Inventory), "GiveItemPermanent", new Type[2] { typeof(ItemIndex), typeof(int) }, (Type[])null), "GuardRemoval", unlockAfter: false); void Around(MethodBase method, string prefix) { Patch(method, prefix, unlockAfter: true); } void Patch(MethodBase method, string prefix, bool unlockAfter) { //IL_0027: 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_004f: Expected O, but got Unknown try { if (method == null) { throw new MissingMethodException("not found"); } harmony.Patch(method, new HarmonyMethod(typeof(ChamberDeadeyeLock), prefix, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (!unlockAfter) ? ((HarmonyMethod)null) : new HarmonyMethod(typeof(ChamberDeadeyeLock), "Unlock", (Type[])null), (HarmonyMethod)null); } catch (Exception ex) { log.LogWarning((object)("[Chamber] Deadeye lock: " + method?.DeclaringType?.Name + "." + method?.Name + " (" + prefix + ") not patched: " + ex.Message)); } } } private static bool IsChamber(CharacterBody body) { if (Object.op_Implicit((Object)(object)body)) { return body.baseNameToken == "CHAMBER_BODY_NAME"; } return false; } private static bool IsChamber(Inventory inventory) { CharacterMaster val = (Object.op_Implicit((Object)(object)inventory) ? ((Component)inventory).GetComponent<CharacterMaster>() : null); if (!Object.op_Implicit((Object)(object)val)) { return false; } CharacterBody body = val.GetBody(); if (!Object.op_Implicit((Object)(object)body)) { if (Object.op_Implicit((Object)(object)val.bodyPrefab)) { return IsChamber(val.bodyPrefab.GetComponent<CharacterBody>()); } return false; } return IsChamber(body); } private static bool Lock(bool chamber) { ItemDef val = (chamber ? Deadeye : null); if (!Object.op_Implicit((Object)(object)val)) { return false; } if (_depth++ == 0) { _wasRemovable = val.canRemove; val.canRemove = false; } return true; } private static void LockForBehavior(LunarSunBehavior __instance, out bool __state) { __state = Lock(Object.op_Implicit((Object)(object)__instance) && IsChamber(((BaseItemBodyBehavior)__instance).body)); } private static void LockForActivator(Interactor activator, out bool __state) { __state = Lock(Object.op_Implicit((Object)(object)activator) && IsChamber(((Component)activator).GetComponent<CharacterBody>())); } private static void LockForInventory(Inventory __instance, out bool __state) { __state = Lock(IsChamber(__instance)); } private static void LockForItemCount(Inventory __instance, ItemIndex itemIndex, out bool __state) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) __state = IsDeadeye(itemIndex) && Lock(IsChamber(__instance)); } private static bool IsDeadeye(ItemIndex itemIndex) { //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) if (Object.op_Implicit((Object)(object)Deadeye)) { return itemIndex == Deadeye.itemIndex; } return false; } private static bool RefuseRoam(RoamingItemDisableBehavior __instance, ItemIndex itemIndex, ref bool __result) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (IsDeadeye(itemIndex) && Object.op_Implicit((Object)(object)__instance) && IsChamber(((BaseItemBodyBehavior)__instance).body)) { __result = false; return false; } return true; } private static Exception Unlock(bool __state, Exception __exception) { if (__state && --_depth == 0 && Object.op_Implicit((Object)(object)Deadeye)) { Deadeye.canRemove = _wasRemovable; } return __exception; } private static bool RefuseSteal(ItemIndex itemIndex, Inventory ___victimInventory, ref int __result) { //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) if (Object.op_Implicit((Object)(object)Deadeye) && itemIndex == Deadeye.itemIndex && IsChamber(___victimInventory)) { ManualLogSource log = _log; if (log != null) { log.LogInfo((object)"[Chamber] kept Chamber's Deadeye: a steal was refused"); } __result = 0; return false; } return true; } private static bool GuardRemoval(Inventory __instance, ItemIndex itemIndex, int countToAdd) { //IL_0010: 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) if (countToAdd >= 0 || !Object.op_Implicit((Object)(object)Deadeye) || itemIndex != Deadeye.itemIndex || !IsChamber(__instance)) { return true; } ManualLogSource log = _log; if (log != null) { log.LogInfo((object)$"[Chamber] kept Chamber's Deadeye: a removal of {-countToAdd} was refused"); } return false; } } public static class ChamberDebugCommands { private sealed class Registrar : MonoBehaviour { private void Update() { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) Console instance = Console.instance; if (!Object.op_Implicit((Object)(object)instance)) { return; } BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; FieldInfo field = typeof(Console).GetField("loadingIsComplete", bindingAttr); if (field != null && !(bool)field.GetValue(instance)) { return; } IDictionary dictionary = (IDictionary)typeof(Console).GetField("concommandCatalog", bindingAttr).GetValue(instance); Type nestedType = typeof(Console).GetNestedType("ConCommand", bindingAttr); MethodInfo[] methods = typeof(ChamberDebugCommands).GetMethods(bindingAttr); foreach (MethodInfo methodInfo in methods) { ConCommandAttribute val = (ConCommandAttribute)Attribute.GetCustomAttribute(methodInfo, typeof(ConCommandAttribute)); if (val != null) { object obj = Activator.CreateInstance(nestedType, nonPublic: true); nestedType.GetField("flags").SetValue(obj, val.flags); nestedType.GetField("helpText").SetValue(obj, val.helpText); nestedType.GetField("action").SetValue(obj, Delegate.CreateDelegate(typeof(ConCommandDelegate), methodInfo)); dictionary[val.commandName.ToLowerInvariant()] = obj; Debug.Log((object)("[Chamber] console command registered: " + val.commandName)); } } Object.Destroy((Object)(object)((Component)this).gameObject); } } public static void Register() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown GameObject val = new GameObject("ChamberDebugCommandsRegistrar"); Object.DontDestroyOnLoad((Object)val); val.AddComponent<Registrar>(); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CmdCam(ConCommandArgs args) { string text = ((((ConCommandArgs)(ref args)).Count > 0) ? ((ConCommandArgs)(ref args))[0].ToLowerInvariant() : "front"); ChamberDebugCamera.Set(text); Debug.Log((object)("[Chamber cam] " + text)); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CmdCamDist(ConCommandArgs args) { if (((ConCommandArgs)(ref args)).Count > 0 && float.TryParse(((ConCommandArgs)(ref args))[0], NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { ChamberDebugCamera.Distance = Mathf.Clamp(result, 1f, 20f); } } } internal sealed class ChamberDebugCamera : MonoBehaviour { public static float Distance = 3.5f; private static ChamberDebugCamera _instance; private Camera _cam; private float _yaw; public static void Set(string mode) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown if (mode == "off") { if (Object.op_Implicit((Object)(object)_instance)) { Object.Destroy((Object)(object)((Component)_instance).gameObject); } return; } if (!Object.op_Implicit((Object)(object)_instance)) { GameObject val = new GameObject("ChamberDebugCamera"); Object.DontDestroyOnLoad((Object)(object)val); _instance = val.AddComponent<ChamberDebugCamera>(); _instance._cam = val.AddComponent<Camera>(); _instance._cam.depth = 100f; _instance._cam.fieldOfView = 50f; _instance._cam.nearClipPlane = 0.05f; } _instance._yaw = ((mode == "side") ? 90f : ((mode == "back") ? 180f : 0f)); } private void LateUpdate() { //IL_0060: 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_006f: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_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) LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); CharacterBody val = ((firstLocalUser != null && Object.op_Implicit((Object)(object)firstLocalUser.cachedMaster)) ? firstLocalUser.cachedMaster.GetBody() : null); if (Object.op_Implicit((Object)(object)val)) { Vector3 val2 = Vector3.ProjectOnPlane(((Object.op_Implicit((Object)(object)val.modelLocator) && Object.op_Implicit((Object)(object)val.modelLocator.modelTransform)) ? val.modelLocator.modelTransform : ((Component)val).transform).forward, Vector3.up); Vector3 val3 = ((Vector3)(ref val2)).normalized; if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { val3 = Vector3.forward; } Vector3 val4 = Quaternion.AngleAxis(_yaw, Vector3.up) * val3; Vector3 corePosition = val.corePosition; ((Component)this).transform.position = corePosition + val4 * Distance + Vector3.up * 0.3f; ((Component)this).transform.rotation = Quaternion.LookRotation(corePosition - ((Component)this).transform.position, Vector3.up); } } } internal static class ChamberFiles { internal static readonly string Root = Path.GetDirectoryName(typeof(ChamberFiles).Assembly.Location) ?? string.Empty; internal static string Find(string folder, string file) { string text = Path.Combine(Root, folder, file); string text2 = Path.Combine(Root, file); if (!File.Exists(text) && File.Exists(text2)) { return text2; } return text; } internal static Stream Embedded(string file) { return typeof(ChamberFiles).Assembly.GetManifestResourceStream(file); } internal static byte[] Read(string folder, string file) { using (Stream stream = Embedded(file)) { if (stream != null) { MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); return memoryStream.ToArray(); } } string path = Find(folder, file); if (!File.Exists(path)) { return null; } return File.ReadAllBytes(path); } internal static string Extracted(string file) { using Stream stream = Embedded(file); if (stream == null) { return null; } string text = Path.Combine(Paths.CachePath, "ChamberMod"); string text2 = Path.Combine(text, file); FileInfo fileInfo = new FileInfo(text2); if (!fileInfo.Exists || fileInfo.Length != stream.Length || fileInfo.LastWriteTimeUtc < File.GetLastWriteTimeUtc(typeof(ChamberFiles).Assembly.Location)) { Directory.CreateDirectory(text); string text3 = text2 + ".part"; using (FileStream destination = File.Create(text3)) { stream.CopyTo(destination); } File.Delete(text2); File.Move(text3, text2); } return text2; } internal static string Dir(string folder) { string text = Path.Combine(Root, folder); if (!Directory.Exists(text)) { return Root; } return text; } } internal static class ChamberItemDisplays { [Serializable] private class ExportRule { public string guid; public string childName; public Vector3 localPos; public Vector3 localAngles; public Vector3 localScale; public int ruleType; } [Serializable] private class ExportGroup { public string name; public List<ExportRule> rules; } [Serializable] private class Export { public List<ExportGroup> itemGroups; public List<ExportGroup> equipmentGroups; } internal static ItemDisplayRuleSet Rules; private static Dictionary<string, ExportRule[]> ReadExport() { Dictionary<string, ExportRule[]> dictionary = new Dictionary<string, ExportRule[]>(); using Stream stream = typeof(ChamberItemDisplays).Assembly.GetManifestResourceStream("ChamberBodyIDRS.json"); using StreamReader streamReader = new StreamReader(stream); Export export = JsonUtility.FromJson<Export>(streamReader.ReadToEnd()); foreach (ExportGroup item in export.itemGroups.Concat(export.equipmentGroups)) { dictionary[item.name] = item.rules.Where((ExportRule r) => r.ruleType == 0).ToArray(); } return dictionary; } internal static void Apply(ManualLogSource log) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0076: 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_00e1: 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_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_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0234: 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_0258: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)Rules) || Rules.keyAssetRuleGroups == null) { return; } float realtimeSinceStartup = Time.realtimeSinceStartup; Dictionary<string, ExportRule[]> dictionary = ReadExport(); int num = 0; int num2 = 0; ChamberAnchorFile.ItemData boxes = new ChamberAnchorFile.ItemData(); KeyAssetRuleGroup[] keyAssetRuleGroups = Rules.keyAssetRuleGroups; for (int i = 0; i < keyAssetRuleGroups.Length; i++) { KeyAssetRuleGroup group = keyAssetRuleGroups[i]; ItemDisplayRule[] rules = group.displayRuleGroup.rules; string key = (Object.op_Implicit(group.keyAsset) ? group.keyAsset.name : null); if (rules == null || key == null) { continue; } dictionary.TryGetValue(key, out var value); int j = 0; int num3 = 0; for (; j < rules.Length; j++) { if ((int)rules[j].ruleType != 0) { continue; } ExportRule hit = ((value != null && num3 < value.Length) ? value[num3] : null); num3++; if (hit != null && !string.IsNullOrEmpty(hit.guid) && rules[j].followerPrefabAddress != null && !string.IsNullOrEmpty(((AssetReference)rules[j].followerPrefabAddress).AssetGUID) && ((AssetReference)rules[j].followerPrefabAddress).AssetGUID != hit.guid) { hit = null; num2++; } int index = j; ItemDisplayRule orig = rules[j]; if (hit != null) { rules[j].childName = hit.childName; rules[j].localPos = hit.localPos; rules[j].localAngles = hit.localAngles; rules[j].localScale = hit.localScale; if (ChamberAnchorFile.Change.TryGetValue(hit.childName, out var value2)) { ChamberAnchorFile.Convert(value2, ref rules[j].localPos, ref rules[j].localAngles, ref rules[j].localScale); } num++; } Record(); void Record() { //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_0012: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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) //IL_0056: 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_0093: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_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_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013e: 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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: 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_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_01a5: 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_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_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) ItemDisplayRule val = rules[index]; Bounds val2 = (Bounds)(((??)ChamberAnchorFile.PrefabBounds(val.followerPrefab)) ?? new Bounds(Vector3.zero, Vector3.one * 0.2f)); Quaternion val3 = Quaternion.Euler(val.localAngles); Object keyAsset = group.keyAsset; string text = (Object.op_Implicit((keyAsset is ItemDef) ? keyAsset : null) ? ((ItemDef)group.keyAsset).nameToken : (Object.op_Implicit((Object)/*isinst with value type is only supported in some contexts*/) ? ((EquipmentDef)group.keyAsset).nameToken : null)); boxes.items.Add(new ChamberAnchorFile.ItemBox { item = key, name = ((text != null) ? Language.GetString(text) : key), child = val.childName, pos = val.localPos, forward = val3 * Vector3.forward, up = val3 * Vector3.up, scale = val.localScale, center = ((Bounds)(ref val2)).center, size = ((Bounds)(ref val2)).size, placed = (hit != null), origChild = orig.childName, origPos = orig.localPos, origScale = orig.localScale, origForward = Quaternion.Euler(orig.localAngles) * Vector3.forward, origUp = Quaternion.Euler(orig.localAngles) * Vector3.up }); } } } ChamberAnchorFile.WriteItems(boxes, log); log.LogInfo((object)($"[Chamber] item displays: {num} from the placement export, {num2} skipped (other prefab); " + $"{Time.realtimeSinceStartup - realtimeSinceStartup:F2} s, game loaded at {Time.realtimeSinceStartup:F1} s after start")); } } internal sealed class ChamberLobbyFx : MonoBehaviour { private const float Shot1Length = 3.2f; private const float Shot2Start = 3.2f; private const float IdleStart = 8.6333f; private static readonly int Shot1Hash = Animator.StringToHash("LobbyShot1"); private static readonly int Shot2Hash = Animator.StringToHash("LobbyShot2"); private static readonly int IdleHash = Animator.StringToHash("LobbyIdle"); private static readonly Color Gold = new Color(1f, 0.83f, 0.44f, 1f); private const float VfxUnit = 0.010726014f; private Animator animator; private Transform skeleton; private Transform head; private Transform muzzle; private Transform rifleGrip; private Transform cardBone; private Transform weaponHand; private T