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 CompanyIssuedTracks v1.0.0
BepInEx/plugins/CompanyIssuedTracks/JoJoScrap.dll
Decompiled 3 hours agousing System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Unity.Netcode; using UnityEditor; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] [CompilerGenerated] [EditorBrowsable(EditorBrowsableState.Never)] [GeneratedCode("Unity.MonoScriptGenerator.MonoScriptInfoGenerator", null)] internal class UnitySourceGeneratedAssemblyMonoScriptTypes_v1 { private struct MonoScriptData { public byte[] FilePathsData; public byte[] TypesData; public int TotalTypes; public int TotalFiles; public bool IsEditorOnly; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static MonoScriptData Get() { return new MonoScriptData { FilePathsData = new byte[202] { 0, 0, 0, 5, 0, 0, 0, 35, 92, 65, 115, 115, 101, 116, 115, 92, 74, 111, 74, 111, 83, 99, 114, 97, 112, 92, 83, 99, 114, 105, 112, 116, 115, 92, 80, 108, 117, 103, 105, 110, 46, 99, 115, 0, 0, 0, 1, 0, 0, 0, 49, 92, 65, 115, 115, 101, 116, 115, 92, 74, 111, 74, 111, 83, 99, 114, 97, 112, 92, 83, 99, 114, 105, 112, 116, 115, 92, 82, 101, 99, 111, 114, 100, 80, 108, 97, 121, 101, 114, 68, 105, 115, 99, 83, 108, 111, 116, 46, 99, 115, 0, 0, 0, 1, 0, 0, 0, 38, 92, 65, 115, 115, 101, 116, 115, 92, 74, 111, 74, 111, 83, 99, 114, 97, 112, 92, 83, 99, 114, 105, 112, 116, 115, 92, 86, 105, 110, 121, 108, 68, 105, 115, 99, 46, 99, 115, 0, 0, 0, 1, 0, 0, 0, 48, 92, 65, 115, 115, 101, 116, 115, 92, 74, 111, 74, 111, 83, 99, 114, 97, 112, 92, 83, 99, 114, 105, 112, 116, 115, 92, 86, 105, 110, 121, 108, 68, 105, 115, 99, 68, 101, 102, 105, 110, 105, 116, 105, 111, 110, 46, 99, 115 }, TypesData = new byte[318] { 0, 0, 0, 0, 16, 74, 111, 74, 111, 83, 99, 114, 97, 112, 124, 80, 108, 117, 103, 105, 110, 0, 0, 0, 0, 49, 74, 111, 74, 111, 83, 99, 114, 97, 112, 46, 80, 108, 117, 103, 105, 110, 124, 67, 111, 112, 121, 86, 97, 110, 105, 108, 108, 97, 83, 99, 114, 97, 112, 83, 112, 97, 119, 110, 71, 114, 111, 117, 112, 115, 80, 97, 116, 99, 104, 0, 0, 0, 0, 40, 74, 111, 74, 111, 83, 99, 114, 97, 112, 46, 80, 108, 117, 103, 105, 110, 124, 82, 101, 99, 111, 114, 100, 80, 108, 97, 121, 101, 114, 65, 116, 116, 97, 99, 104, 80, 97, 116, 99, 104, 0, 0, 0, 0, 42, 74, 111, 74, 111, 83, 99, 114, 97, 112, 46, 80, 108, 117, 103, 105, 110, 124, 82, 101, 99, 111, 114, 100, 80, 108, 97, 121, 101, 114, 73, 110, 116, 101, 114, 97, 99, 116, 80, 97, 116, 99, 104, 0, 0, 0, 0, 53, 74, 111, 74, 111, 83, 99, 114, 97, 112, 46, 80, 108, 117, 103, 105, 110, 124, 80, 114, 101, 118, 101, 110, 116, 68, 111, 117, 98, 108, 101, 71, 114, 97, 98, 79, 110, 82, 101, 99, 111, 114, 100, 80, 108, 97, 121, 101, 114, 80, 97, 116, 99, 104, 0, 0, 0, 0, 30, 74, 111, 74, 111, 83, 99, 114, 97, 112, 124, 82, 101, 99, 111, 114, 100, 80, 108, 97, 121, 101, 114, 68, 105, 115, 99, 83, 108, 111, 116, 0, 0, 0, 0, 19, 74, 111, 74, 111, 83, 99, 114, 97, 112, 124, 86, 105, 110, 121, 108, 68, 105, 115, 99, 0, 0, 0, 0, 29, 74, 111, 74, 111, 83, 99, 114, 97, 112, 124, 86, 105, 110, 121, 108, 68, 105, 115, 99, 68, 101, 102, 105, 110, 105, 116, 105, 111, 110 }, TotalFiles = 4, TotalTypes = 8, IsEditorOnly = false }; } } namespace JoJoScrap { [BepInPlugin("com.g4music.jojobizarreinyls", "JoJo Bizarre Vinyls", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { [HarmonyPatch(typeof(StartOfRound), "Awake")] private static class CopyVanillaScrapSpawnGroupsPatch { private static void Postfix(StartOfRound __instance) { //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: 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_01f6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.allItemsList == (Object)null || __instance.allItemsList.itemsList == null) { return; } List<ItemGroup> list = null; AudioClip val = null; AudioClip val2 = null; AudioClip val3 = null; Vector3 positionOffset = default(Vector3); ((Vector3)(ref positionOffset))..ctor(0.01f, 0.12f, -0.22f); Vector3 rotationOffset = default(Vector3); ((Vector3)(ref rotationOffset))..ctor(6.59f, 25.69f, -176.41f); foreach (Item items in __instance.allItemsList.itemsList) { if (!((Object)(object)items == (Object)null) && !RegisteredVinylItems.Contains(items)) { if (list == null && items.isScrap && !items.twoHanded && items.spawnPositionTypes != null && items.spawnPositionTypes.Count > 0) { list = new List<ItemGroup>(items.spawnPositionTypes); } if ((Object)(object)val == (Object)null && (Object)(object)items.grabSFX != (Object)null) { val = items.grabSFX; } if ((Object)(object)val2 == (Object)null && (Object)(object)items.dropSFX != (Object)null) { val2 = items.dropSFX; } if ((Object)(object)val3 == (Object)null && (Object)(object)items.pocketSFX != (Object)null) { val3 = items.pocketSFX; } } } foreach (Item registeredVinylItem in RegisteredVinylItems) { if (!((Object)(object)registeredVinylItem == (Object)null)) { if (list != null && list.Count > 0 && (registeredVinylItem.spawnPositionTypes == null || registeredVinylItem.spawnPositionTypes.Count == 0)) { registeredVinylItem.spawnPositionTypes = new List<ItemGroup>(list); } if ((Object)(object)registeredVinylItem.grabSFX == (Object)null) { registeredVinylItem.grabSFX = val; } if ((Object)(object)registeredVinylItem.dropSFX == (Object)null) { registeredVinylItem.dropSFX = val2; } if ((Object)(object)registeredVinylItem.pocketSFX == (Object)null) { registeredVinylItem.pocketSFX = val3; } registeredVinylItem.positionOffset = positionOffset; registeredVinylItem.rotationOffset = rotationOffset; } } } } [HarmonyPatch(typeof(AnimatedObjectTrigger), "Start")] private static class RecordPlayerAttachPatch { private static void Postfix(AnimatedObjectTrigger __instance) { if ((Object)(object)__instance == (Object)null) { return; } Transform root = ((Component)__instance).transform.root; if (((Object)__instance).name.IndexOf("RecordPlayer", StringComparison.OrdinalIgnoreCase) >= 0 || ((Object)(object)((Component)__instance).transform.parent != (Object)null && ((Object)((Component)__instance).transform.parent).name.IndexOf("RecordPlayer", StringComparison.OrdinalIgnoreCase) >= 0) || ((Object)(object)root != (Object)null && ((Object)root).name.IndexOf("RecordPlayer", StringComparison.OrdinalIgnoreCase) >= 0)) { NetworkObject componentInParent = ((Component)__instance).GetComponentInParent<NetworkObject>(); GameObject val = (((Object)(object)componentInParent != (Object)null) ? ((Component)componentInParent).gameObject : ((Component)__instance).gameObject); if ((Object)(object)val.GetComponent<RecordPlayerDiscSlot>() == (Object)null) { val.AddComponent<RecordPlayerDiscSlot>(); Log.LogInfo((object)("Attached RecordPlayerDiscSlot to " + ((Object)val).name)); } } } } [HarmonyPatch(typeof(InteractTrigger), "Interact")] private static class RecordPlayerInteractPatch { private static bool Prefix(InteractTrigger __instance, Transform playerTransform) { if ((Object)(object)__instance == (Object)null) { return true; } RecordPlayerDiscSlot componentInParent = ((Component)__instance).GetComponentInParent<RecordPlayerDiscSlot>(); if ((Object)(object)componentInParent == (Object)null) { return true; } if (Time.frameCount <= RecordPlayerDiscSlot.LastGrabFrame + 1 || Time.unscaledTime - RecordPlayerDiscSlot.LastGrabTime < 0.3f) { return false; } PlayerControllerB val = (((Object)(object)playerTransform != (Object)null) ? ((Component)playerTransform).GetComponent<PlayerControllerB>() : GameNetworkManager.Instance?.localPlayerController); if ((Object)(object)val == (Object)null) { return true; } if (componentInParent.HasDisc || val.currentlyHeldObjectServer is VinylDisc) { componentInParent.HandleInteract(val); return false; } return true; } } [HarmonyPatch(typeof(PlayerControllerB), "BeginGrabObject")] private static class PreventDoubleGrabOnRecordPlayerPatch { private static bool Prefix(PlayerControllerB __instance, out GrabbableObject __state) { __state = (((Object)(object)__instance != (Object)null) ? __instance.currentlyHeldObjectServer : null); return !RecordPlayerDiscSlot.SuppressNativeGrabThisFrame; } private static void Postfix(PlayerControllerB __instance, GrabbableObject __state) { if ((Object)(object)__instance != (Object)null && (Object)(object)__instance.currentlyHeldObjectServer != (Object)null && (Object)(object)__instance.currentlyHeldObjectServer != (Object)(object)__state) { RecordPlayerDiscSlot.LastGrabFrame = Time.frameCount; RecordPlayerDiscSlot.LastGrabTime = Time.unscaledTime; } } } public const string ModGuid = "com.g4music.jojobizarreinyls"; public const string ModName = "JoJo Bizarre Vinyls"; public const string ModVersion = "1.0.0"; private const float TargetDiscDiameter = 0.54f; private const float GrabHitboxSize = 0.56f; private const float GrabHitboxHeight = 0.08f; public static readonly List<Item> RegisteredVinylItems = new List<Item>(); private Harmony harmony; public static ManualLogSource Log { get; private set; } private void Awake() { //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Expected O, but got Unknown //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: 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_0259: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location) ?? string.Empty, "jojoscrap"); if (!File.Exists(text)) { Log.LogError((object)("Could not find AssetBundle at: " + text)); return; } AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val == (Object)null) { Log.LogError((object)"Failed to load 'jojoscrap' AssetBundle."); return; } VinylDiscDefinition[] array = val.LoadAllAssets<VinylDiscDefinition>(); Array.Sort(array, (VinylDiscDefinition a, VinylDiscDefinition b) => string.Compare(a.itemName, b.itemName, StringComparison.OrdinalIgnoreCase)); Shader hdrpLit = Shader.Find("HDRP/Lit"); Sprite val2 = CreateFallbackDiscSprite(); int num = 0; VinylDiscDefinition[] array2 = array; foreach (VinylDiscDefinition vinylDiscDefinition in array2) { if ((Object)(object)vinylDiscDefinition == (Object)null || (Object)(object)vinylDiscDefinition.spawnPrefab == (Object)null) { continue; } ConfigureDiscGeometryAndHitbox(vinylDiscDefinition.spawnPrefab); ConvertPrefabMaterialsToHdrp(vinylDiscDefinition.spawnPrefab, hdrpLit); Item val3 = ScriptableObject.CreateInstance<Item>(); ((Object)val3).name = ((Object)vinylDiscDefinition).name; val3.itemName = vinylDiscDefinition.itemName; val3.spawnPrefab = vinylDiscDefinition.spawnPrefab; val3.itemIcon = (((Object)(object)vinylDiscDefinition.itemIcon != (Object)null) ? vinylDiscDefinition.itemIcon : val2); val3.minValue = vinylDiscDefinition.minValue; val3.maxValue = vinylDiscDefinition.maxValue; val3.weight = vinylDiscDefinition.weight; val3.positionOffset = vinylDiscDefinition.positionOffset; val3.rotationOffset = vinylDiscDefinition.rotationOffset; val3.isScrap = true; val3.isConductiveMetal = false; val3.canBeGrabbedBeforeGameStart = true; val3.itemSpawnsOnGround = true; val3.twoHanded = false; val3.requiresBattery = false; val3.verticalOffset = 0.01f; val3.restingRotation = Vector3.zero; VinylDisc component = vinylDiscDefinition.spawnPrefab.GetComponent<VinylDisc>(); if ((Object)(object)component != (Object)null) { ((GrabbableObject)component).itemProperties = val3; } Transform val4 = vinylDiscDefinition.spawnPrefab.transform.Find("ScanNode"); if ((Object)(object)val4 != (Object)null) { val4.localPosition = new Vector3(0f, 0.08f, 0f); BoxCollider component2 = ((Component)val4).GetComponent<BoxCollider>(); if ((Object)(object)component2 != (Object)null) { component2.size = new Vector3(0.6f, 0.4f, 0.6f); } ScanNodeProperties val5 = ((Component)val4).GetComponent<ScanNodeProperties>(); if ((Object)(object)val5 == (Object)null) { val5 = ((Component)val4).gameObject.AddComponent<ScanNodeProperties>(); } val5.headerText = vinylDiscDefinition.itemName; val5.subText = "Value: $"; val5.scrapValue = vinylDiscDefinition.minValue; val5.minRange = 0; val5.maxRange = 13; val5.nodeType = 2; } NetworkPrefabs.RegisterNetworkPrefab(vinylDiscDefinition.spawnPrefab); Items.RegisterScrap(val3, 18, (LevelTypes)(-1)); RegisteredVinylItems.Add(val3); num++; Log.LogInfo((object)("Registered JoJo Vinyl Scrap: " + vinylDiscDefinition.itemName)); } harmony = new Harmony("com.g4music.jojobizarreinyls"); harmony.PatchAll(Assembly.GetExecutingAssembly()); Log.LogInfo((object)string.Format("{0} v{1} loaded ({2} vinyl discs).", "JoJo Bizarre Vinyls", "1.0.0", num)); } private static void ConfigureDiscGeometryAndHitbox(GameObject prefabRoot) { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_012d: 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_00f7: 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_0179: 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_0189: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: 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_0163: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)prefabRoot == (Object)null) { return; } prefabRoot.layer = 6; AudioSource val = prefabRoot.GetComponent<AudioSource>(); if ((Object)(object)val == (Object)null) { val = prefabRoot.AddComponent<AudioSource>(); } val.playOnAwake = false; val.spatialBlend = 1f; Transform val2 = null; for (int i = 0; i < prefabRoot.transform.childCount; i++) { Transform child = prefabRoot.transform.GetChild(i); if (!string.Equals(((Object)child).name, "ScanNode", StringComparison.OrdinalIgnoreCase)) { val2 = child; break; } } if ((Object)(object)val2 != (Object)null) { val2.localPosition = Vector3.zero; val2.localRotation = Quaternion.identity; val2.localScale = Vector3.one; Bounds val3 = CalculateBoundsInRoot(val2, prefabRoot.transform); if (((Bounds)(ref val3)).size != Vector3.zero) { if (((Bounds)(ref val3)).size.x < ((Bounds)(ref val3)).size.y && ((Bounds)(ref val3)).size.x < ((Bounds)(ref val3)).size.z) { val2.localRotation = Quaternion.Euler(0f, 0f, 90f); } else if (((Bounds)(ref val3)).size.z < ((Bounds)(ref val3)).size.y && ((Bounds)(ref val3)).size.z < ((Bounds)(ref val3)).size.x) { val2.localRotation = Quaternion.Euler(90f, 0f, 0f); } Bounds val4 = CalculateBoundsInRoot(val2, prefabRoot.transform); float num = Mathf.Max(((Bounds)(ref val4)).size.x, ((Bounds)(ref val4)).size.z); if (num > 1E-05f) { float num2 = 0.54f / num; val2.localScale = Vector3.one * num2; } Bounds val5 = CalculateBoundsInRoot(val2, prefabRoot.transform); val2.localPosition = -((Bounds)(ref val5)).center; } Collider[] componentsInChildren = ((Component)val2).GetComponentsInChildren<Collider>(true); foreach (Collider val6 in componentsInChildren) { if ((Object)(object)val6 != (Object)null) { val6.enabled = false; } } } BoxCollider val7 = prefabRoot.GetComponent<BoxCollider>(); if ((Object)(object)val7 == (Object)null) { val7 = prefabRoot.AddComponent<BoxCollider>(); } ((Collider)val7).enabled = true; ((Collider)val7).isTrigger = true; val7.center = Vector3.zero; val7.size = new Vector3(0.56f, 0.08f, 0.56f); VinylDisc component = prefabRoot.GetComponent<VinylDisc>(); if ((Object)(object)component != (Object)null) { ((GrabbableObject)component).propColliders = (Collider[])(object)new Collider[1] { (Collider)val7 }; } } private static Bounds CalculateBoundsInRoot(Transform visual, Transform root) { //IL_000b: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_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_005c: 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_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_0090: 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_00a4: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) MeshFilter[] componentsInChildren = ((Component)visual).GetComponentsInChildren<MeshFilter>(true); bool flag = false; Bounds result = default(Bounds); MeshFilter[] array = componentsInChildren; Vector3 val2 = default(Vector3); foreach (MeshFilter val in array) { if ((Object)(object)val == (Object)null || (Object)(object)val.sharedMesh == (Object)null) { continue; } Bounds bounds = val.sharedMesh.bounds; Matrix4x4 matrixRelativeTo = GetMatrixRelativeTo(((Component)val).transform, root); Vector3 min = ((Bounds)(ref bounds)).min; Vector3 max = ((Bounds)(ref bounds)).max; for (int j = 0; j <= 1; j++) { for (int k = 0; k <= 1; k++) { for (int l = 0; l <= 1; l++) { ((Vector3)(ref val2))..ctor((j == 0) ? min.x : max.x, (k == 0) ? min.y : max.y, (l == 0) ? min.z : max.z); Vector3 val3 = ((Matrix4x4)(ref matrixRelativeTo)).MultiplyPoint3x4(val2); if (!flag) { ((Bounds)(ref result))..ctor(val3, Vector3.zero); flag = true; } else { ((Bounds)(ref result)).Encapsulate(val3); } } } } } return result; } private static Matrix4x4 GetMatrixRelativeTo(Transform target, Transform root) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_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_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) Matrix4x4 val = Matrix4x4.identity; Transform val2 = target; while ((Object)(object)val2 != (Object)null && (Object)(object)val2 != (Object)(object)root) { val = Matrix4x4.TRS(val2.localPosition, val2.localRotation, val2.localScale) * val; val2 = val2.parent; } return val; } private static void ConvertPrefabMaterialsToHdrp(GameObject prefab, Shader hdrpLit) { //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown //IL_014b: 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_0222: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)prefab == (Object)null || (Object)(object)hdrpLit == (Object)null) { return; } Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if ((Object)(object)val == (Object)null || val.sharedMaterials == null) { continue; } Material[] sharedMaterials = val.sharedMaterials; for (int j = 0; j < sharedMaterials.Length; j++) { Material val2 = sharedMaterials[j]; if ((Object)(object)val2 == (Object)null || (Object)(object)val2.shader == (Object)(object)hdrpLit) { continue; } Texture val3 = null; if (val2.HasProperty("_MainTex")) { val3 = val2.GetTexture("_MainTex"); } if ((Object)(object)val3 == (Object)null && val2.HasProperty("_BaseColorMap")) { val3 = val2.GetTexture("_BaseColorMap"); } if ((Object)(object)val3 == (Object)null && val2.HasProperty("_BaseMap")) { val3 = val2.GetTexture("_BaseMap"); } Texture val4 = null; if (val2.HasProperty("_BumpMap")) { val4 = val2.GetTexture("_BumpMap"); } if ((Object)(object)val4 == (Object)null && val2.HasProperty("_NormalMap")) { val4 = val2.GetTexture("_NormalMap"); } Color val5 = (val2.HasProperty("_Color") ? val2.GetColor("_Color") : (val2.HasProperty("_BaseColor") ? val2.GetColor("_BaseColor") : Color.white)); bool flag = (Object)(object)val4 != (Object)null; Material val6 = new Material(hdrpLit); ((Object)val6).name = ((Object)val2).name + "_HDRP"; if ((Object)(object)val3 != (Object)null && val6.HasProperty("_BaseColorMap")) { val6.SetTexture("_BaseColorMap", val3); } if ((Object)(object)val4 != (Object)null && val6.HasProperty("_NormalMap")) { val6.SetTexture("_NormalMap", val4); val6.EnableKeyword("_NORMALMAP"); val6.EnableKeyword("_NORMALMAP_TANGENT_SPACE"); if (val6.HasProperty("_NormalScale")) { val6.SetFloat("_NormalScale", 1.2f); } } if (val6.HasProperty("_BaseColor")) { val6.SetColor("_BaseColor", val5); } if (val6.HasProperty("_Smoothness")) { val6.SetFloat("_Smoothness", flag ? 0.62f : 0.25f); } if (val6.HasProperty("_Metallic")) { val6.SetFloat("_Metallic", 0f); } if (val6.HasProperty("_DoubleSidedEnable")) { val6.SetFloat("_DoubleSidedEnable", 1f); val6.EnableKeyword("_DOUBLESIDED_ON"); } sharedMaterials[j] = val6; } val.sharedMaterials = sharedMaterials; } } private static Sprite CreateFallbackDiscSprite() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(64f, 64f); for (int i = 0; i < 128; i++) { for (int j = 0; j < 128; j++) { float num = Vector2.Distance(new Vector2((float)j, (float)i), val2); if (num > 58f || num < 6f) { val.SetPixel(j, i, Color.clear); } else if (num < 20f) { val.SetPixel(j, i, new Color(0.95f, 0.85f, 0.25f, 1f)); } else { val.SetPixel(j, i, new Color(0.1f, 0.1f, 0.12f, 1f)); } } } val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f)); } } public class RecordPlayerDiscSlot : MonoBehaviour { public static bool SuppressNativeGrabThisFrame; public static int LastGrabFrame = -999; public static float LastGrabTime = -999f; private const string VolumePrefKey = "JoJoScrap_DiscVolumeMultiplier"; private const float DefaultDiscVolumeMultiplier = 0.55f; private const float VolumeStep = 0.05f; private const float MinVolumeMultiplier = 0.05f; private const float MaxVolumeMultiplier = 1.5f; private static float customDiscVolumeMultiplier = -1f; private static readonly MethodInfo SwitchToItemSlotMethod = typeof(PlayerControllerB).GetMethod("SwitchToItemSlot", BindingFlags.Instance | BindingFlags.NonPublic); private static bool inputReflectionInitialized; private static PropertyInfo keyboardCurrentProp; private static PropertyInfo equalsKeyProp; private static PropertyInfo numpadPlusKeyProp; private static PropertyInfo minusKeyProp; private static PropertyInfo numpadMinusKeyProp; private static PropertyInfo wasPressedThisFrameProp; private NetworkObject parentNetObj; private InteractTrigger interactTrigger; private AnimatedObjectTrigger animTrigger; private string defaultHoverTip = "Play record: [E]"; private AudioClip defaultGramophoneClip; private float defaultAudioVolume = 1f; private bool hasCapturedDefaultVolume; private VinylDisc slottedDisc; private bool interactionLocked; private float lastInteractTime; public bool HasDisc => (Object)(object)slottedDisc != (Object)null; private static float GetVolumeMultiplier() { if (customDiscVolumeMultiplier < 0f) { customDiscVolumeMultiplier = Mathf.Clamp(PlayerPrefs.GetFloat("JoJoScrap_DiscVolumeMultiplier", 0.55f), 0.05f, 1.5f); } return customDiscVolumeMultiplier; } private static void AdjustVolumeMultiplier(float delta) { PlayerPrefs.SetFloat("JoJoScrap_DiscVolumeMultiplier", customDiscVolumeMultiplier = Mathf.Clamp(Mathf.Round((GetVolumeMultiplier() + delta) * 100f) / 100f, 0.05f, 1.5f)); PlayerPrefs.Save(); } private static void EnsureInputReflection() { if (inputReflectionInitialized) { return; } inputReflectionInitialized = true; try { Type type = Type.GetType("UnityEngine.InputSystem.Keyboard, Unity.InputSystem"); if (!(type == null)) { keyboardCurrentProp = type.GetProperty("current", BindingFlags.Static | BindingFlags.Public); equalsKeyProp = type.GetProperty("equalsKey", BindingFlags.Instance | BindingFlags.Public); numpadPlusKeyProp = type.GetProperty("numpadPlusKey", BindingFlags.Instance | BindingFlags.Public); minusKeyProp = type.GetProperty("minusKey", BindingFlags.Instance | BindingFlags.Public); numpadMinusKeyProp = type.GetProperty("numpadMinusKey", BindingFlags.Instance | BindingFlags.Public); if (equalsKeyProp != null) { wasPressedThisFrameProp = equalsKeyProp.PropertyType.GetProperty("wasPressedThisFrame", BindingFlags.Instance | BindingFlags.Public); } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("InputSystem reflection setup skipped: " + ex.Message)); } } private static bool WasKeyPressed(PropertyInfo keyProp) { EnsureInputReflection(); if (keyboardCurrentProp == null || keyProp == null || wasPressedThisFrameProp == null) { return false; } object value = keyboardCurrentProp.GetValue(null); if (value == null) { return false; } object value2 = keyProp.GetValue(value); if (value2 == null) { return false; } object value3 = wasPressedThisFrameProp.GetValue(value2); bool flag = default(bool); int num; if (value3 is bool) { flag = (bool)value3; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } private void Awake() { parentNetObj = ((Component)this).GetComponentInParent<NetworkObject>(); interactTrigger = ((Component)this).GetComponentInChildren<InteractTrigger>(true); animTrigger = ((Component)this).GetComponentInChildren<AnimatedObjectTrigger>(true); if ((Object)(object)interactTrigger != (Object)null && !string.IsNullOrEmpty(interactTrigger.hoverTip)) { defaultHoverTip = interactTrigger.hoverTip; } if ((Object)(object)animTrigger != (Object)null) { defaultGramophoneClip = animTrigger.playWhileTrue; CaptureDefaultVolumeIfNeeded(); } } private void CaptureDefaultVolumeIfNeeded() { if (!hasCapturedDefaultVolume && (Object)(object)animTrigger != (Object)null && (Object)(object)animTrigger.thisAudioSource != (Object)null) { defaultAudioVolume = animTrigger.thisAudioSource.volume; hasCapturedDefaultVolume = true; } } private void Update() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)interactTrigger == (Object)null || (Object)(object)GameNetworkManager.Instance == (Object)null) { return; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null) { return; } if (Vector3.Distance(((Component)localPlayerController).transform.position, ((Component)this).transform.position) <= 5f && ((Object)(object)slottedDisc != (Object)null || localPlayerController.currentlyHeldObjectServer is VinylDisc)) { if (WasKeyPressed(equalsKeyProp) || WasKeyPressed(numpadPlusKeyProp)) { AdjustVolumeMultiplier(0.05f); } else if (WasKeyPressed(minusKeyProp) || WasKeyPressed(numpadMinusKeyProp)) { AdjustVolumeMultiplier(-0.05f); } } int num = Mathf.RoundToInt(GetVolumeMultiplier() * 100f); if ((Object)(object)slottedDisc != (Object)null) { string arg = (((Object)(object)((GrabbableObject)slottedDisc).itemProperties != (Object)null) ? ((GrabbableObject)slottedDisc).itemProperties.itemName : "Vinyl Disc"); string arg2 = ((GetPreferredEmptySlot(localPlayerController) >= 0) ? "Take" : "Eject"); interactTrigger.hoverTip = $"{arg2} {arg} : [E] (Vol: {num}% | +/-)"; } else if (localPlayerController.currentlyHeldObjectServer is VinylDisc vinylDisc) { string arg3 = (((Object)(object)((GrabbableObject)vinylDisc).itemProperties != (Object)null) ? ((GrabbableObject)vinylDisc).itemProperties.itemName : "Vinyl Disc"); interactTrigger.hoverTip = $"Insert {arg3} : [E] (Vol: {num}% | +/-)"; } else { interactTrigger.hoverTip = defaultHoverTip; } } private void LateUpdate() { SuppressNativeGrabThisFrame = false; if ((Object)(object)slottedDisc != (Object)null && (Object)(object)animTrigger != (Object)null && (Object)(object)animTrigger.thisAudioSource != (Object)null) { CaptureDefaultVolumeIfNeeded(); animTrigger.thisAudioSource.volume = defaultAudioVolume * GetVolumeMultiplier(); } } private static int GetPreferredEmptySlot(PlayerControllerB player) { if ((Object)(object)player == (Object)null || player.ItemSlots == null || player.ItemSlots.Length == 0) { return -1; } int currentItemSlot = player.currentItemSlot; if (currentItemSlot >= 0 && currentItemSlot < player.ItemSlots.Length && (Object)(object)player.ItemSlots[currentItemSlot] == (Object)null) { return currentItemSlot; } for (int i = 0; i < player.ItemSlots.Length; i++) { if ((Object)(object)player.ItemSlots[i] == (Object)null) { return i; } } return -1; } private static void ScrubDiscFromPlayerSlots(PlayerControllerB player, VinylDisc disc) { if ((Object)(object)player == (Object)null || (Object)(object)disc == (Object)null) { return; } if (player.ItemSlots != null) { for (int i = 0; i < player.ItemSlots.Length; i++) { if ((Object)(object)player.ItemSlots[i] == (Object)(object)disc) { player.ItemSlots[i] = null; if (((NetworkBehaviour)player).IsOwner && (Object)(object)HUDManager.Instance != (Object)null && HUDManager.Instance.itemSlotIcons != null && i < HUDManager.Instance.itemSlotIcons.Length && (Object)(object)HUDManager.Instance.itemSlotIcons[i] != (Object)null) { ((Behaviour)HUDManager.Instance.itemSlotIcons[i]).enabled = false; } } } } if ((Object)(object)player.currentlyHeldObjectServer == (Object)(object)disc) { player.currentlyHeldObjectServer = null; } if ((Object)(object)player.currentlyHeldObject == (Object)(object)disc) { player.currentlyHeldObject = null; } if ((Object)(object)player.currentlyHeldObjectServer == (Object)null) { player.isHoldingObject = false; player.twoHanded = false; } } private static PlayerControllerB FindPlayerByClientId(ulong clientId) { if ((Object)(object)StartOfRound.Instance != (Object)null && StartOfRound.Instance.allPlayerScripts != null) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val != (Object)null && val.playerClientId == clientId) { return val; } } } PlayerControllerB val2 = GameNetworkManager.Instance?.localPlayerController; if (!((Object)(object)val2 != (Object)null) || val2.playerClientId != clientId) { return null; } return val2; } public void HandleInteract(PlayerControllerB player) { //IL_0081: 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_0125: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)player == (Object)null) && !((Object)(object)parentNetObj == (Object)null) && !interactionLocked && Time.frameCount > LastGrabFrame + 1 && !(Time.unscaledTime - LastGrabTime < 0.3f) && !(Time.unscaledTime - lastInteractTime < 0.25f)) { if ((Object)(object)slottedDisc != (Object)null) { lastInteractTime = Time.unscaledTime; interactionLocked = true; slottedDisc.RequestEjectFromRecordPlayerServerRpc(NetworkObjectReference.op_Implicit(parentNetObj), player.playerClientId); } else if (player.currentlyHeldObjectServer is VinylDisc vinylDisc && player.isHoldingObject && player.currentItemSlot >= 0 && player.currentItemSlot < player.ItemSlots.Length && !((Object)(object)player.ItemSlots[player.currentItemSlot] != (Object)(object)vinylDisc)) { lastInteractTime = Time.unscaledTime; interactionLocked = true; player.DiscardHeldObject(true, (NetworkObject)null, ((Component)this).transform.TransformPoint(new Vector3(0f, 0.525f, 0f)), false); ScrubDiscFromPlayerSlots(player, vinylDisc); vinylDisc.RequestInsertIntoRecordPlayerServerRpc(NetworkObjectReference.op_Implicit(parentNetObj)); } } } public void ApplyDiscVisualAndAudio(VinylDisc disc) { interactionLocked = false; slottedDisc = disc; if ((Object)(object)slottedDisc == (Object)null) { return; } PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val != (Object)null) { ScrubDiscFromPlayerSlots(val, slottedDisc); } ((GrabbableObject)slottedDisc).playerHeldBy = null; slottedDisc.SetSlottedState(slotted: true, ((Component)this).transform); if (!((Object)(object)animTrigger != (Object)null)) { return; } CaptureDefaultVolumeIfNeeded(); AudioClip rolledClip = slottedDisc.GetRolledClip(); if ((Object)(object)rolledClip != (Object)null) { animTrigger.playWhileTrue = rolledClip; if ((Object)(object)animTrigger.thisAudioSource != (Object)null) { animTrigger.thisAudioSource.Stop(); animTrigger.thisAudioSource.clip = rolledClip; animTrigger.thisAudioSource.volume = defaultAudioVolume * GetVolumeMultiplier(); } } if (!animTrigger.boolValue) { animTrigger.TriggerAnimation(GameNetworkManager.Instance?.localPlayerController); } else if ((Object)(object)animTrigger.thisAudioSource != (Object)null) { animTrigger.thisAudioSource.Play(); } } public void ClearDiscVisualAndAudio(ulong requestingClientId) { //IL_0118: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: 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_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0187: 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_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0197: 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) interactionLocked = false; VinylDisc vinylDisc = slottedDisc; slottedDisc = null; if ((Object)(object)animTrigger != (Object)null) { if ((Object)(object)animTrigger.thisAudioSource != (Object)null) { animTrigger.thisAudioSource.Stop(); if (hasCapturedDefaultVolume) { animTrigger.thisAudioSource.volume = defaultAudioVolume; } } animTrigger.playWhileTrue = defaultGramophoneClip; if (animTrigger.boolValue) { animTrigger.TriggerAnimation(GameNetworkManager.Instance?.localPlayerController); } } if (!((Object)(object)vinylDisc == (Object)null)) { ((GrabbableObject)vinylDisc).playerHeldBy = null; vinylDisc.SetSlottedState(slotted: false); PlayerControllerB val = FindPlayerByClientId(requestingClientId); if ((Object)(object)val != (Object)null) { ScrubDiscFromPlayerSlots(val, vinylDisc); } int num = (((Object)(object)val != (Object)null) ? GetPreferredEmptySlot(val) : (-1)); if ((Object)(object)val != (Object)null && num >= 0) { EquipDiscIntoSlot(val, vinylDisc, num); return; } Transform val2 = (((Object)(object)StartOfRound.Instance != (Object)null) ? StartOfRound.Instance.elevatorTransform : null); Vector3 val3 = ((Component)this).transform.position + ((Component)this).transform.forward * 0.45f + Vector3.up * 0.55f; ((Component)vinylDisc).transform.SetParent(val2, true); ((Component)vinylDisc).transform.position = val3; ((Component)vinylDisc).transform.rotation = Quaternion.identity; ((GrabbableObject)vinylDisc).targetFloorPosition = (((GrabbableObject)vinylDisc).startFallingPosition = (((Object)(object)val2 != (Object)null) ? val2.InverseTransformPoint(val3) : val3)); ((GrabbableObject)vinylDisc).isInElevator = true; ((GrabbableObject)vinylDisc).isInShipRoom = true; ((GrabbableObject)vinylDisc).EnablePhysics(true); } } private static void EquipDiscIntoSlot(PlayerControllerB player, VinylDisc disc, int targetSlot) { player.isGrabbingObjectAnimation = false; ((GrabbableObject)disc).playerHeldBy = player; ((GrabbableObject)disc).grabbable = true; ((GrabbableObject)disc).isHeld = true; ((GrabbableObject)disc).isPocketed = false; ((GrabbableObject)disc).hasHitGround = false; ((GrabbableObject)disc).EnablePhysics(false); ((GrabbableObject)disc).parentObject = (((NetworkBehaviour)player).IsOwner ? player.localItemHolder : player.serverItemHolder); if (SwitchToItemSlotMethod != null) { try { SwitchToItemSlotMethod.Invoke(player, new object[2] { targetSlot, disc }); } catch (Exception ex) { Plugin.Log.LogWarning((object)("SwitchToItemSlot invocation warning: " + ex.Message)); } } player.ItemSlots[targetSlot] = (GrabbableObject)(object)disc; player.currentItemSlot = targetSlot; player.currentlyHeldObjectServer = (GrabbableObject)(object)disc; player.currentlyHeldObject = (GrabbableObject)(object)disc; player.isHoldingObject = true; player.twoHanded = (Object)(object)((GrabbableObject)disc).itemProperties != (Object)null && ((GrabbableObject)disc).itemProperties.twoHanded; ((GrabbableObject)disc).GrabItem(); if (((NetworkBehaviour)player).IsOwner && (Object)(object)HUDManager.Instance != (Object)null && HUDManager.Instance.itemSlotIcons != null && targetSlot < HUDManager.Instance.itemSlotIcons.Length && (Object)(object)HUDManager.Instance.itemSlotIcons[targetSlot] != (Object)null && (Object)(object)((GrabbableObject)disc).itemProperties != (Object)null && (Object)(object)((GrabbableObject)disc).itemProperties.itemIcon != (Object)null) { HUDManager.Instance.itemSlotIcons[targetSlot].sprite = ((GrabbableObject)disc).itemProperties.itemIcon; ((Behaviour)HUDManager.Instance.itemSlotIcons[targetSlot]).enabled = true; } } } public class VinylDisc : GrabbableObject { [Tooltip("All tracks belonging to this album/category folder.")] public AudioClip[] trackPool; [HideInInspector] public bool isSlottedOnPlayer; [HideInInspector] public Transform slottedParent; private readonly NetworkVariable<int> rolledTrackIndex = new NetworkVariable<int>(-1, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public override void Start() { ((GrabbableObject)this).Start(); if (base.propColliders == null) { return; } for (int i = 0; i < base.propColliders.Length; i++) { if ((Object)(object)base.propColliders[i] != (Object)null) { base.propColliders[i].isTrigger = true; } } } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); if (((NetworkBehaviour)this).IsServer && rolledTrackIndex.Value < 0 && trackPool != null && trackPool.Length != 0) { rolledTrackIndex.Value = Random.Range(0, trackPool.Length); } } public override void PocketItem() { if (((NetworkBehaviour)this).IsOwner && (Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.IsInspectingItem = false; } base.isPocketed = true; ((GrabbableObject)this).EnableItemMeshes(false); AudioSource component = ((Component)this).GetComponent<AudioSource>(); if ((Object)(object)component != (Object)null && (Object)(object)base.itemProperties != (Object)null && (Object)(object)base.itemProperties.pocketSFX != (Object)null) { component.PlayOneShot(base.itemProperties.pocketSFX, 1f); } } public AudioClip GetRolledClip() { if (trackPool == null || trackPool.Length == 0) { return null; } int value = rolledTrackIndex.Value; if (value >= 0 && value < trackPool.Length) { return trackPool[value]; } return trackPool[0]; } public void SetSlottedState(bool slotted, Transform recordPlayerTransform = null) { isSlottedOnPlayer = slotted; slottedParent = recordPlayerTransform; base.grabbable = !slotted; base.grabbableToEnemies = !slotted; if (slotted) { base.parentObject = null; base.hasHitGround = true; base.isHeld = false; base.isPocketed = false; } Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if ((Object)(object)val != (Object)null) { val.enabled = !slotted; } } Collider[] componentsInChildren2 = ((Component)this).GetComponentsInChildren<Collider>(true); foreach (Collider val2 in componentsInChildren2) { if ((Object)(object)val2 != (Object)null) { val2.isTrigger = true; val2.enabled = !slotted; } } } public override void LateUpdate() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (isSlottedOnPlayer && (Object)(object)slottedParent != (Object)null) { ((Component)this).transform.position = slottedParent.position + Vector3.up * 0.45f; } else { ((GrabbableObject)this).LateUpdate(); } } [ServerRpc(RequireOwnership = false)] public void RequestInsertIntoRecordPlayerServerRpc(NetworkObjectReference recordPlayerRef) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(4174545414u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref recordPlayerRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 4174545414u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; BroadcastInsertIntoRecordPlayerClientRpc(recordPlayerRef); } } } [ClientRpc] private void BroadcastInsertIntoRecordPlayerClientRpc(NetworkObjectReference recordPlayerRef) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1378428679u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref recordPlayerRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1378428679u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref recordPlayerRef)).TryGet(ref val3, (NetworkManager)null)) { RecordPlayerDiscSlot componentInChildren = ((Component)val3).GetComponentInChildren<RecordPlayerDiscSlot>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.ApplyDiscVisualAndAudio(this); } } } [ServerRpc(RequireOwnership = false)] public void RequestEjectFromRecordPlayerServerRpc(NetworkObjectReference recordPlayerRef, ulong requestingClientId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_00a4: 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_011f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(4173148737u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref recordPlayerRef, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val, requestingClientId); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 4173148737u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetSlottedState(slotted: false); if ((Object)(object)((NetworkBehaviour)this).NetworkObject != (Object)null && ((NetworkBehaviour)this).NetworkObject.OwnerClientId != requestingClientId) { ((NetworkBehaviour)this).NetworkObject.ChangeOwnership(requestingClientId); } BroadcastEjectFromRecordPlayerClientRpc(recordPlayerRef, requestingClientId); } } [ClientRpc] private void BroadcastEjectFromRecordPlayerClientRpc(NetworkObjectReference recordPlayerRef, ulong requestingClientId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_00a4: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1324211080u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref recordPlayerRef, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val, requestingClientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1324211080u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref recordPlayerRef)).TryGet(ref val3, (NetworkManager)null)) { RecordPlayerDiscSlot componentInChildren = ((Component)val3).GetComponentInChildren<RecordPlayerDiscSlot>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.ClearDiscVisualAndAudio(requestingClientId); return; } } SetSlottedState(slotted: false); } public override int GetItemDataToSave() { return rolledTrackIndex.Value; } public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); if (((NetworkBehaviour)this).IsServer && trackPool != null && saveData >= 0 && saveData < trackPool.Length) { rolledTrackIndex.Value = saveData; } } protected override void __initializeVariables() { if (rolledTrackIndex == null) { throw new Exception("VinylDisc.rolledTrackIndex cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)rolledTrackIndex).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)rolledTrackIndex, "rolledTrackIndex"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)rolledTrackIndex); ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(4174545414u, new RpcReceiveHandler(__rpc_handler_4174545414), "RequestInsertIntoRecordPlayerServerRpc"); ((NetworkBehaviour)this).__registerRpc(1378428679u, new RpcReceiveHandler(__rpc_handler_1378428679), "BroadcastInsertIntoRecordPlayerClientRpc"); ((NetworkBehaviour)this).__registerRpc(4173148737u, new RpcReceiveHandler(__rpc_handler_4173148737), "RequestEjectFromRecordPlayerServerRpc"); ((NetworkBehaviour)this).__registerRpc(1324211080u, new RpcReceiveHandler(__rpc_handler_1324211080), "BroadcastEjectFromRecordPlayerClientRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_4174545414(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference recordPlayerRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref recordPlayerRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((VinylDisc)(object)target).RequestInsertIntoRecordPlayerServerRpc(recordPlayerRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1378428679(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference recordPlayerRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref recordPlayerRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((VinylDisc)(object)target).BroadcastInsertIntoRecordPlayerClientRpc(recordPlayerRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4173148737(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_003e: 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_005c: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference recordPlayerRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref recordPlayerRef, default(ForNetworkSerializable)); ulong requestingClientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref requestingClientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((VinylDisc)(object)target).RequestEjectFromRecordPlayerServerRpc(recordPlayerRef, requestingClientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1324211080(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_003e: 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_005c: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference recordPlayerRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref recordPlayerRef, default(ForNetworkSerializable)); ulong requestingClientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref requestingClientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((VinylDisc)(object)target).BroadcastEjectFromRecordPlayerClientRpc(recordPlayerRef, requestingClientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "VinylDisc"; } } public class VinylDiscDefinition : ScriptableObject { public string itemName; public GameObject spawnPrefab; public Sprite itemIcon; public int minValue = 45; public int maxValue = 95; public float weight = 1.05f; public Vector3 positionOffset = new Vector3(-0.1f, 0.15f, 0.05f); public Vector3 rotationOffset = new Vector3(0f, 0f, 90f); } } namespace __GEN { internal class NetworkVariableSerializationHelper { [InitializeOnLoadMethod] internal static void InitializeSerialization() { } } }