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 clips = new Dictionary(); 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(); 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(); 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(text); if ((Object)(object)val2 != (Object)null) { return val2; } return val.LoadAsset("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 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 LoadXorBin(string path) { byte[] array = File.ReadAllBytes(path); for (int i = 0; i < array.Length; i++) { array[i] ^= Key(i); } Dictionary dictionary = new Dictionary(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(); } 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 all, string prefix) { List list = new List(); foreach (KeyValuePair 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 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 templates = new Dictionary(); 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()) && !templates.ContainsKey((itemType)9)) { templates[(itemType)9] = prefab; } else if ((int)val2 == 6 && Object.op_Implicit((Object)(object)prefab.GetComponent()) && !templates.ContainsKey((itemType)6)) { templates[(itemType)6] = prefab; } else if ((int)val2 == 7 && Object.op_Implicit((Object)(object)prefab.GetComponent()) && !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(template, val.transform, false); ((Object)val2).name = definition.PrefabName; ((Object)val2).hideFlags = (HideFlags)61; val2.SetActive(true); ItemAttributes component = val2.GetComponent(); 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(val3); ((Object)val4).name = definition.PrefabName.ToLowerInvariant(); PartyAnimalRepoAccess.SetField(val4, "itemName", definition.ItemName); PartyAnimalRepoAccess.SetField(val4, "itemNameLocalized", null); PartyAnimalRepoAccess.SetField(val4, "description", definition.Description); PartyAnimalRepoAccess.SetField(val4, "itemType", definition.ItemType); PartyAnimalRepoAccess.SetField(val4, "emojiIcon", definition.Icon); PartyAnimalRepoAccess.SetField(val4, "itemVolume", definition.Volume); PartyAnimalRepoAccess.SetField(val4, "itemSecretShopType", (itemSecretShopType)0); PartyAnimalRepoAccess.SetField(val4, "maxAmount", 1); PartyAnimalRepoAccess.SetField(val4, "maxAmountInShop", definition.MaxShop); PartyAnimalRepoAccess.SetField(val4, "maxPurchase", value: false); PartyAnimalRepoAccess.SetField(val4, "physicalItem", value: true); Value val5 = ScriptableObject.CreateInstance(); ((Object)val5).name = definition.PrefabName + "_Value"; PartyAnimalRepoAccess.SetField(val5, "valueMin", definition.ValueMin); PartyAnimalRepoAccess.SetField(val5, "valueMax", definition.ValueMax); PartyAnimalRepoAccess.SetField(val4, "value", val5); PartyAnimalRepoAccess.SetField(component, "item", val4); PartyAnimalRepoAccess.SetField(component, "emojiIcon", definition.Icon); PartyAnimalRepoAccess.SetField(component, "itemType", definition.ItemType); PartyAnimalRepoAccess.SetField(component, "itemName", definition.ItemName); PartyAnimalRepoAccess.SetField(component, "promptName", definition.ItemName); PartyAnimalRepoAccess.SetField(component, "itemAssetName", ((Object)val4).name); ConfigureFunctionalComponents(val2, definition, val.transform); PartyAnimalItemVisuals.ReplaceTemplateVisuals(val2, definition); PartyAnimalWeaponController partyAnimalWeaponController = val2.GetComponent() ?? val2.AddComponent(); partyAnimalWeaponController.Configure(definition); ItemGrenade component2 = val2.GetComponent(); UnityEvent val6 = (Object.op_Implicit((Object)(object)component2) ? PartyAnimalRepoAccess.GetField(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(); if (Object.op_Implicit((Object)(object)component)) { PartyAnimalRepoAccess.SetField(component, "autoDrain", value: false); PartyAnimalRepoAccess.SetField(component, "batteryDrainRate", 0f); PartyAnimalRepoAccess.SetField(component, "isUnchargable", value: false); PartyAnimalRepoAccess.SetField(component, "suppressBatteryUI", value: false); } ItemGun component2 = prefab.GetComponent(); HurtCollider[] componentsInChildren; if (Object.op_Implicit((Object)(object)component2)) { PartyAnimalRepoAccess.MuteGunSounds(component2); PartyAnimalRepoAccess.SetField(component2, "hasOneShot", value: true); PartyAnimalRepoAccess.SetField(component2, "hasBuildUp", value: false); PartyAnimalRepoAccess.SetField(component2, "numberOfBullets", 1); PartyAnimalRepoAccess.SetField(component2, "gunRandomSpread", (definition.Kind == PartyAnimalWeaponKind.Crossbow) ? 1.5f : 0.5f); PartyAnimalRepoAccess.SetField(component2, "gunRange", (definition.Kind == PartyAnimalWeaponKind.Crossbow) ? 48f : 34f); PartyAnimalRepoAccess.SetField(component2, "gunRecoilForce", (definition.Kind == PartyAnimalWeaponKind.Crossbow) ? 1.2f : 0.45f); PartyAnimalRepoAccess.SetField(component2, "cameraShakeMultiplier", (definition.Kind == PartyAnimalWeaponKind.Crossbow) ? 0.7f : 0.35f); PartyAnimalRepoAccess.SetField(component2, "shootCooldown", (definition.Kind == PartyAnimalWeaponKind.Taser) ? 1.05f : 1.25f); PartyAnimalRepoAccess.SetField(component2, "batteryDrain", (definition.Kind == PartyAnimalWeaponKind.Taser) ? 18f : 12f); PartyAnimalRepoAccess.SetField(component2, "batteryDrainFullBar", value: false); PartyAnimalRepoAccess.SetField(component2, "misfirePercentageChange", 0f); PartyAnimalRepoAccess.SetField(component2, "investigateRadius", 18f); GameObject val = PartyAnimalRepoAccess.GunBulletPrefab(component2); if ((Object)(object)val != (Object)null) { GameObject val2 = Object.Instantiate(val, bank, false); ((Object)val2).name = definition.PrefabName + "_RepoBullet"; ((Object)val2).hideFlags = (HideFlags)61; val2.SetActive(true); PartyAnimalRepoAccess.SetField(component2, "bulletPrefab", val2); componentsInChildren = val2.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { ConfigureHurtCollider(componentsInChildren[i], definition, 0); } } } ItemGrenade component3 = prefab.GetComponent(); if (Object.op_Implicit((Object)(object)component3)) { PartyAnimalRepoAccess.MuteSound(PartyAnimalRepoAccess.GetField(component3, "soundSplinter")); PartyAnimalRepoAccess.MuteSound(PartyAnimalRepoAccess.GetField(component3, "soundTick")); PartyAnimalRepoAccess.SetField(component3, "tickTime", 2.1f); PartyAnimalRepoAccess.SetField(component3, "onDetonate", new UnityEvent()); } ItemMelee component4 = prefab.GetComponent(); if (Object.op_Implicit((Object)(object)component4)) { PartyAnimalRepoAccess.SetField(component4, "usesBatteryLogic", value: true); PartyAnimalRepoAccess.SetField(component4, "hasBrokenMesh", value: false); PartyAnimalRepoAccess.SetField(component4, "durabilityDrain", 2.5f); PartyAnimalRepoAccess.SetField(component4, "durabilityDrainOnEnemiesAndPVP", 5f); PartyAnimalRepoAccess.SetField(component4, "hitFreeze", 0.08f); PartyAnimalRepoAccess.SetField(component4, "swingDetectSpeedMultiplier", 0.75f); PartyAnimalRepoAccess.SetField(component4, "scrollSwingForce", 7f); PartyAnimalRepoAccess.SetField(component4, "forwardTilt", 20f); } int collisionDamage = (((int)definition.ItemType == 7) ? definition.Damage : 0); componentsInChildren = prefab.GetComponentsInChildren(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, "playerLogic", flag); PartyAnimalRepoAccess.SetField(hurtCollider, "enemyLogic", flag); PartyAnimalRepoAccess.SetField(hurtCollider, "playerKill", value: false); PartyAnimalRepoAccess.SetField(hurtCollider, "enemyKill", value: false); PartyAnimalRepoAccess.SetField(hurtCollider, "playerDamage", collisionDamage); PartyAnimalRepoAccess.SetField(hurtCollider, "enemyDamage", collisionDamage); PartyAnimalRepoAccess.SetField(hurtCollider, "playerDamageCooldown", flag ? 0.35f : 0f); PartyAnimalRepoAccess.SetField(hurtCollider, "enemyDamageCooldown", flag ? 0.35f : 0f); PartyAnimalRepoAccess.SetField(hurtCollider, "playerTumbleForce", flag ? definition.Force : 0f); PartyAnimalRepoAccess.SetField(hurtCollider, "playerTumbleTime", flag ? 0.55f : 0f); PartyAnimalRepoAccess.SetField(hurtCollider, "enemyFreezeTime", (definition.Kind == PartyAnimalWeaponKind.FreezingGun) ? 2.4f : 0.1f); PartyAnimalRepoAccess.SetField(hurtCollider, "enemyStunTime", (definition.Kind == PartyAnimalWeaponKind.Taser) ? 5.6f : 0.35f); PartyAnimalRepoAccess.SetField(hurtCollider, "physHitForce", definition.Force); PartyAnimalRepoAccess.SetField(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(); 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(); 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(); 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(); 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(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } ParticleSystem[] componentsInChildren2 = prefab.GetComponentsInChildren(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(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(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(); obj.cookingOptions = (MeshColliderCookingOptions)14; obj.convex = true; ((Collider)obj).isTrigger = false; obj.sharedMesh = val2; ConfigureColliderObject(((Component)val).gameObject); ((Component)val).gameObject.AddComponent(); ((Component)val).gameObject.AddComponent().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(); 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 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 hashSet = new HashSet(); 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(); obj.center = Vector3.zero; obj.size = Vector3.Max(size, Vector3.one * 0.12f); ((Collider)obj).isTrigger = false; ConfigureColliderObject(val2); val2.AddComponent(); val2.AddComponent().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(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(true); for (int i = 0; i < componentsInChildren.Length; i++) { DestroyComponent((Component)(object)componentsInChildren[i]); } PhysGrabObjectBoxCollider[] componentsInChildren2 = prefab.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren2.Length; i++) { DestroyComponent((Component)(object)componentsInChildren2[i]); } PhysGrabObjectMeshCollider[] componentsInChildren3 = prefab.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren3.Length; i++) { DestroyComponent((Component)(object)componentsInChildren3[i]); } Collider[] componentsInChildren4 = prefab.GetComponentsInChildren(true); foreach (Collider val in componentsInChildren4) { if ((Object)(object)val != (Object)null && !val.isTrigger && !Object.op_Implicit((Object)(object)((Component)val).GetComponentInParent())) { 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 PlayerHealthRef = AccessTools.FieldRefAccess("playerHealth"); private static readonly FieldRef PlayerTumbleRef = AccessTools.FieldRefAccess("tumble"); private static readonly Dictionary FieldExistsCache = new Dictionary(); 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 instance, string fieldName, TField fallback = default(TField)) where TInstance : class { if (!FieldExists(fieldName)) { return fallback; } try { return AccessTools.FieldRefAccess(fieldName).Invoke(instance); } catch (Exception) { return fallback; } } public static bool SetField(TInstance instance, string fieldName, TField value) where TInstance : class { if (!FieldExists(fieldName)) { return false; } try { AccessTools.FieldRefAccess(fieldName).Invoke(instance) = value; return true; } catch (Exception) { return false; } } public static Item? AttributesItem(ItemAttributes attributes) { return GetField(attributes, "item"); } public static PrefabRef? ItemPrefab(Item item) { return GetField(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", (itemType)0); } public static bool ItemDisabled(Item item) { return GetField(item, "disabled", fallback: false); } public static Transform? GunMuzzle(ItemGun gun) { return GetField(gun, "gunMuzzle"); } public static GameObject? GunBulletPrefab(ItemGun gun) { return GetField(gun, "bulletPrefab"); } public static PhysGrabObject? GunPhysGrabObject(ItemGun gun) { return GetField(gun, "physGrabObject"); } public static void MuteGunSounds(ItemGun gun) { MuteSound(GetField(gun, "soundShoot")); MuteSound(GetField(gun, "soundShootGlobal")); MuteSound(GetField(gun, "soundHit")); MuteSound(GetField(gun, "soundNoAmmo")); } private static bool FieldExists(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, "Sounds", Array.Empty()); SetField(sound, "Volume", 0f); SetField(sound, "VolumeDefault", 0f); SetField(sound, "VolumeRandom", 0f); } } public static EnemyHealth? EnemyHealth(Enemy enemy) { return GetField(enemy, "Health"); } public static bool EnemyHasStateStunned(Enemy enemy) { return GetField(enemy, "HasStateStunned", fallback: false); } public static EnemyStateStunned? EnemyStateStunned(Enemy enemy) { return GetField(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(); itemGrenade = ((Component)this).GetComponent(); itemMelee = ((Component)this).GetComponent(); audioSource = ((Component)this).GetComponent(); if (!Object.op_Implicit((Object)(object)audioSource)) { audioSource = ((Component)this).gameObject.AddComponent(); } 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(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(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 hashSet = new HashSet(); HashSet hashSet2 = new HashSet(); HashSet hashSet3 = new HashSet(); 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 hashSet4 = new HashSet(); 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 hashSet = new HashSet(); HashSet hashSet2 = new HashSet(); HashSet hashSet3 = new HashSet(); 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 hashSet = new HashSet(); HashSet hashSet2 = new HashSet(); HashSet hashSet3 = new HashSet(); 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(), 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 hashSet = new HashSet(); HashSet hashSet2 = new HashSet(); HashSet hashSet3 = new HashSet(); 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 players, HashSet enemies, HashSet 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(); if (Object.op_Implicit((Object)(object)componentInParent)) { players.Add(componentInParent); } Enemy componentInParent2 = ((Component)collider).GetComponentInParent(); 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 players, HashSet enemies, HashSet bodies, HashSet 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 list = new List(); 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() : 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()) || Object.op_Implicit((Object)(object)((Component)body).GetComponentInParent()) || Object.op_Implicit((Object)(object)((Component)body).GetComponentInParent()) || Object.op_Implicit((Object)(object)((Component)body).GetComponentInParent())) { return true; } return false; } private static void AddSceneTargets(Vector3 start, Vector3 end, float targetRadius, PlayerAvatar? shooter, HashSet players, HashSet 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(); 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(); 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 players, HashSet 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(); 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(); 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 invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) Vector3 val = end - start; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude <= 0.0001f) { return start; } float num = Mathf.Clamp01(Vector3.Dot(point - start, val) / sqrMagnitude); return start + val * num; } } public sealed class PartyAnimalProjectileVisual : MonoBehaviour { private static Material? crossbowMaterial; private static Material? freezeMaterial; private static Material? taserMaterial; private static Mesh? boltMesh; private static Mesh? shardMesh; private Vector3 start; private Vector3 end; private float duration; private float elapsed; private LineRenderer? line; private Transform? projectile; public static void Spawn(PartyAnimalWeaponKind kind, Transform? sourcePart, Vector3 start, Vector3 end, float speed) { //IL_0010: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) PartyAnimalProjectileVisual partyAnimalProjectileVisual = new GameObject($"Empress Party Animal {kind} Projectile").AddComponent(); partyAnimalProjectileVisual.start = start; partyAnimalProjectileVisual.end = end; partyAnimalProjectileVisual.duration = Mathf.Clamp(Vector3.Distance(start, end) / Mathf.Max(1f, speed), 0.04f, 0.55f); partyAnimalProjectileVisual.Build(kind, sourcePart); } private void Build(PartyAnimalWeaponKind kind, Transform? sourcePart) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_00b9: Expected O, but got Unknown //IL_00d3: 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_00dd: 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_0138: Expected O, but got Unknown ((Component)this).transform.position = start; Vector3 val = end - start; if (((Vector3)(ref val)).sqrMagnitude < 0.001f) { val = Vector3.forward; } if (kind == PartyAnimalWeaponKind.Crossbow && (Object)(object)sourcePart != (Object)null) { GameObject val2 = Object.Instantiate(((Component)sourcePart).gameObject, ((Component)this).transform); ((Object)val2).name = "Crossbolt"; val2.transform.localPosition = Vector3.zero; val2.transform.rotation = Quaternion.LookRotation(((Vector3)(ref val)).normalized, Vector3.up); Strip(val2); projectile = val2.transform; } else { GameObject val3 = new GameObject((kind == PartyAnimalWeaponKind.Taser) ? "Taser Pin" : "Freeze Shard"); val3.transform.SetParent(((Component)this).transform, false); val3.transform.rotation = Quaternion.LookRotation(((Vector3)(ref val)).normalized, Vector3.up); MeshFilter obj = val3.AddComponent(); MeshRenderer val4 = val3.AddComponent(); obj.sharedMesh = ((kind == PartyAnimalWeaponKind.Taser) ? BoltMesh() : ShardMesh()); ((Renderer)val4).sharedMaterial = ((kind == PartyAnimalWeaponKind.Taser) ? TaserMaterial() : FreezeMaterial()); projectile = val3.transform; } GameObject val5 = new GameObject("Trail"); val5.transform.SetParent(((Component)this).transform, false); line = val5.AddComponent(); line.positionCount = 2; line.useWorldSpace = true; line.widthMultiplier = ((kind == PartyAnimalWeaponKind.Crossbow) ? 0.018f : 0.035f); LineRenderer val6 = line; ((Renderer)val6).sharedMaterial = (Material)(kind switch { PartyAnimalWeaponKind.FreezingGun => FreezeMaterial(), PartyAnimalWeaponKind.Taser => TaserMaterial(), _ => CrossbowMaterial(), }); } private void Update() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_008a: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) elapsed += Time.deltaTime; float num = ((duration > 0f) ? Mathf.Clamp01(elapsed / duration) : 1f); Vector3 val = Vector3.Lerp(start, end, num); ((Component)this).transform.position = val; if ((Object)(object)line != (Object)null) { line.SetPosition(0, Vector3.Lerp(start, end, Mathf.Max(0f, num - 0.18f))); line.SetPosition(1, val); } if ((Object)(object)projectile != (Object)null) { projectile.localScale = Vector3.one * (1f + Mathf.Sin(num * MathF.PI) * 0.18f); } if (num >= 1f) { Object.Destroy((Object)(object)((Component)this).gameObject, 0.08f); } } private static void Strip(GameObject root) { Collider[] componentsInChildren = root.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren[i]); } PhysGrabObjectCollider[] componentsInChildren2 = root.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren2.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren2[i]); } Rigidbody[] componentsInChildren3 = root.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren3.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren3[i]); } } private static Material CrossbowMaterial() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) return crossbowMaterial ?? (crossbowMaterial = CreateMaterial(new Color(0.95f, 0.72f, 0.36f, 0.85f))); } private static Material FreezeMaterial() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) return freezeMaterial ?? (freezeMaterial = CreateMaterial(new Color(0.42f, 0.92f, 1f, 0.78f))); } private static Material TaserMaterial() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) return taserMaterial ?? (taserMaterial = CreateMaterial(new Color(1f, 0.9f, 0.14f, 0.85f))); } private static Material CreateMaterial(Color color) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_0040: 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_0059: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown Material val = new Material(Shader.Find("Standard") ?? Shader.Find("Diffuse")) { color = color }; val.SetFloat("_Mode", 3f); val.SetInt("_SrcBlend", 5); val.SetInt("_DstBlend", 10); val.SetInt("_ZWrite", 0); val.DisableKeyword("_ALPHATEST_ON"); val.EnableKeyword("_ALPHABLEND_ON"); val.renderQueue = 3000; return val; } private static Mesh BoltMesh() { return boltMesh ?? (boltMesh = BoxMesh(0.035f, 0.035f, 0.72f)); } private static Mesh ShardMesh() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)shardMesh != (Object)null) { return shardMesh; } Mesh val = new Mesh(); val.vertices = (Vector3[])(object)new Vector3[6] { new Vector3(0f, 0.09f, 0f), new Vector3(0.09f, 0f, 0f), new Vector3(0f, -0.09f, 0f), new Vector3(-0.09f, 0f, 0f), new Vector3(0f, 0f, 0.42f), new Vector3(0f, 0f, -0.18f) }; val.triangles = new int[24] { 0, 4, 1, 1, 4, 2, 2, 4, 3, 3, 4, 0, 1, 5, 0, 2, 5, 1, 3, 5, 2, 0, 5, 3 }; val.RecalculateNormals(); shardMesh = val; return shardMesh; } private static Mesh BoxMesh(float x, float y, float z) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_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_0070: 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_0080: 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_008f: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) float num = x * 0.5f; float num2 = y * 0.5f; float num3 = z * 0.5f; Mesh val = new Mesh(); val.vertices = (Vector3[])(object)new Vector3[8] { new Vector3(0f - num, 0f - num2, 0f - num3), new Vector3(num, 0f - num2, 0f - num3), new Vector3(num, num2, 0f - num3), new Vector3(0f - num, num2, 0f - num3), new Vector3(0f - num, 0f - num2, num3), new Vector3(num, 0f - num2, num3), new Vector3(num, num2, num3), new Vector3(0f - num, num2, num3) }; val.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 }; val.RecalculateNormals(); return val; } } public sealed class PartyAnimalIceEffect : MonoBehaviour { private static Mesh? iceMesh; private static Material? iceMaterial; private Transform? target; private float duration; private float elapsed; private Vector3 offset; private Vector3 baseScale; public static void Spawn(Transform target, float duration, Vector3 scale) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_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_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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Empress Party Animal Ice"); val.transform.localScale = scale; PartyAnimalIceEffect partyAnimalIceEffect = val.AddComponent(); partyAnimalIceEffect.target = target; partyAnimalIceEffect.duration = duration; partyAnimalIceEffect.offset = Vector3.up * Mathf.Max(0.35f, scale.y * 0.32f); partyAnimalIceEffect.baseScale = scale; val.transform.position = target.position + partyAnimalIceEffect.offset; MeshFilter val2 = val.AddComponent(); MeshRenderer obj = val.AddComponent(); val2.sharedMesh = IceMesh(); ((Renderer)obj).sharedMaterial = IceMaterial(); } private void Update() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_00a8: Unknown result type (might be due to invalid IL or missing references) elapsed += Time.deltaTime; Transform val = target; if ((Object)(object)val == (Object)null || elapsed >= duration) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } ((Component)this).transform.position = val.position + offset; ((Component)this).transform.rotation = Quaternion.Euler(0f, Time.time * 20f, 0f); float num = 1f + Mathf.Sin(elapsed * 12f) * 0.03f; ((Component)this).transform.localScale = baseScale * num; } private static Mesh IceMesh() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00ee: 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) if ((Object)(object)iceMesh != (Object)null) { return iceMesh; } Mesh val = new Mesh(); val.vertices = (Vector3[])(object)new Vector3[8] { new Vector3(-0.5f, -0.5f, -0.5f), new Vector3(0.5f, -0.5f, -0.5f), new Vector3(0.5f, 0.5f, -0.5f), new Vector3(-0.5f, 0.5f, -0.5f), new Vector3(-0.5f, -0.5f, 0.5f), new Vector3(0.5f, -0.5f, 0.5f), new Vector3(0.5f, 0.5f, 0.5f), new Vector3(-0.5f, 0.5f, 0.5f) }; val.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 }; val.RecalculateNormals(); iceMesh = val; return iceMesh; } private static Material IceMaterial() { //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_0045: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_008f: 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_00aa: Expected O, but got Unknown if ((Object)(object)iceMaterial != (Object)null) { return iceMaterial; } Material val = new Material(Shader.Find("Standard") ?? Shader.Find("Diffuse")) { color = new Color(0.38f, 0.9f, 1f, 0.34f) }; val.SetFloat("_Mode", 3f); val.SetInt("_SrcBlend", 5); val.SetInt("_DstBlend", 10); val.SetInt("_ZWrite", 0); val.DisableKeyword("_ALPHATEST_ON"); val.EnableKeyword("_ALPHABLEND_ON"); val.renderQueue = 3000; iceMaterial = val; return iceMaterial; } } public sealed class PartyAnimalShockEffect : MonoBehaviour { private static Material? shockMaterial; private static readonly Dictionary soundTimes = new Dictionary(); private Transform? target; private float duration; private float elapsed; private Vector3 offset; private Vector3 scale; private LineRenderer[] lines = Array.Empty(); private float redrawTimer; public static void Spawn(Transform target, float duration, Vector3 scale) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_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) GameObject val = new GameObject("Empress Party Animal Shock"); PartyAnimalShockEffect partyAnimalShockEffect = val.AddComponent(); partyAnimalShockEffect.target = target; partyAnimalShockEffect.duration = duration; partyAnimalShockEffect.scale = scale; partyAnimalShockEffect.offset = Vector3.up * Mathf.Max(0.3f, scale.y * 0.28f); val.transform.position = target.position + partyAnimalShockEffect.offset; PlaySpawnSound(target, val.transform.position); partyAnimalShockEffect.lines = (LineRenderer[])(object)new LineRenderer[5]; for (int i = 0; i < partyAnimalShockEffect.lines.Length; i++) { GameObject val2 = new GameObject($"Arc {i}"); val2.transform.SetParent(val.transform, false); LineRenderer val3 = val2.AddComponent(); val3.useWorldSpace = true; val3.positionCount = 5; val3.widthMultiplier = 0.025f; ((Renderer)val3).sharedMaterial = ShockMaterial(); partyAnimalShockEffect.lines[i] = val3; } } private void Update() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) elapsed += Time.deltaTime; Transform val = target; if ((Object)(object)val == (Object)null || elapsed >= duration) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } ((Component)this).transform.position = val.position + offset; redrawTimer -= Time.deltaTime; if (redrawTimer <= 0f) { redrawTimer = 0.045f; Redraw(); } } private void Redraw() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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) Vector3 position = ((Component)this).transform.position; for (int i = 0; i < lines.Length; i++) { LineRenderer val = lines[i]; if (Object.op_Implicit((Object)(object)val)) { Vector3 val2 = position + RandomPoint(); Vector3 val3 = position + RandomPoint(); for (int j = 0; j < val.positionCount; j++) { float num = (float)j / ((float)val.positionCount - 1f); Vector3 val4 = Vector3.Lerp(val2, val3, num) + Random.insideUnitSphere * 0.08f; val.SetPosition(j, val4); } } } } private Vector3 RandomPoint() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) Vector3 onUnitSphere = Random.onUnitSphere; onUnitSphere.x *= scale.x * 0.5f; onUnitSphere.y *= scale.y * 0.45f; onUnitSphere.z *= scale.z * 0.5f; return onUnitSphere; } private static Material ShockMaterial() { //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_0045: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown if ((Object)(object)shockMaterial != (Object)null) { return shockMaterial; } Material val = new Material(Shader.Find("Standard") ?? Shader.Find("Diffuse")) { color = new Color(1f, 0.92f, 0.12f, 0.92f) }; val.SetFloat("_Mode", 3f); val.SetInt("_SrcBlend", 5); val.SetInt("_DstBlend", 1); val.SetInt("_ZWrite", 0); val.DisableKeyword("_ALPHATEST_ON"); val.EnableKeyword("_ALPHABLEND_ON"); val.renderQueue = 3000; shockMaterial = val; return shockMaterial; } private static void PlaySpawnSound(Transform target, Vector3 position) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) int instanceID = ((Object)target).GetInstanceID(); if (!soundTimes.TryGetValue(instanceID, out var value) || !(Time.time - value < 0.55f)) { soundTimes[instanceID] = Time.time; PartyAnimalItemAudio.PlayShockAt(position); } } } public sealed class PartyAnimalShockAura : MonoBehaviour { private static readonly Dictionary appliedTimes = new Dictionary(); private PlayerAvatar? ownerPlayer; private float remaining; private float scanTimer; public static void Attach(Transform target, PlayerAvatar? ownerPlayer, PlayerAvatar? shooter, float duration) { if (Object.op_Implicit((Object)(object)target)) { PartyAnimalShockAura obj = ((Component)target).GetComponent() ?? ((Component)target).gameObject.AddComponent(); obj.ownerPlayer = ownerPlayer ?? ((Component)target).GetComponentInParent(); obj.remaining = Mathf.Max(obj.remaining, duration); obj.scanTimer = Mathf.Min(obj.scanTimer, 0.08f); } } private void Update() { remaining -= Time.deltaTime; if (remaining <= 0f) { Object.Destroy((Object)(object)this); } else if (SemiFunc.IsMasterClientOrSingleplayer()) { scanTimer -= Time.deltaTime; if (!(scanTimer > 0f)) { scanTimer = 0.22f; Scan(); } } } private void Scan() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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) Collider[] array = Physics.OverlapSphere(((Component)this).transform.position + Vector3.up * 0.85f, 2.65f, -1, (QueryTriggerInteraction)2); foreach (Collider val in array) { if (Object.op_Implicit((Object)(object)val) && !((Component)val).transform.IsChildOf(((Component)this).transform)) { PlayerAvatar componentInParent = ((Component)val).GetComponentInParent(); if (Object.op_Implicit((Object)(object)componentInParent) && (Object)(object)componentInParent != (Object)(object)ownerPlayer) { ChainPlayer(componentInParent); } Enemy componentInParent2 = ((Component)val).GetComponentInParent(); if (Object.op_Implicit((Object)(object)componentInParent2)) { ChainEnemy(componentInParent2); } Rigidbody attachedRigidbody = val.attachedRigidbody; if (Object.op_Implicit((Object)(object)attachedRigidbody) && !IgnoredBody(attachedRigidbody)) { ChainBody(attachedRigidbody); } } } } private void ChainPlayer(PlayerAvatar player) { //IL_00ae: 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_0033: 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_004c: 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_005c: 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_0069: Unknown result type (might be due to invalid IL or missing references) if (!AppliedRecently(((Object)player).GetInstanceID())) { PlayerTumble val = PartyAnimalRepoAccess.Tumble(player); if ((Object)(object)val != (Object)null) { val.TumbleRequest(true, false); val.TumbleOverride(true); val.TumbleForce((Random.onUnitSphere + Vector3.up * 0.6f) * 5.5f); Vector3 insideUnitSphere = Random.insideUnitSphere; val.TumbleTorque(((Vector3)(ref insideUnitSphere)).normalized * 28f); val.TumbleOverrideTime(Mathf.Min(remaining, 5.6f)); } PartyAnimalShockEffect.Spawn(((Component)player).transform, Mathf.Min(remaining, 5.6f), new Vector3(1.1f, 1.75f, 1.1f)); Attach(((Component)player).transform, player, null, Mathf.Min(remaining, 5.6f)); } } private void ChainEnemy(Enemy enemy) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) if (AppliedRecently(((Object)enemy).GetInstanceID())) { return; } if (PartyAnimalRepoAccess.EnemyHasStateStunned(enemy)) { EnemyStateStunned val = PartyAnimalRepoAccess.EnemyStateStunned(enemy); if ((Object)(object)val != (Object)null) { val.Set(Mathf.Min(remaining, 5.6f)); } } PartyAnimalShockEffect.Spawn(((Component)enemy).transform, Mathf.Min(remaining, 5.6f), new Vector3(1.4f, 1.9f, 1.4f)); Attach(((Component)enemy).transform, null, null, Mathf.Min(remaining, 5.6f)); } private void ChainBody(Rigidbody body) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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_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_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_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_0061: Unknown result type (might be due to invalid IL or missing references) if (!AppliedRecently(((Object)body).GetInstanceID())) { if (!body.isKinematic) { body.velocity *= 0.22f; body.angularVelocity *= 0.22f; body.AddForce((Random.onUnitSphere + Vector3.up * 0.6f) * 0.65f, (ForceMode)1); } PartyAnimalShockEffect.Spawn(((Component)body).transform, Mathf.Min(remaining, 5.6f), Vector3.one * 0.95f); } } private static bool AppliedRecently(int key) { if (appliedTimes.TryGetValue(key, out var value) && Time.time - value < 0.7f) { return true; } appliedTimes[key] = Time.time; return false; } private bool IgnoredBody(Rigidbody body) { if (!Object.op_Implicit((Object)(object)body)) { return true; } if (((Component)body).transform.IsChildOf(((Component)this).transform) || ((Component)this).transform.IsChildOf(((Component)body).transform)) { return true; } if (Object.op_Implicit((Object)(object)((Component)body).GetComponentInParent()) || Object.op_Implicit((Object)(object)((Component)body).GetComponentInParent()) || Object.op_Implicit((Object)(object)((Component)body).GetComponentInParent()) || Object.op_Implicit((Object)(object)((Component)body).GetComponentInParent())) { return true; } return false; } } public sealed class PartyAnimalBombFuseEffect : MonoBehaviour { private static Material? sparkMaterial; private Transform? target; private Vector3 localOffset; private float duration; private float elapsed; public static void Spawn(Transform target, float duration) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Expected O, but got Unknown GameObject val = new GameObject("Empress Party Animal Bomb Fuse"); PartyAnimalBombFuseEffect partyAnimalBombFuseEffect = val.AddComponent(); partyAnimalBombFuseEffect.target = target; partyAnimalBombFuseEffect.duration = duration; partyAnimalBombFuseEffect.localOffset = partyAnimalBombFuseEffect.FindFuseOffset(target); val.transform.position = target.TransformPoint(partyAnimalBombFuseEffect.localOffset); ParticleSystem val2 = val.AddComponent(); MainModule main = val2.main; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.12f, 0.32f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.18f, 0.85f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.025f, 0.075f); ((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(1f, 0.78f, 0.16f, 1f), new Color(1f, 0.18f, 0.05f, 1f)); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).maxParticles = 90; EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).rateOverTime = new MinMaxCurve(34f, 58f); ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ((ShapeModule)(ref shape)).radius = 0.035f; ParticleSystemRenderer component = val.GetComponent(); ((Renderer)component).material = SparkMaterial(); component.renderMode = (ParticleSystemRenderMode)0; val2.Play(); Object.Destroy((Object)val, duration + 0.45f); } private void Update() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0077: Unknown result type (might be due to invalid IL or missing references) elapsed += Time.deltaTime; Transform val = target; if ((Object)(object)val == (Object)null || elapsed >= duration) { ParticleSystem component = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { EmissionModule emission = component.emission; ((EmissionModule)(ref emission)).enabled = false; } target = null; } else { ((Component)this).transform.position = val.TransformPoint(localOffset) + Random.insideUnitSphere * 0.01f; } } private Vector3 FindFuseOffset(Transform root) { //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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) Transform val = null; Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren(true); foreach (Transform val2 in componentsInChildren) { string text = ((Object)val2).name.ToLowerInvariant(); if (text.Contains("fuse") || text.Contains("wick") || text.Contains("bomb_05")) { val = val2; } } if ((Object)(object)val != (Object)null) { return root.InverseTransformPoint(val.position) + Vector3.up * 0.05f; } Bounds bounds = default(Bounds); ((Bounds)(ref bounds))..ctor(root.position, Vector3.one * 0.2f); bool flag = false; Renderer[] componentsInChildren2 = ((Component)root).GetComponentsInChildren(true); foreach (Renderer val3 in componentsInChildren2) { if (val3.enabled && !(val3 is ParticleSystemRenderer)) { if (flag) { ((Bounds)(ref bounds)).Encapsulate(val3.bounds); continue; } bounds = val3.bounds; flag = true; } } Vector3 val4 = ((Bounds)(ref bounds)).center + Vector3.up * ((Bounds)(ref bounds)).extents.y; return root.InverseTransformPoint(val4); } private static Material SparkMaterial() { //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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown if ((Object)(object)sparkMaterial != (Object)null) { return sparkMaterial; } sparkMaterial = new Material(Shader.Find("Particles/Standard Unlit") ?? Shader.Find("Standard") ?? Shader.Find("Diffuse")) { color = new Color(1f, 0.55f, 0.08f, 0.95f) }; return sparkMaterial; } } public enum PartyAnimalWeaponKind { Crossbow, FreezingGun, Taser, Bomb, Nunchucks } }