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 Scrapalooza v1.0.0
Scrapalooza.dll
Decompiled 2 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.Networking; using UnityEngine.Rendering; [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("Scrapalooza")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+c51e8a2ff05a1712ef24d7cf30bf0684370e3da1")] [assembly: AssemblyProduct("Scrapalooza")] [assembly: AssemblyTitle("Scrapalooza")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LootMod { public class ExplosiveHit : MonoBehaviour, IHittable { internal const float ThrowChance = 0.8f; internal const float HitChance = 0.15f; private const string Msg = "Scrapalooza.Boom"; internal static void Init() { ItemNet.On("Scrapalooza.Boom", delegate(NetworkObject no, Vector3 _) { StunGrenadeItem component = ((Component)no).GetComponent<StunGrenadeItem>(); if (Object.op_Implicit((Object)(object)component)) { Explode(component); } }); } public bool Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) StunGrenadeItem component = ((Component)this).GetComponent<StunGrenadeItem>(); LootTag component2 = ((Component)this).GetComponent<LootTag>(); if ((Object)(object)component == (Object)null || (Object)(object)component2 == (Object)null || component2.exploded || ((GrabbableObject)component).isHeld || ((GrabbableObject)component).isHeldByEnemy || component2.flying) { return false; } if (Random.value < 0.15f) { ItemNet.Send("Scrapalooza.Boom", ((NetworkBehaviour)component).NetworkObject, Vector3.zero); } return true; } internal static bool ThrowRoll(StunGrenadeItem g) { //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_0019: 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) Vector3 position = ((Component)g).transform.position; return new Random(Dice.Hash((int)((NetworkBehaviour)g).NetworkObjectId * 7919 + Mathf.RoundToInt(position.x * 4f) * 104729 + Mathf.RoundToInt(position.z * 4f) * 1299709)).NextDouble() < 0.800000011920929; } internal static void Explode(StunGrenadeItem g) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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) LootTag component = ((Component)g).GetComponent<LootTag>(); if (!((Object)(object)component == (Object)null) && !component.exploded) { component.exploded = true; component.thrown = false; Landmine.SpawnExplosion(((Component)g).transform.position + Vector3.up * 0.2f, true, component.blastKill, component.blastDamage, 50, 0f, (GameObject)null, false); ((GrabbableObject)g).DestroyObjectInHand((PlayerControllerB)null); } } } internal static class Extras { internal static AudioClip GunClick; internal static bool HeldBehaviour(PlayerControllerB p, string behaviour) { GrabbableObject val = (Object.op_Implicit((Object)(object)p) ? p.currentlyHeldObjectServer : null); LootTag lootTag = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<LootTag>() : null); if (Object.op_Implicit((Object)(object)lootTag)) { return lootTag.behaviour == behaviour; } return false; } } [HarmonyPatch(typeof(GrabbableObject), "ItemActivate")] internal static class GunClickPatch { private static void Postfix(GrabbableObject __instance, bool buttonDown) { if (!buttonDown) { return; } LootTag component = ((Component)__instance).GetComponent<LootTag>(); if (Object.op_Implicit((Object)(object)component) && !(component.behaviour != "gun") && Object.op_Implicit((Object)(object)Extras.GunClick)) { AudioSource component2 = ((Component)__instance).GetComponent<AudioSource>(); if (Object.op_Implicit((Object)(object)component2)) { component2.PlayOneShot(Extras.GunClick); WalkieTalkie.TransmitOneShotAudio(component2, Extras.GunClick, 1f); } } } } [HarmonyPatch(typeof(PlayerControllerB), "IHittable.Hit")] internal static class SqueakPlayerPatch { private static bool Prefix(int force, PlayerControllerB playerWhoHit, ref bool __result) { if (force != 0 || !Extras.HeldBehaviour(playerWhoHit, "squeak")) { return true; } __result = true; return false; } } [HarmonyPatch(typeof(PlayerControllerB), "IHittable.Hit")] internal static class PlayerDamagePatch { internal static readonly Dictionary<string, int> ById = new Dictionary<string, int>(); private static readonly MethodInfo Allow = AccessTools.Method(typeof(PlayerControllerB), "AllowPlayerDeath", (Type[])null, (Type[])null); private static bool Prefix(PlayerControllerB __instance, int force, Vector3 hitDirection, PlayerControllerB playerWhoHit, ref bool __result) { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) GrabbableObject val = (Object.op_Implicit((Object)(object)playerWhoHit) ? playerWhoHit.currentlyHeldObjectServer : null); LootTag lootTag = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<LootTag>() : null); if (!Object.op_Implicit((Object)(object)lootTag) || force <= 0 || !ById.TryGetValue(lootTag.id, out var value)) { return true; } __result = false; if (Allow != null && !(bool)Allow.Invoke(__instance, null)) { return false; } CentipedeAI[] array = Object.FindObjectsByType<CentipedeAI>((FindObjectsSortMode)0); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i].clingingToPlayer == (Object)(object)__instance) { return false; } } if (Object.op_Implicit((Object)(object)__instance.inAnimationWithEnemy)) { return false; } __instance.DamagePlayerFromOtherClientServerRpc(value, hitDirection, (int)playerWhoHit.playerClientId); __result = true; return false; } } [HarmonyPatch(typeof(EnemyAICollisionDetect), "IHittable.Hit")] internal static class SqueakEnemyPatch { internal static readonly Dictionary<string, int> Every = new Dictionary<string, int>(); private static readonly ConditionalWeakTable<GrabbableObject, int[]> count = new ConditionalWeakTable<GrabbableObject, int[]>(); private static bool Prefix(int force, PlayerControllerB playerWhoHit, ref bool __result) { if (force == 0 && Extras.HeldBehaviour(playerWhoHit, "squeak")) { __result = true; return false; } GrabbableObject val = (Object.op_Implicit((Object)(object)playerWhoHit) ? playerWhoHit.currentlyHeldObjectServer : null); LootTag lootTag = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<LootTag>() : null); if (!Object.op_Implicit((Object)(object)lootTag) || !Every.TryGetValue(lootTag.id, out var value) || value <= 1) { return true; } int[] orCreateValue = count.GetOrCreateValue(val); orCreateValue[0]++; if (orCreateValue[0] % value == 0) { return true; } __result = true; return false; } } public class LavaLamp : MonoBehaviour { internal static readonly Dictionary<string, int[]> Glass = new Dictionary<string, int[]>(); internal static readonly Dictionary<string, Vector3> Centre = new Dictionary<string, Vector3>(); private static readonly Color LavaColor = new Color(0.75f, 0.3f, 1f); private static readonly (Color lava, Color pulse)[] Palette = new(Color, Color)[6] { (new Color(0.75f, 0.3f, 1f), new Color(1f, 0.35f, 0.6f)), (new Color(1f, 0.15f, 0.1f), new Color(1f, 0.45f, 0.1f)), (new Color(0.2f, 1f, 0.25f), new Color(0.7f, 1f, 0.1f)), (new Color(0.15f, 0.45f, 1f), new Color(0.2f, 0.9f, 1f)), (new Color(1f, 0.5f, 0.05f), new Color(1f, 0.8f, 0.2f)), (new Color(1f, 0.3f, 0.7f), new Color(1f, 0.6f, 0.85f)) }; private int pal; private GrabbableObject grab; private Light light; private Material[] lava = (Material[])(object)new Material[0]; private float seed; internal void SetValue(int value) { pal = Math.Abs(value) % Palette.Length; ApplyColour(); } private void ApplyColour() { //IL_0024: 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_004d: Unknown result type (might be due to invalid IL or missing references) Material[] array = lava; foreach (Material obj in array) { obj.SetColor("_EmissiveColor", Palette[pal].lava * 4f); obj.SetColor("_BaseColor", Palette[pal].lava); } } internal static void SetupLight(Item fancy, LootItems.Entry e) { //IL_008d: 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_00a9: 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) Light val = ((Object.op_Implicit((Object)(object)fancy) && Object.op_Implicit((Object)(object)fancy.spawnPrefab)) ? fancy.spawnPrefab.GetComponentInChildren<Light>(true) : null); if (!Object.op_Implicit((Object)(object)val)) { Plugin.Log.LogWarning((object)(e.m.id + ": Fancy lamp light not found, lava lamp stays dark")); return; } GameObject obj = Object.Instantiate<GameObject>(((Component)val).gameObject, e.prefab.transform, false); ((Object)obj).name = "LavaLight"; Centre.TryGetValue(e.m.id, out var value); obj.transform.localPosition = value; obj.transform.localRotation = Quaternion.identity; obj.transform.localScale = Vector3.one; Light component = obj.GetComponent<Light>(); component.color = LavaColor; ((Behaviour)component).enabled = true; component.type = (LightType)2; component.cookie = null; component.shadows = (LightShadows)0; } private void Start() { grab = ((Component)this).GetComponent<GrabbableObject>(); light = ((Component)this).GetComponentInChildren<Light>(true); if (Object.op_Implicit((Object)(object)light)) { light.shadows = (LightShadows)0; } seed = Random.value * 10f; LootTag component = ((Component)this).GetComponent<LootTag>(); if (!Object.op_Implicit((Object)(object)component) || !Glass.TryGetValue(component.id, out var value)) { return; } List<Material> list = new List<Material>(); MeshRenderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<MeshRenderer>(true); foreach (MeshRenderer obj in componentsInChildren) { ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; Material[] materials = ((Renderer)obj).materials; int[] array = value; foreach (int num in array) { if (num < materials.Length) { list.Add(materials[num]); } } } lava = list.ToArray(); ApplyColour(); } private void Update() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) float num = Time.time + seed; if (Object.op_Implicit((Object)(object)light)) { ((Behaviour)light).enabled = !Object.op_Implicit((Object)(object)grab) || !grab.isPocketed; light.color = Color.Lerp(Palette[pal].lava, Palette[pal].pulse, 0.5f + 0.5f * Mathf.Sin(num * 0.7f)); } } } [HarmonyPatch(typeof(GrabbableObject), "SetScrapValue")] internal static class LavaColourPatch { private static void Postfix(GrabbableObject __instance, int setValueTo) { ((Component)__instance).GetComponent<LavaLamp>()?.SetValue(setValueTo); } } internal static class Dice { private static readonly Vector3[] Faces = (Vector3[])(object)new Vector3[6] { new Vector3(0f, 0f, 0f), new Vector3(90f, 0f, 0f), new Vector3(180f, 0f, 0f), new Vector3(-90f, 0f, 0f), new Vector3(0f, 0f, 90f), new Vector3(0f, 0f, -90f) }; internal static int Hash(int x) { int num = (x ^ (x >>> 16)) * 2146121005; int num2 = (num ^ (num >>> 15)) * -2073254261; return (num2 ^ (num2 >>> 16)) & 0x7FFFFFFF; } internal static void Land(GrabbableObject g) { //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_0019: 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_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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)g).transform.position; Random random = new Random(Hash((int)((NetworkBehaviour)g).NetworkObjectId * 7919 + Mathf.RoundToInt(position.x * 4f) * 104729 + Mathf.RoundToInt(position.z * 4f) * 1299709)); Vector3 val = Faces[random.Next(Faces.Length)]; float num = (float)random.NextDouble() * 360f; LootTag component = ((Component)g).GetComponent<LootTag>(); if (Object.op_Implicit((Object)(object)component)) { component.pendingRot = Quaternion.Euler(0f, num, 0f) * Quaternion.Euler(g.itemProperties.restingRotation) * Quaternion.Euler(val); } Plugin.Log.LogInfo((object)$"Giant Die landed: face {Array.IndexOf(Faces, val)}"); } } public class PhoneRing : MonoBehaviour { private Light screen; internal static AudioClip RingClip; private const string Msg = "Scrapalooza.Ring"; private float next = -1f; internal static AudioClip HangUpClip; private const string HangMsg = "Scrapalooza.HangUp"; private AudioSource ring; private Coroutine ringing; private GrabbableObject g; internal bool Ringing => ringing != null; private void LateUpdate() { GrabbableObject component = ((Component)this).GetComponent<GrabbableObject>(); AudioLowPassFilter component2 = ((Component)this).GetComponent<AudioLowPassFilter>(); if (Object.op_Implicit((Object)(object)component2) && ((Behaviour)component2).enabled && Object.op_Implicit((Object)(object)component) && !component.isPocketed) { ((Behaviour)component2).enabled = false; } if (!Object.op_Implicit((Object)(object)screen)) { screen = ((Component)this).GetComponentInChildren<Light>(true); } if (Object.op_Implicit((Object)(object)screen)) { ((Behaviour)screen).enabled = !Object.op_Implicit((Object)(object)component) || !component.isPocketed; } } internal static void SetupScreenLight(Item fancy, LootItems.Entry e) { //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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_0133: 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_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) Light val = ((Object.op_Implicit((Object)(object)fancy) && Object.op_Implicit((Object)(object)fancy.spawnPrefab)) ? fancy.spawnPrefab.GetComponentInChildren<Light>(true) : null); int num = Array.FindIndex(e.m.materials, (string n) => n.EndsWith("__glow")); Mesh sharedMesh = e.prefab.GetComponent<MeshFilter>().sharedMesh; if (!Object.op_Implicit((Object)(object)val) || num < 0) { Plugin.Log.LogWarning((object)$"{e.m.id}: no screen light (light {Object.op_Implicit((Object)(object)val)}, glow submesh {num})"); return; } int[] triangles = sharedMesh.GetTriangles(num); Vector3[] vertices = sharedMesh.vertices; Vector3[] normals = sharedMesh.normals; Vector3 val2 = Vector3.zero; Vector3 val3 = Vector3.zero; int[] array = triangles; foreach (int num3 in array) { val2 += vertices[num3]; val3 += normals[num3]; } val2 /= (float)triangles.Length; val3 = ((((Vector3)(ref val3)).sqrMagnitude > 0f) ? ((Vector3)(ref val3)).normalized : Vector3.up); GameObject obj = Object.Instantiate<GameObject>(((Component)val).gameObject, e.prefab.transform, false); ((Object)obj).name = "ScreenLight"; obj.transform.localPosition = val2 + val3 * 0.15f; obj.transform.localRotation = Quaternion.identity; obj.transform.localScale = Vector3.one; Light component = obj.GetComponent<Light>(); component.type = (LightType)2; component.cookie = null; component.shadows = (LightShadows)0; component.color = new Color(0.85f, 0.92f, 1f); component.intensity *= 0.035f; component.range = 1.4f; ((Behaviour)component).enabled = true; } internal static AudioClip MakeRingtone() { float num = 3.2f; float[] array = new float[(int)(22050f * num)]; for (int i = 0; i < array.Length; i++) { float num2 = (float)i / 22050f; float num3 = num2 % 1.1f; if (!(num3 > 0.75f)) { float num4 = (((int)(num2 / 0.05f) % 2 == 0) ? 1320f : 1660f); float num5 = Mathf.Sign(Mathf.Sin(MathF.PI * 2f * num4 * num2)); float num6 = Mathf.Min(new float[3] { 1f, num3 / 0.01f, (0.75f - num3) / 0.02f }); array[i] = 0.25f * num5 * num6; } } AudioClip obj = AudioClip.Create("ScrapaloozaRingtone", array.Length, 1, 22050, false); obj.SetData(array, 0); return obj; } internal static void Init() { ItemNet.On("Scrapalooza.Ring", delegate(NetworkObject no, Vector3 v) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) PhoneRing component = ((Component)no).GetComponent<PhoneRing>(); if (Object.op_Implicit((Object)(object)component)) { component.StartRing(Mathf.Clamp(Mathf.RoundToInt(v.x), 1, 3)); } }); ItemNet.On("Scrapalooza.HangUp", delegate(NetworkObject no, Vector3 _) { PhoneRing component = ((Component)no).GetComponent<PhoneRing>(); if (Object.op_Implicit((Object)(object)component)) { component.HangUp(); } }); } private void StartRing(int times) { if (Object.op_Implicit((Object)(object)RingClip)) { if (!Object.op_Implicit((Object)(object)ring)) { AudioSource component = ((Component)this).GetComponent<AudioSource>(); ring = ((Component)this).gameObject.AddComponent<AudioSource>(); ring.playOnAwake = false; ring.spatialBlend = 1f; ring.dopplerLevel = 0f; ring.rolloffMode = (AudioRolloffMode)1; ring.maxDistance = (Object.op_Implicit((Object)(object)component) ? component.maxDistance : 17f); ring.outputAudioMixerGroup = (Object.op_Implicit((Object)(object)component) ? component.outputAudioMixerGroup : null); } if (ringing != null) { ((MonoBehaviour)this).StopCoroutine(ringing); } ringing = ((MonoBehaviour)this).StartCoroutine(Ring(times)); Tips(); } } private IEnumerator Ring(int times) { for (int i = 0; i < times; i++) { bool flag = Object.op_Implicit((Object)(object)g) && g.isPocketed; AudioLowPassFilter obj = ((Component)this).GetComponent<AudioLowPassFilter>() ?? ((Component)this).gameObject.AddComponent<AudioLowPassFilter>(); obj.cutoffFrequency = 900f; ((Behaviour)obj).enabled = flag; ring.volume = (flag ? 0.55f : 1f); ring.clip = RingClip; ring.Play(); WalkieTalkie.TransmitOneShotAudio(ring, RingClip, ring.volume); if (Object.op_Implicit((Object)(object)RoundManager.Instance)) { RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, flag ? 12f : 20f, flag ? 0.5f : 0.8f, 0, false, 0); } yield return (object)new WaitForSeconds(RingClip.length + 0.4f); } ringing = null; Tips(); } internal void HangUp() { if (ringing != null) { ((MonoBehaviour)this).StopCoroutine(ringing); ringing = null; if (Object.op_Implicit((Object)(object)ring)) { ring.Stop(); } AudioSource component = ((Component)this).GetComponent<AudioSource>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)HangUpClip)) { component.PlayOneShot(HangUpClip); WalkieTalkie.TransmitOneShotAudio(component, HangUpClip, 1f); } Tips(); } } private void Tips() { if (!Object.op_Implicit((Object)(object)g)) { g = ((Component)this).GetComponent<GrabbableObject>(); } PlayerControllerB val = (Object.op_Implicit((Object)(object)GameNetworkManager.Instance) ? GameNetworkManager.Instance.localPlayerController : null); if (Object.op_Implicit((Object)(object)g) && Object.op_Implicit((Object)(object)val) && !((Object)(object)g.playerHeldBy != (Object)(object)val) && !g.isPocketed && Object.op_Implicit((Object)(object)HUDManager.Instance)) { HUDManager.Instance.ChangeControlTipMultiple((ringing == null) ? new string[0] : new string[1] { "Hang up : [LMB]" }, true, g.itemProperties); } } internal void Equipped() { Tips(); } private void Update() { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)g)) { g = ((Component)this).GetComponent<GrabbableObject>(); } NetworkManager singleton = NetworkManager.Singleton; if (!((Object)(object)singleton == (Object)null) && singleton.IsServer && !((Object)(object)StartOfRound.Instance == (Object)null) && !StartOfRound.Instance.inShipPhase && Object.op_Implicit((Object)(object)g) && ((NetworkBehaviour)g).IsSpawned && !g.deactivated) { if (next < 0f) { next = Time.time + Random.Range(60f, 180f); } if (!(Time.time < next)) { next = Time.time + Random.Range(60f, 180f); ItemNet.Send("Scrapalooza.Ring", ((NetworkBehaviour)g).NetworkObject, new Vector3((float)Random.Range(2, 4), 0f, 0f)); } } } } public class Extinguisher : MonoBehaviour { internal static AudioClip SprayClip; internal static AudioClip EmptyClip; internal static GameObject ParticleSrc; private const string Msg = "Scrapalooza.Stun"; private const float TankSeconds = 20f; private const float StunTime = 2.5f; private const float Range = 4.5f; private const float PerEnemyCooldown = 4f; private GrabbableObject grab; private AudioSource audio; private ParticleSystem cloud; private float tank = 20f; private float nextCheck; private bool spraying; private readonly Dictionary<EnemyAI, float> lastStun = new Dictionary<EnemyAI, float>(); private const string TankMsg = "Scrapalooza.Tank"; private bool wasHeld; internal int SaveData => Mathf.RoundToInt(Mathf.Clamp(tank, 0f, 20f) * 100f); internal static void Setup(Item vanilla, LootItems.Entry e) { SprayPaintItem val = ((Object.op_Implicit((Object)(object)vanilla) && Object.op_Implicit((Object)(object)vanilla.spawnPrefab)) ? vanilla.spawnPrefab.GetComponent<SprayPaintItem>() : null); ParticleSrc = ((Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.sprayParticle)) ? ((Component)val.sprayParticle).gameObject : null); if (!Object.op_Implicit((Object)(object)ParticleSrc)) { Plugin.Log.LogWarning((object)"extinguisher: spray particle not found"); } } internal static void Init() { ItemNet.On("Scrapalooza.Stun", delegate(NetworkObject no, Vector3 v) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) EnemyAI component = ((Component)no).GetComponent<EnemyAI>(); if (Object.op_Implicit((Object)(object)component) && !component.isEnemyDead) { component.SetEnemyStunned(true, v.x, (PlayerControllerB)null); } }); ItemNet.On("Scrapalooza.Tank", delegate(NetworkObject no, Vector3 v) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) Extinguisher component = ((Component)no).GetComponent<Extinguisher>(); if (Object.op_Implicit((Object)(object)component)) { component.tank = v.x; if (component.tank <= 0f && component.spraying) { component.Stop(); if (Object.op_Implicit((Object)(object)EmptyClip)) { component.audio.PlayOneShot(EmptyClip); } } } }); } internal void LoadData(int d) { tank = Mathf.Clamp((float)d / 100f, 0f, 20f); } private void SendTank() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)grab) && ((NetworkBehaviour)grab).IsSpawned) { ItemNet.Send("Scrapalooza.Tank", ((NetworkBehaviour)grab).NetworkObject, new Vector3(tank, 0f, 0f)); } } private void Start() { grab = ((Component)this).GetComponent<GrabbableObject>(); audio = ((Component)this).GetComponent<AudioSource>(); } internal void SetSpraying(bool on) { //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_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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) if (on && tank <= 0f) { if (Object.op_Implicit((Object)(object)EmptyClip)) { audio.PlayOneShot(EmptyClip); } return; } if (!on && spraying && Object.op_Implicit((Object)(object)grab) && ((NetworkBehaviour)grab).IsOwner) { SendTank(); } spraying = on; if (on) { if (!Object.op_Implicit((Object)(object)cloud) && Object.op_Implicit((Object)(object)ParticleSrc)) { GameObject val = Object.Instantiate<GameObject>(ParticleSrc); ((Object)val).name = "ExtinguisherCloud"; cloud = val.GetComponent<ParticleSystem>(); ParticleSystem[] componentsInChildren = val.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem obj in componentsInChildren) { MainModule main = obj.main; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.95f, 0.95f, 0.95f, 0.8f)); ColorOverLifetimeModule colorOverLifetime = obj.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = false; ParticleSystemRenderer component = ((Component)obj).GetComponent<ParticleSystemRenderer>(); if (Object.op_Implicit((Object)(object)component)) { Material[] materials = ((Renderer)component).materials; Material[] array = materials; foreach (Material val2 in array) { string[] array2 = new string[5] { "_Color", "_BaseColor", "_UnlitColor", "_TintColor", "_EmissiveColor" }; foreach (string text in array2) { if (val2.HasProperty(text)) { float a = val2.GetColor(text).a; val2.SetColor(text, (Color)((text == "_EmissiveColor") ? Color.black : new Color(1f, 1f, 1f, a))); } } } ((Renderer)component).materials = materials; } ((MainModule)(ref main)).startSizeMultiplier = ((MainModule)(ref main)).startSizeMultiplier * 2.5f; ((MainModule)(ref main)).startSpeedMultiplier = ((MainModule)(ref main)).startSpeedMultiplier * 1.5f; } } if (Object.op_Implicit((Object)(object)cloud)) { cloud.Play(true); } if (Object.op_Implicit((Object)(object)SprayClip)) { audio.clip = SprayClip; audio.loop = true; audio.Play(); } } else { Stop(); } } private void Stop() { spraying = false; if (Object.op_Implicit((Object)(object)cloud)) { cloud.Stop(true, (ParticleSystemStopBehavior)1); } if (Object.op_Implicit((Object)(object)audio) && audio.loop) { audio.loop = false; audio.Stop(); } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)cloud)) { Object.Destroy((Object)(object)((Component)cloud).gameObject); } } private void Update() { //IL_00bd: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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_00e6: 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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: 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_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_026b: 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) NetworkManager singleton = NetworkManager.Singleton; bool flag = Object.op_Implicit((Object)(object)grab) && grab.isHeld; if (flag && !wasHeld && Object.op_Implicit((Object)(object)singleton) && singleton.IsServer) { SendTank(); } wasHeld = flag; if (!spraying) { return; } PlayerControllerB val = (Object.op_Implicit((Object)(object)grab) ? grab.playerHeldBy : null); if (!Object.op_Implicit((Object)(object)val) || !grab.isHeld || grab.isPocketed) { Stop(); return; } Transform transform = ((Component)val.gameplayCamera).transform; if (Object.op_Implicit((Object)(object)cloud)) { ((Component)cloud).transform.position = transform.position + transform.forward * 0.6f + Vector3.down * 0.3f; ((Component)cloud).transform.rotation = Quaternion.LookRotation(transform.forward); } tank -= Time.deltaTime; if (tank <= 0f) { tank = 0f; Stop(); if (Object.op_Implicit((Object)(object)EmptyClip)) { audio.PlayOneShot(EmptyClip); } if (((NetworkBehaviour)grab).IsOwner) { SendTank(); } } else { if (!((NetworkBehaviour)grab).IsOwner || Time.time < nextCheck) { return; } nextCheck = Time.time + 0.25f; RoundManager instance = RoundManager.Instance; if (instance != null) { instance.PlayAudibleNoise(((Component)this).transform.position, 8f, 0.4f, 0, false, 0); } RaycastHit[] array = Physics.SphereCastAll(transform.position, 0.7f, transform.forward, 4.5f, 524288, (QueryTriggerInteraction)2); for (int i = 0; i < array.Length; i++) { RaycastHit val2 = array[i]; EnemyAICollisionDetect component = ((Component)((RaycastHit)(ref val2)).collider).GetComponent<EnemyAICollisionDetect>(); EnemyAI val3 = (Object.op_Implicit((Object)(object)component) ? component.mainScript : null); if (Object.op_Implicit((Object)(object)val3) && !val3.isEnemyDead && (!lastStun.TryGetValue(val3, out var value) || !(Time.time - value < 4f)) && !Physics.Linecast(transform.position, (((RaycastHit)(ref val2)).point == Vector3.zero) ? ((Component)val3).transform.position : ((RaycastHit)(ref val2)).point, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { lastStun[val3] = Time.time; ItemNet.Send("Scrapalooza.Stun", ((NetworkBehaviour)val3).NetworkObject, new Vector3(2.5f, 0f, 0f)); } } } } } [HarmonyPatch(typeof(GrabbableObject), "GetItemDataToSave")] internal static class ExtinguisherSavePatch { private static bool Prefix(GrabbableObject __instance, ref int __result) { Extinguisher component = ((Component)__instance).GetComponent<Extinguisher>(); if (!Object.op_Implicit((Object)(object)component)) { return true; } __result = component.SaveData; return false; } } [HarmonyPatch(typeof(GrabbableObject), "LoadItemSaveData")] internal static class ExtinguisherLoadPatch { private static bool Prefix(GrabbableObject __instance, int saveData) { Extinguisher component = ((Component)__instance).GetComponent<Extinguisher>(); if (!Object.op_Implicit((Object)(object)component)) { return true; } component.LoadData(saveData); return false; } } [HarmonyPatch(typeof(GrabbableObject), "ItemActivate")] internal static class ExtinguisherUsePatch { private static void Postfix(GrabbableObject __instance, bool buttonDown) { ((Component)__instance).GetComponent<Extinguisher>()?.SetSpraying(buttonDown); } } public class OldLightFlicker : MonoBehaviour { private const float Dim = 0.45f; private readonly List<(Light l, float baseI)> lights = new List<(Light, float)>(); private float dipUntil; private float nextDip; private void Start() { Light[] componentsInChildren = ((Component)this).GetComponentsInChildren<Light>(true); foreach (Light val in componentsInChildren) { lights.Add((val, val.intensity)); } nextDip = Time.time + Random.Range(2f, 8f); } private void Update() { if (Time.time > nextDip) { dipUntil = Time.time + Random.Range(0.05f, 0.35f); nextDip = Time.time + Random.Range(1.5f, 9f); } float num = 0.45f * ((Time.time < dipUntil) ? Random.Range(0.05f, 0.4f) : (1f - 0.08f * Mathf.PerlinNoise(Time.time * 6f, 0f))); foreach (var (val, num2) in lights) { if (Object.op_Implicit((Object)(object)val)) { val.intensity = num2 * num; } } } } [HarmonyPatch(typeof(SoccerBallProp), "FallWithCurve")] internal static class BallSpinPatch { private class Spin { public Vector3 from; public Vector3 to; public Vector3 axis; public float degPerSec; } private static readonly ConditionalWeakTable<SoccerBallProp, Spin> state = new ConditionalWeakTable<SoccerBallProp, Spin>(); private static void Prefix(SoccerBallProp __instance, out Quaternion __state) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) __state = ((Component)__instance).transform.rotation; } private static void Postfix(SoccerBallProp __instance, Quaternion __state) { //IL_001b: 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_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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)((Component)__instance).GetComponent<LootTag>())) { Spin orCreateValue = state.GetOrCreateValue(__instance); if (orCreateValue.from != ((GrabbableObject)__instance).startFallingPosition || orCreateValue.to != ((GrabbableObject)__instance).targetFloorPosition) { orCreateValue.from = ((GrabbableObject)__instance).startFallingPosition; orCreateValue.to = ((GrabbableObject)__instance).targetFloorPosition; Vector3 val = orCreateValue.to - orCreateValue.from; val.y = 0f; float magnitude = ((Vector3)(ref val)).magnitude; Transform parent = ((Component)__instance).transform.parent; Vector3 val2 = (Object.op_Implicit((Object)(object)parent) ? parent.TransformDirection(val) : val); Random random = new Random(Mathf.RoundToInt(orCreateValue.from.x * 97f + orCreateValue.to.z * 131f + orCreateValue.to.x * 17f)); Vector3 val3 = ((magnitude > 0.01f) ? Vector3.Cross(Vector3.up, ((Vector3)(ref val2)).normalized) : Vector3.right); Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor((float)random.NextDouble() - 0.5f, (float)random.NextDouble() - 0.5f, (float)random.NextDouble() - 0.5f); Vector3 val5 = val3 + val4 * 0.8f; orCreateValue.axis = ((Vector3)(ref val5)).normalized; orCreateValue.degPerSec = Mathf.Clamp(magnitude * 260f, 200f, 1400f) * (0.8f + 0.4f * (float)random.NextDouble()); } float num = 1f - Mathf.Clamp01(((GrabbableObject)__instance).fallTime); ((Component)__instance).transform.rotation = Quaternion.AngleAxis(orCreateValue.degPerSec * num * Time.deltaTime, orCreateValue.axis) * __state; } } } public class LandPose : MonoBehaviour { private GrabbableObject g; private LootTag tag; private void Start() { g = ((Component)this).GetComponent<GrabbableObject>(); tag = ((Component)this).GetComponent<LootTag>(); } private void LateUpdate() { //IL_008a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)g) && Object.op_Implicit((Object)(object)tag) && tag.pendingRot.HasValue) { if (g.isHeld || g.isHeldByEnemy) { tag.pendingRot = null; } else if (g.reachedFloorTarget && !(g.fallTime < 1f)) { ((Component)this).transform.rotation = tag.pendingRot.Value; tag.pendingRot = null; } } } } internal static class DartHit { private const int Mask = 524296; internal static void Check(GrabbableObject g, LootTag tag, Vector3 a, Vector3 b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_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_0021: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) Vector3 val = b - a; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 0.0001f) { return; } RaycastHit[] array = Physics.SphereCastAll(a, 0.2f, val / magnitude, magnitude, 524296, (QueryTriggerInteraction)2); IHittable val3 = default(IHittable); for (int i = 0; i < array.Length; i++) { RaycastHit val2 = array[i]; if (!((Component)((RaycastHit)(ref val2)).transform).TryGetComponent<IHittable>(ref val3)) { continue; } PlayerControllerB component = ((Component)((RaycastHit)(ref val2)).transform).GetComponent<PlayerControllerB>(); if (Object.op_Implicit((Object)(object)component) && (Object)(object)component == (Object)(object)tag.thrower) { continue; } EnemyAICollisionDetect component2 = ((Component)((RaycastHit)(ref val2)).transform).GetComponent<EnemyAICollisionDetect>(); object obj = (Object.op_Implicit((Object)(object)component2) ? component2.mainScript : (((object)component) ?? ((object)val3))); if (obj != null && tag.hitThisThrow.Add(obj) && tag.hitForce > 0) { try { val3.Hit(tag.hitForce, val / magnitude, tag.thrower, true, 1); } catch (Exception ex) { Plugin.Log.LogWarning((object)("dart hit: " + ex.Message)); } } } } } internal static class ItemNet { private static readonly Dictionary<string, Action<NetworkObject, Vector3>> handlers = new Dictionary<string, Action<NetworkObject, Vector3>>(); internal static void On(string msg, Action<NetworkObject, Vector3> handler) { handlers[msg] = handler; } internal static void RegisterAll() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null || singleton.CustomMessagingManager == null) { return; } foreach (KeyValuePair<string, Action<NetworkObject, Vector3>> handler in handlers) { string msg = handler.Key; singleton.CustomMessagingManager.UnregisterNamedMessageHandler(msg); singleton.CustomMessagingManager.RegisterNamedMessageHandler(msg, (HandleNamedMessageDelegate)delegate(ulong sender, FastBufferReader r) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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) ulong id = default(ulong); ((FastBufferReader)(ref r)).ReadValueSafe<ulong>(ref id, default(ForPrimitives)); Vector3 v = default(Vector3); ((FastBufferReader)(ref r)).ReadValueSafe(ref v); if (NetworkManager.Singleton.IsServer) { Broadcast(msg, id, v); } else { Run(msg, id, v); } }); } } internal unsafe static void Send(string msg, NetworkObject no, Vector3 v) { //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_003b: 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_0045: Unknown result type (might be due to invalid IL or missing references) NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null || (Object)(object)no == (Object)null) { return; } if (singleton.IsServer) { Broadcast(msg, no.NetworkObjectId, v); return; } FastBufferWriter val = Writer(no.NetworkObjectId, v); try { singleton.CustomMessagingManager.SendNamedMessage(msg, 0uL, val, (NetworkDelivery)3); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } private static FastBufferWriter Writer(ulong id, Vector3 v) { //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_0026: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter result = default(FastBufferWriter); ((FastBufferWriter)(ref result))..ctor(64, (Allocator)2, -1); ((FastBufferWriter)(ref result)).WriteValueSafe<ulong>(ref id, default(ForPrimitives)); ((FastBufferWriter)(ref result)).WriteValueSafe(ref v); return result; } private unsafe static void Broadcast(string msg, ulong id, Vector3 v) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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) NetworkManager singleton = NetworkManager.Singleton; Run(msg, id, v); List<ulong> list = new List<ulong>(); foreach (ulong connectedClientsId in singleton.ConnectedClientsIds) { if (connectedClientsId != singleton.LocalClientId) { list.Add(connectedClientsId); } } if (list.Count == 0) { return; } FastBufferWriter val = Writer(id, v); try { singleton.CustomMessagingManager.SendNamedMessage(msg, (IReadOnlyList<ulong>)list, val, (NetworkDelivery)3); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } private static void Run(string msg, ulong id, Vector3 v) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (handlers.TryGetValue(msg, out var value) && NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(id, out var value2)) { value(value2, v); } } } public class UseSound : MonoBehaviour { internal static AudioClip Squeak; internal static AudioClip[] Farts = (AudioClip[])(object)new AudioClip[0]; private GrabbableObject grab; private AudioSource audio; private Sounds.Set set; private bool play; private bool step; private bool farts; private float noiseRange = 22f; private float noiseLoud = 0.9f; private Vector3 baseScale; private float squash = -1f; private float depth = 0.3f; private float busyUntil; private float stepCool; private int noiseCount; private void Start() { //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) grab = ((Component)this).GetComponent<GrabbableObject>(); audio = ((Component)this).GetComponent<AudioSource>(); set = Sounds.For(grab); LootTag tag = ((Component)this).GetComponent<LootTag>(); play = Object.op_Implicit((Object)(object)tag) && tag.behaviour == "play"; ManifestItem manifestItem = LootItems.Entries.FirstOrDefault((LootItems.Entry e) => e.m.id == tag?.id)?.m; step = manifestItem?.step ?? false; farts = manifestItem != null && manifestItem.squeak == "whoopie"; if (manifestItem?.useNoise != null && manifestItem.useNoise.Length == 2) { noiseRange = manifestItem.useNoise[0]; noiseLoud = manifestItem.useNoise[1]; } baseScale = ((Component)this).transform.localScale; } private AudioClip Pick() { if (set == null || set.use.Length == 0) { if (!farts || Farts.Length == 0) { if (!play) { return Squeak; } return null; } return Farts[Random.Range(0, Farts.Length)]; } return set.use[Random.Range(0, set.use.Length)]; } internal void Use() { Use(0.3f); } internal void Use(float squashDepth) { if (play && Time.time < busyUntil) { return; } AudioClip val = Pick(); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)audio)) { audio.PlayOneShot(val); WalkieTalkie.TransmitOneShotAudio(audio, val, 1f); busyUntil = Time.time + val.length; if (!play) { squash = 0f; depth = squashDepth; } Noise(play ? noiseRange : 8f, play ? noiseLoud : 0.4f); if (play) { ((MonoBehaviour)this).StartCoroutine(PlayNoise(val.length)); } } } private IEnumerator PlayNoise(float len) { for (float t = 1f; t < len; t += 1f) { yield return (object)new WaitForSeconds(1f); Noise(noiseRange, noiseLoud); } } private void Noise(float range, float loud) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton != (Object)null && singleton.IsServer && Object.op_Implicit((Object)(object)RoundManager.Instance)) { RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, range, loud, noiseCount++, Object.op_Implicit((Object)(object)grab) && grab.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); } } private void Update() { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017d: 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_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) if (squash >= 0f) { squash += Time.deltaTime; float num = squash; float num2; if (num < 0.08f) { num2 = 1f - depth * (num / 0.08f); } else { float num3 = num - 0.08f; num2 = 1f - depth * Mathf.Exp((0f - num3) * 9f) * Mathf.Cos(num3 * 22f); } float num4 = 1f + Mathf.Max(0f, 1f - num2) * 0.15f; ((Component)this).transform.localScale = Vector3.Scale(baseScale, new Vector3(num4, num4, num2)); if (num > 0.6f) { ((Component)this).transform.localScale = baseScale; squash = -1f; } } if (!step || !Object.op_Implicit((Object)(object)grab) || grab.isHeld || !grab.hasHitGround || !(Time.time > stepCool) || !Object.op_Implicit((Object)(object)StartOfRound.Instance)) { return; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!Object.op_Implicit((Object)(object)val) || !val.isPlayerControlled || val.isPlayerDead) { continue; } Vector3 val2 = ((Component)val).transform.position - ((Component)this).transform.position; val2.y *= 0.5f; if (((Vector3)(ref val2)).magnitude < 0.45f) { Vector3 velocity = val.thisController.velocity; if (((Vector3)(ref velocity)).sqrMagnitude > 0.5f) { stepCool = Time.time + 0.8f; Use(0.5f); break; } } } } } public class Drink : MonoBehaviour { internal static AudioClip[] Gulp; internal static AudioClip Empty; internal bool empty; private string effect = ""; private GrabbableObject grab; private AudioSource audio; private bool drinking; internal int SaveData => empty ? 1 : 0; private void Start() { grab = ((Component)this).GetComponent<GrabbableObject>(); audio = ((Component)this).GetComponent<AudioSource>(); string id = ((Component)this).GetComponent<LootTag>()?.id; effect = LootItems.Entries.FirstOrDefault((LootItems.Entry e) => e.m.id == id)?.m.drink ?? ""; } internal void LoadData(int d) { empty = d == 1; } internal void Use() { if (!Object.op_Implicit((Object)(object)audio) || drinking) { return; } if (empty) { if (Object.op_Implicit((Object)(object)Empty)) { audio.PlayOneShot(Empty); } return; } empty = true; if (Object.op_Implicit((Object)(object)grab)) { grab.SetScrapValue(Mathf.Max(1, Mathf.RoundToInt((float)grab.scrapValue * 0.4f))); } PlayerControllerB val = (Object.op_Implicit((Object)(object)grab) ? grab.playerHeldBy : null); if (Object.op_Implicit((Object)(object)val)) { ((MonoBehaviour)val).StartCoroutine(Sip(val)); } } private IEnumerator Sip(PlayerControllerB pl) { drinking = true; pl.playerBodyAnimator.SetBool("useTZPItem", true); yield return (object)new WaitForSeconds(0.75f); if (Gulp != null && Gulp.Length != 0 && Object.op_Implicit((Object)(object)audio)) { AudioClip val = Gulp[Random.Range(0, Gulp.Length)]; audio.PlayOneShot(val); WalkieTalkie.TransmitOneShotAudio(audio, val, 1f); } yield return (object)new WaitForSeconds(0.75f); if (Object.op_Implicit((Object)(object)pl)) { pl.playerBodyAnimator.SetBool("useTZPItem", false); } drinking = false; if (Object.op_Implicit((Object)(object)pl) && !pl.isPlayerDead && (Object)(object)pl == (Object)(object)GameNetworkManager.Instance.localPlayerController) { Apply(pl); } } private void Apply(PlayerControllerB pl) { //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) string[] array = effect.Split(':'); switch (array[0]) { case "stamina": pl.sprintMeter = 1f; break; case "soda": pl.sprintMeter = Mathf.Clamp01(pl.sprintMeter + 0.5f); break; case "heal": pl.health = Mathf.Min(100, pl.health + 20); HUDManager.Instance.UpdateHealthUI(pl.health, false); if (pl.criticallyInjured && pl.health >= 20) { pl.MakeCriticallyInjured(false); } break; case "hurt": pl.DamagePlayer(Mathf.Min(15, pl.health - 1), true, true, (CauseOfDeath)0, 0, false, default(Vector3)); HUDManager.Instance.flashFilter = Mathf.Max(HUDManager.Instance.flashFilter, 0.35f); HUDManager.Instance.ShakeCamera((ScreenShakeType)0); ((MonoBehaviour)pl).StartCoroutine((pl.poisonSpeed > 0f) ? Poison(pl, 6f) : Drunk(pl, 6f)); break; case "crit": if (pl.health > 8) { pl.DamagePlayer(pl.health - 8, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); } else if (!pl.criticallyInjured) { pl.MakeCriticallyInjured(true); } HUDManager.Instance.flashFilter = 1f; HUDManager.Instance.ShakeCamera((ScreenShakeType)1); ((MonoBehaviour)pl).StartCoroutine((pl.poisonSpeed > 0f) ? Poison(pl, 12f) : Drunk(pl, 12f)); break; case "drunk": { float result; float secs = ((array.Length > 1 && float.TryParse(array[1], NumberStyles.Float, CultureInfo.InvariantCulture, out result)) ? result : 5f); ((MonoBehaviour)pl).StartCoroutine(Drunk(pl, secs)); break; } } } private static IEnumerator Poison(PlayerControllerB pl, float secs) { for (float t = 0f; t < secs; t += Time.deltaTime) { if (!Object.op_Implicit((Object)(object)pl)) { break; } if (pl.isPlayerDead) { break; } pl.poisonInertia = Mathf.Clamp(pl.poisonInertia + Time.deltaTime / 1.75f * pl.poisonSpeed, 0.1f, 3f); pl.increasingPoisonThisFrame = true; yield return null; } } private static IEnumerator Drunk(PlayerControllerB pl, float secs) { for (float t = 0f; t < secs; t += Time.deltaTime) { if (!Object.op_Implicit((Object)(object)pl)) { break; } if (pl.isPlayerDead) { break; } pl.drunknessInertia = Mathf.Clamp(pl.drunknessInertia + Time.deltaTime / 1.75f * pl.drunknessSpeed, 0.1f, 3f); pl.increasingDrunknessThisFrame = true; yield return null; } } } [HarmonyPatch(typeof(GrabbableObject), "ItemActivate")] internal static class JuiceActivatePatch { private static void Postfix(GrabbableObject __instance, bool buttonDown) { if (buttonDown) { UseSound component = ((Component)__instance).GetComponent<UseSound>(); if (Object.op_Implicit((Object)(object)component)) { component.Use(); } Drink component2 = ((Component)__instance).GetComponent<Drink>(); if (Object.op_Implicit((Object)(object)component2)) { component2.Use(); } PhoneRing component3 = ((Component)__instance).GetComponent<PhoneRing>(); if (Object.op_Implicit((Object)(object)component3)) { component3.HangUp(); } } } } [HarmonyPatch(typeof(GrabbableObject), "GetItemDataToSave")] internal static class DrinkSavePatch { private static bool Prefix(GrabbableObject __instance, ref int __result) { Drink component = ((Component)__instance).GetComponent<Drink>(); if (!Object.op_Implicit((Object)(object)component)) { return true; } __result = component.SaveData; return false; } } [HarmonyPatch(typeof(GrabbableObject), "LoadItemSaveData")] internal static class DrinkLoadPatch { private static bool Prefix(GrabbableObject __instance, int saveData) { Drink component = ((Component)__instance).GetComponent<Drink>(); if (!Object.op_Implicit((Object)(object)component)) { return true; } component.LoadData(saveData); return false; } } [HarmonyPatch(typeof(GrabbableObject), "PlayDropSFX")] internal static class ThudPatch { internal static readonly HashSet<string> Ids = new HashSet<string>(); private static void Postfix(GrabbableObject __instance) { //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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) LootTag component = ((Component)__instance).GetComponent<LootTag>(); if (!Object.op_Implicit((Object)(object)component) || !Ids.Contains(component.id) || !__instance.hasBeenHeld) { return; } Vector3 position = ((Component)__instance).transform.position; PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if (Object.op_Implicit((Object)(object)val) && !val.isPlayerDead) { float num = Vector3.Distance(((Component)val).transform.position, position); if (num < 5f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else if (num < 12f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } } NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton != (Object)null && singleton.IsServer && Object.op_Implicit((Object)(object)RoundManager.Instance)) { RoundManager.Instance.PlayAudibleNoise(position, 25f, 1f, 0, __instance.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); } if (Crush.Ids.Contains(component.id)) { Crush.Land(__instance); } } } [HarmonyPatch(typeof(GrabbableObject), "PlayDropSFX")] internal static class DustPatch { internal static readonly HashSet<string> Ids = new HashSet<string>(); private static void Postfix(GrabbableObject __instance) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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_0157: 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_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Expected O, but got Unknown //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) LootTag component = ((Component)__instance).GetComponent<LootTag>(); if (!Object.op_Implicit((Object)(object)component) || !Ids.Contains(component.id) || !Object.op_Implicit((Object)(object)Extinguisher.ParticleSrc) || !__instance.hasBeenHeld) { return; } MeshFilter component2 = ((Component)__instance).GetComponent<MeshFilter>(); Vector3? obj; if (component2 == null) { obj = null; } else { Mesh sharedMesh = component2.sharedMesh; if (sharedMesh == null) { obj = null; } else { Bounds bounds = sharedMesh.bounds; obj = ((Bounds)(ref bounds)).size; } } Vector3 val = (Vector3)(((??)obj) ?? (Vector3.one * 0.5f)); float num = Mathf.Clamp(Mathf.Max(new float[3] { val.x, val.y, val.z }) * 0.5f, 0.25f, 0.9f); GameObject val2 = Object.Instantiate<GameObject>(Extinguisher.ParticleSrc, ((Component)__instance).transform.position, Quaternion.Euler(-90f, 0f, 0f)); val2.SetActive(true); ParticleSystem[] componentsInChildren = val2.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val3 in componentsInChildren) { val3.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = val3.main; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).duration = 0.2f; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.8f, 1.4f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.4f, 1.1f); ((MainModule)(ref main)).startSize = new MinMaxCurve(num * 0.5f, num * 1f); ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.55f, 0.5f, 0.42f, 0.35f)); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(-0.02f); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; EmissionModule emission = val3.emission; ((EmissionModule)(ref emission)).enabled = true; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f); ((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[1] { new Burst(0f, (short)14, (short)20) }); ShapeModule shape = val3.shape; ((ShapeModule)(ref shape)).enabled = true; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)10; ((ShapeModule)(ref shape)).radius = num; ((ShapeModule)(ref shape)).arc = 360f; ColorOverLifetimeModule colorOverLifetime = val3.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val4 = new Gradient(); val4.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Color.white, 0f), new GradientColorKey(Color.white, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[3] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(0.6f, 0.3f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val4); val3.Play(); } Object.Destroy((Object)(object)val2, 3f); } } internal static class Crush { internal static readonly HashSet<string> Ids = new HashSet<string>(); private const float MinFall = 2f; private const float Radius = 0.9f; internal static void Land(GrabbableObject g) { //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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0151: 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_016a: 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_017a: Unknown result type (might be due to invalid IL or missing references) float num = g.startFallingPosition.y - g.targetFloorPosition.y; if (num < 2f) { return; } Vector3 position = ((Component)g).transform.position; Collider[] array = Physics.OverlapSphere(position + Vector3.up * 0.3f, 0.9f, 524288, (QueryTriggerInteraction)2); HashSet<EnemyAI> hashSet = new HashSet<EnemyAI>(); Collider[] array2 = array; foreach (Collider val in array2) { EnemyAI val2 = ((Component)val).GetComponentInParent<EnemyAICollisionDetect>()?.mainScript ?? ((Component)val).GetComponentInParent<EnemyAI>(); if (Object.op_Implicit((Object)(object)val2) && !val2.isEnemyDead && hashSet.Add(val2) && !(val2 is ForestGiantAI) && !(val2 is RadMechAI)) { val2.KillEnemyOnOwnerClient(!val2.enemyType.canDie); } } PlayerControllerB val3 = (Object.op_Implicit((Object)(object)GameNetworkManager.Instance) ? GameNetworkManager.Instance.localPlayerController : null); if (Object.op_Implicit((Object)(object)val3) && !val3.isPlayerDead && val3.isPlayerControlled) { Vector3 val4 = ((Component)val3).transform.position - position; Vector2 val5 = new Vector2(val4.x, val4.z); if (((Vector2)(ref val5)).magnitude < 0.9f && val4.y > -1.2f && val4.y < 0.6f) { val3.KillPlayer(Vector3.down * 8f, true, (CauseOfDeath)8, 0, default(Vector3), false); } } Plugin.Log.LogInfo((object)$"{g.itemProperties.itemName} landed after a {num:F1} m fall: crushed {hashSet.Count} enemies in range"); } } public class Floppy : MonoBehaviour { private Mesh mesh; private Vector3[] baseV; private Vector3[] baseN; private Vector3[] curV; private Vector3[] curN; private float[] w; private float[] legs; private Vector3 A; private Vector3 piv; private Vector3 pivLegs; private Vector3 theta; private Vector3 omega; private Vector3 lastPos; private Vector3 lastVel; private float stretch; private float sVel; private float maxStretch; private float amp; private float hz; private float gain; private bool init; private float shownT = -1f; private float shownS = -1f; private void Start() { //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) string id = ((Component)this).GetComponent<LootTag>()?.id; ManifestFloppy manifestFloppy = LootItems.Entries.FirstOrDefault((LootItems.Entry e) => e.m.id == id)?.m.floppy; MeshFilter component = ((Component)this).GetComponent<MeshFilter>(); if (manifestFloppy == null || !Object.op_Implicit((Object)(object)component)) { ((Behaviour)this).enabled = false; return; } mesh = component.mesh; baseV = mesh.vertices; baseN = mesh.normals; curV = (Vector3[])baseV.Clone(); curN = (Vector3[])baseN.Clone(); ? a; if (manifestFloppy.axis == null || manifestFloppy.axis.Length != 3) { a = new Vector3(0f, 0f, 1f); } else { Vector3 val = new Vector3(0f - manifestFloppy.axis[0], manifestFloppy.axis[1], manifestFloppy.axis[2]); a = ((Vector3)(ref val)).normalized; } A = (Vector3)a; float lo = baseV.Min((Vector3 v) => Vector3.Dot(v, A)); float hi = baseV.Max((Vector3 v) => Vector3.Dot(v, A)); float s0 = lo + (hi - lo) * manifestFloppy.from; piv = A * s0; w = baseV.Select(delegate(Vector3 v) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01((Vector3.Dot(v, A) - s0) / Mathf.Max(0.0001f, hi - s0)); return num * Mathf.Sqrt(num); }).ToArray(); if (manifestFloppy.to > 0f) { float s1 = lo + (hi - lo) * manifestFloppy.to; pivLegs = A * s1; legs = baseV.Select(delegate(Vector3 v) { //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) float num = Mathf.Clamp01((s1 - Vector3.Dot(v, A)) / Mathf.Max(0.0001f, s1 - lo)); return num * Mathf.Sqrt(num) * 0.6f; }).ToArray(); } amp = ((manifestFloppy.amp > 0f) ? manifestFloppy.amp : 30f); hz = ((manifestFloppy.hz > 0f) ? manifestFloppy.hz : 2f); maxStretch = manifestFloppy.stretch; gain = ((manifestFloppy.gain > 0f) ? manifestFloppy.gain : 1.5f); } private void Update() { //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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_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_0138: 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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: 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_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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01df: 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_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_044f: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Min(Time.deltaTime, 0.05f); if (num <= 0f) { return; } Vector3 position = ((Component)this).transform.position; if (!init) { init = true; lastPos = position; return; } Vector3 val = (position - lastPos) / num; Vector3 val2 = Vector3.ClampMagnitude((val - lastVel) / num, 60f); lastPos = position; lastVel = Vector3.ClampMagnitude(val, 30f); Vector3 val3 = ((Component)this).transform.InverseTransformDirection(val2); Vector3 val4 = Vector3.Cross(A, -val3) * gain; val4 -= A * Vector3.Dot(val4, A); float num2 = Mathf.Clamp((0f - Vector3.Dot(val3, A)) * 0.02f, 0f - maxStretch, maxStretch); float num3 = MathF.PI * 2f * hz; float num4 = num3 * num3; float num5 = 0.24f * num3; int num6 = Mathf.CeilToInt(num * 120f); float num7 = num / (float)num6; for (int i = 0; i < num6; i++) { omega += (num4 * (val4 - theta) - num5 * omega) * num7; theta += omega * num7; sVel += (num4 * (num2 - stretch) - num5 * sVel) * num7; stretch += sVel * num7; } theta -= A * Vector3.Dot(theta, A); if (((Vector3)(ref theta)).magnitude > amp) { theta = ((Vector3)(ref theta)).normalized * amp; omega *= 0.5f; } stretch = Mathf.Clamp(stretch, 0f - maxStretch, maxStretch); float magnitude = ((Vector3)(ref theta)).magnitude; if (Mathf.Abs(magnitude - shownT) < 0.05f && Mathf.Abs(stretch - shownS) < 0.002f) { return; } shownT = magnitude; shownS = stretch; Vector3 val5 = ((magnitude > 0.001f) ? (theta / magnitude) : Vector3.right); for (int j = 0; j < baseV.Length; j++) { if (legs != null && legs[j] > 0f) { Quaternion val6 = Quaternion.AngleAxis((0f - magnitude) * legs[j], val5); curV[j] = pivLegs + val6 * (baseV[j] - pivLegs); curN[j] = val6 * baseN[j]; } else if (w[j] <= 0f) { curV[j] = baseV[j]; curN[j] = baseN[j]; } else { Vector3 val7 = baseV[j] - piv; val7 += A * (Vector3.Dot(val7, A) * stretch * w[j]); Quaternion val8 = Quaternion.AngleAxis(magnitude * w[j], val5); curV[j] = piv + val8 * val7; curN[j] = val8 * baseN[j]; } } mesh.vertices = curV; mesh.normals = curN; mesh.RecalculateBounds(); } } public class Tint : MonoBehaviour { private Material[] mats; private Color[] pal; private void Init() { if (mats != null) { return; } string id = ((Component)this).GetComponent<LootTag>()?.id; ManifestItem m = LootItems.Entries.FirstOrDefault((LootItems.Entry e) => e.m.id == id)?.m; MeshRenderer component = ((Component)this).GetComponent<MeshRenderer>(); if (m?.tint == null || !Object.op_Implicit((Object)(object)component)) { mats = (Material[])(object)new Material[0]; return; } Material[] materials = ((Renderer)component).materials; mats = materials.Where((Material x, int i) => i < m.materials.Length && m.tint.mats.Any((string t) => m.materials[i].Contains(t))).ToArray(); pal = ((IEnumerable<float[]>)m.tint.palette).Select((Func<float[], Color>)((float[] c) => new Color(c[0] / 255f, c[1] / 255f, c[2] / 255f))).ToArray(); } internal void Apply(int value) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) Init(); if (pal != null && pal.Length != 0) { Color val = pal[Math.Abs(value) % pal.Length]; Material[] array = mats; foreach (Material obj in array) { obj.SetTexture("_BaseColorMap", (Texture)(object)Texture2D.whiteTexture); obj.SetColor("_BaseColor", val); } } } } [HarmonyPatch(typeof(GrabbableObject), "SetScrapValue")] internal static class TintValuePatch { private static void Postfix(GrabbableObject __instance, int setValueTo) { Tint component = ((Component)__instance).GetComponent<Tint>(); if (Object.op_Implicit((Object)(object)component)) { component.Apply(setValueTo); } } } internal static class ThrowQ { [HarmonyPatch(typeof(GrabbableObject), "ItemInteractLeftRight")] private static class StartPatch { private static void Postfix(GrabbableObject __instance, bool right) { //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_0056: 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_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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) LootTag component = ((Component)__instance).GetComponent<LootTag>(); PlayerControllerB playerHeldBy = __instance.playerHeldBy; if (!right && Object.op_Implicit((Object)(object)component) && Ids.Contains(component.id) && Object.op_Implicit((Object)(object)playerHeldBy) && !(__instance is StunGrenadeItem)) { Transform transform = ((Component)playerHeldBy.gameplayCamera).transform; component.throwDir = transform.forward; component.throwStart = transform.position + transform.forward * 0.6f + Vector3.down * 0.2f; component.path = null; component.flying = true; component.flightTime = 0f; component.thrown = true; if (((NetworkBehaviour)__instance).IsOwner) { ((MonoBehaviour)playerHeldBy).StartCoroutine(Release(playerHeldBy, __instance, component)); } } } private static IEnumerator Release(PlayerControllerB pl, GrabbableObject g, LootTag tag) { yield return null; if (!Object.op_Implicit((Object)(object)pl) || (Object)(object)pl.currentlyHeldObjectServer != (Object)(object)g) { tag.flying = false; tag.thrown = false; } else { ThrowArc.Simulate(tag.throwStart, tag.throwDir, out var hitPoint); pl.DiscardHeldObject(true, (NetworkObject)null, ThrowArc.Floor(hitPoint, g.itemProperties.verticalOffset), true); } } } [HarmonyPatch(typeof(GrabbableObject), "FallWithCurve")] private static class FlightPatch { private static bool Prefix(GrabbableObject __instance) { if (!(__instance is StunGrenadeItem)) { return !ThrowFlightPatch.Fly(__instance); } return true; } } [HarmonyPatch(typeof(GrabbableObject), "OnHitGround")] private static class LandPatch { private static void Postfix(GrabbableObject __instance) { LootTag component = ((Component)__instance).GetComponent<LootTag>(); if (Object.op_Implicit((Object)(object)component) && component.thrown && Ids.Contains(component.id) && !(__instance is StunGrenadeItem)) { component.thrown = false; UseSound component2 = ((Component)__instance).GetComponent<UseSound>(); if (Object.op_Implicit((Object)(object)component2)) { component2.Use(0.5f); } } } } [HarmonyPatch(typeof(GrabbableObject), "EquipItem")] private static class CatchPatch { private static void Postfix(GrabbableObject __instance) { LootTag component = ((Component)__instance).GetComponent<LootTag>(); if (Object.op_Implicit((Object)(object)component) && Ids.Contains(component.id)) { component.flying = false; component.thrown = false; component.path = null; if (Object.op_Implicit((Object)(object)__instance.playerHeldBy)) { __instance.playerHeldBy.equippedUsableItemQE = true; } } } } [HarmonyPatch(typeof(GrabbableObject), "PocketItem")] private static class PocketPatch { private static void Prefix(GrabbableObject __instance) { PlayerControllerB val = QOff(__instance); if (Object.op_Implicit((Object)(object)val)) { val.equippedUsableItemQE = false; } } } [HarmonyPatch(typeof(GrabbableObject), "DiscardItem")] private static class DiscardPatch { private static void Prefix(GrabbableObject __instance) { PlayerControllerB val = QOff(__instance); if (Object.op_Implicit((Object)(object)val)) { val.equippedUsableItemQE = false; } } } internal static readonly HashSet<string> Ids = new HashSet<string>(); private static PlayerControllerB QOff(GrabbableObject g) { LootTag component = ((Component)g).GetComponent<LootTag>(); if (!Object.op_Implicit((Object)(object)component) || !Ids.Contains(component.id)) { return null; } return g.playerHeldBy; } } [HarmonyPatch(typeof(GrabbableObject), "EquipItem")] internal static class PhoneEquipPatch { private static void Postfix(GrabbableObject __instance) { PhoneRing component = ((Component)__instance).GetComponent<PhoneRing>(); if (Object.op_Implicit((Object)(object)component)) { component.Equipped(); } } } public class LootTag : MonoBehaviour { public string id; public string behaviour; public float blastKill; public float blastDamage; public bool thrown; public bool exploded; public Vector3 throwStart; public Vector3 throwDir; public List<Vector3> path; public float flightTime; public bool flying; public Quaternion? pendingRot; public Vector3 lastDir; public float halfLen; public Vector3 tip; public bool disc; public int hitForce = 1; public PlayerControllerB thrower; public readonly HashSet<object> hitThisThrow = new HashSet<object>(); private void Awake() { Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true); foreach (Transform obj in componentsInChildren) { ((Object)((Component)obj).gameObject).hideFlags = (HideFlags)0; Component[] components = ((Component)obj).GetComponents<Component>(); foreach (Component val in components) { if (Object.op_Implicit((Object)(object)val)) { ((Object)val).hideFlags = (HideFlags)0; } } } } public Quaternion DiscAlong(Vector3 d, float spinDeg) { //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_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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.up - d * Vector3.Dot(Vector3.up, d); if (((Vector3)(ref val)).sqrMagnitude < 1E-06f) { val = Vector3.forward; } ((Vector3)(ref val)).Normalize(); return Quaternion.AngleAxis(spinDeg, val) * Quaternion.LookRotation(val, d); } public Quaternion StuckAlong(Vector3 d) { //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_0009: 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) if (!disc) { return PointAlong(d); } return DiscAlong(d, 0f); } public Quaternion PointAlong(Vector3 d) { //IL_001e: 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_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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_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: Unk