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 BoobeesValuables v0.1.2
plugins/BoobeesValuables/BoobeesValuables.dll
Decompiled 2 hours agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using REPOLib.Modules; using UnityEngine; using UnityEngine.AI; using UnityEngine.Networking; [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("BoobeesValuables")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.2.0")] [assembly: AssemblyInformationalVersion("0.1.2")] [assembly: AssemblyProduct("BoobeesValuables")] [assembly: AssemblyTitle("BoobeesValuables")] [assembly: AssemblyVersion("0.1.2.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace BoobeesValuables { [BepInPlugin("bzone.boobeesvaluables", "Boobees Valuables", "0.1.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class BoobeesPlugin : BaseUnityPlugin { private readonly struct Prop { internal readonly string Asset; internal readonly string Name; internal readonly string Presets; internal readonly Type Type; internal Prop(string asset, string name, string presets, Type type) { //IL_0016: 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) Asset = asset; Name = name; Presets = presets; Type = type; } } public const string Id = "bzone.boobeesvaluables"; private const string Trophy = "valuables/03 medium/valuable manor trophy"; private static readonly Prop[] Catalog = new Prop[5] { new Prop("01-honey-tin", "Boobees Honey Tin", "valuables/03 medium/valuable manor kettle", (Type)1), new Prop("03-hive-radio", "Boobees Hive Radio", "valuables/02 small/valuable arctic camera", (Type)1), new Prop("04-honeycomb-lantern", "Boobees Honeycomb Lantern", "valuables/03 medium/valuable manor trophy", (Type)1), new Prop("05-boo-globe", "Boobees Snow Globe", "valuables/01 tiny/valuable desert snow globe", (Type)1), new Prop("06-cast-iron-boobee", "Boobees Cast Iron Boo-Bee", "valuables/05 wide/valuable wizard griffin statue", (Type)3) }; private Harmony? patches; private GameObject? prefabs; internal static AudioClip RadioTrack { get; private set; } = null; internal static AudioClip BeeTrack { get; private set; } = null; internal static NetworkedEvent RadioEvent { get; private set; } = null; private IEnumerator Start() { string assets = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "assets"); string uriString = Path.Combine(assets, "lisa_ara_ara_normalized_lGdXcjK.mp3"); UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(new Uri(uriString), (AudioType)13); try { yield return request.SendWebRequest(); if ((int)request.result != 1) { ((BaseUnityPlugin)this).Logger.LogError((object)("Could not load the local Boo-Bee MP3: " + request.error)); yield break; } BeeTrack = DownloadHandlerAudioClip.GetContent(request); if ((Object)(object)BeeTrack == (Object)null || BeeTrack.samples == 0) { ((BaseUnityPlugin)this).Logger.LogError((object)"Boo-Bee MP3 decoded to an empty clip."); } else { RegisterValuables(assets); } } finally { ((IDisposable)request)?.Dispose(); } } private void RegisterValuables(string assets) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_00b0: 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_00f2: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_013c: 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_019f: 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_01bd: Unknown result type (might be due to invalid IL or missing references) try { RadioTrack = WaveAsset.LoadMonoPcm(Path.Combine(assets, "miel-pops-old-radio-full.wav")); GameObject trophy = FindTemplate("valuables/03 medium/valuable manor trophy"); List<(Prop, GameObject, Vector3, int, float)> list = new List<(Prop, GameObject, Vector3, int, float)>(); prefabs = new GameObject("Boobees valuable prefab templates"); prefabs.SetActive(false); Object.DontDestroyOnLoad((Object)(object)prefabs); Prop[] catalog = Catalog; for (int i = 0; i < catalog.Length; i++) { Prop prop = catalog[i]; PropModel propModel = PropModel.Load(Path.Combine(assets, prop.Asset), prop.Asset == "04-honeycomb-lantern"); ValuableObject component = FindTemplate(prop.Presets).GetComponent<ValuableObject>(); int parts; GameObject item = MakePrefab(prop, propModel, trophy, component, out parts); list.Add((prop, item, propModel.Size, parts, component.physAttributePreset.mass)); } RadioEvent = new NetworkedEvent("bzone.boobeesvaluables.RadioState", (Action<EventData>)RadioCue.Receive); patches = new Harmony("bzone.boobeesvaluables"); patches.PatchAll(typeof(DamageCuePatch)); foreach (var (prop2, val, val2, num, num2) in list) { if (Valuables.RegisterValuable(val, new List<string> { "Valuables - Generic" }) == null) { throw new InvalidOperationException("REPOLib did not register " + prop2.Name); } ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Registered {prop2.Name}: {val2.x:F3} x {val2.y:F3} x {val2.z:F3} m, {num} hitboxes, mass {num2:F2}"); } ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Five valuables ready. Radio {RadioTrack.length:F3}s, Boo-Bee {BeeTrack.length:F3}s."); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Boobees registration failed: " + ex)); } } private static GameObject FindTemplate(string path) { GameObject val = Resources.Load<GameObject>(path); if ((Object)(object)val == (Object)null || (Object)(object)val.GetComponent<ValuableObject>() == (Object)null) { throw new InvalidOperationException("The game is missing a native valuable template at " + path); } return val; } private GameObject MakePrefab(Prop prop, PropModel model, GameObject trophy, ValuableObject exemplar, out int parts) { //IL_0025: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(trophy, prefabs.transform, false); ((Object)val).name = prop.Name; val.transform.localPosition = Vector3.zero; val.transform.localRotation = Quaternion.identity; val.transform.localScale = Vector3.one; ValuableObject component = val.GetComponent<ValuableObject>(); PhysGrabObject component2 = val.GetComponent<PhysGrabObject>(); RoomVolumeCheck component3 = val.GetComponent<RoomVolumeCheck>(); Rigidbody component4 = val.GetComponent<Rigidbody>(); component.valuePreset = exemplar.valuePreset; component.physAttributePreset = exemplar.physAttributePreset; component.durabilityPreset = exemplar.durabilityPreset; component.audioPreset = exemplar.audioPreset; component.audioPresetPitch = exemplar.audioPresetPitch; component.particleColors = exemplar.particleColors; component.volumeType = prop.Type; component4.mass = exemplar.physAttributePreset.mass; Collider[] array = (from c in val.GetComponentsInChildren<Collider>(true) where ((Component)c).CompareTag("Phys Grab Object") select c).ToArray(); if (array.Length == 0) { throw new InvalidOperationException("Native trophy has no Phys Grab Object colliders."); } int layer = ((Component)array[0]).gameObject.layer; Collider[] array2 = array; for (int num = 0; num < array2.Length; num++) { Object.DestroyImmediate((Object)(object)array2[num]); } PhysGrabObjectCollider[] componentsInChildren = val.GetComponentsInChildren<PhysGrabObjectCollider>(true); for (int num = 0; num < componentsInChildren.Length; num++) { Object.DestroyImmediate((Object)(object)componentsInChildren[num]); } Renderer[] componentsInChildren2 = val.GetComponentsInChildren<Renderer>(true); foreach (Renderer val2 in componentsInChildren2) { if (val2 is MeshRenderer || val2 is SkinnedMeshRenderer) { val2.enabled = false; } } model.AddTo(val.transform, val.layer); parts = PropColliders.Attach(prop.Asset, val.transform, layer); component2.colliders.Clear(); component3.CheckPosition = Vector3.zero; component3.currentSize = model.Size + new Vector3(0.011f, 0.011f, 0.016f); NavMeshObstacle component5 = val.GetComponent<NavMeshObstacle>(); if ((Object)(object)component5 != (Object)null) { Object.DestroyImmediate((Object)(object)component5); } Transform val3 = val.transform.Find("ForceCenterPoint"); if ((Object)(object)val3 == (Object)null) { val3 = new GameObject("ForceCenterPoint").transform; val3.SetParent(val.transform, false); } val3.localPosition = Vector3.zero; if (prop.Asset == "06-cast-iron-boobee") { if (model.Size.x > 1.5f || component3.currentSize.x > 1.5f) { throw new InvalidDataException("The cast-iron statue exceeds its 1.50 m width limit."); } val3.localPosition = new Vector3(0f, -0.35f, 0f); component4.centerOfMass = val3.localPosition; Transform val4 = val.transform.Find("Center of Mass"); if ((Object)(object)val4 == (Object)null) { val4 = new GameObject("Center of Mass").transform; val4.SetParent(val.transform, false); } val4.localPosition = component4.centerOfMass; if (exemplar.physAttributePreset.mass < 3f) { throw new InvalidDataException("The native heavy preset is too light for Boobees."); } val.AddComponent<DamageCue>(); val.AddComponent<BooBeeSway>(); } else if (prop.Asset == "03-hive-radio") { val.AddComponent<RadioCue>(); } val.SetActive(true); return val; } } internal sealed class BooBeeSway : MonoBehaviour { private sealed class SheetMesh { private readonly struct WeightedVertex { internal readonly int Index; internal readonly Vector4 Left; internal readonly Vector4 Right; internal WeightedVertex(int index, Vector4 left, Vector4 right) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_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) Index = index; Left = left; Right = right; } } private static readonly Vector3 InverseRadiiSquared = new Vector3(16f, 10.4f, 18.9f); private readonly Mesh mesh; private readonly Vector3[] points; private readonly Vector3[] normals; private readonly Vector3[] restPoints; private readonly Vector3[] restNormals; private readonly Vector4[] tangents; private readonly Vector4[] restTangents; private readonly List<WeightedVertex> region = new List<WeightedVertex>(); internal SheetMesh(MeshFilter filter) { //IL_00b9: 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_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_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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_00f7: Unknown result type (might be due to invalid IL or missing references) mesh = Object.Instantiate<Mesh>(filter.sharedMesh); mesh.MarkDynamic(); filter.sharedMesh = mesh; restPoints = mesh.vertices; restNormals = mesh.normals; restTangents = mesh.tangents; points = (Vector3[])restPoints.Clone(); normals = (Vector3[])restNormals.Clone(); tangents = (Vector4[])restTangents.Clone(); for (int i = 0; i < restPoints.Length; i++) { Vector4 val = WeightAt(restPoints[i] - LeftCenter); Vector4 val2 = WeightAt(restPoints[i] - RightCenter); if (val.w > 0f || val2.w > 0f) { region.Add(new WeightedVertex(i, val, val2)); } } } private static Vector4 WeightAt(Vector3 distance) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0042: 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_0022: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.Scale(distance, InverseRadiiSquared); float num = 1f - Vector3.Dot(distance, val); if (num <= 0f) { return Vector4.zero; } Vector3 val2 = -4f * num * val; return new Vector4(val2.x, val2.y, val2.z, num * num); } internal void Draw(Vector2 pose) { //IL_0020: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0060: 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_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_007c: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0177: 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_00ad: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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_0126: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) foreach (WeightedVertex item in region) { int index = item.Index; Vector4 val = pose.x * item.Left + pose.y * item.Right; points[index] = restPoints[index] + Vector3.up * val.w; Vector3 val2 = restNormals[index]; Vector4 val3 = restTangents[index]; if (pose != Vector2.zero) { float num = val2.y / (1f + val.y); Vector3 val4 = new Vector3(val2.x - val.x * num, num, val2.z - val.z * num); val2 = ((Vector3)(ref val4)).normalized; val4 = new Vector3(val3.x, val3.y + val.x * val3.x + val.y * val3.y + val.z * val3.z, val3.z); Vector3 normalized = ((Vector3)(ref val4)).normalized; ((Vector4)(ref val3))..ctor(normalized.x, normalized.y, normalized.z, val3.w); } normals[index] = val2; tangents[index] = val3; } mesh.vertices = points; mesh.normals = normals; mesh.tangents = tangents; } internal void Release() { Object.Destroy((Object)(object)mesh); } } private const float MaxOffset = 0.028f; private const float RestTolerance = 0.00015f; private static readonly Vector3 LeftCenter = new Vector3(-0.175f, 0.15f, -0.43f); private static readonly Vector3 RightCenter = new Vector3(0.175f, 0.15f, -0.43f); private Rigidbody body; private SheetMesh? sheet; private Vector3 lastLeftPoint; private Vector3 lastRightPoint; private Vector3 lastLeftVelocity; private Vector3 lastRightVelocity; private bool hasSample; private bool wasKinematic; private bool hitThisStep; private Vector2 offset; private Vector2 previousOffset; private Vector2 speed; private Vector2 drawnOffset; private void Awake() { body = ((Component)this).GetComponent<Rigidbody>(); } private void OnDisable() { //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_0023: 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_002a: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_003a: 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) hasSample = (wasKinematic = (hitThisStep = false)); offset = (previousOffset = (speed = (drawnOffset = Vector2.zero))); sheet?.Draw(Vector2.zero); } private void OnDestroy() { sheet?.Release(); } private void FixedUpdate() { //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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_0049: 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_0076: 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_0062: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_00a1: 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_0145: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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_00e1: 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_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) float fixedDeltaTime = Time.fixedDeltaTime; Quaternion rotation = body.rotation; Vector3 val = body.position + rotation * LeftCenter; Vector3 val2 = body.position + rotation * RightCenter; bool isKinematic = body.isKinematic; Vector3 val3 = (isKinematic ? ((val - lastLeftPoint) / fixedDeltaTime) : body.GetPointVelocity(val)); Vector3 val4 = (isKinematic ? ((val2 - lastRightPoint) / fixedDeltaTime) : body.GetPointVelocity(val2)); if (hasSample && wasKinematic == isKinematic && !hitThisStep) { Quaternion val5 = Quaternion.Inverse(rotation); speed.x += MotionKick(val5 * (val3 - lastLeftVelocity), -0.24f, fixedDeltaTime); speed.y += MotionKick(val5 * (val4 - lastRightVelocity), 0.24f, fixedDeltaTime); } hasSample = !isKinematic || wasKinematic; wasKinematic = isKinematic; hitThisStep = false; lastLeftPoint = val; lastRightPoint = val2; lastLeftVelocity = val3; lastRightVelocity = val4; previousOffset = offset; Advance(ref offset.x, ref speed.x, fixedDeltaTime); Advance(ref offset.y, ref speed.y, fixedDeltaTime); } private static float MotionKick(Vector3 change, float side, float step) { //IL_0022: 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_0037: Unknown result type (might be due to invalid IL or missing references) float magnitude = ((Vector3)(ref change)).magnitude; float num = 14f * step; if (magnitude <= num || magnitude > 18f) { return 0f; } return (0f - change.y + 0.42f * change.z + side * change.x) * (1f - num / magnitude) * 0.25f; } private void OnCollisionEnter(Collision collision) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) Vector3 val = collision.relativeVelocity; float magnitude = ((Vector3)(ref val)).magnitude; val = collision.impulse; float num = Mathf.Min(magnitude, ((Vector3)(ref val)).magnitude / body.mass); if (!(num <= 0.55f) && collision.contactCount != 0) { Transform transform = ((Component)this).transform; ContactPoint contact = collision.GetContact(0); float x = transform.InverseTransformPoint(((ContactPoint)(ref contact)).point).x; float num2 = 0.25f * Mathf.Clamp(x / 0.55f, -1f, 1f); float num3 = Mathf.Min(0.88f, (num - 0.55f) * 0.24f); speed -= num3 * new Vector2(1f - num2, 1f + num2); hitThisStep = true; } } private static void Advance(ref float displacement, ref float velocity, float step) { velocity = Mathf.Clamp(velocity, -1.05f, 1.05f); velocity -= (380f * displacement + 17f * velocity) * step; displacement = Mathf.Clamp(displacement + velocity * step, -0.028f, 0.028f); if (Mathf.Abs(displacement) < 0.00015f && Mathf.Abs(velocity) < 0.003f) { displacement = (velocity = 0f); } } private void LateUpdate() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) float num = (Time.time - Time.fixedTime) / Time.fixedDeltaTime; Vector2 val = Vector2.Lerp(previousOffset, offset, num); if (((Vector2)(ref val)).Equals(drawnOffset)) { return; } if (!((Vector2)(ref val)).Equals(Vector2.zero)) { Vector2 val2 = val - drawnOffset; if (((Vector2)(ref val2)).sqrMagnitude < 1E-09f) { return; } } if (sheet == null) { sheet = new SheetMesh(((Component)((Component)this).transform.Find("Boobees Visuals")).GetComponentsInChildren<MeshFilter>().Single()); } sheet.Draw(val); drawnOffset = val; } } internal sealed class PropModel { private sealed class Part { internal readonly string Name; internal readonly Mesh Mesh; internal readonly Material[] Materials; internal Part(string name, Mesh mesh, Material[] materials) { Name = name; Mesh = mesh; Materials = materials; } } internal readonly Vector3 Size; private readonly List<Part> parts; private PropModel(Vector3 size, List<Part> parts) { //IL_0007: 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) Size = size; this.parts = parts; } internal static PropModel Load(string folder, bool lantern) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0263: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Expected O, but got Unknown PropTextures propTextures = new PropTextures(folder, lantern); using BinaryReader binaryReader = new BinaryReader(File.OpenRead(Path.Combine(folder, "model.bvb"))); if (Encoding.ASCII.GetString(binaryReader.ReadBytes(4)) != "BVB1") { throw new InvalidDataException("Invalid Boobees mesh header: " + folder); } Vector3 size = ReadVector(binaryReader); List<Part> list = new List<Part>(); int num = CheckCount(binaryReader.ReadUInt16(), 1, 16, "parts"); for (int i = 0; i < num; i++) { string text = Encoding.UTF8.GetString(binaryReader.ReadBytes(CheckCount(binaryReader.ReadUInt16(), 1, 400, "name"))); int num2 = CheckCount(binaryReader.ReadUInt16(), 1, 20, "materials"); Material[] array = (Material[])(object)new Material[num2]; for (int j = 0; j < num2; j++) { array[j] = propTextures.ReadMaterial(binaryReader); } int num3 = CheckCount(binaryReader.ReadInt32(), 3, 64000, "vertices"); Vector3[] array2 = (Vector3[])(object)new Vector3[num3]; Vector3[] array3 = (Vector3[])(object)new Vector3[num3]; Vector2[] array4 = (Vector2[])(object)new Vector2[num3]; for (int k = 0; k < num3; k++) { array2[k] = ReadVector(binaryReader); array3[k] = ReadVector(binaryReader); array4[k] = new Vector2(binaryReader.ReadSingle(), binaryReader.ReadSingle()); } Mesh val = new Mesh { name = "Boobees " + text }; val.vertices = array2; val.normals = array3; val.uv = array4; val.subMeshCount = num2; for (int l = 0; l < num2; l++) { int num4 = CheckCount(binaryReader.ReadInt32(), 0, 190000, "indices"); if (num4 % 3 != 0) { throw new InvalidDataException("Non-triangular Boobees mesh."); } int[] array5 = new int[num4]; for (int m = 0; m < num4; m++) { array5[m] = CheckCount(binaryReader.ReadInt32(), 0, num3 - 1, "triangle index"); } val.SetTriangles(array5, l, false); } val.RecalculateBounds(); val.RecalculateTangents(); list.Add(new Part(text, val, array)); } if (binaryReader.BaseStream.Position != binaryReader.BaseStream.Length) { throw new InvalidDataException("Unexpected data after the Boobees mesh: " + folder); } return new PropModel(size, list); } internal void AddTo(Transform parent, int layer) { //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_0012: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Boobees Visuals") { layer = layer }; val.transform.SetParent(parent, false); foreach (Part part in parts) { GameObject val2 = new GameObject(part.Name) { layer = layer }; val2.transform.SetParent(val.transform, false); val2.AddComponent<MeshFilter>().sharedMesh = part.Mesh; ((Renderer)val2.AddComponent<MeshRenderer>()).sharedMaterials = part.Materials; } } private static Vector3 ReadVector(BinaryReader reader) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); } private static int CheckCount(int value, int minimum, int maximum, string name) { if (value < minimum || value > maximum) { throw new InvalidDataException("Invalid Boobees " + name + ": " + value); } return value; } } internal sealed class PropTextures { private readonly string folder; private readonly bool lantern; private Material? texturedMaterial; internal PropTextures(string folder, bool lantern) { this.folder = folder; this.lantern = lantern; } internal Material ReadMaterial(BinaryReader reader) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Invalid comparison between Unknown and I4 //IL_00a3: 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_01af: 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_0191: Unknown result type (might be due to invalid IL or missing references) bool flag = reader.ReadByte() != 0; Color val = default(Color); ((Color)(ref val))..ctor(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); float num = 1f - reader.ReadSingle(); float num2 = reader.ReadSingle(); if (flag && (Object)(object)texturedMaterial != (Object)null) { return texturedMaterial; } Shader obj = Shader.Find("Standard"); if (!Object.op_Implicit((Object)(object)obj)) { throw new InvalidOperationException("Unity Standard shader is unavailable."); } Material val2 = new Material(obj) { name = "Boobees " + Path.GetFileName(folder) }; val2.color = (((int)QualitySettings.activeColorSpace == 1) ? ((Color)(ref val)).gamma : val); val2.SetFloat("_Glossiness", num); val2.SetFloat("_Metallic", num2); if (flag) { val2.color = Color.white; val2.SetTexture("_MainTex", (Texture)(object)LoadTexture("color.png", linear: false)); val2.SetTexture("_MetallicGlossMap", (Texture)(object)LoadTexture("metal.png", linear: true)); val2.SetFloat("_GlossMapScale", 1f); val2.EnableKeyword("_METALLICGLOSSMAP"); val2.SetTexture("_BumpMap", (Texture)(object)LoadTexture("normal.png", linear: true)); val2.SetFloat("_BumpScale", 0.85f); val2.EnableKeyword("_NORMALMAP"); if (lantern) { val2.SetTexture("_EmissionMap", (Texture)(object)LoadTexture("emission.png", linear: false)); val2.SetColor("_EmissionColor", new Color(0.6f, 0.49f, 0.35f)); val2.EnableKeyword("_EMISSION"); } texturedMaterial = val2; } if (val.a < 0.999f) { ((Object)val2).name = ((Object)val2).name + " | Glass"; val2.SetOverrideTag("RenderType", "Transparent"); val2.SetFloat("_Mode", 2f); val2.SetInt("_SrcBlend", 5); val2.SetInt("_DstBlend", 10); val2.SetInt("_ZWrite", 0); val2.EnableKeyword("_ALPHABLEND_ON"); val2.renderQueue = 3000; } return val2; } private Texture2D LoadTexture(string name, bool linear) { //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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Invalid comparison between Unknown and I4 Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true, linear) { name = Path.GetFileName(folder) + " " + name, anisoLevel = 2 }; if (!ImageConversion.LoadImage(val, File.ReadAllBytes(Path.Combine(folder, name)), false)) { throw new InvalidDataException("Cannot load Boobees texture: " + name); } if ((int)SystemInfo.graphicsDeviceType != 4) { val.Compress(false); } val.Apply(false, true); return val; } } internal static class WaveAsset { internal static AudioClip LoadMonoPcm(string path) { using BinaryReader binaryReader = new BinaryReader(File.OpenRead(path)); if (ReadId(binaryReader) != "RIFF") { throw new InvalidDataException("Expected RIFF WAV: " + path); } binaryReader.ReadUInt32(); if (ReadId(binaryReader) != "WAVE") { throw new InvalidDataException("Expected WAVE: " + path); } int num = 0; float[] array = null; while (binaryReader.BaseStream.Position + 8 <= binaryReader.BaseStream.Length) { string text = ReadId(binaryReader); uint num2 = binaryReader.ReadUInt32(); long num3 = binaryReader.BaseStream.Position + num2; if (num3 > binaryReader.BaseStream.Length) { throw new InvalidDataException("Truncated WAV: " + path); } if (text == "fmt " && num2 >= 16) { ushort num4 = binaryReader.ReadUInt16(); int num5 = binaryReader.ReadUInt16(); num = binaryReader.ReadInt32(); binaryReader.ReadUInt32(); binaryReader.ReadUInt16(); if (num4 != 1 || num5 != 1 || binaryReader.ReadUInt16() != 16 || num != 48000) { throw new InvalidDataException("Expected mono 48 kHz PCM16: " + path); } } if (text == "data" && num2 != 0 && num2 % 2 == 0) { array = new float[num2 / 2]; for (int i = 0; i < array.Length; i++) { array[i] = (float)binaryReader.ReadInt16() / 32768f; } } binaryReader.BaseStream.Position = num3 + (num2 & 1); } if (num == 0 || array == null) { throw new InvalidDataException("Incomplete WAV: " + path); } AudioClip obj = AudioClip.Create(Path.GetFileNameWithoutExtension(path), array.Length, 1, num, false); if (!obj.SetData(array, 0)) { throw new InvalidDataException("Could not upload WAV: " + path); } return obj; } private static string ReadId(BinaryReader file) { return Encoding.ASCII.GetString(file.ReadBytes(4)); } } internal sealed class PropColliders { private readonly struct Ring { internal readonly float Y; internal readonly float XRadius; internal readonly float ZRadius; internal readonly float ZCenter; internal Ring(float y, float xRadius, float zRadius, float zCenter) { Y = y; XRadius = xRadius; ZRadius = zRadius; ZCenter = zCenter; } } private readonly Transform root; private readonly int layer; private int count; private PropColliders(Transform parent, int layer) { //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) root = new GameObject("Boobees Hitboxes") { layer = layer }.transform; root.SetParent(parent, false); this.layer = layer; } internal static int Attach(string asset, Transform parent, int layer) { PropColliders propColliders = new PropColliders(parent, layer); switch (asset) { case "01-honey-tin": propColliders.Tin(); break; case "03-hive-radio": propColliders.Radio(); break; case "04-honeycomb-lantern": propColliders.Lantern(); break; case "05-boo-globe": propColliders.Globe(); break; case "06-cast-iron-boobee": propColliders.Statue(); break; default: throw new ArgumentOutOfRangeException("asset"); } return propColliders.count; } private void Tin() { //IL_00bb: 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_00f8: 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) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) Hull("Round enamel body", 12, new Ring(-0.141f, 0.141f, 0.138f, 0.006f), new Ring(0.026f, 0.14f, 0.138f, 0.006f)); Hull("Lid rim", 12, new Ring(0.024f, 0.143f, 0.14f, 0.006f), new Ring(0.057f, 0.132f, 0.132f, 0.006f)); Box("Latch", V(0f, -0.015f, -0.138f), V(0.036f, 0.07f, 0.02f)); for (int i = -1; i <= 1; i += 2) { Ball("Handle hinge", V((float)i * 0.145f, 0.007f, 0.007f), 0.013f); Bar("Handle upright", V((float)i * 0.146f, 0.015f, 0.007f), V((float)i * 0.128f, 0.085f, 0.006f), 0.009f); Bar("Handle shoulder", V((float)i * 0.128f, 0.085f, 0.006f), V((float)i * 0.091f, 0.132f, 0.006f), 0.009f); } Bar("Handle top", V(-0.091f, 0.132f, 0.006f), V(0.091f, 0.132f, 0.006f), 0.009f); } private void Radio() { //IL_00b2: 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_00e8: 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0164: 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_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0217: 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) Hull("Beveled cabinet", 8, true, new Ring(-0.193f, 0.178f, 0.079f, 0.004f), new Ring(-0.174f, 0.196f, 0.094f, 0.004f), new Ring(0.054f, 0.196f, 0.094f, 0.004f), new Ring(0.076f, 0.173f, 0.081f, 0.006f)); for (int i = -1; i <= 1; i += 2) { Box("Cabinet foot", V((float)i * 0.15f, -0.21f, -0.061f), V(0.049f, 0.035f, 0.039f)); Box("Cabinet foot", V((float)i * 0.15f, -0.21f, 0.067f), V(0.049f, 0.035f, 0.039f)); Bar("Handle leg", V((float)i * 0.102f, 0.065f, 0.013f), V((float)i * 0.073f, 0.112f, 0.013f), 0.01f); } Bar("Handle top", V(-0.073f, 0.112f, 0.013f), V(0.073f, 0.112f, 0.013f), 0.01f); Box("Speaker surround", V(-0.055f, -0.055f, -0.093f), V(0.176f, 0.163f, 0.014f)); Ball("Tuning knob", V(0.116f, -0.044f, -0.089f), 0.019f); Ball("Tuning knob", V(0.116f, -0.101f, -0.089f), 0.019f); Bar("Antenna", V(0.108f, 0.068f, 0.039f), V(0.194f, 0.221f, 0.095f), 0.006f); } private void Lantern() { //IL_012b: 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_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) Hull("Hexagonal base", 6, new Ring(-0.172f, 0.114f, 0.115f, 0f), new Ring(-0.14f, 0.104f, 0.104f, 0f)); Hull("Tapered honeycomb panes", 6, new Ring(-0.142f, 0.101f, 0.101f, 0f), new Ring(0.042f, 0.066f, 0.068f, 0f)); Hull("Hexagonal crown", 6, new Ring(0.041f, 0.081f, 0.081f, 0f), new Ring(0.061f, 0.08f, 0.079f, 0f), new Ring(0.105f, 0.031f, 0.031f, 0f)); Box("Loop mount", V(0f, 0.108f, 0f), V(0.044f, 0.018f, 0.023f)); for (int i = 0; i < 6; i++) { float num = (float)i * MathF.PI / 3f; float num2 = (float)(i + 1) * MathF.PI / 3f; Bar("Loop segment", V(0.025f * Mathf.Cos(num), 0.143f + 0.026f * Mathf.Sin(num), 0f), V(0.025f * Mathf.Cos(num2), 0.143f + 0.026f * Mathf.Sin(num2), 0f), 0.005f); } } private void Globe() { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) Hull("Scalloped pedestal", 12, new Ring(-0.154f, 0.116f, 0.115f, 0f), new Ring(-0.137f, 0.115f, 0.115f, 0f), new Ring(-0.103f, 0.106f, 0.108f, 0f), new Ring(-0.068f, 0.094f, 0.095f, 0f)); Ball("Glass globe", V(0f, 0.0295f, 0f), 0.1245f); Box("Gold medallion", V(0f, -0.107f, -0.104f), V(0.057f, 0.045f, 0.015f)); } private void Statue() { //IL_018e: 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_01d0: 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_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0273: 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_02b1: Unknown result type (might be due to invalid IL or missing references) Hull("Beveled cast-iron plinth", 8, true, new Ring(-0.862f, 0.644f, 0.552f, -0.015f), new Ring(-0.816f, 0.665f, 0.577f, -0.015f), new Ring(-0.694f, 0.661f, 0.562f, -0.015f), new Ring(-0.609f, 0.594f, 0.515f, -0.005f)); Hull("Flared drapery", 12, new Ring(-0.609f, 0.668f, 0.557f, 0.004f), new Ring(-0.509f, 0.682f, 0.548f, 0.012f), new Ring(-0.118f, 0.423f, 0.374f, 0.016f)); Hull("Torso", 10, new Ring(-0.203f, 0.442f, 0.372f, 0.015f), new Ring(0.195f, 0.331f, 0.326f, 0.015f), new Ring(0.461f, 0.258f, 0.228f, 0.017f)); Bar("Rounded hood", V(0f, 0.359f, -0.013f), V(0f, 0.501f, -0.007f), 0.205f); for (int i = -1; i <= 1; i += 2) { Ball("Front drapery", V((float)i * 0.18f, 0.129f, -0.3f), 0.182f); Bar("Large wing", V((float)i * 0.369f, 0.301f, 0.255f), V((float)i * 0.466f, 0.498f, 0.328f), 0.091f); Bar("Small wing", V((float)i * 0.355f, 0.258f, 0.266f), V((float)i * 0.471f, 0.218f, 0.31f), 0.075f); Bar("Antenna stalk", V((float)i * 0.133f, 0.592f, -0.067f), V((float)i * 0.212f, 0.773f, -0.061f), 0.04f); Ball("Antenna tip", V((float)i * 0.219f, 0.788f, -0.065f), 0.07f); } } private Transform NewCollider(string name, Vector3 point) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_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_003b: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name) { layer = layer, tag = "Phys Grab Object" }; val.transform.SetParent(root, false); val.transform.localPosition = point; val.AddComponent<PhysGrabObjectCollider>().colliderID = count++; return val.transform; } private void Box(string name, Vector3 point, Vector3 size) { //IL_0002: 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) ((Component)NewCollider(name, point)).gameObject.AddComponent<BoxCollider>().size = size; } private void Ball(string name, Vector3 point, float radius) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) ((Component)NewCollider(name, point)).gameObject.AddComponent<SphereCollider>().radius = radius; } private void Bar(string name, Vector3 from, Vector3 to, float radius) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0041: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) Transform obj = NewCollider(name, (from + to) / 2f); obj.localRotation = Quaternion.FromToRotation(Vector3.up, to - from); CapsuleCollider obj2 = ((Component)obj).gameObject.AddComponent<CapsuleCollider>(); obj2.radius = radius; Vector3 val = to - from; obj2.height = ((Vector3)(ref val)).magnitude + 2f * radius; } private void Hull(string name, int sides, params Ring[] rings) { Hull(name, sides, chamfered: false, rings); } private void Hull(string name, int sides, bool chamfered, params Ring[] rings) { //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_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_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_0066: 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_007c: 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_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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_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_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0237: 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_024b: Expected O, but got Unknown //IL_0253: 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_0109: 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_0129: 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_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) Vector3[] array = (Vector3[])(object)new Vector3[rings.Length * sides]; List<int> list = new List<int>(); Vector2[] array2 = (Vector2[])(object)new Vector2[8] { new Vector2(1f, 0.72f), new Vector2(0.78f, 1f), new Vector2(-0.78f, 1f), new Vector2(-1f, 0.72f), new Vector2(-1f, -0.72f), new Vector2(-0.78f, -1f), new Vector2(0.78f, -1f), new Vector2(1f, -0.72f) }; for (int i = 0; i < rings.Length; i++) { Ring ring = rings[i]; for (int j = 0; j < sides; j++) { float num = (float)j * 2f * MathF.PI / (float)sides; Vector2 val = (Vector2)(chamfered ? array2[j] : new Vector2(Mathf.Cos(num), Mathf.Sin(num))); array[i * sides + j] = V(ring.XRadius * val.x, ring.Y, ring.ZCenter + ring.ZRadius * val.y); if (i != 0) { int num2 = (i - 1) * sides + j; int num3 = (i - 1) * sides + (j + 1) % sides; list.Add(num2); list.Add(num2 + sides); list.Add(num3); list.Add(num3); list.Add(num2 + sides); list.Add(num3 + sides); } } } for (int k = 1; k < sides - 1; k++) { list.Add(0); list.Add(k); list.Add(k + 1); int num4 = (rings.Length - 1) * sides; list.Add(num4); list.Add(num4 + k + 1); list.Add(num4 + k); } Mesh val2 = new Mesh { name = "Boobees collision | " + name, vertices = array, triangles = list.ToArray() }; val2.RecalculateBounds(); MeshCollider obj = ((Component)NewCollider(name, Vector3.zero)).gameObject.AddComponent<MeshCollider>(); obj.convex = true; obj.sharedMesh = val2; } private static Vector3 V(float x, float y, float z) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return new Vector3(x, y, z); } } public sealed class RadioCue : MonoBehaviour { private const float FadeTime = 0.15f; private const float Volume = 0.72f; private PhysGrabObject grab; private PhotonView view; private AudioSource source; private bool held; private int sequence; private int lastSender = -1; private int lastSequence; private float fadeEnds; private void Awake() { grab = ((Component)this).GetComponent<PhysGrabObject>(); view = ((Component)this).GetComponent<PhotonView>(); source = SpatialAudio.Add(((Component)this).gameObject, BoobeesPlugin.RadioTrack, 0.72f, 12f); } private void Update() { //IL_012d: Unknown result type (might be due to invalid IL or missing references) if (fadeEnds > 0f) { float num = fadeEnds - Time.unscaledTime; source.volume = 0.72f * Mathf.Clamp01(num / 0.15f); if (num <= 0f) { source.Stop(); fadeEnds = 0f; } } bool flag = SemiFunc.IsMultiplayer(); if (flag && (!PhotonNetwork.InRoom || !PhotonNetwork.IsMasterClient || view.ViewID == 0)) { return; } bool flag2 = false; foreach (PhysGrabber item in grab.playerGrabbing) { if ((Object)(object)item != (Object)null) { flag2 = true; break; } } if (flag2 != held) { Apply(flag2, 0.0); if (flag) { BoobeesPlugin.RadioEvent.RaiseEvent((object)new object[4] { view.ViewID, ++sequence, flag2, PhotonNetwork.Time }, NetworkingEvents.RaiseOthers, SendOptions.SendReliable); } } } private void Apply(bool grabbed, double elapsed) { held = grabbed; if (!grabbed) { if (source.isPlaying) { fadeEnds = Time.unscaledTime + 0.15f; } return; } fadeEnds = 0f; source.Stop(); source.volume = 0.72f; if (!(elapsed >= (double)source.clip.length)) { source.timeSamples = Mathf.Clamp((int)(elapsed * (double)source.clip.frequency), 0, source.clip.samples - 1); source.Play(); } } internal static void Receive(EventData data) { if (!PhotonNetwork.InRoom || PhotonNetwork.MasterClient == null || data.Sender != PhotonNetwork.MasterClient.ActorNumber || !(data.CustomData is object[] array) || array.Length != 4 || !(array[0] is int num) || !(array[1] is int num2) || !(array[2] is bool flag) || !(array[3] is double num3)) { return; } PhotonView val = PhotonView.Find(num); RadioCue radioCue = default(RadioCue); if (!((Object)(object)val == (Object)null) && ((Component)val).TryGetComponent<RadioCue>(ref radioCue) && (radioCue.lastSender != data.Sender || num2 > radioCue.lastSequence)) { radioCue.lastSender = data.Sender; radioCue.lastSequence = num2; if (radioCue.held != flag) { radioCue.Apply(flag, Math.Max(0.0, PhotonNetwork.Time - num3)); } } } } public sealed class DamageCue : MonoBehaviour { private AudioSource? previous; internal void PlayAt(Vector3 position) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)previous != (Object)null && previous.isPlaying) { CueTail cueTail = ((Component)previous).gameObject.AddComponent<CueTail>(); ((MonoBehaviour)cueTail).StartCoroutine(cueTail.EndEarly(previous)); } GameObject val = new GameObject("Boobees ara ara"); val.transform.position = position; previous = SpatialAudio.Add(val, BoobeesPlugin.BeeTrack, 1f, 15f); previous.Play(); Object.Destroy((Object)(object)val, BoobeesPlugin.BeeTrack.length + 0.1f); } } internal sealed class CueTail : MonoBehaviour { internal IEnumerator EndEarly(AudioSource source) { float start = Time.unscaledTime; float volume = source.volume; while ((Object)(object)source != (Object)null && Time.unscaledTime < start + 0.045f) { source.volume = volume * (1f - (Time.unscaledTime - start) / 0.045f); yield return null; } Object.Destroy((Object)(object)((Component)this).gameObject); } } internal static class SpatialAudio { internal static AudioSource Add(GameObject root, AudioClip clip, float volume, float distance) { AudioSource obj = root.AddComponent<AudioSource>(); obj.clip = clip; obj.playOnAwake = false; obj.loop = false; obj.volume = volume; obj.spatialBlend = 1f; obj.minDistance = 1f; obj.maxDistance = distance; obj.rolloffMode = (AudioRolloffMode)1; obj.dopplerLevel = 0f; return obj; } } [HarmonyPatch(typeof(PhysGrabObjectImpactDetector), "BreakRPC")] internal static class DamageCuePatch { private readonly struct DamageSnapshot { internal readonly DamageCue? Cue; internal readonly ValuableObject? Valuable; internal readonly float Before; internal readonly Vector3 Position; internal DamageSnapshot(DamageCue cue, ValuableObject valuable, float before, Vector3 position) { //IL_0016: 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) Cue = cue; Valuable = valuable; Before = before; Position = position; } } private static readonly FieldRef<ValuableObject, float> CurrentValue = AccessTools.FieldRefAccess<ValuableObject, float>("dollarValueCurrent"); private static void Prefix(PhysGrabObjectImpactDetector __instance, float __0, bool __3, out DamageSnapshot __state) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) __state = default(DamageSnapshot); DamageCue cue = default(DamageCue); ValuableObject val = default(ValuableObject); if (__3 && !(__0 <= 0f) && ((Component)__instance).TryGetComponent<DamageCue>(ref cue) && ((Component)__instance).TryGetComponent<ValuableObject>(ref val)) { __state = new DamageSnapshot(cue, val, CurrentValue.Invoke(val), ((Component)__instance).transform.position); } } private static void Postfix(DamageSnapshot __state) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (__state.Cue != null && __state.Valuable != null && CurrentValue.Invoke(__state.Valuable) < __state.Before) { __state.Cue.PlayAt(__state.Position); } } } }