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 PartyAnimal Weapons v1.0.1
EmpressPartyAnimalItems.dll
Decompiled 10 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.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using REPOLib.Modules; using UnityEngine; using UnityEngine.Events; [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("Empress")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("EmpressPartyAnimalItems")] [assembly: AssemblyTitle("EmpressPartyAnimalItems")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.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 Empress.REPO.PartyAnimalItems { public static class PartyAnimalItemAudio { private const string BundleName = "partyanimalitemsassets"; private const string AudioBinName = "partyanimalitemsaudio.xorbin"; private static readonly Dictionary<PartyAnimalWeaponKind, AudioClip[]> clips = new Dictionary<PartyAnimalWeaponKind, AudioClip[]>(); private static AssetBundle? bundle; private static AudioClip? fuseClip; public static void Load(string pluginDirectory) { LoadBundle(pluginDirectory); LoadAudio(pluginDirectory); } public static void Play(PartyAnimalWeaponKind kind, AudioSource? source, float volume = 0.9f) { if (!((Object)(object)source == (Object)null) && clips.TryGetValue(kind, out AudioClip[] value) && value.Length != 0) { source.spatialBlend = 1f; source.minDistance = 2f; source.maxDistance = 28f; source.rolloffMode = (AudioRolloffMode)1; source.PlayOneShot(value[Random.Range(0, value.Length)], volume); } } public static void PlayAt(PartyAnimalWeaponKind kind, Vector3 position, float volume = 0.9f) { //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_003b: 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_0087: Expected O, but got Unknown if (clips.TryGetValue(kind, out AudioClip[] value) && value.Length != 0) { AudioClip val = value[Random.Range(0, value.Length)]; GameObject val2 = new GameObject($"Empress Party Animal {kind} Audio"); val2.transform.position = position; AudioSource obj = val2.AddComponent<AudioSource>(); obj.spatialBlend = 1f; obj.minDistance = 2f; obj.maxDistance = 30f; obj.rolloffMode = (AudioRolloffMode)1; obj.PlayOneShot(val, volume); Object.Destroy((Object)val2, val.length + 0.35f); } } public static void PlayShockAt(Vector3 position, float volume = 0.55f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) PlayAt(PartyAnimalWeaponKind.Taser, position, volume); } public static void PlayFuseAt(Vector3 position, float duration) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown AudioClip clip = FuseClip(); GameObject val = new GameObject("Empress Party Animal Bomb Fuse Audio"); val.transform.position = position; AudioSource obj = val.AddComponent<AudioSource>(); obj.clip = clip; obj.loop = true; obj.spatialBlend = 1f; obj.minDistance = 1.2f; obj.maxDistance = 18f; obj.rolloffMode = (AudioRolloffMode)1; obj.volume = 0.55f; obj.pitch = Random.Range(0.94f, 1.08f); obj.Play(); Object.Destroy((Object)val, duration + 0.15f); } public static GameObject? LoadVisual(PartyAnimalWeaponKind kind) { AssetBundle val = bundle; if ((Object)(object)val == (Object)null) { return null; } string text = VisualAssetName(kind); GameObject val2 = val.LoadAsset<GameObject>(text); if ((Object)(object)val2 != (Object)null) { return val2; } return val.LoadAsset<GameObject>("assets/partyanimalitemmodels/prefabs/" + text.ToLowerInvariant() + ".prefab"); } private static void LoadBundle(string pluginDirectory) { string text = Resolve(pluginDirectory, "partyanimalitemsassets"); if (!File.Exists(text)) { PartyAnimalItemsPlugin.Log.LogWarning((object)"Missing partyanimalitemsassets; Party Animals item visuals will be skipped."); return; } bundle = AssetBundle.LoadFromFile(text); if (!Object.op_Implicit((Object)(object)bundle)) { PartyAnimalItemsPlugin.Log.LogWarning((object)"Could not load partyanimalitemsassets."); } } private static void LoadAudio(string pluginDirectory) { clips.Clear(); string path = Resolve(pluginDirectory, "partyanimalitemsaudio.xorbin"); if (!File.Exists(path)) { PartyAnimalItemsPlugin.Log.LogWarning((object)"Missing partyanimalitemsaudio.xorbin; Party Animals weapon audio will be skipped."); return; } Dictionary<string, AudioClip> dictionary = LoadXorBin(path); Map(PartyAnimalWeaponKind.Crossbow, dictionary, "crossbow_fire"); Map(PartyAnimalWeaponKind.Taser, dictionary, "taser_fire"); Map(PartyAnimalWeaponKind.Bomb, dictionary, "bomb_explode"); Map(PartyAnimalWeaponKind.Nunchucks, dictionary, "nunchucks_whoosh"); PartyAnimalItemsPlugin.Log.LogInfo((object)$"Loaded {dictionary.Count} Party Animals item audio clip(s)."); } private static string Resolve(string pluginDirectory, string fileName) { string text = Path.Combine(pluginDirectory, fileName); if (File.Exists(text)) { return text; } return Path.Combine(Path.GetDirectoryName(PartyAnimalItemsPlugin.PluginDirectory) ?? pluginDirectory, fileName); } private static Dictionary<string, AudioClip> LoadXorBin(string path) { byte[] array = File.ReadAllBytes(path); for (int i = 0; i < array.Length; i++) { array[i] ^= Key(i); } Dictionary<string, AudioClip> dictionary = new Dictionary<string, AudioClip>(StringComparer.OrdinalIgnoreCase); using MemoryStream input = new MemoryStream(array); using BinaryReader binaryReader = new BinaryReader(input, Encoding.UTF8); if (Encoding.ASCII.GetString(binaryReader.ReadBytes(4)) != "EPAI") { return dictionary; } binaryReader.ReadInt32(); int num = binaryReader.ReadInt32(); for (int j = 0; j < num; j++) { int count = binaryReader.ReadInt32(); string @string = Encoding.UTF8.GetString(binaryReader.ReadBytes(count)); int count2 = binaryReader.ReadInt32(); byte[] data = binaryReader.ReadBytes(count2); AudioClip val = CreateClipFromWav(@string, data); if ((Object)(object)val != (Object)null) { dictionary[@string] = val; } } return dictionary; } private static AudioClip? CreateClipFromWav(string name, byte[] data) { using MemoryStream memoryStream = new MemoryStream(data); using BinaryReader binaryReader = new BinaryReader(memoryStream); if (Encoding.ASCII.GetString(binaryReader.ReadBytes(4)) != "RIFF") { return null; } binaryReader.ReadInt32(); if (Encoding.ASCII.GetString(binaryReader.ReadBytes(4)) != "WAVE") { return null; } short format = 0; short num = 0; int num2 = 0; short num3 = 0; byte[] array = null; while (memoryStream.Position + 8 <= memoryStream.Length) { string @string = Encoding.ASCII.GetString(binaryReader.ReadBytes(4)); int num4 = binaryReader.ReadInt32(); long val = memoryStream.Position + num4 + (num4 & 1); if (@string == "fmt ") { format = binaryReader.ReadInt16(); num = binaryReader.ReadInt16(); num2 = binaryReader.ReadInt32(); binaryReader.ReadInt32(); binaryReader.ReadInt16(); num3 = binaryReader.ReadInt16(); } else if (@string == "data") { array = binaryReader.ReadBytes(num4); } memoryStream.Position = Math.Min(val, memoryStream.Length); } if (array == null || num <= 0 || num2 <= 0 || num3 <= 0) { return null; } float[] array2 = ConvertSamples(array, format, num3); if (array2.Length == 0) { return null; } AudioClip obj = AudioClip.Create(name, array2.Length / num, (int)num, num2, false); obj.SetData(array2, 0); return obj; } private static float[] ConvertSamples(byte[] data, short format, short bits) { if (format == 3 && bits == 32) { float[] array = new float[data.Length / 4]; Buffer.BlockCopy(data, 0, array, 0, data.Length); return array; } int num = bits / 8; if (num <= 0) { return Array.Empty<float>(); } int num2 = data.Length / num; float[] array2 = new float[num2]; for (int i = 0; i < num2; i++) { int num3 = i * num; float[] array3 = array2; int num4 = i; array3[num4] = bits switch { 8 => (float)(data[num3] - 128) / 128f, 16 => (float)BitConverter.ToInt16(data, num3) / 32768f, 24 => (float)ReadInt24(data, num3) / 8388608f, 32 => (float)BitConverter.ToInt32(data, num3) / 2.1474836E+09f, _ => 0f, }; } return array2; } private static int ReadInt24(byte[] data, int offset) { int num = data[offset] | (data[offset + 1] << 8) | (data[offset + 2] << 16); if (((uint)num & 0x800000u) != 0) { num |= -16777216; } return num; } private static byte Key(int index) { return (byte)(0xA7u ^ (uint)(index * 31)); } private static AudioClip FuseClip() { if ((Object)(object)fuseClip != (Object)null) { return fuseClip; } int num = Mathf.RoundToInt(9261f); float[] array = new float[num]; for (int i = 0; i < num; i++) { float num2 = (float)i / 22050f; float num3 = Random.Range(-1f, 1f) * 0.18f; float num4 = ((Random.value > 0.94f) ? Random.Range(-0.9f, 0.9f) : 0f); float num5 = Mathf.Sin(num2 * 92f) * 0.05f + Mathf.Sin(num2 * 173f) * 0.035f; array[i] = Mathf.Clamp(num3 + num4 + num5, -1f, 1f); } fuseClip = AudioClip.Create("EmpressPartyAnimalBombFuse", num, 1, 22050, false); fuseClip.SetData(array, 0); return fuseClip; } private static string VisualAssetName(PartyAnimalWeaponKind kind) { return kind switch { PartyAnimalWeaponKind.Crossbow => "EmpressPartyAnimalVisual_Crossbow", PartyAnimalWeaponKind.FreezingGun => "EmpressPartyAnimalVisual_FreezingGun", PartyAnimalWeaponKind.Taser => "EmpressPartyAnimalVisual_Taser", PartyAnimalWeaponKind.Bomb => "EmpressPartyAnimalVisual_Bomb", PartyAnimalWeaponKind.Nunchucks => "EmpressPartyAnimalVisual_Nunchucks", _ => string.Empty, }; } private static void Map(PartyAnimalWeaponKind kind, Dictionary<string, AudioClip> all, string prefix) { List<AudioClip> list = new List<AudioClip>(); foreach (KeyValuePair<string, AudioClip> item in all) { if (item.Key.IndexOf(prefix, StringComparison.OrdinalIgnoreCase) >= 0) { list.Add(item.Value); } } if (list.Count > 0) { clips[kind] = list.ToArray(); } } } public sealed class PartyAnimalItemDefinition { public PartyAnimalWeaponKind Kind { get; } public string PrefabName { get; } public string ItemName { get; } public string Description { get; } public itemType ItemType { get; } public emojiIcon Icon { get; } public itemVolume Volume { get; } public float ValueMin { get; } public float ValueMax { get; } public int MaxShop { get; } public int Damage { get; } public float Radius { get; } public float Force { get; } public Color Primary { get; } public Color Secondary { get; } public Color Accent { get; } public PartyAnimalItemDefinition(PartyAnimalWeaponKind kind, string prefabName, string itemName, string description, itemType itemType, emojiIcon icon, itemVolume volume, float valueMin, float valueMax, int maxShop, int damage, float radius, float force, Color primary, Color secondary, Color accent) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0036: 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_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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) Kind = kind; PrefabName = prefabName; ItemName = itemName; Description = description; ItemType = itemType; Icon = icon; Volume = volume; ValueMin = valueMin; ValueMax = valueMax; MaxShop = maxShop; Damage = damage; Radius = radius; Force = force; Primary = primary; Secondary = secondary; Accent = accent; } } public static class PartyAnimalItemDefinitions { public static readonly IReadOnlyList<PartyAnimalItemDefinition> All = new PartyAnimalItemDefinition[4] { new PartyAnimalItemDefinition(PartyAnimalWeaponKind.Crossbow, "EmpressPartyAnimalItem_Crossbow", "Party Crossbow", "A toy-looking crossbow that hits much harder than it looks.", (itemType)9, (emojiIcon)25, (itemVolume)2, 16000f, 26000f, 1, 18, 1.4f, 10f, new Color(0.58f, 0.28f, 0.13f), new Color(0.12f, 0.08f, 0.06f), new Color(1f, 0.78f, 0.22f)), new PartyAnimalItemDefinition(PartyAnimalWeaponKind.Taser, "EmpressPartyAnimalItem_Taser", "Party Taser", "Zaps targets into a short tumble and punishes anything too close to the shot.", (itemType)9, (emojiIcon)25, (itemVolume)1, 15000f, 25000f, 1, 8, 2f, 9f, new Color(0.08f, 0.08f, 0.09f), new Color(0.95f, 0.85f, 0.12f), new Color(0.2f, 0.95f, 1f)), new PartyAnimalItemDefinition(PartyAnimalWeaponKind.Bomb, "EmpressPartyAnimalItem_Bomb", "Party Bomb", "A fuse bomb with a chunky Party Animals blast adapted for REPO.", (itemType)6, (emojiIcon)13, (itemVolume)1, 12000f, 22000f, 2, 45, 5.5f, 18f, new Color(0.08f, 0.08f, 0.08f), new Color(0.78f, 0.12f, 0.08f), new Color(1f, 0.68f, 0.08f)), new PartyAnimalItemDefinition(PartyAnimalWeaponKind.Nunchucks, "EmpressPartyAnimalItem_Nunchucks", "Party Nunchucks", "A swinging melee toy that becomes everyone else's problem.", (itemType)7, (emojiIcon)18, (itemVolume)1, 13000f, 23000f, 1, 16, 1.8f, 12f, new Color(0.18f, 0.11f, 0.06f), new Color(0.06f, 0.06f, 0.065f), new Color(0.85f, 0.65f, 0.26f)) }; } public sealed class PartyAnimalItemFactory { private readonly Dictionary<itemType, GameObject> templates = new Dictionary<itemType, GameObject>(); private GameObject? prefabBank; public bool TryRegisterAll() { ResolveTemplates(); if (templates.Count == 0) { return false; } int num = 0; foreach (PartyAnimalItemDefinition item in PartyAnimalItemDefinitions.All) { GameObject template = GetTemplate(item); if ((Object)(object)template == (Object)null) { PartyAnimalItemsPlugin.Log.LogWarning((object)("Skipping " + item.ItemName + ": no REPO item template was found.")); continue; } ItemAttributes val = CreatePrefab(item, template); if (Object.op_Implicit((Object)(object)val) && Items.RegisterItem(val) != null) { num++; } } if (num > 0) { PartyAnimalItemsPlugin.Log.LogInfo((object)$"Registered {num} Party Animals shop item(s) with REPOLib."); } return num > 0; } private void ResolveTemplates() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Invalid comparison between Unknown and I4 //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Invalid comparison between Unknown and I4 //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Invalid comparison between Unknown and I4 templates.Clear(); if (!Object.op_Implicit((Object)(object)StatsManager.instance)) { return; } foreach (Item value in StatsManager.instance.itemDictionary.Values) { PrefabRef val = (Object.op_Implicit((Object)(object)value) ? PartyAnimalRepoAccess.ItemPrefab(value) : null); if (!Object.op_Implicit((Object)(object)value) || PartyAnimalRepoAccess.ItemDisabled(value) || val == null || !val.IsValid()) { continue; } GameObject prefab = val.Prefab; if (Object.op_Implicit((Object)(object)prefab)) { itemType val2 = PartyAnimalRepoAccess.ItemType(value); if ((int)val2 == 9 && Object.op_Implicit((Object)(object)prefab.GetComponent<ItemGun>()) && !templates.ContainsKey((itemType)9)) { templates[(itemType)9] = prefab; } else if ((int)val2 == 6 && Object.op_Implicit((Object)(object)prefab.GetComponent<ItemGrenade>()) && !templates.ContainsKey((itemType)6)) { templates[(itemType)6] = prefab; } else if ((int)val2 == 7 && Object.op_Implicit((Object)(object)prefab.GetComponent<ItemMelee>()) && !templates.ContainsKey((itemType)7)) { templates[(itemType)7] = prefab; } } } } private GameObject? GetTemplate(PartyAnimalItemDefinition definition) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (templates.TryGetValue(definition.ItemType, out GameObject value) && Object.op_Implicit((Object)(object)value)) { return value; } foreach (GameObject value2 in templates.Values) { if (Object.op_Implicit((Object)(object)value2)) { return value2; } } return null; } private ItemAttributes? CreatePrefab(PartyAnimalItemDefinition definition, GameObject template) { //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_01cf: 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: Expected O, but got Unknown GameObject val = EnsurePrefabBank(); GameObject val2 = Object.Instantiate<GameObject>(template, val.transform, false); ((Object)val2).name = definition.PrefabName; ((Object)val2).hideFlags = (HideFlags)61; val2.SetActive(true); ItemAttributes component = val2.GetComponent<ItemAttributes>(); Item val3 = (Object.op_Implicit((Object)(object)component) ? PartyAnimalRepoAccess.AttributesItem(component) : null); if (!Object.op_Implicit((Object)(object)component) || (Object)(object)val3 == (Object)null || !Object.op_Implicit((Object)(object)val3)) { PartyAnimalItemsPlugin.Log.LogWarning((object)("Skipping " + definition.ItemName + ": template has no ItemAttributes.")); return null; } Item val4 = Object.Instantiate<Item>(val3); ((Object)val4).name = definition.PrefabName.ToLowerInvariant(); PartyAnimalRepoAccess.SetField<Item, string>(val4, "itemName", definition.ItemName); PartyAnimalRepoAccess.SetField<Item, LocalizedAsset>(val4, "itemNameLocalized", null); PartyAnimalRepoAccess.SetField<Item, string>(val4, "description", definition.Description); PartyAnimalRepoAccess.SetField<Item, itemType>(val4, "itemType", definition.ItemType); PartyAnimalRepoAccess.SetField<Item, emojiIcon>(val4, "emojiIcon", definition.Icon); PartyAnimalRepoAccess.SetField<Item, itemVolume>(val4, "itemVolume", definition.Volume); PartyAnimalRepoAccess.SetField<Item, itemSecretShopType>(val4, "itemSecretShopType", (itemSecretShopType)0); PartyAnimalRepoAccess.SetField<Item, int>(val4, "maxAmount", 1); PartyAnimalRepoAccess.SetField<Item, int>(val4, "maxAmountInShop", definition.MaxShop); PartyAnimalRepoAccess.SetField<Item, bool>(val4, "maxPurchase", value: false); PartyAnimalRepoAccess.SetField<Item, bool>(val4, "physicalItem", value: true); Value val5 = ScriptableObject.CreateInstance<Value>(); ((Object)val5).name = definition.PrefabName + "_Value"; PartyAnimalRepoAccess.SetField<Value, float>(val5, "valueMin", definition.ValueMin); PartyAnimalRepoAccess.SetField<Value, float>(val5, "valueMax", definition.ValueMax); PartyAnimalRepoAccess.SetField<Item, Value>(val4, "value", val5); PartyAnimalRepoAccess.SetField<ItemAttributes, Item>(component, "item", val4); PartyAnimalRepoAccess.SetField<ItemAttributes, emojiIcon>(component, "emojiIcon", definition.Icon); PartyAnimalRepoAccess.SetField<ItemAttributes, itemType>(component, "itemType", definition.ItemType); PartyAnimalRepoAccess.SetField<ItemAttributes, string>(component, "itemName", definition.ItemName); PartyAnimalRepoAccess.SetField<ItemAttributes, string>(component, "promptName", definition.ItemName); PartyAnimalRepoAccess.SetField<ItemAttributes, string>(component, "itemAssetName", ((Object)val4).name); ConfigureFunctionalComponents(val2, definition, val.transform); PartyAnimalItemVisuals.ReplaceTemplateVisuals(val2, definition); PartyAnimalWeaponController partyAnimalWeaponController = val2.GetComponent<PartyAnimalWeaponController>() ?? val2.AddComponent<PartyAnimalWeaponController>(); partyAnimalWeaponController.Configure(definition); ItemGrenade component2 = val2.GetComponent<ItemGrenade>(); UnityEvent val6 = (Object.op_Implicit((Object)(object)component2) ? PartyAnimalRepoAccess.GetField<ItemGrenade, UnityEvent>(component2, "onDetonate") : null); if (Object.op_Implicit((Object)(object)component2) && val6 != null) { val6.AddListener(new UnityAction(partyAnimalWeaponController.OnGrenadeDetonated)); } return component; } private static void ConfigureFunctionalComponents(GameObject prefab, PartyAnimalItemDefinition definition, Transform bank) { //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Expected O, but got Unknown //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Invalid comparison between Unknown and I4 ItemBattery component = prefab.GetComponent<ItemBattery>(); if (Object.op_Implicit((Object)(object)component)) { PartyAnimalRepoAccess.SetField<ItemBattery, bool>(component, "autoDrain", value: false); PartyAnimalRepoAccess.SetField<ItemBattery, float>(component, "batteryDrainRate", 0f); PartyAnimalRepoAccess.SetField<ItemBattery, bool>(component, "isUnchargable", value: false); PartyAnimalRepoAccess.SetField<ItemBattery, bool>(component, "suppressBatteryUI", value: false); } ItemGun component2 = prefab.GetComponent<ItemGun>(); HurtCollider[] componentsInChildren; if (Object.op_Implicit((Object)(object)component2)) { PartyAnimalRepoAccess.MuteGunSounds(component2); PartyAnimalRepoAccess.SetField<ItemGun, bool>(component2, "hasOneShot", value: true); PartyAnimalRepoAccess.SetField<ItemGun, bool>(component2, "hasBuildUp", value: false); PartyAnimalRepoAccess.SetField<ItemGun, int>(component2, "numberOfBullets", 1); PartyAnimalRepoAccess.SetField<ItemGun, float>(component2, "gunRandomSpread", (definition.Kind == PartyAnimalWeaponKind.Crossbow) ? 1.5f : 0.5f); PartyAnimalRepoAccess.SetField<ItemGun, float>(component2, "gunRange", (definition.Kind == PartyAnimalWeaponKind.Crossbow) ? 48f : 34f); PartyAnimalRepoAccess.SetField<ItemGun, float>(component2, "gunRecoilForce", (definition.Kind == PartyAnimalWeaponKind.Crossbow) ? 1.2f : 0.45f); PartyAnimalRepoAccess.SetField<ItemGun, float>(component2, "cameraShakeMultiplier", (definition.Kind == PartyAnimalWeaponKind.Crossbow) ? 0.7f : 0.35f); PartyAnimalRepoAccess.SetField<ItemGun, float>(component2, "shootCooldown", (definition.Kind == PartyAnimalWeaponKind.Taser) ? 1.05f : 1.25f); PartyAnimalRepoAccess.SetField<ItemGun, float>(component2, "batteryDrain", (definition.Kind == PartyAnimalWeaponKind.Taser) ? 18f : 12f); PartyAnimalRepoAccess.SetField<ItemGun, bool>(component2, "batteryDrainFullBar", value: false); PartyAnimalRepoAccess.SetField<ItemGun, float>(component2, "misfirePercentageChange", 0f); PartyAnimalRepoAccess.SetField<ItemGun, float>(component2, "investigateRadius", 18f); GameObject val = PartyAnimalRepoAccess.GunBulletPrefab(component2); if ((Object)(object)val != (Object)null) { GameObject val2 = Object.Instantiate<GameObject>(val, bank, false); ((Object)val2).name = definition.PrefabName + "_RepoBullet"; ((Object)val2).hideFlags = (HideFlags)61; val2.SetActive(true); PartyAnimalRepoAccess.SetField<ItemGun, GameObject>(component2, "bulletPrefab", val2); componentsInChildren = val2.GetComponentsInChildren<HurtCollider>(true); for (int i = 0; i < componentsInChildren.Length; i++) { ConfigureHurtCollider(componentsInChildren[i], definition, 0); } } } ItemGrenade component3 = prefab.GetComponent<ItemGrenade>(); if (Object.op_Implicit((Object)(object)component3)) { PartyAnimalRepoAccess.MuteSound(PartyAnimalRepoAccess.GetField<ItemGrenade, Sound>(component3, "soundSplinter")); PartyAnimalRepoAccess.MuteSound(PartyAnimalRepoAccess.GetField<ItemGrenade, Sound>(component3, "soundTick")); PartyAnimalRepoAccess.SetField<ItemGrenade, float>(component3, "tickTime", 2.1f); PartyAnimalRepoAccess.SetField<ItemGrenade, UnityEvent>(component3, "onDetonate", new UnityEvent()); } ItemMelee component4 = prefab.GetComponent<ItemMelee>(); if (Object.op_Implicit((Object)(object)component4)) { PartyAnimalRepoAccess.SetField<ItemMelee, bool>(component4, "usesBatteryLogic", value: true); PartyAnimalRepoAccess.SetField<ItemMelee, bool>(component4, "hasBrokenMesh", value: false); PartyAnimalRepoAccess.SetField<ItemMelee, float>(component4, "durabilityDrain", 2.5f); PartyAnimalRepoAccess.SetField<ItemMelee, float>(component4, "durabilityDrainOnEnemiesAndPVP", 5f); PartyAnimalRepoAccess.SetField<ItemMelee, float>(component4, "hitFreeze", 0.08f); PartyAnimalRepoAccess.SetField<ItemMelee, float>(component4, "swingDetectSpeedMultiplier", 0.75f); PartyAnimalRepoAccess.SetField<ItemMelee, float>(component4, "scrollSwingForce", 7f); PartyAnimalRepoAccess.SetField<ItemMelee, float>(component4, "forwardTilt", 20f); } int collisionDamage = (((int)definition.ItemType == 7) ? definition.Damage : 0); componentsInChildren = prefab.GetComponentsInChildren<HurtCollider>(true); for (int i = 0; i < componentsInChildren.Length; i++) { ConfigureHurtCollider(componentsInChildren[i], definition, collisionDamage); } } private static void ConfigureHurtCollider(HurtCollider hurtCollider, PartyAnimalItemDefinition definition, int collisionDamage) { bool flag = collisionDamage > 0; PartyAnimalRepoAccess.SetField<HurtCollider, bool>(hurtCollider, "playerLogic", flag); PartyAnimalRepoAccess.SetField<HurtCollider, bool>(hurtCollider, "enemyLogic", flag); PartyAnimalRepoAccess.SetField<HurtCollider, bool>(hurtCollider, "playerKill", value: false); PartyAnimalRepoAccess.SetField<HurtCollider, bool>(hurtCollider, "enemyKill", value: false); PartyAnimalRepoAccess.SetField<HurtCollider, int>(hurtCollider, "playerDamage", collisionDamage); PartyAnimalRepoAccess.SetField<HurtCollider, int>(hurtCollider, "enemyDamage", collisionDamage); PartyAnimalRepoAccess.SetField<HurtCollider, float>(hurtCollider, "playerDamageCooldown", flag ? 0.35f : 0f); PartyAnimalRepoAccess.SetField<HurtCollider, float>(hurtCollider, "enemyDamageCooldown", flag ? 0.35f : 0f); PartyAnimalRepoAccess.SetField<HurtCollider, float>(hurtCollider, "playerTumbleForce", flag ? definition.Force : 0f); PartyAnimalRepoAccess.SetField<HurtCollider, float>(hurtCollider, "playerTumbleTime", flag ? 0.55f : 0f); PartyAnimalRepoAccess.SetField<HurtCollider, float>(hurtCollider, "enemyFreezeTime", (definition.Kind == PartyAnimalWeaponKind.FreezingGun) ? 2.4f : 0.1f); PartyAnimalRepoAccess.SetField<HurtCollider, float>(hurtCollider, "enemyStunTime", (definition.Kind == PartyAnimalWeaponKind.Taser) ? 5.6f : 0.35f); PartyAnimalRepoAccess.SetField<HurtCollider, float>(hurtCollider, "physHitForce", definition.Force); PartyAnimalRepoAccess.SetField<HurtCollider, float>(hurtCollider, "enemyHitForce", definition.Force); } private GameObject EnsurePrefabBank() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown if ((Object)(object)prefabBank != (Object)null) { return prefabBank; } prefabBank = new GameObject("Empress Party Animal Items Prefab Bank") { hideFlags = (HideFlags)61 }; prefabBank.SetActive(false); Object.DontDestroyOnLoad((Object)(object)prefabBank); return prefabBank; } } [HarmonyPatch(typeof(ItemGun), "ShootBulletRPC")] public static class PartyAnimalGunBulletPatch { private static void Postfix(ItemGun __instance, Vector3 _endPosition, bool _hit, int _shooterID) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) PartyAnimalWeaponController component = ((Component)__instance).GetComponent<PartyAnimalWeaponController>(); if (Object.op_Implicit((Object)(object)component)) { component.OnGunBullet(_endPosition, _shooterID); } } } [HarmonyPatch(typeof(ItemMelee), "StateSetRPC")] public static class PartyAnimalMeleeStatePatch { private static void Postfix(ItemMelee __instance, int _newState) { if (_newState == 2) { PartyAnimalWeaponController component = ((Component)__instance).GetComponent<PartyAnimalWeaponController>(); if (Object.op_Implicit((Object)(object)component)) { component.OnMeleeSwing(); } } } } [HarmonyPatch(typeof(ItemGrenade), "TickStartRPC")] public static class PartyAnimalGrenadeTickStartPatch { private static void Postfix(ItemGrenade __instance) { PartyAnimalWeaponController component = ((Component)__instance).GetComponent<PartyAnimalWeaponController>(); if (Object.op_Implicit((Object)(object)component)) { component.OnBombArmed(); } } } [HarmonyPatch(typeof(ItemGrenade), "TickEndRPC")] public static class PartyAnimalGrenadeTickEndPatch { private static void Postfix(ItemGrenade __instance) { PartyAnimalWeaponController component = ((Component)__instance).GetComponent<PartyAnimalWeaponController>(); if (Object.op_Implicit((Object)(object)component)) { component.OnGrenadeDetonated(); } } } public static class PartyAnimalItemRegistry { private static bool registered; private static PartyAnimalItemFactory? factory; public static void TryRegister() { if (!registered) { if (factory == null) { factory = new PartyAnimalItemFactory(); } registered = factory.TryRegisterAll(); } } } [HarmonyPatch(typeof(StatsManager), "LoadItemsFromFolder")] public static class PartyAnimalStatsManagerLoadItemsPatch { private static void Postfix() { PartyAnimalItemRegistry.TryRegister(); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Empress.REPO.PartyAnimalItems", "Empress Party Animal Items", "1.0.0")] public sealed class PartyAnimalItemsPlugin : BaseUnityPlugin { public const string PluginGuid = "Empress.REPO.PartyAnimalItems"; public const string PluginName = "Empress Party Animal Items"; public const string PluginVersion = "1.0.0"; private Harmony? harmony; internal static ManualLogSource Log { get; private set; } = null; internal static string PluginDirectory { get; private set; } = string.Empty; private void Awake() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; PluginDirectory = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location) ?? Paths.PluginPath; ((Component)this).transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); PartyAnimalItemAudio.Load(PluginDirectory); harmony = new Harmony("Empress.REPO.PartyAnimalItems"); harmony.PatchAll(); Log.LogInfo((object)"Empress Party Animal Items v1.0.0 loaded."); } } public static class PartyAnimalItemVisuals { private const int MaxColliderTriangles = 36; private const float MinColliderExtent = 0.015f; public static void ReplaceTemplateVisuals(GameObject prefab, PartyAnimalItemDefinition definition) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } ParticleSystem[] componentsInChildren2 = prefab.GetComponentsInChildren<ParticleSystem>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { componentsInChildren2[i].Stop(true, (ParticleSystemStopBehavior)0); } RemoveTemplatePhysicalColliders(prefab); GameObject val = new GameObject("Empress Party Animal Visual"); val.transform.SetParent(prefab.transform, false); val.transform.localPosition = Vector3.zero; val.transform.localRotation = Quaternion.identity; val.transform.localScale = Vector3.one; GameObject val2 = PartyAnimalItemAudio.LoadVisual(definition.Kind); if ((Object)(object)val2 == (Object)null) { PartyAnimalItemsPlugin.Log.LogWarning((object)("Missing bundled visual for " + definition.ItemName + ".")); return; } GameObject val3 = Object.Instantiate<GameObject>(val2, val.transform, false); ((Object)val3).name = ((Object)val2).name; val3.transform.localPosition = Vector3.zero; val3.transform.localRotation = Quaternion.identity; val3.transform.localScale = Vector3.one; SetLayer(val, prefab.layer); if (AddCollisionMeshes(val3.transform) == 0) { AddFallbackBox(val3.transform); } } private static int AddCollisionMeshes(Transform root) { int num = 0; Renderer[] componentsInChildren = ((Component)root).GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if (val.enabled && !(val is ParticleSystemRenderer)) { Mesh val2 = CreateCollisionMesh(val); if ((Object)(object)val2 == (Object)null || !HasValidCollisionShape(val2)) { DestroyMesh(val2); continue; } MeshCollider obj = ((Component)val).gameObject.AddComponent<MeshCollider>(); obj.cookingOptions = (MeshColliderCookingOptions)14; obj.convex = true; ((Collider)obj).isTrigger = false; obj.sharedMesh = val2; ConfigureColliderObject(((Component)val).gameObject); ((Component)val).gameObject.AddComponent<PhysGrabObjectCollider>(); ((Component)val).gameObject.AddComponent<PhysGrabObjectMeshCollider>().showGizmo = false; num++; } } return num; } private static Mesh? CreateCollisionMesh(Renderer renderer) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) Mesh val = null; Mesh val2 = null; SkinnedMeshRenderer val3 = (SkinnedMeshRenderer)(object)((renderer is SkinnedMeshRenderer) ? renderer : null); if (val3 != null && (Object)(object)val3.sharedMesh != (Object)null) { val2 = new Mesh { name = ((Object)renderer).name + "_EmpressPartyAnimalCollider", hideFlags = (HideFlags)61 }; try { val3.BakeMesh(val2); val = val2; } catch { val = val3.sharedMesh; } } else { MeshFilter component = ((Component)renderer).GetComponent<MeshFilter>(); if ((Object)(object)component != (Object)null && (Object)(object)component.sharedMesh != (Object)null) { val = component.sharedMesh; } } Mesh val4 = CreateReducedMesh(val, ((Object)renderer).name + "_EmpressPartyAnimalCollider"); if ((Object)(object)val4 == (Object)null && (Object)(object)val != (Object)null) { val4 = CreateBoxMesh(val.bounds, ((Object)renderer).name + "_EmpressPartyAnimalCollider"); } DestroyMesh(val2); return val4; } private static Mesh? CreateReducedMesh(Mesh? sourceMesh, string name) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)sourceMesh == (Object)null || !sourceMesh.isReadable) { return null; } Vector3[] vertices = sourceMesh.vertices; int[] triangles = sourceMesh.triangles; if (!HasValidVertexSet(vertices, sourceMesh.bounds) || triangles.Length < 3) { return null; } int num = triangles.Length / 3; int num2 = Mathf.Min(num, 36); Vector3[] array = (Vector3[])(object)new Vector3[num2 * 3]; int[] array2 = new int[num2 * 3]; for (int i = 0; i < num2; i++) { int num3 = ((num2 > 1) ? Mathf.RoundToInt((float)i * ((float)num - 1f) / ((float)num2 - 1f)) : 0) * 3; int num4 = i * 3; array[num4] = vertices[triangles[num3]]; array[num4 + 1] = vertices[triangles[num3 + 1]]; array[num4 + 2] = vertices[triangles[num3 + 2]]; array2[num4] = num4; array2[num4 + 1] = num4 + 1; array2[num4 + 2] = num4 + 2; } Mesh val = new Mesh { name = name, hideFlags = (HideFlags)61, vertices = array, triangles = array2 }; val.RecalculateBounds(); return val; } private static Mesh? CreateBoxMesh(Bounds bounds, string name) { //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_0010: 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_0022: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00a2: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_010f: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0152: 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_015e: 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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Expected O, but got Unknown Vector3 size = ((Bounds)(ref bounds)).size; if (Mathf.Max(new float[3] { size.x, size.y, size.z }) < 0.015f) { return null; } Vector3 min = ((Bounds)(ref bounds)).min; Vector3 max = ((Bounds)(ref bounds)).max; Vector3[] vertices = (Vector3[])(object)new Vector3[8] { new Vector3(min.x, min.y, min.z), new Vector3(max.x, min.y, min.z), new Vector3(max.x, max.y, min.z), new Vector3(min.x, max.y, min.z), new Vector3(min.x, min.y, max.z), new Vector3(max.x, min.y, max.z), new Vector3(max.x, max.y, max.z), new Vector3(min.x, max.y, max.z) }; int[] triangles = new int[36] { 0, 2, 1, 0, 3, 2, 4, 5, 6, 4, 6, 7, 0, 1, 5, 0, 5, 4, 2, 3, 7, 2, 7, 6, 1, 2, 6, 1, 6, 5, 3, 0, 4, 3, 4, 7 }; Mesh val = new Mesh { name = name, hideFlags = (HideFlags)61, vertices = vertices, triangles = triangles }; val.RecalculateBounds(); return val; } private static bool HasValidCollisionShape(Mesh mesh) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (mesh.isReadable && mesh.vertexCount >= 3) { return HasValidVertexSet(mesh.vertices, mesh.bounds); } return false; } private static bool HasValidVertexSet(IReadOnlyList<Vector3> vertices, Bounds bounds) { //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_0010: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) Vector3 size = ((Bounds)(ref bounds)).size; if (Mathf.Max(new float[3] { size.x, size.y, size.z }) < 0.015f) { return false; } HashSet<Vector3Int> hashSet = new HashSet<Vector3Int>(); for (int i = 0; i < vertices.Count; i++) { Vector3 val = vertices[i]; hashSet.Add(new Vector3Int(Mathf.RoundToInt(val.x * 10000f), Mathf.RoundToInt(val.y * 10000f), Mathf.RoundToInt(val.z * 10000f))); if (hashSet.Count >= 3) { return true; } } return false; } private static void AddFallbackBox(Transform root) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Expected O, but got Unknown //IL_0124: Unknown result type (might be due to invalid IL or missing references) Bounds val = CalculateVisualBounds(root); GameObject val2 = new GameObject("EmpressPartyAnimalFallbackGrabBounds"); val2.transform.SetParent(root, false); val2.transform.localPosition = root.InverseTransformPoint(((Bounds)(ref val)).center); val2.transform.localRotation = Quaternion.identity; val2.transform.localScale = Vector3.one; Vector3 size = ((Bounds)(ref val)).size; Vector3 lossyScale = root.lossyScale; size.x = ((lossyScale.x == 0f) ? 0.3f : (size.x / Mathf.Abs(lossyScale.x))); size.y = ((lossyScale.y == 0f) ? 0.3f : (size.y / Mathf.Abs(lossyScale.y))); size.z = ((lossyScale.z == 0f) ? 0.3f : (size.z / Mathf.Abs(lossyScale.z))); BoxCollider obj = val2.AddComponent<BoxCollider>(); obj.center = Vector3.zero; obj.size = Vector3.Max(size, Vector3.one * 0.12f); ((Collider)obj).isTrigger = false; ConfigureColliderObject(val2); val2.AddComponent<PhysGrabObjectCollider>(); val2.AddComponent<PhysGrabObjectBoxCollider>().drawGizmos = false; } private static Bounds CalculateVisualBounds(Transform root) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = ((Component)root).GetComponentsInChildren<Renderer>(true); Bounds bounds = default(Bounds); ((Bounds)(ref bounds))..ctor(root.position, Vector3.one * 0.3f); bool flag = false; Renderer[] array = componentsInChildren; foreach (Renderer val in array) { if (val.enabled && !(val is ParticleSystemRenderer)) { if (flag) { ((Bounds)(ref bounds)).Encapsulate(val.bounds); continue; } bounds = val.bounds; flag = true; } } return bounds; } private static void SetLayer(GameObject gameObject, int layer) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) gameObject.layer = layer; foreach (Transform item in gameObject.transform) { SetLayer(((Component)item).gameObject, layer); } } private static void ConfigureColliderObject(GameObject gameObject) { gameObject.tag = "Phys Grab Object"; int num = LayerMask.NameToLayer("PhysGrabObject"); if (num >= 0) { gameObject.layer = num; } } private static void RemoveTemplatePhysicalColliders(GameObject prefab) { PhysGrabObjectCollider[] componentsInChildren = prefab.GetComponentsInChildren<PhysGrabObjectCollider>(true); for (int i = 0; i < componentsInChildren.Length; i++) { DestroyComponent((Component)(object)componentsInChildren[i]); } PhysGrabObjectBoxCollider[] componentsInChildren2 = prefab.GetComponentsInChildren<PhysGrabObjectBoxCollider>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { DestroyComponent((Component)(object)componentsInChildren2[i]); } PhysGrabObjectMeshCollider[] componentsInChildren3 = prefab.GetComponentsInChildren<PhysGrabObjectMeshCollider>(true); for (int i = 0; i < componentsInChildren3.Length; i++) { DestroyComponent((Component)(object)componentsInChildren3[i]); } Collider[] componentsInChildren4 = prefab.GetComponentsInChildren<Collider>(true); foreach (Collider val in componentsInChildren4) { if ((Object)(object)val != (Object)null && !val.isTrigger && !Object.op_Implicit((Object)(object)((Component)val).GetComponentInParent<HurtCollider>())) { DestroyComponent((Component)(object)val); } } } private static void DestroyComponent(Component component) { if ((Object)(object)component != (Object)null) { Object.DestroyImmediate((Object)(object)component); } } private static void DestroyMesh(Mesh? mesh) { //IL_000a: 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) if ((Object)(object)mesh != (Object)null && (((Object)mesh).hideFlags & 0x3D) != 0) { Object.DestroyImmediate((Object)(object)mesh); } } } public static class PartyAnimalRepoAccess { private static readonly FieldRef<PlayerAvatar, PlayerHealth> PlayerHealthRef = AccessTools.FieldRefAccess<PlayerAvatar, PlayerHealth>("playerHealth"); private static readonly FieldRef<PlayerAvatar, PlayerTumble> PlayerTumbleRef = AccessTools.FieldRefAccess<PlayerAvatar, PlayerTumble>("tumble"); private static readonly Dictionary<string, bool> FieldExistsCache = new Dictionary<string, bool>(); public static PlayerHealth? Health(PlayerAvatar player) { try { return PlayerHealthRef.Invoke(player); } catch (Exception) { return null; } } public static PlayerTumble? Tumble(PlayerAvatar player) { try { return PlayerTumbleRef.Invoke(player); } catch (Exception) { return null; } } public static TField GetField<TInstance, TField>(TInstance instance, string fieldName, TField fallback = default(TField)) where TInstance : class { if (!FieldExists<TInstance>(fieldName)) { return fallback; } try { return AccessTools.FieldRefAccess<TInstance, TField>(fieldName).Invoke(instance); } catch (Exception) { return fallback; } } public static bool SetField<TInstance, TField>(TInstance instance, string fieldName, TField value) where TInstance : class { if (!FieldExists<TInstance>(fieldName)) { return false; } try { AccessTools.FieldRefAccess<TInstance, TField>(fieldName).Invoke(instance) = value; return true; } catch (Exception) { return false; } } public static Item? AttributesItem(ItemAttributes attributes) { return GetField<ItemAttributes, Item>(attributes, "item"); } public static PrefabRef? ItemPrefab(Item item) { return GetField<Item, PrefabRef>(item, "prefab"); } public static itemType ItemType(Item item) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return GetField<Item, itemType>(item, "itemType", (itemType)0); } public static bool ItemDisabled(Item item) { return GetField<Item, bool>(item, "disabled", fallback: false); } public static Transform? GunMuzzle(ItemGun gun) { return GetField<ItemGun, Transform>(gun, "gunMuzzle"); } public static GameObject? GunBulletPrefab(ItemGun gun) { return GetField<ItemGun, GameObject>(gun, "bulletPrefab"); } public static PhysGrabObject? GunPhysGrabObject(ItemGun gun) { return GetField<ItemGun, PhysGrabObject>(gun, "physGrabObject"); } public static void MuteGunSounds(ItemGun gun) { MuteSound(GetField<ItemGun, Sound>(gun, "soundShoot")); MuteSound(GetField<ItemGun, Sound>(gun, "soundShootGlobal")); MuteSound(GetField<ItemGun, Sound>(gun, "soundHit")); MuteSound(GetField<ItemGun, Sound>(gun, "soundNoAmmo")); } private static bool FieldExists<TInstance>(string fieldName) { string key = typeof(TInstance).FullName + ":" + fieldName; if (FieldExistsCache.TryGetValue(key, out var value)) { return value; } Type type = typeof(TInstance); while (type != null) { foreach (FieldInfo declaredField in AccessTools.GetDeclaredFields(type)) { if (declaredField.Name == fieldName) { FieldExistsCache[key] = true; return true; } } type = type.BaseType; } FieldExistsCache[key] = false; return false; } public static void MuteSound(Sound? sound) { if (sound != null) { SetField<Sound, AudioClip[]>(sound, "Sounds", Array.Empty<AudioClip>()); SetField<Sound, float>(sound, "Volume", 0f); SetField<Sound, float>(sound, "VolumeDefault", 0f); SetField<Sound, float>(sound, "VolumeRandom", 0f); } } public static EnemyHealth? EnemyHealth(Enemy enemy) { return GetField<Enemy, EnemyHealth>(enemy, "Health"); } public static bool EnemyHasStateStunned(Enemy enemy) { return GetField<Enemy, bool>(enemy, "HasStateStunned", fallback: false); } public static EnemyStateStunned? EnemyStateStunned(Enemy enemy) { return GetField<Enemy, EnemyStateStunned>(enemy, "StateStunned"); } } public sealed class PartyAnimalWeaponController : MonoBehaviour { public const float TaserStunDuration = 5.6f; public const float TaserChainRadius = 2.65f; public PartyAnimalWeaponKind kind; public int damage; public float radius; public float force; public float freezeTime; public float tumbleTime; private AudioSource? audioSource; private ItemGun? itemGun; private ItemGrenade? itemGrenade; private ItemMelee? itemMelee; private Transform? visualRoot; private Transform? arrowPart; private Vector3 visualBasePosition; private Quaternion visualBaseRotation; private Vector3 visualBaseScale = Vector3.one; private float lastSoundTime; private float lastEffectTime; private float animationTimer; private float animationLength = 0.34f; private float bombArmedPulseTimer; private float lastBombArmTime; public void Configure(PartyAnimalItemDefinition definition) { kind = definition.Kind; damage = definition.Damage; radius = definition.Radius; force = definition.Force; freezeTime = ((definition.Kind == PartyAnimalWeaponKind.FreezingGun) ? 2.6f : 0f); tumbleTime = ((definition.Kind == PartyAnimalWeaponKind.Taser) ? 5.6f : ((definition.Kind == PartyAnimalWeaponKind.Crossbow) ? 0.35f : 0f)); CacheVisuals(); } private void Awake() { itemGun = ((Component)this).GetComponent<ItemGun>(); itemGrenade = ((Component)this).GetComponent<ItemGrenade>(); itemMelee = ((Component)this).GetComponent<ItemMelee>(); audioSource = ((Component)this).GetComponent<AudioSource>(); if (!Object.op_Implicit((Object)(object)audioSource)) { audioSource = ((Component)this).gameObject.AddComponent<AudioSource>(); } CacheVisuals(); } private void Update() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_0162: 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_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)visualRoot)) { CacheVisuals(); } Transform val = visualRoot; if ((Object)(object)val == (Object)null) { return; } bool flag = animationTimer > 0f; bool flag2 = kind == PartyAnimalWeaponKind.Bomb && bombArmedPulseTimer > 0f; if (flag2) { bombArmedPulseTimer -= Time.deltaTime; } if (!flag && !flag2) { val.localPosition = visualBasePosition; val.localRotation = visualBaseRotation; val.localScale = visualBaseScale; return; } float num = (flag ? Mathf.Clamp01(1f - animationTimer / animationLength) : 1f); float num2 = (flag ? Mathf.Sin(num * MathF.PI) : 0f); if (flag) { animationTimer -= Time.deltaTime; } float num3 = (flag2 ? (Mathf.Sin(Time.time * 18f) * 0.055f) : 0f); float num4 = kind switch { PartyAnimalWeaponKind.Crossbow => 0.08f, PartyAnimalWeaponKind.FreezingGun => 0.05f, PartyAnimalWeaponKind.Taser => 0.04f, PartyAnimalWeaponKind.Nunchucks => 0.12f, PartyAnimalWeaponKind.Bomb => 0.07f, _ => 0.04f, }; val.localPosition = visualBasePosition + Vector3.back * num2 * num4 + Vector3.up * Mathf.Abs(num3) * 0.035f; val.localRotation = visualBaseRotation * Quaternion.Euler((kind == PartyAnimalWeaponKind.Nunchucks) ? (num2 * 65f) : (num2 * -7f), (kind == PartyAnimalWeaponKind.Nunchucks) ? (Mathf.Sin(num * MathF.PI * 2f) * 40f) : (num3 * 120f), 0f); val.localScale = visualBaseScale * (1f + num3); } public void OnGunBullet(Vector3 endPosition, int shooterId) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) PlaySound(0.22f); StartAttackAnimation(); Transform val = (((Object)(object)itemGun != (Object)null) ? PartyAnimalRepoAccess.GunMuzzle(itemGun) : null); Vector3 val2 = (((Object)(object)val != (Object)null) ? val.position : ((Component)this).transform.position); Vector3 val3 = endPosition - val2; if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { val3 = ((Component)this).transform.forward; endPosition = val2 + val3 * 24f; } PartyAnimalProjectileVisual.Spawn(kind, (kind == PartyAnimalWeaponKind.Crossbow) ? arrowPart : null, val2, endPosition, ProjectileSpeed()); if (kind == PartyAnimalWeaponKind.FreezingGun && !SemiFunc.IsMasterClientOrSingleplayer()) { ((MonoBehaviour)this).StartCoroutine(SpawnFreezeVisualsDelayed(Mathf.Clamp(Vector3.Distance(val2, endPosition) / ProjectileSpeed(), 0.04f, 0.55f), val2, endPosition, ((Vector3)(ref val3)).normalized, shooterId)); } if (kind == PartyAnimalWeaponKind.Taser) { ((MonoBehaviour)this).StartCoroutine(SpawnShockVisualsDelayed(Mathf.Clamp(Vector3.Distance(val2, endPosition) / ProjectileSpeed(), 0.04f, 0.55f), val2, endPosition, ((Vector3)(ref val3)).normalized, shooterId)); } if (SemiFunc.IsMasterClientOrSingleplayer() && !(Time.time - lastEffectTime < 0.12f)) { lastEffectTime = Time.time; ((MonoBehaviour)this).StartCoroutine(ApplyPointDelayed(Mathf.Clamp(Vector3.Distance(val2, endPosition) / ProjectileSpeed(), 0.04f, 0.55f), val2, endPosition, ((Vector3)(ref val3)).normalized, shooterId)); } } public void OnGrenadeDetonated() { //IL_0036: 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) if (!(Time.time - lastEffectTime < 0.18f)) { lastEffectTime = Time.time; bombArmedPulseTimer = 0f; PartyAnimalItemAudio.PlayAt(kind, ((Component)this).transform.position, 1f); StartAttackAnimation(); if (SemiFunc.IsMasterClientOrSingleplayer()) { ApplyExplosion(((Component)this).transform.position); } } } public void OnBombArmed() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (kind == PartyAnimalWeaponKind.Bomb) { if (Time.time - lastBombArmTime > 0.25f) { lastBombArmTime = Time.time; PartyAnimalItemAudio.PlayFuseAt(((Component)this).transform.position, 2.1f); PartyAnimalBombFuseEffect.Spawn((Transform)(((Object)(object)visualRoot != (Object)null) ? ((object)visualRoot) : ((object)((Component)this).transform)), 2.1f); } bombArmedPulseTimer = 2.1f; StartAttackAnimation(); } } public void OnMeleeSwing() { PlaySound(0.22f, 0.78f); StartAttackAnimation(); } private IEnumerator ApplyPointDelayed(float delay, Vector3 start, Vector3 end, Vector3 direction, int shooterId) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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) yield return (object)new WaitForSeconds(delay); ApplyPoint(start, end, direction, shooterId); } private IEnumerator SpawnFreezeVisualsDelayed(float delay, Vector3 start, Vector3 end, Vector3 direction, int shooterId) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) yield return (object)new WaitForSeconds(delay); SpawnFreezeVisuals(start, end, direction, shooterId); } private IEnumerator SpawnShockVisualsDelayed(float delay, Vector3 start, Vector3 end, Vector3 direction, int shooterId) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) yield return (object)new WaitForSeconds(delay); SpawnShockVisuals(start, end, direction, shooterId); } private void CacheVisuals() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) visualRoot = ((Component)this).transform.Find("Empress Party Animal Visual"); if (Object.op_Implicit((Object)(object)visualRoot)) { visualBasePosition = visualRoot.localPosition; visualBaseRotation = visualRoot.localRotation; visualBaseScale = visualRoot.localScale; arrowPart = FindChild(visualRoot, "Arrow"); } } private static Transform? FindChild(Transform root, string name) { Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if (((Object)val).name.IndexOf(name, StringComparison.OrdinalIgnoreCase) >= 0) { return val; } } return null; } private void StartAttackAnimation() { animationLength = ((kind == PartyAnimalWeaponKind.Nunchucks) ? 0.48f : 0.34f); animationTimer = animationLength; if (kind == PartyAnimalWeaponKind.Crossbow && Object.op_Implicit((Object)(object)arrowPart)) { ((MonoBehaviour)this).StartCoroutine(HideArrowBriefly()); } } private IEnumerator HideArrowBriefly() { Transform val = arrowPart; if ((Object)(object)val == (Object)null) { yield break; } Renderer[] renderers = ((Component)val).GetComponentsInChildren<Renderer>(true); Renderer[] array = renderers; for (int i = 0; i < array.Length; i++) { array[i].enabled = false; } yield return (object)new WaitForSeconds(0.38f); array = renderers; foreach (Renderer val2 in array) { if (Object.op_Implicit((Object)(object)val2)) { val2.enabled = true; } } } private float ProjectileSpeed() { return kind switch { PartyAnimalWeaponKind.Crossbow => 44f, PartyAnimalWeaponKind.FreezingGun => 19f, PartyAnimalWeaponKind.Taser => 32f, _ => 28f, }; } private void PlaySound(float cooldown, float volume = 0.9f) { if (!(Time.time - lastSoundTime < cooldown)) { lastSoundTime = Time.time; PartyAnimalItemAudio.Play(kind, audioSource, volume); } } private void ApplyPoint(Vector3 start, Vector3 end, Vector3 direction, int shooterId) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0247: 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_0264: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: 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_01fb: 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_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) HashSet<PlayerAvatar> hashSet = new HashSet<PlayerAvatar>(); HashSet<Enemy> hashSet2 = new HashSet<Enemy>(); HashSet<Rigidbody> hashSet3 = new HashSet<Rigidbody>(); int num = -1; float num2 = Vector3.Distance(start, end); RaycastHit[] array = Physics.SphereCastAll(start, (kind == PartyAnimalWeaponKind.Crossbow) ? 0.16f : 0.28f, direction, num2, num, (QueryTriggerInteraction)2); for (int i = 0; i < array.Length; i++) { RaycastHit val = array[i]; AddHit(((RaycastHit)(ref val)).collider, hashSet, hashSet2, hashSet3, ((Component)this).transform); } Collider[] array2 = Physics.OverlapSphere(end, radius, num, (QueryTriggerInteraction)2); for (int i = 0; i < array2.Length; i++) { AddHit(array2[i], hashSet, hashSet2, hashSet3, ((Component)this).transform); } PlayerAvatar val2 = ((shooterId >= 0) ? SemiFunc.PlayerAvatarGetFromPhotonID(shooterId) : null); AddSceneTargets(start, end, (kind == PartyAnimalWeaponKind.Taser) ? 1.2f : Mathf.Max(0.65f, radius * 0.35f), val2, hashSet, hashSet2); HashSet<PlayerAvatar> hashSet4 = new HashSet<PlayerAvatar>(); if (kind == PartyAnimalWeaponKind.Taser) { PartyAnimalItemAudio.Play(kind, audioSource, 0.75f); ExpandShockTargets(hashSet, hashSet2, hashSet3, hashSet4, val2, ((Component)this).transform); } foreach (PlayerAvatar item in hashSet) { if (!((Object)(object)item == (Object)(object)val2) || (kind == PartyAnimalWeaponKind.Taser && hashSet4.Contains(item))) { ApplyToPlayer(item, val2); } } foreach (Enemy item2 in hashSet2) { ApplyToEnemy(item2, direction, val2); } foreach (Rigidbody item3 in hashSet3) { if (!Object.op_Implicit((Object)(object)item3)) { continue; } if (kind == PartyAnimalWeaponKind.FreezingGun) { if (!item3.isKinematic) { item3.velocity *= 0.08f; item3.angularVelocity *= 0.08f; } PartyAnimalIceEffect.Spawn(((Component)item3).transform, freezeTime, Vector3.one * 0.85f); } else if (kind == PartyAnimalWeaponKind.Taser) { PartyAnimalShockEffect.Spawn(((Component)item3).transform, 5.6f, Vector3.one * 0.95f); ((MonoBehaviour)this).StartCoroutine(ShockBody(item3, 5.6f, direction)); } else if (!item3.isKinematic) { item3.AddForceAtPosition(direction * force, end, (ForceMode)1); } } } private IEnumerator ShockBody(Rigidbody body, float duration, Vector3 direction) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) float timer = 0f; while (Object.op_Implicit((Object)(object)body) && timer < duration) { if (!body.isKinematic) { body.velocity *= 0.28f; body.angularVelocity *= 0.28f; body.AddForce((direction + Vector3.up * 0.55f) * 0.75f, (ForceMode)1); } timer += 0.18f; yield return (object)new WaitForSeconds(0.18f); } } private static void SpawnFreezeVisuals(Vector3 start, Vector3 end, Vector3 direction, int shooterId) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_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_005d: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_017d: 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) HashSet<PlayerAvatar> hashSet = new HashSet<PlayerAvatar>(); HashSet<Enemy> hashSet2 = new HashSet<Enemy>(); HashSet<Rigidbody> hashSet3 = new HashSet<Rigidbody>(); int num = -1; float num2 = Vector3.Distance(start, end); RaycastHit[] array = Physics.SphereCastAll(start, 0.28f, direction, num2, num, (QueryTriggerInteraction)2); for (int i = 0; i < array.Length; i++) { RaycastHit val = array[i]; AddHit(((RaycastHit)(ref val)).collider, hashSet, hashSet2, hashSet3); } Collider[] array2 = Physics.OverlapSphere(end, 2.6f, num, (QueryTriggerInteraction)2); for (int i = 0; i < array2.Length; i++) { AddHit(array2[i], hashSet, hashSet2, hashSet3); } PlayerAvatar val2 = ((shooterId >= 0) ? SemiFunc.PlayerAvatarGetFromPhotonID(shooterId) : null); AddSceneTargets(start, end, 1.05f, val2, hashSet, hashSet2); foreach (PlayerAvatar item in hashSet) { if ((Object)(object)item != (Object)(object)val2) { PartyAnimalIceEffect.Spawn(((Component)item).transform, 2.6f, new Vector3(1.1f, 1.75f, 1.1f)); } } foreach (Enemy item2 in hashSet2) { PartyAnimalIceEffect.Spawn(((Component)item2).transform, 2.6f, new Vector3(1.4f, 1.9f, 1.4f)); } foreach (Rigidbody item3 in hashSet3) { if (Object.op_Implicit((Object)(object)item3)) { PartyAnimalIceEffect.Spawn(((Component)item3).transform, 2.6f, Vector3.one * 0.85f); } } } private static void SpawnShockVisuals(Vector3 start, Vector3 end, Vector3 direction, int shooterId) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_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_005d: 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_00f5: 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_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) HashSet<PlayerAvatar> hashSet = new HashSet<PlayerAvatar>(); HashSet<Enemy> hashSet2 = new HashSet<Enemy>(); HashSet<Rigidbody> hashSet3 = new HashSet<Rigidbody>(); int num = -1; float num2 = Vector3.Distance(start, end); RaycastHit[] array = Physics.SphereCastAll(start, 0.34f, direction, num2, num, (QueryTriggerInteraction)2); for (int i = 0; i < array.Length; i++) { RaycastHit val = array[i]; AddHit(((RaycastHit)(ref val)).collider, hashSet, hashSet2, hashSet3); } Collider[] array2 = Physics.OverlapSphere(end, 2.25f, num, (QueryTriggerInteraction)2); for (int i = 0; i < array2.Length; i++) { AddHit(array2[i], hashSet, hashSet2, hashSet3); } PlayerAvatar val2 = ((shooterId >= 0) ? SemiFunc.PlayerAvatarGetFromPhotonID(shooterId) : null); AddSceneTargets(start, end, 1.2f, val2, hashSet, hashSet2); ExpandShockTargets(hashSet, hashSet2, hashSet3, new HashSet<PlayerAvatar>(), val2, null); foreach (PlayerAvatar item in hashSet) { if ((Object)(object)item != (Object)(object)val2) { PartyAnimalShockEffect.Spawn(((Component)item).transform, 5.6f, new Vector3(1.1f, 1.75f, 1.1f)); } } foreach (Enemy item2 in hashSet2) { PartyAnimalShockEffect.Spawn(((Component)item2).transform, 5.6f, new Vector3(1.4f, 1.9f, 1.4f)); } foreach (Rigidbody item3 in hashSet3) { if (Object.op_Implicit((Object)(object)item3)) { PartyAnimalShockEffect.Spawn(((Component)item3).transform, 5.6f, Vector3.one * 0.95f); } } } private void ApplyExplosion(Vector3 origin) { //IL_0014: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_0123: Unknown result type (might be due to invalid IL or missing references) int num = -1; HashSet<PlayerAvatar> hashSet = new HashSet<PlayerAvatar>(); HashSet<Enemy> hashSet2 = new HashSet<Enemy>(); HashSet<Rigidbody> hashSet3 = new HashSet<Rigidbody>(); Collider[] array = Physics.OverlapSphere(origin, radius, num, (QueryTriggerInteraction)2); for (int i = 0; i < array.Length; i++) { AddHit(array[i], hashSet, hashSet2, hashSet3, ((Component)this).transform); } AddSceneTargetsSphere(origin, radius, hashSet, hashSet2); foreach (PlayerAvatar item in hashSet) { ApplyToPlayer(item, null); } foreach (Enemy item2 in hashSet2) { Vector3 val = ((Component)item2).transform.position - origin; Vector3 normalized = ((Vector3)(ref val)).normalized; ApplyToEnemy(item2, (((Vector3)(ref normalized)).sqrMagnitude > 0f) ? normalized : Vector3.up, null); } foreach (Rigidbody item3 in hashSet3) { if (Object.op_Implicit((Object)(object)item3) && !item3.isKinematic) { item3.AddExplosionForce(force, origin, radius, 0.5f, (ForceMode)1); } } } private void ApplyToPlayer(PlayerAvatar player, PlayerAvatar? shooter) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_0106: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) PlayerHealth val = PartyAnimalRepoAccess.Health(player); PlayerTumble val2 = PartyAnimalRepoAccess.Tumble(player); if ((Object)(object)val != (Object)null && damage > 0) { val.HurtOther(damage, ((Component)player).transform.position, true, -1, false); } if ((Object)(object)val != (Object)null && freezeTime > 0f) { val.HurtFreezeOverride(freezeTime); PartyAnimalIceEffect.Spawn(((Component)player).transform, freezeTime, new Vector3(1.1f, 1.75f, 1.1f)); } if ((Object)(object)val2 != (Object)null && tumbleTime > 0f) { val2.TumbleRequest(true, false); if (kind == PartyAnimalWeaponKind.Taser) { PartyAnimalShockEffect.Spawn(((Component)player).transform, 5.6f, new Vector3(1.1f, 1.75f, 1.1f)); PartyAnimalShockAura.Attach(((Component)player).transform, player, shooter, 5.6f); val2.TumbleOverride(true); Vector3 val3 = ((Component)player).transform.localRotation * Vector3.back; val2.TumbleForce((val3 + Vector3.up * 0.45f) * 7f); Vector3 insideUnitSphere = Random.insideUnitSphere; val2.TumbleTorque(((Vector3)(ref insideUnitSphere)).normalized * 35f); } val2.TumbleOverrideTime(tumbleTime); } } private void ApplyToEnemy(Enemy enemy, Vector3 direction, PlayerAvatar? shooter) { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) if (kind == PartyAnimalWeaponKind.Taser && PartyAnimalRepoAccess.EnemyHasStateStunned(enemy)) { EnemyStateStunned val = PartyAnimalRepoAccess.EnemyStateStunned(enemy); if ((Object)(object)val != (Object)null) { val.Set(5.6f); PartyAnimalShockEffect.Spawn(((Component)enemy).transform, 5.6f, new Vector3(1.4f, 1.9f, 1.4f)); PartyAnimalShockAura.Attach(((Component)enemy).transform, null, shooter, 5.6f); } } if (freezeTime > 0f) { enemy.Freeze(freezeTime); PartyAnimalIceEffect.Spawn(((Component)enemy).transform, freezeTime, new Vector3(1.4f, 1.9f, 1.4f)); } EnemyHealth val2 = PartyAnimalRepoAccess.EnemyHealth(enemy); if ((Object)(object)val2 != (Object)null && damage > 0) { val2.Hurt((kind == PartyAnimalWeaponKind.Bomb) ? 999 : damage, direction); } } private static void AddHit(Collider collider, HashSet<PlayerAvatar> players, HashSet<Enemy> enemies, HashSet<Rigidbody> bodies, Transform? ignoredRoot = null) { if (Object.op_Implicit((Object)(object)collider) && (!((Object)(object)ignoredRoot != (Object)null) || !((Component)collider).transform.IsChildOf(ignoredRoot))) { PlayerAvatar componentInParent = ((Component)collider).GetComponentInParent<PlayerAvatar>(); if (Object.op_Implicit((Object)(object)componentInParent)) { players.Add(componentInParent); } Enemy componentInParent2 = ((Component)collider).GetComponentInParent<Enemy>(); if (Object.op_Implicit((Object)(object)componentInParent2)) { enemies.Add(componentInParent2); } Rigidbody attachedRigidbody = collider.attachedRigidbody; if (Object.op_Implicit((Object)(object)attachedRigidbody) && !IsIgnoredShockBody(attachedRigidbody, ignoredRoot)) { bodies.Add(attachedRigidbody); } } } private static void ExpandShockTargets(HashSet<PlayerAvatar> players, HashSet<Enemy> enemies, HashSet<Rigidbody> bodies, HashSet<PlayerAvatar> chainPlayers, PlayerAvatar? shooter, Transform? ignoredRoot) { //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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00d0: Unknown result type (might be due to invalid IL or missing references) List<Vector3> list = new List<Vector3>(); foreach (PlayerAvatar player in players) { if (Object.op_Implicit((Object)(object)player) && (Object)(object)player != (Object)(object)shooter) { list.Add(((Component)player).transform.position + Vector3.up * 0.9f); } } foreach (Enemy enemy in enemies) { if (Object.op_Implicit((Object)(object)enemy)) { list.Add(((Component)enemy).transform.position + Vector3.up * 0.9f); } } int num = -1; foreach (Vector3 item in list) { Collider[] array = Physics.OverlapSphere(item, 2.65f, num, (QueryTriggerInteraction)2); foreach (Collider val in array) { PlayerAvatar val2 = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponentInParent<PlayerAvatar>() : null); if ((Object)(object)val2 != (Object)null && (Object)(object)val2 == (Object)(object)shooter) { chainPlayers.Add(val2); } AddHit(val, players, enemies, bodies, ignoredRoot); } } } private static bool IsIgnoredShockBody(Rigidbody body, Transform? ignoredRoot) { if (!Object.op_Implicit((Object)(object)body)) { return true; } Transform transform = ((Component)body).transform; if ((Object)(object)ignoredRoot != (Object)null && (transform.IsChildOf(ignoredRoot) || ignoredRoot.IsChildOf(transform))) { return true; } if (Object.op_Implicit((Object)(object)((Component)body).GetComponentInParent<ItemAttributes>()) || Object.op_Implicit((Object)(object)((Component)body).GetComponentInParent<ItemGun>()) || Object.op_Implicit((Object)(object)((Component)body).GetComponentInParent<ItemGrenade>()) || Object.op_Implicit((Object)(object)((Component)body).GetComponentInParent<ItemMelee>())) { return true; } return false; } private static void AddSceneTargets(Vector3 start, Vector3 end, float targetRadius, PlayerAvatar? shooter, HashSet<PlayerAvatar> players, HashSet<Enemy> enemies) { //IL_0029: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) float num = targetRadius * targetRadius; PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); Vector3 val3; foreach (PlayerAvatar val in array) { if (Object.op_Implicit((Object)(object)val) && !((Object)(object)val == (Object)(object)shooter)) { Vector3 val2 = ((Component)val).transform.position + Vector3.up * 0.9f; val3 = ClosestPointOnSegment(start, end, val2) - val2; if (((Vector3)(ref val3)).sqrMagnitude <= num) { players.Add(val); } } } Enemy[] array2 = Object.FindObjectsOfType<Enemy>(); foreach (Enemy val4 in array2) { if (Object.op_Implicit((Object)(object)val4)) { Vector3 val5 = ((Component)val4).transform.position + Vector3.up * 0.9f; val3 = ClosestPointOnSegment(start, end, val5) - val5; if (((Vector3)(ref val3)).sqrMagnitude <= num) { enemies.Add(val4); } } } } private static void AddSceneTargetsSphere(Vector3 origin, float targetRadius, HashSet<PlayerAvatar> players, HashSet<Enemy> enemies) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) float num = targetRadius * targetRadius; PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); Vector3 val2; foreach (PlayerAvatar val in array) { if (Object.op_Implicit((Object)(object)val)) { val2 = ((Component)val).transform.position + Vector3.up * 0.9f - origin; if (((Vector3)(ref val2)).sqrMagnitude <= num) { players.Add(val); } } } Enemy[] array2 = Object.FindObjectsOfType<Enemy>(); foreach (Enemy val3 in array2) { if (Object.op_Implicit((Object)(object)val3)) { val2 = ((Component)val3).transform.position + Vector3.up * 0.9f - origin; if (((Vector3)(ref val2)).sqrMagnitude <= num) { enemies.Add(val3); } } } } private static Vector3 ClosestPointOnSegment(Vector3 start, Vector3 end, Vector3 point) { //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_001a: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to in