Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Bruces funny mod v0.7.5
CocoaBoss.dll
Decompiled 21 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using CocoaBoss.States; using EntityStates; using KinematicCharacterController; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using R2API; using RoR2; using RoR2.CharacterAI; using RoR2.ConVar; using RoR2.ContentManagement; using RoR2.Navigation; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.Rendering.PostProcessing; using UnityEngine.SceneManagement; using UnityEngine.UI; [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("CocoaBoss")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CocoaBoss")] [assembly: AssemblyTitle("CocoaBoss")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace CocoaBoss { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.bruce.cocoaboss", "CocoaFinalBoss", "0.7.5")] public class CocoaPlugin : BaseUnityPlugin { public const string GUID = "com.bruce.cocoaboss"; public const string Name = "CocoaFinalBoss"; public const string Version = "0.7.5"; public static CocoaPlugin Instance { get; private set; } private void Awake() { Instance = this; Log.Source = ((BaseUnityPlugin)this).Logger; ModConfig.Init(((BaseUnityPlugin)this).Config); Tokens.Register(); Assets.Init(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)); CocoaAudio.Init(); NoFear.Init(); Interactables.Init(); CocoaBodyFactory.Init(); CocoaPupFactory.Init(); CocoaStage.Init(); GoldenBoneRoute.Init(); Compat.Init(); CocoaContentPack.Register(); Log.Info("CocoaFinalBoss 0.7.5 loaded. Cocoa is ready for pets."); } } public class CocoaAnimator : MonoBehaviour { public enum Pose { Idle, Bite, Lick, Bark, Sit, Dead, Spin, Beam, Cough, GrabCharge, Hold, Dazed, DeathRise, Divine, Assemble, Pounce, PounceFly, Swipe, Telekinesis } public bool humanoid; public float assemble = 1f; public float rise; private Transform dazeStars; public bool flying; public float spinSpeed; public float beamCharge; private float spinAngle; public Transform poseRoot; public Transform torso; public Transform head; public Transform jaw; public Transform tongue; public Transform earL; public Transform earR; public Transform eyeL; public Transform eyeR; public Transform tail; public Transform legFL; public Transform legFR; public Transform legBL; public Transform legBR; private Pose pose; private float poseTime; private float poseDuration = 1f; private float hitTime = 0.5f; private float walkPhase; private float speedSmoothed; private float barkPulse; private Vector3 lastPos; private Vector3 headRestPos; private Vector3 tongueRestScale; private Vector3 eyeRestScale; private Quaternion modelRest; private bool initialized; private float crawlS; private float nextCreepSound; private bool EnsureInit() { //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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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) if (initialized) { return true; } if (!Object.op_Implicit((Object)(object)poseRoot) || !Object.op_Implicit((Object)(object)head) || !Object.op_Implicit((Object)(object)tongue) || !Object.op_Implicit((Object)(object)eyeL)) { return false; } initialized = true; headRestPos = head.localPosition; tongueRestScale = tongue.localScale; eyeRestScale = eyeL.localScale; modelRest = poseRoot.localRotation; lastPos = ((Component)this).transform.position; return true; } public void SetPose(Pose p, float duration = 1f, float hit = 0.5f) { pose = p; poseTime = 0f; poseDuration = Mathf.Max(0.01f, duration); hitTime = hit; } public void Bark() { barkPulse = 1f; } private void LateUpdate() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_09f2: Unknown result type (might be due to invalid IL or missing references) //IL_0a69: Unknown result type (might be due to invalid IL or missing references) //IL_0a6f: Unknown result type (might be due to invalid IL or missing references) //IL_0a81: Unknown result type (might be due to invalid IL or missing references) //IL_0a86: Unknown result type (might be due to invalid IL or missing references) //IL_0aa1: Unknown result type (might be due to invalid IL or missing references) //IL_0ab7: Unknown result type (might be due to invalid IL or missing references) //IL_0ac9: Unknown result type (might be due to invalid IL or missing references) //IL_0ad0: Unknown result type (might be due to invalid IL or missing references) //IL_0ae6: Unknown result type (might be due to invalid IL or missing references) //IL_0b00: Unknown result type (might be due to invalid IL or missing references) //IL_0b07: Unknown result type (might be due to invalid IL or missing references) //IL_0b1d: Unknown result type (might be due to invalid IL or missing references) //IL_0b23: Unknown result type (might be due to invalid IL or missing references) //IL_0b28: Unknown result type (might be due to invalid IL or missing references) //IL_0b2a: Unknown result type (might be due to invalid IL or missing references) //IL_0b31: Unknown result type (might be due to invalid IL or missing references) //IL_0b47: Unknown result type (might be due to invalid IL or missing references) //IL_0b5e: Unknown result type (might be due to invalid IL or missing references) //IL_0b65: Unknown result type (might be due to invalid IL or missing references) //IL_0b7b: Unknown result type (might be due to invalid IL or missing references) //IL_0b8c: Unknown result type (might be due to invalid IL or missing references) //IL_0b99: Unknown result type (might be due to invalid IL or missing references) //IL_0baf: Unknown result type (might be due to invalid IL or missing references) //IL_0bb5: Unknown result type (might be due to invalid IL or missing references) //IL_0bd2: Unknown result type (might be due to invalid IL or missing references) //IL_0bd7: Unknown result type (might be due to invalid IL or missing references) //IL_0bf1: Unknown result type (might be due to invalid IL or missing references) //IL_0bf8: Unknown result type (might be due to invalid IL or missing references) //IL_0c03: Unknown result type (might be due to invalid IL or missing references) //IL_0c23: Unknown result type (might be due to invalid IL or missing references) //IL_0c28: Unknown result type (might be due to invalid IL or missing references) //IL_0c2d: Unknown result type (might be due to invalid IL or missing references) //IL_0c3b: Unknown result type (might be due to invalid IL or missing references) //IL_0c40: Unknown result type (might be due to invalid IL or missing references) //IL_0c44: Unknown result type (might be due to invalid IL or missing references) //IL_0c5a: Unknown result type (might be due to invalid IL or missing references) //IL_0c5f: Unknown result type (might be due to invalid IL or missing references) //IL_0c63: Unknown result type (might be due to invalid IL or missing references) //IL_0c79: Unknown result type (might be due to invalid IL or missing references) //IL_0c8e: Unknown result type (might be due to invalid IL or missing references) //IL_0c95: Unknown result type (might be due to invalid IL or missing references) //IL_0cab: Unknown result type (might be due to invalid IL or missing references) //IL_0cbf: Unknown result type (might be due to invalid IL or missing references) //IL_0cc6: Unknown result type (might be due to invalid IL or missing references) //IL_0d01: Unknown result type (might be due to invalid IL or missing references) //IL_0d17: Unknown result type (might be due to invalid IL or missing references) //IL_0d31: Unknown result type (might be due to invalid IL or missing references) //IL_0d38: Unknown result type (might be due to invalid IL or missing references) //IL_0d4e: Unknown result type (might be due to invalid IL or missing references) //IL_0d68: Unknown result type (might be due to invalid IL or missing references) //IL_0d6f: Unknown result type (might be due to invalid IL or missing references) //IL_0d85: Unknown result type (might be due to invalid IL or missing references) //IL_0da0: Unknown result type (might be due to invalid IL or missing references) //IL_0da7: Unknown result type (might be due to invalid IL or missing references) //IL_0dbd: Unknown result type (might be due to invalid IL or missing references) //IL_0dd8: Unknown result type (might be due to invalid IL or missing references) //IL_0ddf: Unknown result type (might be due to invalid IL or missing references) float deltaTime = Time.deltaTime; if (deltaTime <= 0f || !EnsureInit()) { return; } poseTime += deltaTime; float num = Mathf.Clamp01(poseTime / poseDuration); Vector3 val = ((Component)this).transform.position - lastPos; val.y = 0f; lastPos = ((Component)this).transform.position; speedSmoothed = Mathf.Lerp(speedSmoothed, ((Vector3)(ref val)).magnitude / deltaTime, 1f - Mathf.Exp(-8f * deltaTime)); float num2 = Mathf.Clamp01(speedSmoothed / 6f); walkPhase += deltaTime * (2f + speedSmoothed * 0.55f); barkPulse = Mathf.MoveTowards(barkPulse, 0f, deltaTime * 3.5f); float num3 = Mathf.Sin(walkPhase * 2f) * 1.2f * num2; float num4 = Mathf.Sin(Time.time * 1.3f) * 2f; float num5 = 0f; float num6 = 0f; float num7 = 0f; float num8 = 0f; float num9 = Mathf.Sin(walkPhase * 2f) * 6f * num2; float num10 = 7f; float num11 = 18f; Vector3 val2 = Vector3.zero; float num12 = Mathf.Sin(walkPhase) * 28f * num2; float num13 = 0f; float num14 = 0f; float num15 = 0f; if (flying) { float num16 = Mathf.Clamp01(speedSmoothed / 18f); num12 = -16f * num16 + Mathf.Sin(Time.time * 3.1f) * 4f; num3 = 7f * num16 + Mathf.Sin(Time.time * 2.2f) * 1.5f; num9 = 10f + 22f * num16 + Mathf.Sin(Time.time * 9f) * 4f * num16; num15 = Mathf.Sin(Time.time * 2.2f) * 0.35f; num10 = 10f; num11 = 22f; } switch (pose) { case Pose.Bite: { float num26 = hitTime / poseDuration; float num27 = ((num < num26) ? (-0.3f * (num / num26)) : Mathf.Lerp(1f, 0f, (num - num26) / (1f - num26))); ((Vector3)(ref val2))..ctor(0f, -0.6f * Mathf.Max(0f, num27), 2.2f * num27); num4 += 18f * Mathf.Max(0f, num27) - 10f * Mathf.Max(0f, 0f - num27) * 3f; num6 = ((num < num26) ? Mathf.Lerp(0f, 32f, num / num26) : Mathf.Lerp(32f, 0f, Mathf.Clamp01((num - num26) * 12f))); num11 = 8f; break; } case Pose.Lick: { float num24 = hitTime / poseDuration; num7 = ((num < num24 * 0.6f) ? (num / (num24 * 0.6f)) : ((num > 0.85f) ? Mathf.Lerp(1f, 0f, (num - 0.85f) / 0.15f) : 1f)); num6 = 22f * num7; float num25 = Mathf.Clamp01((num - num24 * 0.5f) / (1f - num24 * 0.5f)); num5 = Mathf.Lerp(-22.5f, 22.5f, Mathf.SmoothStep(0f, 1f, num25)) * num7; num4 += 12f * num7; val2 = new Vector3(0f, -0.4f, 0.8f) * num7; break; } case Pose.Bark: num4 += -18f * barkPulse - 6f; num6 = 30f * barkPulse; num9 += 20f * barkPulse; num3 += -3f * barkPulse; num11 = 25f; num10 = 12f; break; case Pose.Sit: num13 = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01(poseTime * 3f)); num7 = num13; num6 = 18f * num13; num8 = num13; num4 += -8f * num13 + Mathf.Sin(Time.time * 6f) * 3f; num5 = Mathf.Sin(Time.time * 2.2f) * 10f; num11 = 35f; num10 = 18f; num12 = 0f; break; case Pose.Spin: { float num29 = Mathf.Clamp01(spinSpeed / 900f); num9 = 25f + 55f * num29; num12 = 0f; num6 = 10f + 12f * num29; num4 += -10f; num13 = 0f; num11 = 10f; num10 = 3f; num3 = 0f; break; } case Pose.Beam: { float num28 = Mathf.Sin(Time.time * 70f) * 1.5f * beamCharge; num4 += 10f * beamCharge + num28; ((Vector3)(ref val2))..ctor(num28 * 0.05f, -0.3f * beamCharge, 0.6f * beamCharge); num9 = -25f * beamCharge; num12 = 0f; num11 = 4f; num6 = 2f; num3 += num28 * 0.5f; break; } case Pose.Cough: { float num21 = hitTime / poseDuration; float num22 = Mathf.Clamp01(num / num21); float num23 = ((num < num21) ? 0f : Mathf.Clamp01(1f - (num - num21) / (1f - num21))); num4 += -20f * num22 * (1f - num23) + 28f * num23 + Mathf.Sin(Time.time * 40f) * 3f * num23; ((Vector3)(ref val2))..ctor(0f, -0.5f * num23, 1.8f * num23); num6 = 6f * num22 + 34f * num23; num7 = 0.4f * num23; num3 += -6f * num22 + 8f * num23; num12 = 0f; num9 = 12f * num23; break; } case Pose.GrabCharge: { float num19 = Mathf.Clamp01(num / 0.25f); float num20 = Mathf.Sin(Time.time * 55f) * 2f * num19; num3 += 10f * num19 + num20; num4 += 14f * num19 - num20; ((Vector3)(ref val2))..ctor(0f, -0.8f * num19, 0.5f * num19); num6 = 26f * num19; num9 = -30f * num19; num12 = -12f * num19; num11 = 2f; num15 = 0.8f * num19; break; } case Pose.Hold: num6 = 9f; num4 += 6f; num9 = 35f; num12 = Mathf.Sin(Time.time * 18f) * 25f; num11 = 30f; num10 = 16f; break; case Pose.Dazed: num13 = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01(poseTime * 2f)); num5 = Mathf.Sin(Time.time * 2.6f) * 18f; num4 += Mathf.Cos(Time.time * 2.6f) * 10f + 6f; num8 = 0.7f; num7 = 0.6f; num6 = 14f; num11 = 4f; num12 = 0f; break; case Pose.DeathRise: { float num18 = Mathf.Clamp01(poseTime / poseDuration); num14 = Mathf.Sin(Time.time * 47f) * 6f * num18; num15 = 0f - rise; num4 += Mathf.Sin(Time.time * 39f) * 8f * num18 - 12f; num6 = 25f; num9 = 40f * num18; num12 = 0f; num11 = 0f; break; } case Pose.Divine: num12 = 0f; num3 = -6f; num4 += -14f; num9 = 18f + Mathf.Sin(Time.time * 1.5f) * 4f; num11 = 8f; num10 = 3f; num13 = 0f; num8 = 0.35f; break; case Pose.Dead: { float num17 = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01(poseTime / 1.2f)); num14 = 82f * num17; num15 = 2.6f * num17; num8 = num17; num7 = 0.35f * num17; num6 = 8f * num17; num11 = Mathf.Lerp(18f, 0f, num17); num12 = 0f; num3 = 0f; break; } } float num30 = 1f - Mathf.Exp(-14f * deltaTime); if (pose == Pose.Dazed) { if (!Object.op_Implicit((Object)(object)dazeStars)) { dazeStars = BuildStars(); } ((Component)dazeStars).gameObject.SetActive(true); dazeStars.localRotation = Quaternion.Euler(0f, Time.time * 200f, 0f); } else if (Object.op_Implicit((Object)(object)dazeStars)) { ((Component)dazeStars).gameObject.SetActive(false); } spinAngle = ((spinSpeed > 0.01f) ? ((spinAngle + spinSpeed * deltaTime) % 360f) : Mathf.MoveTowardsAngle(spinAngle, 0f, 720f * deltaTime)); poseRoot.localRotation = Quaternion.Slerp(poseRoot.localRotation, modelRest * Quaternion.Euler(0f, spinAngle, num14), (spinSpeed > 0.01f) ? 1f : num30); poseRoot.localPosition = Vector3.Lerp(poseRoot.localPosition, new Vector3(0f, 0f - num15, 0f), num30); torso.localRotation = Quaternion.Slerp(torso.localRotation, Quaternion.Euler(num3 - 28f * num13, 0f, 0f), num30); head.localPosition = Vector3.Lerp(head.localPosition, headRestPos + val2, num30); head.localRotation = Quaternion.Slerp(head.localRotation, Quaternion.Euler(num4 + 26f * num13, num5, 0f), num30); jaw.localRotation = Quaternion.Slerp(jaw.localRotation, Quaternion.Euler(num6, 0f, 0f), num30 * 1.5f); tongue.localScale = Vector3.Lerp(tongue.localScale, Vector3.Scale(tongueRestScale, new Vector3(1f, 1f, 1f + 3.5f * num7)) * ((num7 > 0.01f) ? 1f : 0.001f), num30); Vector3 val3 = Vector3.Scale(eyeRestScale, new Vector3(1f, Mathf.Lerp(1f, 0.18f, num8), 1f)); eyeL.localScale = Vector3.Lerp(eyeL.localScale, val3, num30); eyeR.localScale = Vector3.Lerp(eyeR.localScale, val3, num30); earL.localRotation = Quaternion.Slerp(earL.localRotation, Quaternion.Euler(num9 * 0.4f, 0f, 0f - num9), num30); earR.localRotation = Quaternion.Slerp(earR.localRotation, Quaternion.Euler(num9 * 0.4f, 0f, num9), num30); tail.localRotation = Quaternion.Euler(0f, Mathf.Sin(Time.time * num10) * num11, Mathf.Sin(Time.time * num10) * num11 * 0.3f); legFL.localRotation = Quaternion.Slerp(legFL.localRotation, Quaternion.Euler(num12 + 28f * num13, 0f, 0f), num30); legBR.localRotation = Quaternion.Slerp(legBR.localRotation, Quaternion.Euler(num12 - 55f * num13, 0f, 0f), num30); legFR.localRotation = Quaternion.Slerp(legFR.localRotation, Quaternion.Euler(0f - num12 + 28f * num13, 0f, 0f), num30); legBL.localRotation = Quaternion.Slerp(legBL.localRotation, Quaternion.Euler(0f - num12 - 55f * num13, 0f, 0f), num30); if (humanoid) { ApplyHumanoid(num, num15, num4, num6); } } private static float Noise(float speed, float seed) { return (Mathf.PerlinNoise(Time.time * speed, seed) - 0.5f) * 2f; } private static float Hash(int w, int salt) { int num = w * 374761393 + salt * 668265263; int num2 = (num ^ (num >> 13)) * 1274126177; return (float)((num2 ^ (num2 >> 16)) & 0xFFFF) / 65535f; } private static float Jerk(float t, int steps) { t = Mathf.Clamp01(t); if (t >= 1f) { return 1f; } float num = t * (float)steps; int num2 = Mathf.FloorToInt(num); float num3 = num - (float)num2; float num4 = ((num3 < 0.3f) ? (num3 / 0.3f) : 1f); num4 = 1f + 2.7f * Mathf.Pow(num4 - 1f, 3f) + 1.7f * Mathf.Pow(num4 - 1f, 2f); return Mathf.Clamp01(((float)num2 + num4) / (float)steps); } private bool WantsCrawl() { //IL_005a: 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_006f: Unknown result type (might be due to invalid IL or missing references) if (pose != Pose.Idle) { return false; } float num = float.MaxValue; foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers((TeamIndex)1)) { CharacterBody val = (Object.op_Implicit((Object)(object)teamMember) ? teamMember.body : null); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.healthComponent) && val.healthComponent.alive) { Vector3 val2 = val.corePosition - ((Component)this).transform.position; val2.y = 0f; num = Mathf.Min(num, ((Vector3)(ref val2)).magnitude); } } return num > 26f; } private void ApplyHumanoid(float t, float drop, float headPitchPose, float jawPose) { //IL_08dd: Unknown result type (might be due to invalid IL or missing references) //IL_0922: Unknown result type (might be due to invalid IL or missing references) //IL_0953: Unknown result type (might be due to invalid IL or missing references) //IL_0988: Unknown result type (might be due to invalid IL or missing references) //IL_09b7: Unknown result type (might be due to invalid IL or missing references) //IL_0a1b: Unknown result type (might be due to invalid IL or missing references) //IL_0a56: Unknown result type (might be due to invalid IL or missing references) //IL_0a7b: Unknown result type (might be due to invalid IL or missing references) //IL_0a9d: Unknown result type (might be due to invalid IL or missing references) //IL_0acc: Unknown result type (might be due to invalid IL or missing references) //IL_0ae8: Unknown result type (might be due to invalid IL or missing references) //IL_0b17: Unknown result type (might be due to invalid IL or missing references) //IL_0b1e: Unknown result type (might be due to invalid IL or missing references) //IL_0b5a: Unknown result type (might be due to invalid IL or missing references) //IL_0b92: Unknown result type (might be due to invalid IL or missing references) //IL_0b99: Unknown result type (might be due to invalid IL or missing references) //IL_0baa: Unknown result type (might be due to invalid IL or missing references) //IL_0bc1: Unknown result type (might be due to invalid IL or missing references) //IL_0c48: Unknown result type (might be due to invalid IL or missing references) float deltaTime = Time.deltaTime; float num = Mathf.Clamp01(assemble); bool flag = num < 1f; float num2 = Jerk(Mathf.InverseLerp(0.06f, 0.3f, num), 4); float num3 = Jerk(Mathf.InverseLerp(0.3f, 0.52f, num), 5); float num4 = Jerk(Mathf.InverseLerp(0.5f, 0.7f, num), 4); float num5 = Mathf.InverseLerp(0.7f, 0.9f, num); float num6 = ((num5 < 0.8f) ? (150f * Mathf.SmoothStep(0f, 1f, num5 / 0.8f)) : (150f * (1f - Mathf.Clamp01((num5 - 0.8f) / 0.05f)))); float num7 = (flag ? 1f : 0.35f); int w = Mathf.FloorToInt(Time.time * (flag ? 7f : 2.3f)); float num8 = ((Hash(w, 3) > (flag ? 0.7f : 0.82f)) ? ((Hash(w, 5) - 0.5f) * (flag ? 30f : 18f)) : 0f); float num9 = Mathf.Clamp01(speedSmoothed / 8f); crawlS = Mathf.MoveTowards(crawlS, (!flag && WantsCrawl()) ? 1f : 0f, deltaTime * 2.2f); float num10 = -80f * num2; float num11 = 0f; float num12 = 5.7599998f * num3; float num13 = 0f; float num14 = 0f; float num15 = 0f; float num16 = 0f; float num17 = 0f; float num18 = num6; float num19 = 0f; float num20 = 0f; float num21 = Mathf.Max(jawPose, 0f); float num22 = 0f; float num23 = 0f; if (!flag) { float num24 = walkPhase * 0.8f; float num25 = Mathf.Sign(Mathf.Sin(num24)) * Mathf.Pow(Mathf.Abs(Mathf.Sin(num24)), 0.45f); float num26 = Mathf.Sin(num24 - 1.1f); num15 = num25 * 36f * num9; num16 = (0f - num26) * 24f * num9; num11 = Mathf.Sin(num24) * 8f * num9 + num8 * 0.5f; num10 = -64f + Noise(2f, 11f) * 5f; num23 = 0.35f; num13 = Mathf.Sin(Time.time * 2.1f + Mathf.Sin(num24) * 0.6f) * 28f - num25 * 10f * num9; num14 = num26 * 16f * num9 + Noise(1.5f, 4f) * 6f; int w2 = Mathf.FloorToInt(Time.time * 0.55f + Hash(Mathf.FloorToInt(Time.time * 0.55f), 2) * 0.5f); num18 = ((Hash(w2, 9) < 0.15f) ? 168f : ((Hash(w2, 7) - 0.5f) * 210f)); num17 = (Hash(w2, 13) - 0.5f) * 80f; num19 = (Hash(w2, 17) - 0.5f) * 30f; num21 = Mathf.Max(num21, 6f + Mathf.Abs(Mathf.Sin(Time.time * 31f)) * 9f); int num27 = Mathf.FloorToInt(Time.time / 7f); float num28 = Time.time - (float)num27 * 7f - Hash(num27, 21) * 4f; float num29 = ((num28 > 0f && num28 < 0.9f) ? Mathf.Sin(num28 / 0.9f * MathF.PI) : 0f); num10 -= 38f * num29; num19 -= 45f * num29; num21 = Mathf.Max(num21, 35f * num29); num13 += 60f * num29; num14 += 70f * num29; num22 = Mathf.Max(0f, Mathf.Sin(Time.time * 1.7f) + Noise(0.8f, 30f) * 0.6f); if (crawlS > 0.001f) { float num30 = crawlS; float num31 = Mathf.Sin(walkPhase * 1.1f); num10 = Mathf.Lerp(num10, -14f + Mathf.Sin(walkPhase * 2.2f) * 4f, num30); num13 = Mathf.Lerp(num13, -60f + num31 * 30f * num9, num30); num14 = Mathf.Lerp(num14, -60f - num31 * 30f * num9, num30); num15 = Mathf.Lerp(num15, 35f - num31 * 28f * num9, num30); num16 = Mathf.Lerp(num16, 35f + num31 * 28f * num9, num30); num20 = Mathf.Lerp(num20, num12 * 0.45f, num30); num18 = Mathf.Lerp(num18, num18 * 0.4f, num30); num11 = Mathf.Lerp(num11, Mathf.Sin(walkPhase * 1.1f) * 5f, num30); } switch (pose) { case Pose.Pounce: { float num35 = Mathf.Clamp01(t * 4f); num10 = Mathf.Lerp(num10, -30f, num35); num20 = 3.6f * num35; num11 = Noise(30f, 3f) * 4f * num35; num13 = (num14 = 75f * num35 + Noise(40f, 1f) * 10f * num35); num15 = (num16 = -24f * num35); num19 = -25f * num35; num17 = 0f; num18 = Noise(30f, 2f) * 14f * num35; num21 = 40f * num35; break; } case Pose.PounceFly: num10 = -10f; num13 = (num14 = -100f); num15 = 40f; num16 = 52f; num17 = 0f; num18 = 0f; num19 = -15f; num21 = 45f; num11 = 0f; break; case Pose.Swipe: { float num32 = Mathf.Clamp01(hitTime / poseDuration); float num33 = ((t < num32) ? (t / num32) : 1f); float num34 = ((t < num32) ? 0f : Mathf.Clamp01((t - num32) / 0.15f)); num14 = Mathf.Lerp(Mathf.Lerp(0f, 150f, num33), -75f, num34) + Noise(30f, 7f) * 8f * (1f - num34); num13 = -15f; num10 = -56f; num11 = -10f * num33 + 20f * num34; num17 = -20f * num33; num18 = 0f; num21 = 20f + 25f * num34; break; } case Pose.Telekinesis: num10 = -95f + Noise(3f, 4f) * 4f; num13 = (num14 = -125f + Noise(18f, 5f) * 7f); num15 = 10f + Noise(2f, 8f) * 6f; num16 = -8f + Noise(2.2f, 9f) * 6f; num19 = -35f; num17 = 0f; num18 = Noise(4f, 6f) * 15f; num11 = Noise(1.5f, 2f) * 6f; num21 = 30f; break; } } else { num13 = (num14 = Mathf.Lerp(-90f, 0f, num4)); num15 = Mathf.Lerp(0f, 25f, num3) * (1f - num3) * 4f + num8 * 0.5f; num16 = (0f - num15) * 0.7f; num19 = num8; num11 = num8 * 0.3f; num21 = Mathf.Max(jawPose, (num5 > 0.75f) ? 38f : (12f * Mathf.Abs(Noise(10f, 9f)))); } num10 += num8 * 0.4f + Noise(25f, 1f) * 2f * num7; poseRoot.localPosition = new Vector3(Noise(30f, 21f) * 0.05f * num7, num12 - num20 - drop, 0f); torso.localRotation = Quaternion.Euler(num10, Noise(20f, 2f) * 3f * num7, num11 + Noise(23f, 8f) * 3f * num7); torso.localScale = new Vector3(1f + num22 * 0.06f, 1f, 1f + num22 * 0.04f); head.localRotation = Quaternion.Euler(0f - num10 + headPitchPose + num19 + Noise(35f, 3f) * 3f * num7, num17, num18); num21 = Mathf.Clamp(num21, 0f, 48f); jaw.localRotation = Quaternion.Euler(num21, 0f, 0f); float num36 = Mathf.Lerp(1f, 0.7f, Mathf.Max(num4, num3 * 0.5f)); legFL.localRotation = Quaternion.Euler(num13 - num10 + Noise(28f, 4f) * 4f * num7, 0f, -8f * num4 - 6f * num23); legFR.localRotation = Quaternion.Euler(num14 - num10 + Noise(27f, 6f) * 4f * num7, 0f, 8f * num4); legFL.localScale = new Vector3(num36, 1f + (1.3f + num23) * num4, num36); legFR.localScale = new Vector3(num36, 1f + 1.3f * num4, num36); float num37 = Mathf.Lerp(1f, 0.75f, num3); legBL.localRotation = Quaternion.Euler(num15, 0f, 0f); legBR.localRotation = Quaternion.Euler(num16, 0f, 0f); Transform obj = legBL; Transform obj2 = legBR; Vector3 localScale = default(Vector3); ((Vector3)(ref localScale))..ctor(num37, 1f + 1.6f * num3, num37); obj2.localScale = localScale; obj.localScale = localScale; tail.localRotation = Quaternion.Euler(Noise(9f, 40f) * 25f, Noise(7f, 41f) * 30f, 0f); float num38 = 1f + Mathf.Max(0f, Noise(1.3f, 50f)) * 0.6f; eyeL.localScale = eyeRestScale * num38; eyeR.localScale = eyeRestScale * Mathf.Max(0.35f, 2f - num38); CharacterBody componentInParent = ((Component)this).GetComponentInParent<CharacterBody>(); bool flag2 = Object.op_Implicit((Object)(object)componentInParent) && Object.op_Implicit((Object)(object)componentInParent.healthComponent) && componentInParent.healthComponent.alive && !CocoaFinale.Banished; if (!flag && flag2 && Time.time >= nextCreepSound) { nextCreepSound = Time.time + Random.Range(3f, 7f); if (Random.value < 0.5f) { CocoaAudio.Bark(((Component)this).transform.position, 0.55f, Random.Range(0, 3), Random.Range(0.4f, 0.5f)); } else { Util.PlaySound("Play_beetle_queen_attack1", ((Component)this).gameObject); } } } private Transform BuildStars() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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) Material mat = Assets.Mat("DazeStar", new Color(1f, 0.9f, 0.3f), 0.6f, (Color?)new Color(1f, 0.85f, 0.2f), 3f); MeshBuilder meshBuilder = new MeshBuilder(); for (int i = 0; i < 5; i++) { float num = (float)i * MathF.PI * 2f / 5f; meshBuilder.Ellipsoid(new Vector3(Mathf.Cos(num) * 3f, 0f, Mathf.Sin(num) * 3f), new Vector3(0.6f, 0.6f, 0.25f), Quaternion.Euler(0f, (0f - num) * 57.29578f, 0f), mat, 6, 8); } GameObject obj = meshBuilder.Spawn("DazeStars", head); obj.transform.localPosition = new Vector3(0f, 5.2f, 1.2f); return obj.transform; } internal void Bind(CocoaModelBuilder.Result r) { poseRoot = r.parts[CocoaModelData.P.Root]; torso = r.parts[CocoaModelData.P.Torso]; head = r.parts[CocoaModelData.P.Head]; jaw = r.parts[CocoaModelData.P.Jaw]; tongue = r.parts[CocoaModelData.P.Tongue]; earL = r.parts[CocoaModelData.P.EarL]; earR = r.parts[CocoaModelData.P.EarR]; eyeL = r.parts[CocoaModelData.P.EyeL]; eyeR = r.parts[CocoaModelData.P.EyeR]; tail = r.parts[CocoaModelData.P.Tail]; legFL = r.parts[CocoaModelData.P.LegFL]; legFR = r.parts[CocoaModelData.P.LegFR]; legBL = r.parts[CocoaModelData.P.LegBL]; legBR = r.parts[CocoaModelData.P.LegBR]; } } internal static class CocoaBodyFactory { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static StatHookEventHandler <>9__2_0; public static Func<MeshRenderer, RendererInfo> <>9__3_0; internal void <Init>b__2_0(CharacterBody b, StatHookEventArgs args) { CocoaPhaseController cocoaPhaseController = (Object.op_Implicit((Object)(object)b) ? ((Component)b).GetComponent<CocoaPhaseController>() : null); if (Object.op_Implicit((Object)(object)cocoaPhaseController) && cocoaPhaseController.phase >= 4) { if (cocoaPhaseController.crawling) { args.moveSpeedMultAdd += ModConfig.CrawlSpeedBonus.Value / 100f; } } else if (Object.op_Implicit((Object)(object)cocoaPhaseController) && cocoaPhaseController.phase >= 3) { args.moveSpeedMultAdd += ModConfig.MechaSpeedBonus.Value / 100f; } else if (Object.op_Implicit((Object)(object)cocoaPhaseController) && cocoaPhaseController.phase2) { args.moveSpeedMultAdd += ModConfig.Phase2SpeedBonus.Value / 100f; } } internal RendererInfo <BuildBody>b__3_0(MeshRenderer r) { //IL_0002: 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: Unknown result type (might be due to invalid IL or missing references) return new RendererInfo { renderer = (Renderer)(object)r, defaultMaterial = ((Renderer)r).sharedMaterial, defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false }; } } public const float CapsuleRadius = 5f; public const float CapsuleHeight = 11f; public static void Init() { //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Expected O, but got Unknown CocoaContent.EntityStates.AddRange(new Type[22] { typeof(CocoaSpawn), typeof(CocoaMain), typeof(CocoaBite), typeof(CocoaLick), typeof(CocoaBark), typeof(CocoaPetted), typeof(CocoaDeath), typeof(CocoaSuperTransform), typeof(CocoaEyeBeam), typeof(CocoaCorruptTransform), typeof(CocoaCough), typeof(CocoaGrabCharge), typeof(CocoaGrabHold), typeof(CocoaDazed), typeof(CocoaAscend), typeof(CocoaAssemble), typeof(CocoaPounce), typeof(CocoaSwipe), typeof(CocoaMeteor), typeof(CocoaMeteorThrow), typeof(CocoaFinaleState), typeof(CocoaBanished) }); CocoaContent.BodyPrefab = BuildBody(); object obj = <>c.<>9__2_0; if (obj == null) { StatHookEventHandler val = delegate(CharacterBody b, StatHookEventArgs args) { CocoaPhaseController cocoaPhaseController = (Object.op_Implicit((Object)(object)b) ? ((Component)b).GetComponent<CocoaPhaseController>() : null); if (Object.op_Implicit((Object)(object)cocoaPhaseController) && cocoaPhaseController.phase >= 4) { if (cocoaPhaseController.crawling) { args.moveSpeedMultAdd += ModConfig.CrawlSpeedBonus.Value / 100f; } } else if (Object.op_Implicit((Object)(object)cocoaPhaseController) && cocoaPhaseController.phase >= 3) { args.moveSpeedMultAdd += ModConfig.MechaSpeedBonus.Value / 100f; } else if (Object.op_Implicit((Object)(object)cocoaPhaseController) && cocoaPhaseController.phase2) { args.moveSpeedMultAdd += ModConfig.Phase2SpeedBonus.Value / 100f; } }; <>c.<>9__2_0 = val; obj = (object)val; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj; CocoaContent.MasterPrefab = BuildMaster(CocoaContent.BodyPrefab); } private static GameObject BuildBody() { //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_059d: Unknown result type (might be due to invalid IL or missing references) //IL_05a2: Unknown result type (might be due to invalid IL or missing references) //IL_055c: Unknown result type (might be due to invalid IL or missing references) //IL_0561: Unknown result type (might be due to invalid IL or missing references) //IL_0572: Unknown result type (might be due to invalid IL or missing references) //IL_0577: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Unknown result type (might be due to invalid IL or missing references) //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_0544: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) GameObject val = PrefabAPI.InstantiateClone(Assets.LoadAddressable<GameObject>("RoR2/Base/BeetleQueen/BeetleQueen2Body.prefab"), "CocoaBody", true); CharacterBody component = val.GetComponent<CharacterBody>(); component.baseNameToken = "COCOA_BODY_NAME"; component.subtitleNameToken = "COCOA_BODY_SUBTITLE"; component.baseMaxHealth = ModConfig.BaseHealth.Value; component.levelMaxHealth = ModConfig.LevelHealth.Value; component.baseDamage = ModConfig.BaseDamage.Value; component.levelDamage = ModConfig.LevelDamage.Value; component.baseMoveSpeed = ModConfig.MoveSpeed.Value; component.levelMoveSpeed = 0f; component.baseAcceleration = 45f; component.baseArmor = 20f; component.levelArmor = 0f; component.baseRegen = 0f; component.levelRegen = 0f; component.baseJumpCount = 0; component.isChampion = true; component.rootMotionInMainState = false; component.bodyColor = new Color(0.97f, 0.95f, 0.9f); component.bodyFlags = (BodyFlags)(component.bodyFlags | 0x11); Sprite val2 = Assets.LoadSprite("CocoaPortrait.png"); if (Object.op_Implicit((Object)(object)val2)) { component.portraitIcon = (Texture)(object)val2.texture; } KinematicCharacterMotor component2 = val.GetComponent<KinematicCharacterMotor>(); if (Object.op_Implicit((Object)(object)component2)) { component2.SetCapsuleDimensions(5f, 11f, 0f); } CapsuleCollider component3 = val.GetComponent<CapsuleCollider>(); if (Object.op_Implicit((Object)(object)component3)) { component3.radius = 5f; component3.height = 11f; component3.center = Vector3.zero; } CharacterDirection component4 = val.GetComponent<CharacterDirection>(); if (Object.op_Implicit((Object)(object)component4)) { component4.turnSpeed = 240f; component4.modelAnimator = null; component4.driveFromRootRotation = false; component4.rootMotionAccumulator = null; component4.overrideAnimatorForwardTransform = null; } ModelLocator component5 = val.GetComponent<ModelLocator>(); Transform modelTransform = component5.modelTransform; Transform val3 = (Object.op_Implicit((Object)(object)component5.modelBaseTransform) ? component5.modelBaseTransform : modelTransform.parent); val3.localPosition = new Vector3(0f, -5.5f, 0f); val3.localRotation = Quaternion.identity; val3.localScale = Vector3.one; CocoaModelBuilder.Result result = CocoaModelBuilder.Build("mdlCocoa"); GameObject root = result.root; root.transform.SetParent(val3, false); Object.DestroyImmediate((Object)(object)((Component)modelTransform).gameObject); component5.modelTransform = root.transform; component5.modelBaseTransform = val3; if (Object.op_Implicit((Object)(object)component4)) { component4.targetTransform = val3; } component5.autoUpdateModelTransform = true; component5.normalizeToFloor = false; Transform transform = new GameObject("Core").transform; transform.SetParent(result.parts[CocoaModelData.P.Torso], false); transform.localPosition = new Vector3(0f, 4.3f, -0.4f) - CocoaModelData.Pivots[CocoaModelData.P.Torso].pivot + CocoaModelData.Pivots[CocoaModelData.P.Root].pivot; component.coreTransform = transform; HealthComponent component6 = val.GetComponent<HealthComponent>(); HurtBoxGroup val4 = root.AddComponent<HurtBoxGroup>(); HurtBox val5 = MakeHurtBox("HurtboxBody", result.parts[CocoaModelData.P.Torso], component6, val4, 0, bullseye: true, new Vector3(0f, 4.3f, -0.4f) - CocoaModelData.Pivots[CocoaModelData.P.Torso].pivot, new Vector3(3.3f, 11f, 0f), capsule: true); HurtBox val6 = MakeHurtBox("HurtboxHead", result.parts[CocoaModelData.P.Head], component6, val4, 1, bullseye: false, new Vector3(0f, 8.4f, 4.6f) - CocoaModelData.Pivots[CocoaModelData.P.Head].pivot, new Vector3(3.2f, 0f, 0f), capsule: false); val4.hurtBoxes = (HurtBox[])(object)new HurtBox[2] { val5, val6 }; val4.mainHurtBox = val5; val4.bullseyeCount = 1; component.mainHurtBox = val5; root.AddComponent<ChildLocator>().transformPairs = (NameTransformPair[])(object)new NameTransformPair[3] { new NameTransformPair { name = "Head", transform = result.parts[CocoaModelData.P.Head] }, new NameTransformPair { name = "Mouth", transform = result.parts[CocoaModelData.P.Jaw] }, new NameTransformPair { name = "Chest", transform = transform } }; CharacterModel val7 = root.AddComponent<CharacterModel>(); val7.body = component; val7.autoPopulateLightInfos = true; val7.baseRendererInfos = ((IEnumerable<MeshRenderer>)result.renderers).Select((Func<MeshRenderer, RendererInfo>)((MeshRenderer r) => new RendererInfo { renderer = (Renderer)(object)r, defaultMaterial = ((Renderer)r).sharedMaterial, defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false })).ToArray(); root.AddComponent<CocoaAnimator>().Bind(result); root.AddComponent<CocoaSuperVisuals>().Bind(result, val7); EntityStateMachine[] components = val.GetComponents<EntityStateMachine>(); foreach (EntityStateMachine val8 in components) { if (val8.customName == "Body") { val8.initialStateType = new SerializableEntityStateType(typeof(CocoaSpawn)); val8.mainStateType = new SerializableEntityStateType(typeof(CocoaMain)); } else { val8.initialStateType = new SerializableEntityStateType(typeof(Idle)); val8.mainStateType = new SerializableEntityStateType(typeof(Idle)); } } val.GetComponent<CharacterDeathBehavior>().deathState = new SerializableEntityStateType(typeof(CocoaDeath)); SetStateOnHurt component7 = val.GetComponent<SetStateOnHurt>(); if (Object.op_Implicit((Object)(object)component7)) { Object.DestroyImmediate((Object)(object)component7); } SfxLocator component8 = val.GetComponent<SfxLocator>(); if (Object.op_Implicit((Object)(object)component8)) { component8.deathSound = ""; component8.barkSound = ""; component8.aliveLoopStart = ""; component8.aliveLoopStop = ""; } DeathRewards component9 = val.GetComponent<DeathRewards>(); if (Object.op_Implicit((Object)(object)component9)) { component9.logUnlockableDef = null; component9.bossDropTable = null; } val.AddComponent<CocoaPhaseController>(); val.AddComponent<CocoaHover>(); return val; } internal static HurtBox MakeHurtBox(string name, Transform parent, HealthComponent hc, HurtBoxGroup group, short index, bool bullseye, Vector3 localPos, Vector3 colliderSize, bool capsule) { //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_0017: Expected O, but got Unknown //IL_002a: 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_0043: 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_0095: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name) { layer = LayerIndex.entityPrecise.intVal }; val.transform.SetParent(parent, false); val.transform.localPosition = localPos; if (capsule) { CapsuleCollider obj = val.AddComponent<CapsuleCollider>(); obj.direction = 2; obj.radius = colliderSize.x; obj.height = colliderSize.y; } else { val.AddComponent<SphereCollider>().radius = colliderSize.x; } HurtBox obj2 = val.AddComponent<HurtBox>(); obj2.healthComponent = hc; obj2.hurtBoxGroup = group; obj2.indexInGroup = index; obj2.isBullseye = bullseye; obj2.damageModifier = (DamageModifier)0; return obj2; } private static GameObject BuildMaster(GameObject body) { GameObject val = PrefabAPI.InstantiateClone(Assets.LoadAddressable<GameObject>("RoR2/Base/BeetleQueen/BeetleQueenMaster.prefab"), "CocoaMaster", true); val.GetComponent<CharacterMaster>().bodyPrefab = body; AISkillDriver[] components = val.GetComponents<AISkillDriver>(); for (int i = 0; i < components.Length; i++) { Object.DestroyImmediate((Object)(object)components[i]); } BaseAI component = val.GetComponent<BaseAI>(); if (Object.op_Implicit((Object)(object)component)) { Object.DestroyImmediate((Object)(object)component); } NetworkStateMachine component2 = val.GetComponent<NetworkStateMachine>(); if (Object.op_Implicit((Object)(object)component2)) { Object.DestroyImmediate((Object)(object)component2); } EntityStateMachine[] components2 = val.GetComponents<EntityStateMachine>(); for (int i = 0; i < components2.Length; i++) { Object.DestroyImmediate((Object)(object)components2[i]); } return val; } } public class CocoaHover : MonoBehaviour { public const float BoosterDepth = 1.3f; public float lowUntil; private CharacterBody body; private CharacterMotor motor; private EntityStateMachine machine; public static float Lift => ModConfig.MechaHoverHeight.Value + 1.3f; private void Awake() { body = ((Component)this).GetComponent<CharacterBody>(); motor = ((Component)this).GetComponent<CharacterMotor>(); machine = EntityStateMachine.FindByCustomName(((Component)this).gameObject, "Body"); } public static bool IsMecha(GameObject cocoa) { Transform val = ((Object.op_Implicit((Object)(object)cocoa) && Object.op_Implicit((Object)(object)cocoa.GetComponent<ModelLocator>())) ? cocoa.GetComponent<ModelLocator>().modelTransform : null); CocoaSuperVisuals cocoaSuperVisuals = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<CocoaSuperVisuals>() : null); if (Object.op_Implicit((Object)(object)cocoaSuperVisuals)) { return cocoaSuperVisuals.IsMecha; } return false; } private void FixedUpdate() { //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)motor) || !body.hasEffectiveAuthority || !IsMecha(((Component)this).gameObject) || (Object.op_Implicit((Object)(object)body.healthComponent) && !body.healthComponent.alive)) { return; } EntityState val = (Object.op_Implicit((Object)(object)machine) ? machine.state : null); if (!(val is CocoaCorruptTransform) && !(val is CocoaDeath) && !(val is CocoaSuperTransform) && !(val is CocoaSpawn) && !(val is CocoaAscend)) { motor.useGravity = false; motor.airControl = 1f; float num = ((Time.time < lowUntil) ? 0.4f : Lift); float num2 = CocoaArena.Center.y + num + 5.5f - ((Component)this).transform.position.y; Vector3 velocity = motor.velocity; velocity.y = Mathf.Clamp(num2 * 5f, -32f, 32f); motor.velocity = velocity; if (motor.isGrounded) { ((BaseCharacterController)motor).Motor.ForceUnground(0.1f); } } } } internal static class CocoaModelBuilder { public class Result { public GameObject root; public readonly Dictionary<CocoaModelData.P, Transform> parts = new Dictionary<CocoaModelData.P, Transform>(); public readonly List<MeshRenderer> renderers = new List<MeshRenderer>(); } public static Result Build(string name) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0017: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) Result result = new Result { root = new GameObject(name) }; Transform transform = new GameObject("Pose").transform; transform.SetParent(result.root.transform, false); result.parts[CocoaModelData.P.Root] = transform; Dictionary<CocoaModelData.M, Material> dictionary = new Dictionary<CocoaModelData.M, Material>(); foreach (KeyValuePair<CocoaModelData.M, (Color, float)> material in CocoaModelData.Materials) { Color? emission = ((material.Key == CocoaModelData.M.Glint) ? new Color?(Color.white) : ((Color?)null)); dictionary[material.Key] = Assets.Mat("Cocoa" + material.Key, material.Value.Item1, material.Value.Item2, emission, 1.5f); } foreach (KeyValuePair<CocoaModelData.P, (CocoaModelData.P, Vector3)> pivot in CocoaModelData.Pivots) { if (pivot.Key != CocoaModelData.P.Root) { Transform transform2 = new GameObject(pivot.Key.ToString()).transform; transform2.SetParent(result.parts[pivot.Value.Item1], false); transform2.localPosition = pivot.Value.Item2 - CocoaModelData.Pivots[pivot.Value.Item1].pivot; result.parts[pivot.Key] = transform2; } } LoadBakedFur(result, dictionary); Dictionary<CocoaModelData.P, MeshBuilder> dictionary2 = new Dictionary<CocoaModelData.P, MeshBuilder>(); CocoaModelData.S[] shapes = CocoaModelData.Shapes; for (int i = 0; i < shapes.Length; i++) { CocoaModelData.S s = shapes[i]; if (!dictionary2.TryGetValue(s.part, out var value)) { value = (dictionary2[s.part] = new MeshBuilder()); } value.Ellipsoid(s.center - CocoaModelData.Pivots[s.part].pivot, s.radii, Quaternion.Euler(s.euler), dictionary[s.mat], s.lat, s.lon, s.noise, s.seed); } foreach (KeyValuePair<CocoaModelData.P, MeshBuilder> item in dictionary2) { result.renderers.AddRange(item.Value.SpawnSplit("detail" + item.Key, result.parts[item.Key])); } foreach (MeshRenderer renderer in result.renderers) { ((Renderer)renderer).shadowCastingMode = (ShadowCastingMode)1; ((Renderer)renderer).receiveShadows = true; } return result; } private static void LoadBakedFur(Result r, Dictionary<CocoaModelData.M, Material> mats) { //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_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_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Expected O, but got Unknown //IL_01d1: 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_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = Array.Find(executingAssembly.GetManifestResourceNames(), (string n) => n.EndsWith("cocoa_mesh.bin", StringComparison.OrdinalIgnoreCase)); if (text == null) { Log.Error("cocoa_mesh.bin missing from the DLL; Cocoa will only have eyes and a nose."); return; } using BinaryReader binaryReader = new BinaryReader(executingAssembly.GetManifestResourceStream(text)); if (new string(binaryReader.ReadChars(4)) != "COCO") { Log.Error("cocoa_mesh.bin has a bad header."); return; } binaryReader.ReadInt32(); int num = binaryReader.ReadInt32(); for (int num2 = 0; num2 < num; num2++) { string text2 = ReadString(binaryReader); int num3 = binaryReader.ReadInt32(); Vector3[] array = (Vector3[])(object)new Vector3[num3]; Vector3[] array2 = (Vector3[])(object)new Vector3[num3]; for (int num4 = 0; num4 < num3; num4++) { array[num4] = new Vector3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()); } for (int num5 = 0; num5 < num3; num5++) { array2[num5] = new Vector3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()); } CocoaModelData.P key = (CocoaModelData.P)Enum.Parse(typeof(CocoaModelData.P), text2); int num6 = binaryReader.ReadInt32(); for (int num7 = 0; num7 < num6; num7++) { CocoaModelData.M m = (CocoaModelData.M)Enum.Parse(typeof(CocoaModelData.M), ReadString(binaryReader)); int num8 = binaryReader.ReadInt32(); int[] array3 = new int[num8]; for (int num9 = 0; num9 < num8; num9++) { array3[num9] = binaryReader.ReadInt32(); } Dictionary<int, int> dictionary = new Dictionary<int, int>(); List<Vector3> list = new List<Vector3>(); List<Vector3> list2 = new List<Vector3>(); int[] array4 = new int[num8]; for (int num10 = 0; num10 < num8; num10++) { if (!dictionary.TryGetValue(array3[num10], out var value)) { value = list.Count; dictionary[array3[num10]] = value; list.Add(array[array3[num10]]); list2.Add(array2[array3[num10]]); } array4[num10] = value; } Mesh val = new Mesh { name = $"Cocoa_{text2}_{m}" }; if (list.Count > 65000) { val.indexFormat = (IndexFormat)1; } val.SetVertices(list); val.SetNormals(list2); val.SetTriangles(array4, 0); val.RecalculateBounds(); GameObject val2 = new GameObject($"fur{text2}_{m}"); val2.transform.SetParent(r.parts[key], false); val2.AddComponent<MeshFilter>().sharedMesh = val; MeshRenderer val3 = val2.AddComponent<MeshRenderer>(); ((Renderer)val3).sharedMaterial = mats[m]; r.renderers.Add(val3); } } } private static string ReadString(BinaryReader br) { return new string(br.ReadChars(br.ReadInt32())); } } internal static class CocoaModelData { public enum P { None, Root, Torso, Head, Jaw, Tongue, EarL, EarR, EyeL, EyeR, Tail, LegFL, LegFR, LegBL, LegBR } public enum M { White, Cream, Ear, Beard, Apricot, Caramel, Champagne, Nose, Eye, Glint, Mouth, Tongue, Pad } public readonly struct S { public readonly P part; public readonly M mat; public readonly Vector3 center; public readonly Vector3 radii; public readonly Vector3 euler; public readonly float noise; public readonly int lat; public readonly int lon; public readonly int seed; public S(P part, M mat, float cx, float cy, float cz, float rx, float ry, float rz, float ex, float ey, float ez, float noise, int lat, int lon, int seed) { //IL_0014: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) this.part = part; this.mat = mat; center = new Vector3(cx, cy, cz); radii = new Vector3(rx, ry, rz); euler = new Vector3(ex, ey, ez); this.noise = noise; this.lat = lat; this.lon = lon; this.seed = seed; } } public static readonly Dictionary<P, (P parent, Vector3 pivot)> Pivots = new Dictionary<P, (P, Vector3)> { { P.Root, (P.None, new Vector3(0f, 0f, 0f)) }, { P.Torso, (P.Root, new Vector3(0f, 2.8f, -3.6f)) }, { P.Head, (P.Torso, new Vector3(0f, 6.3f, 3f)) }, { P.Jaw, (P.Head, new Vector3(0f, 6.9f, 5.7f)) }, { P.Tongue, (P.Jaw, new Vector3(0f, 6.8f, 6.3f)) }, { P.EarL, (P.Head, new Vector3(-2.55f, 9.2f, 3.4f)) }, { P.EarR, (P.Head, new Vector3(2.55f, 9.2f, 3.4f)) }, { P.EyeL, (P.Head, new Vector3(-1.2f, 8.75f, 6.25f)) }, { P.EyeR, (P.Head, new Vector3(1.2f, 8.75f, 6.25f)) }, { P.Tail, (P.Torso, new Vector3(0f, 6.2f, -4.7f)) }, { P.LegFL, (P.Torso, new Vector3(-1.9f, 3.6f, 2.4f)) }, { P.LegFR, (P.Torso, new Vector3(1.9f, 3.6f, 2.4f)) }, { P.LegBL, (P.Root, new Vector3(-2.1f, 3.6f, -3.3f)) }, { P.LegBR, (P.Root, new Vector3(2.1f, 3.6f, -3.3f)) } }; public static readonly Dictionary<M, (Color color, float smoothness)> Materials = new Dictionary<M, (Color, float)> { { M.White, (new Color(0.97f, 0.96f, 0.93f), 0.05f) }, { M.Cream, (new Color(0.965f, 0.94f, 0.88f), 0.05f) }, { M.Ear, (new Color(0.94f, 0.88f, 0.76f), 0.05f) }, { M.Beard, (new Color(0.95f, 0.925f, 0.86f), 0.05f) }, { M.Apricot, (new Color(0.92f, 0.78f, 0.6f), 0.05f) }, { M.Caramel, (new Color(0.85f, 0.68f, 0.5f), 0.05f) }, { M.Champagne, (new Color(0.95f, 0.88f, 0.75f), 0.05f) }, { M.Nose, (new Color(0.07f, 0.05f, 0.05f), 0.6f) }, { M.Eye, (new Color(0.1f, 0.06f, 0.04f), 0.95f) }, { M.Glint, (new Color(1f, 1f, 1f), 0.9f) }, { M.Mouth, (new Color(0.45f, 0.16f, 0.2f), 0.3f) }, { M.Tongue, (new Color(0.96f, 0.52f, 0.58f), 0.5f) }, { M.Pad, (new Color(0.25f, 0.2f, 0.2f), 0.2f) } }; public static readonly S[] Shapes = new S[7] { new S(P.Head, M.Nose, 0f, 8.05f, 7.75f, 0.68f, 0.5f, 0.45f, -10f, 0f, 0f, 0f, 20, 28, 1438), new S(P.Jaw, M.Mouth, 0f, 6.95f, 6.4f, 0.95f, 0.35f, 0.95f, 0f, 0f, 0f, 0f, 20, 28, 1508), new S(P.Tongue, M.Tongue, 0f, 6.85f, 6.9f, 0.55f, 0.16f, 0.9f, 0f, 0f, 0f, 0f, 20, 28, 1522), new S(P.EyeL, M.Eye, -1.2f, 8.75f, 6.4f, 0.74f, 0.74f, 0.5f, 0f, 0f, 0f, 0f, 20, 28, 1529), new S(P.EyeL, M.Glint, -0.98f, 9.02f, 6.86f, 0.17f, 0.17f, 0.08f, 0f, 0f, 0f, 0f, 20, 28, 1536), new S(P.EyeR, M.Eye, 1.2f, 8.75f, 6.4f, 0.74f, 0.74f, 0.5f, 0f, 0f, 0f, 0f, 20, 28, 1543), new S(P.EyeR, M.Glint, 1.42f, 9.02f, 6.86f, 0.17f, 0.17f, 0.08f, 0f, 0f, 0f, 0f, 20, 28, 1550) }; } public class CocoaPhaseController : MonoBehaviour, IOnIncomingDamageServerReceiver { public enum StopReason { None, Treat, Pet, Timeout } private static readonly float[] BarksP1 = new float[3] { 0.8f, 0.6f, 0.4f }; private static readonly float[] NoBarks = new float[0]; public int phase = 1; public bool invulnerable; public bool isBarking; public StopReason stopReason; public float nextEyeBeamTime; public float nextCoughTime; public float nextGrabTime; public bool discombobulateRequested; public CharacterBody discombobulatedBy; private HealthComponent health; private CharacterBody body; private EntityStateMachine bodyMachine; private int nextBark; private bool pendingBark; private bool pendingTransform; private bool transforming; private readonly List<GameObject> barkObjects = new List<GameObject>(); private GameObject discombobulateZone; private readonly List<CocoaGasCloud> gas = new List<CocoaGasCloud>(); private readonly Dictionary<CharacterBody, float> exposure = new Dictionary<CharacterBody, float>(); private readonly Dictionary<CharacterBody, float> outOfGas = new Dictionary<CharacterBody, float>(); private readonly Dictionary<CharacterBody, float> infectedUntil = new Dictionary<CharacterBody, float>(); private float infectionTick; private float phase3UnlockTime; public float nextPounceTime; public float nextSwipeTime; public float nextMeteorTime; public float meteorStartedAt; public const float CrawlDistance = 26f; public bool crawling; public bool finale; public bool finaleResting; public bool banishRequested; public bool banished; public CharacterBody banishedBy; private GameObject banishZone; public bool hordeCleared; private readonly List<CharacterMaster> pups = new List<CharacterMaster>(); private bool hordeActive; private int hordeBurstsLeft; private int hordePerBurst; private float hordeNextBurst; private float hordeStartedAt; public static CocoaPhaseController Active { get; private set; } public bool phase2 => phase >= 2; public CharacterBody Body => body; public HealthComponent Health => health; private bool Phase3Locked { get { if (phase == 2) { return Time.time < phase3UnlockTime; } return false; } } private float Floor => Threshold + (Phase3Locked ? 0.01f : 0f); private float Threshold { get { if (phase != 1) { if (phase != 2) { if (phase != 3) { return ModConfig.FinaleThreshold.Value / 100f; } return ModConfig.Phase4Threshold.Value / 100f; } return ModConfig.Phase3Threshold.Value / 100f; } return ModConfig.Phase2Threshold.Value / 100f; } } private float[] Barks { get { if (phase != 1) { return NoBarks; } return BarksP1; } } private void Awake() { health = ((Component)this).GetComponent<HealthComponent>(); body = ((Component)this).GetComponent<CharacterBody>(); bodyMachine = EntityStateMachine.FindByCustomName(((Component)this).gameObject, "Body"); } private void OnEnable() { Active = this; } private void OnDisable() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Active == (Object)(object)this) { Active = null; } if (NetworkServer.active) { EndBarkPhase(); EndGrab(); ClearGas(Vector3.zero, float.MaxValue); if (Object.op_Implicit((Object)(object)banishZone)) { NetworkServer.Destroy(banishZone); } } } private void FixedUpdate() { if (!NetworkServer.active) { return; } UpdateGasAndInfection(); if (!Object.op_Implicit((Object)(object)health) || !health.alive) { return; } float combinedHealthFraction = health.combinedHealthFraction; if (phase < ModConfig.TestStartPhase.Value && !transforming && Object.op_Implicit((Object)(object)bodyMachine) && bodyMachine.state is CocoaMain) { pendingTransform = true; phase3UnlockTime = 0f; } if ((phase < 4 || !finale) && !transforming && !Phase3Locked && combinedHealthFraction <= Threshold + 0.0001f) { pendingTransform = true; } UpdateHorde(); UpdateCrawl(); float[] barks = Barks; while (nextBark < barks.Length && combinedHealthFraction <= barks[nextBark]) { nextBark++; if (!pendingTransform) { pendingBark = true; } } if (!Object.op_Implicit((Object)(object)bodyMachine)) { return; } EntityState state = bodyMachine.state; if (pendingTransform && IsInterruptible(state)) { pendingTransform = false; pendingBark = false; transforming = true; if (phase >= 4) { finale = true; } bodyMachine.SetNextState((EntityState)(object)((phase == 1) ? new CocoaSuperTransform() : ((phase == 2) ? new CocoaCorruptTransform() : ((phase == 3) ? ((CocoaBaseState)new CocoaAscend()) : ((CocoaBaseState)new CocoaFinaleState()))))); } else if (pendingBark && IsInterruptible(state)) { pendingBark = false; bodyMachine.SetNextState((EntityState)(object)new CocoaBark()); } } private static bool IsInterruptible(EntityState s) { if (!(s is CocoaMain) && !(s is CocoaBite) && !(s is CocoaLick) && !(s is CocoaEyeBeam) && !(s is CocoaCough)) { return s is CocoaSwipe; } return true; } public void BeginFinaleResting() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) finaleResting = true; if (!Object.op_Implicit((Object)(object)banishZone) && Object.op_Implicit((Object)(object)CocoaContent.BanishZonePrefab)) { banishZone = Object.Instantiate<GameObject>(CocoaContent.BanishZonePrefab, ((Component)this).transform.position, Quaternion.identity); NetworkServer.Spawn(banishZone); } } public void RequestBanish(CharacterBody by) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown if (NetworkServer.active && finaleResting && !banishRequested) { banishRequested = true; banishedBy = by; if (Object.op_Implicit((Object)(object)banishZone)) { NetworkServer.Destroy(banishZone); } banishZone = null; SimpleChatMessage val = new SimpleChatMessage(); val.baseToken = "COCOA_BANISHED"; val.paramTokens = new string[1] { Object.op_Implicit((Object)(object)by) ? by.GetUserName() : "Someone" }; Chat.SendBroadcastChat((ChatMessageBase)(object)val); } } public void EnterPhase(int phaseIndex) { phase = phaseIndex; transforming = false; invulnerable = false; nextBark = 0; float time = Time.time; nextEyeBeamTime = time + 4f; nextCoughTime = time + 2f; nextGrabTime = time + 6f; if (phaseIndex == 2) { phase3UnlockTime = time + ModConfig.Phase3Lockout.Value; } nextPounceTime = time + 2.5f; nextSwipeTime = time + 1f; nextMeteorTime = time + ModConfig.MeteorInterval.Value; crawling = false; if (Object.op_Implicit((Object)(object)body)) { body.MarkAllStatsDirty(); } } public void EnterPhase2() { EnterPhase(2); } public void OnIncomingDamageServer(DamageInfo di) { if (!Object.op_Implicit((Object)(object)health) || banished) { return; } if (invulnerable) { di.rejected = true; } else { if (phase >= 4 && finale) { return; } float num = health.fullCombinedHealth * Floor; float num2 = health.combinedHealth - num; if (num2 <= 1f) { di.rejected = true; if (!Phase3Locked) { pendingTransform = true; } return; } if (di.damage >= num2 && !Phase3Locked) { pendingTransform = true; } if (di.damage > num2 * 0.25f) { di.damage = num2 * 0.25f; } } } public static float ClampHealth(float value, HealthComponent hc) { CocoaPhaseController active = Active; if (!Object.op_Implicit((Object)(object)active) || !Object.op_Implicit((Object)(object)hc) || (Object)(object)active.health != (Object)(object)hc || !NetworkServer.active) { return value; } if ((active.phase >= 4 && active.finale) || active.banished || !hc.alive) { return value; } float num = Mathf.Max(1f, hc.fullCombinedHealth * active.Floor - hc.shield - hc.barrier); if (value >= num) { return value; } if (!active.Phase3Locked) { active.pendingTransform = true; } return num; } private void LateUpdate() { //IL_0077: 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) if (NetworkServer.active && (phase < 4 || !finale) && !banished && Object.op_Implicit((Object)(object)health) && health.alive) { float num = health.fullCombinedHealth * Floor; if (health.combinedHealth < num - 1f) { health.Heal(num - health.combinedHealth, default(ProcChainMask), false); } } } private void UpdateCrawl() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) bool flag = false; if (phase >= 4 && Object.op_Implicit((Object)(object)bodyMachine) && bodyMachine.state is CocoaMain) { float num = float.MaxValue; foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers((TeamIndex)1)) { CharacterBody val = (Object.op_Implicit((Object)(object)teamMember) ? teamMember.body : null); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.healthComponent) && val.healthComponent.alive) { Vector3 val2 = val.corePosition - ((Component)this).transform.position; val2.y = 0f; num = Mathf.Min(num, ((Vector3)(ref val2)).magnitude); } } flag = num > 26f; } if (flag != crawling) { crawling = flag; if (Object.op_Implicit((Object)(object)body)) { body.MarkAllStatsDirty(); } } } public void BeginHorde() { if (!hordeActive) { int num = Mathf.Max(1, (!Object.op_Implicit((Object)(object)Run.instance)) ? 1 : Run.instance.participatingPlayerCount); int num2 = Mathf.Max(1, ModConfig.HordeSize.Value + ModConfig.HordePerExtraPlayer.Value * (num - 1)); hordeBurstsLeft = 3; hordePerBurst = Mathf.CeilToInt((float)num2 / 3f); hordeNextBurst = Time.time; hordeStartedAt = Time.time; hordeActive = true; hordeCleared = false; pups.Clear(); } } private void UpdateHorde() { //IL_00df: 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) if (!hordeActive) { return; } if (hordeBurstsLeft > 0 && Time.time >= hordeNextBurst) { hordeBurstsLeft--; hordeNextBurst = Time.time + 5f; for (int i = 0; i < hordePerBurst; i++) { SpawnPup(); } } pups.RemoveAll((CharacterMaster m) => !Object.op_Implicit((Object)(object)m) || !Object.op_Implicit((Object)(object)m.GetBody()) || !Object.op_Implicit((Object)(object)m.GetBody().healthComponent) || !m.GetBody().healthComponent.alive); if (Time.time - hordeStartedAt > ModConfig.HordeTimeout.Value) { foreach (CharacterMaster pup in pups) { CharacterBody val = (Object.op_Implicit((Object)(object)pup) ? pup.GetBody() : null); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.healthComponent)) { val.healthComponent.Suicide((GameObject)null, (GameObject)null, default(DamageTypeCombo)); } } pups.Clear(); hordeBurstsLeft = 0; } if (hordeBurstsLeft == 0 && pups.Count == 0) { hordeActive = false; hordeCleared = true; } } private void SpawnPup() { //IL_002d: 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_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_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_007b: 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_008b: 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_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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_00e8: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)CocoaContent.PupMasterPrefab)) { float num = Random.Range(0f, MathF.PI * 2f); float num2 = Random.Range(20f, 43f); Vector3 p = CocoaArena.Center + new Vector3(Mathf.Cos(num) * num2, 0f, Mathf.Sin(num) * num2); p = ArenaSplit.OffChasm(p, 5f); p.y = CocoaArena.Center.y + 1.5f + 0.3f; MasterSummon val = new MasterSummon { masterPrefab = CocoaContent.PupMasterPrefab, position = p }; Vector3 val2 = new Vector3(p.x, 0f, p.z); val.rotation = Quaternion.LookRotation(-((Vector3)(ref val2)).normalized + Vector3.forward * 0.001f); val.ignoreTeamMemberLimit = true; val.teamIndexOverride = (TeamIndex)2; val.useAmbientLevel = true; CharacterMaster val3 = val.Perform(); if (Object.op_Implicit((Object)(object)val3)) { pups.Add(val3); } } } public void BeginBarkPhase(Vector3 center) { //IL_000d: 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_0022: Expected O, but got Unknown //IL_008a: 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_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_00ae: 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_00ba: 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_00e9: Unknown result type (might be due to invalid IL or missing references) EndBarkPhase(); stopReason = StopReason.None; Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = "COCOA_BARK_WARNING" }); int num = Mathf.Max(1, PlayerCharacterMasterController.instances.Count) + ModConfig.ExtraTreats.Value; float num2 = Random.Range(0f, 360f); for (int i = 0; i < num; i++) { float num3 = (num2 + (float)i * 360f / (float)num + Random.Range(-15f, 15f)) * (MathF.PI / 180f); float num4 = Random.Range(22f, 45f); Vector3 p = center + new Vector3(Mathf.Cos(num3) * num4, 1.8f, Mathf.Sin(num3) * num4); p = ArenaSplit.OffChasm(p, 4f); barkObjects.Add(SpawnNet(CocoaContent.TreatPrefab, p)); } barkObjects.Add(SpawnNet(CocoaContent.PetZonePrefab, center)); } private static GameObject SpawnNet(GameObject prefab, Vector3 pos) { //IL_000b: 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) if (!Object.op_Implicit((Object)(object)prefab)) { return null; } GameObject obj = Object.Instantiate<GameObject>(prefab, pos, Quaternion.identity); NetworkServer.Spawn(obj); return obj; } public void EndBarkPhase() { foreach (GameObject barkObject in barkObjects) { if (Object.op_Implicit((Object)(object)barkObject)) { NetworkServer.Destroy(barkObject); } } barkObjects.Clear(); } public void RequestStop(StopReason reason, CharacterBody by) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (NetworkServer.active && isBarking && stopReason == StopReason.None) { stopReason = reason; string text = (Object.op_Implicit((Object)(object)by) ? by.GetUserName() : "Someone"); SimpleChatMessage val = new SimpleChatMessage(); val.baseToken = ((reason == StopReason.Pet) ? "COCOA_PET_MESSAGE" : "COCOA_TREAT_MESSAGE"); val.paramTokens = new string[1] { text }; Chat.SendBroadcastChat((ChatMessageBase)(object)val); } } public void BeginGrab(CharacterBody victim) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) discombobulateRequested = false; discombobulatedBy = null; if (!Object.op_Implicit((Object)(object)discombobulateZone)) { discombobulateZone = SpawnNet(CocoaContent.DiscombobulateZonePrefab, ((Component)this).transform.position); } SimpleChatMessage val = new SimpleChatMessage(); val.baseToken = "COCOA_GRABBED"; val.paramTokens = new string[1] { Object.op_Implicit((Object)(object)victim) ? victim.GetUserName() : "someone" }; Chat.SendBroadcastChat((ChatMessageBase)(object)val); } public void EndGrab() { if (Object.op_Implicit((Object)(object)discombobulateZone)) { NetworkServer.Destroy(discombobulateZone); } discombobulateZone = null; } public void RequestDiscombobulate(CharacterBody by) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && !discombobulateRequested) { discombobulateRequested = true; discombobulatedBy = by; SimpleChatMessage val = new SimpleChatMessage(); val.baseToken = "COCOA_DISCOMBOBULATED"; val.paramTokens = new string[1] { Object.op_Implicit((Object)(object)by) ? by.GetUserName() : "Someone" }; Chat.SendBroadcastChat((ChatMessageBase)(object)val); ClearGas(((Component)this).transform.position, ModConfig.DiscombobulateGasClearRadius.Value); } } public void SpawnGas(Vector3 pos) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0033: 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_005d: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)CocoaContent.GasPrefab)) { RaycastHit val = default(RaycastHit); if (Physics.Raycast(pos + Vector3.up * 10f, Vector3.down, ref val, 40f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { pos = ((RaycastHit)(ref val)).point; } else if (ArenaSplit.IsSplit) { return; } GameObject val2 = SpawnNet(CocoaContent.GasPrefab, pos); CocoaGasCloud cocoaGasCloud = (Object.op_Implicit((Object)(object)val2) ? val2.GetComponent<CocoaGasCloud>() : null); if (Object.op_Implicit((Object)(object)cocoaGasCloud)) { cocoaGasCloud.expireAt = Time.time + ModConfig.GasLifetime.Value; gas.Add(cocoaGasCloud); } } } public void ClearGas(Vector3 around, float radius) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) for (int num = gas.Count - 1; num >= 0; num--) { CocoaGasCloud cocoaGasCloud = gas[num]; if (!Object.op_Implicit((Object)(object)cocoaGasCloud)) { gas.RemoveAt(num); } else { Vector3 val = ((Component)cocoaGasCloud).transform.position - around; if (((Vector3)(ref val)).sqrMagnitude <= radius * radius) { NetworkServer.Destroy(((Component)cocoaGasCloud).gameObject); gas.RemoveAt(num); } } } } private void UpdateGasAndInfection() { //IL_011e: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Expected O, but got Unknown //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) float time = Time.time; float fixedDeltaTime = Time.fixedDeltaTime; for (int num = gas.Count - 1; num >= 0; num--) { if (!Object.op_Implicit((Object)(object)gas[num])) { gas.RemoveAt(num); } else if (time >= gas[num].expireAt) { NetworkServer.Destroy(((Component)gas[num]).gameObject); gas.RemoveAt(num); } } float value = ModConfig.GasRadius.Value; float value2 = ModConfig.InfectAfterSeconds.Value; foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers((TeamIndex)1)) { CharacterBody val = (Object.op_Implicit((Object)(object)teamMember) ? teamMember.body : null); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.healthComponent) || !val.healthComponent.alive) { continue; } bool flag = false; foreach (CocoaGasCloud ga in gas) { if (!Object.op_Implicit((Object)(object)ga)) { continue; } Vector3 val2 = val.footPosition - ((Component)ga).transform.position; if (Mathf.Abs(val2.y) < 6f) { Vector2 val3 = new Vector2(val2.x, val2.z); if (((Vector2)(ref val3)).sqrMagnitude <= (value + val.radius) * (value + val.radius)) { flag = true; break; } } } exposure.TryGetValue(val, out var value3); outOfGas.TryGetValue(val, out var value4); if (flag) { value3 += fixedDeltaTime; value4 = 0f; } else { value4 += fixedDeltaTime; if (value4 > 0.4f) { value3 = 0f; } } if (value3 >= value2) { Infect(val); value3 = 0f; } exposure[val] = value3; outOfGas[val] = value4; } infectionTick -= fixedDeltaTime; if (!(infectionTick <= 0f)) { return; } infectionTick = 0.5f; List<CharacterBody> list = new List<CharacterBody>(); foreach (KeyValuePair<CharacterBody, float> item in infectedUntil) { CharacterBody key = item.Key; if (!Object.op_Implicit((Object)(object)key) || !Object.op_Implicit((Object)(object)key.healthComponent) || !key.healthComponent.alive || time >= item.Value) { list.Add(key); continue; } key.healthComponent.TakeDamage(new DamageInfo { attacker = ((Component)this).gameObject, inflictor = ((Component)this).gameObject, position = key.corePosition, crit = false, procCoefficient = 0f, damage = key.healthComponent.fullCombinedHealth * ModConfig.InfectionDamagePercentPerSecond.Value / 100f * 0.5f, damageColorIndex = (DamageColorIndex)4, damageType = DamageTypeCombo.op_Implicit((DamageType)66) }); } foreach (CharacterBody item2 in list) { infectedUntil.Remove(item2); } } private void Infect(CharacterBody b) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown float value = ModConfig.InfectionDuration.Value; bool num = !infectedUntil.ContainsKey(b); infectedUntil[b] = Time.time + value; if (Object.op_Implicit((Object)(object)CocoaContent.InfectionBuff)) { b.AddTimedBuff(CocoaContent.InfectionBuff, value); } b.AddTimedBuff(Buffs.Poisoned, value); if (num) { SimpleChatMessage val = new SimpleChatMessage(); val.baseToken = "COCOA_INFECTED"; val.paramTokens = new string[1] { b.GetUserName() }; Chat.SendBroadcastChat((ChatMessageBase)(object)val); } } } internal static class CocoaPupFactory { public const float Scale = 0.27f; public const float CapsuleRadius = 1.35f; public const float CapsuleHeight = 3f; public static void Init() { CocoaContent.EntityStates.AddRange(new Type[4] { typeof(PupSpawn), typeof(PupMain), typeof(PupBite), typeof(PupDeath) }); CocoaContent.PupBodyPrefab = BuildBody(); CocoaContent.PupMasterPrefab = BuildMaster(CocoaContent.PupBodyPrefab); } private static GameObject BuildBody() { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0460: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Unknown result type (might be due to invalid IL or missing references) //IL_054b: Unknown result type (might be due to invalid IL or missing references) //IL_0550: Unknown result type (might be due to invalid IL or missing references) //IL_0561: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Unknown result type (might be due to invalid IL or missing references) //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_0538: Unknown result type (might be due to invalid IL or missing references) //IL_0599: Unknown result type (might be due to invalid IL or missing references) //IL_059e: Unknown result type (might be due to invalid IL or missing references) GameObject val = PrefabAPI.InstantiateClone(Assets.LoadAddressable<GameObject>("RoR2/Base/Beetle/BeetleBody.prefab"), "CocoaPupBody", true); CharacterBody component = val.GetComponent<CharacterBody>(); component.baseNameToken = "COCOA_PUP_NAME"; component.subtitleNameToken = ""; component.baseMaxHealth = ModConfig.PupHealth.Value; component.levelMaxHealth = ModConfig.PupHealth.Value * 0.3f; component.baseDamage = ModConfig.PupDamage.Value; component.levelDamage = ModConfig.PupDamage.Value * 0.2f; component.baseMoveSpeed = ModConfig.PupSpeed.Value; component.levelMoveSpeed = 0f; component.baseAcceleration = 60f; component.baseArmor = 0f; component.baseJumpCount = 0; component.isChampion = false; component.rootMotionInMainState = false; component.bodyColor = new Color(0.97f, 0.95f, 0.9f); component.bodyFlags = (BodyFlags)(component.bodyFlags | 1); Sprite val2 = Assets.LoadSprite("CocoaPortrait.png"); if (Object.op_Implicit((Object)(object)val2)) { component.portraitIcon = (Texture)(object)val2.texture; } KinematicCharacterMotor component2 = val.GetComponent<KinematicCharacterMotor>(); if (Object.op_Implicit((Object)(object)component2)) { component2.SetCapsuleDimensions(1.35f, 3f, 0f); } CapsuleCollider component3 = val.GetComponent<CapsuleCollider>(); if (Object.op_Implicit((Object)(object)component3)) { component3.radius = 1.35f; component3.height = 3f; component3.center = Vector3.zero; } CharacterDirection component4 = val.GetComponent<CharacterDirection>(); if (Object.op_Implicit((Object)(object)component4)) { component4.turnSpeed = 540f; component4.modelAnimator = null; component4.driveFromRootRotation = false; component4.rootMotionAccumulator = null; component4.overrideAnimatorForwardTransform = null; } ModelLocator component5 = val.GetComponent<ModelLocator>(); Transform modelTransform = component5.modelTransform; Transform val3 = (Object.op_Implicit((Object)(object)component5.modelBaseTransform) ? component5.modelBaseTransform : modelTransform.parent); val3.localPosition = new Vector3(0f, -1.5f, 0f); val3.localRotation = Quaternion.identity; val3.localScale = Vector3.one; CocoaModelBuilder.Result result = CocoaModelBuilder.Build("mdlCocoaPup"); GameObject root = result.root; root.transform.SetParent(val3, false); root.transform.localScale = Vector3.one * 0.27f; Object.DestroyImmediate((Object)(object)((Component)modelTransform).gameObject); component5.modelTransform = root.transform; component5.modelBaseTransform = val3; if (Object.op_Implicit((Object)(object)component4)) { component4.targetTransform = val3; } component5.autoUpdateModelTransform = true; component5.normalizeToFloor = false; Transform transform = new GameObject("Core").transform; transform.SetParent(result.parts[CocoaModelData.P.Torso], false); transform.localPosition = new Vector3(0f, 4.3f, -0.4f) - CocoaModelData.Pivots[CocoaModelData.P.Torso].pivot + CocoaModelData.Pivots[CocoaModelData.P.Root].pivot; component.coreTransform = transform; HealthComponent component6 = val.GetComponent<HealthComponent>(); HurtBoxGroup val4 = root.AddComponent<HurtBoxGroup>(); HurtBox val5 = CocoaBodyFactory.MakeHurtBox("HurtboxBody", result.parts[CocoaModelData.P.Torso], component6, val4, 0, bullseye: true, new Vector3(0f, 4.3f, -0.4f) - CocoaModelData.Pivots[CocoaModelData.P.Torso].pivot, new Vector3(3.3f, 11f, 0f), capsule: true); HurtBox val6 = CocoaBodyFactory.MakeHurtBox("HurtboxHead", result.parts[CocoaModelData.P.Head], component6, val4, 1, bullseye: false, new Vector3(0f, 8.4f, 4.6f) - CocoaModelData.Pivots[CocoaModelData.P.Head].pivot, new Vector3(3.2f, 0f, 0f), capsule: false); val4.hurtBoxes = (HurtBox[])(object)new HurtBox[2] { val5, val6 }; val4.mainHurtBox = val5; val4.bullseyeCount = 1; component.mainHurtBox = val5; root.AddComponent<ChildLocator>().transformPairs = (NameTransformPair[])(object)new NameTransformPair[3] { new NameTransformPair { name = "Head", transform = result.parts[CocoaModelData.P.Head] }, new NameTransformPair { name = "Mouth", transform = result.parts[CocoaModelData.P.Jaw] }, new NameTransformPair { name = "Chest", transform = transform } }; CharacterModel obj = root.AddComponent<CharacterModel>(); obj.body = component; obj.autoPopulateLightInfos = true; obj.baseRendererInfos = ((IEnumerable<MeshRenderer>)result.renderers).Select((Func<MeshRenderer, RendererInfo>)((MeshRenderer r) => new RendererInfo { renderer = (Renderer)(object)r, defaultMaterial = ((Renderer)r).sharedMaterial, defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false })).ToArray(); root.AddComponent<CocoaAnimator>().Bind(result); EntityStateMachine[] components = val.GetComponents<EntityStateMachine>(); foreach (EntityStateMachine val7 in components) { if (val7.customName == "Body") { val7.initialStateType = new SerializableEntityStateType(typeof(PupSpawn)); val7.mainStateType = new SerializableEntityStateType(